icingaweb2-module-director/application/views/scripts/syncrule/history.phtml

85 lines
2.4 KiB
PHTML

<div class="controls">
<?= $this->tabs ?>
<h1><?= $this->escape($this->title) ?></h1>
<span class="action-links"<?php if (! $this->stayHere): ?> data-base-target="_next"<?php endif ?>>
<?= $this->addLink ?>
</span>
<?= $this->filterEditor ?>
<?= $this->table->getPaginator() ?>
</div>
<div class="content"<?php if (! $this->stayHere): ?> data-base-target="_next"<?php endif ?>>
<?php if ($this->run): ?>
<h3><?= $this->translate('Sync run details') ?></h3>
<table class="key-value-table">
<tr>
<th><?= $this->translate('Start time') ?></th>
<td><?= $this->escape($run->start_time) ?></td>
</tr>
<tr>
<th><?= $this->translate('Duration') ?></th>
<td><?= sprintf('%.2fs', $run->duration_ms / 1000) ?></td>
</tr>
<tr>
<th><?= $this->translate('Activity') ?></th>
<td data-base-target="_next"><?php
$total = $run->objects_deleted + $run->objects_created + $run->objects_modified;
if ($total === 0) {
echo $this->translate('No changes have been made');
} else {
if ($total === 1) {
echo $this->translate('One object has been modified');
} else {
printf(
$this->translate('%s objects have been modified'),
$total
);
}
$activityUrl = sprintf(
'director/config/activities?id>%d&id<=%d',
$formerId,
$lastId
);
$links = array();
if ($run->objects_created > 0) {
$links[] = $this->qlink(
sprintf('%d created', $run->objects_created),
$activityUrl,
array('action_name' => 'create')
);
}
if ($run->objects_modified > 0) {
$links[] = $this->qlink(
sprintf('%d modified', $run->objects_modified),
$activityUrl,
array('action_name' => 'modify')
);
}
if ($run->objects_deleted > 0) {
$links[] = $this->qlink(
sprintf('%d deleted', $run->objects_deleted),
$activityUrl,
array('action_name' => 'delete')
);
}
if (count($links) > 1) {
$links[] = $this->qlink(
'Show all actions',
$activityUrl
);
}
if (! empty($links)) {
echo ': ' . implode(', ', $links);
}
}
?></td>
</tr>
</table>
<?php endif ?>
<?= $this->table->render() ?>
</div>