diff --git a/application/controllers/SyncruleController.php b/application/controllers/SyncruleController.php index a8994c04..9530c3ec 100644 --- a/application/controllers/SyncruleController.php +++ b/application/controllers/SyncruleController.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Director\Controllers; use Icinga\Module\Director\Web\Controller\ActionController; use Icinga\Module\Director\Objects\SyncRule; +use Icinga\Module\Director\Objects\SyncRun; use Icinga\Module\Director\Import\Sync; use Icinga\Data\Filter\Filter; use Icinga\Web\Notification; @@ -120,7 +121,17 @@ class SyncruleController extends ActionController ->enforceFilter(Filter::where('rule_id', $id)) ->setConnection($this->db()); - $this->setViewScript('list/table'); + if ($runId = $this->params->get('run_id')) { + $db = $this->db(); + $this->view->run = SyncRun::load($runId, $db); + $this->view->formerId = $db->fetchActivityLogIdByChecksum( + $this->view->run->last_former_activity + ); + + $this->view->lastId = $db->fetchActivityLogIdByChecksum( + $this->view->run->last_related_activity + ); + } } protected function prepareRuleTabs($ruleId = null) diff --git a/application/views/scripts/syncrule/history.phtml b/application/views/scripts/syncrule/history.phtml new file mode 100644 index 00000000..a225d77c --- /dev/null +++ b/application/views/scripts/syncrule/history.phtml @@ -0,0 +1,84 @@ +
+tabs ?> +

escape($this->title) ?>

+stayHere): ?> data-base-target="_next"> +addLink ?> + +filterEditor ?> +table->getPaginator() ?> +
+ +
stayHere): ?> data-base-target="_next"> +run): ?> +

translate('Sync run details') ?>

+ + + + + + + + + + + + + +
translate('Start time') ?>escape($run->start_time) ?>
translate('Duration') ?>duration_ms / 1000) ?>
translate('Activity') ?>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); + } + } + ?>
+ +table->render() ?> +