From de544110b20a6c465286a46734fa77b62d92b554 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Wed, 20 Apr 2016 15:33:03 +0200 Subject: [PATCH] Sync: redirect to history on sync run --- application/controllers/SyncruleController.php | 14 ++++++++++++-- library/Director/Import/Sync.php | 4 ---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/application/controllers/SyncruleController.php b/application/controllers/SyncruleController.php index 24b60214..9e1405c5 100644 --- a/application/controllers/SyncruleController.php +++ b/application/controllers/SyncruleController.php @@ -8,6 +8,7 @@ use Icinga\Module\Director\Objects\SyncRun; use Icinga\Module\Director\Import\Sync; use Icinga\Data\Filter\Filter; use Icinga\Web\Notification; +use Icinga\Web\Url; class SyncruleController extends ActionController { @@ -23,10 +24,19 @@ class SyncruleController extends ActionController public function runAction() { - $sync = new Sync(SyncRule::load($this->params->get('id'), $this->db())); + $id = $this->params->get('id'); + $sync = new Sync(SyncRule::load($id, $this->db())); if ($runId = $sync->apply()) { Notification::success('Source has successfully been synchronized'); - $this->redirectNow('director/list/syncrule'); + $this->redirectNow( + Url::fromPath( + 'director/syncrule/history', + array( + 'id' => $id, + 'run_id' => $runId + ) + ) + ); } else { } } diff --git a/library/Director/Import/Sync.php b/library/Director/Import/Sync.php index 9eeebf14..1a59cb0f 100644 --- a/library/Director/Import/Sync.php +++ b/library/Director/Import/Sync.php @@ -671,9 +671,6 @@ class Sync /** * Runs a SyncRule and applies all resulting changes * - * TODO: Should return the id of the related sync_history table entry. - * Such a table does not yet exist, so 42 is the answer right now. - * * @return int */ public function apply() @@ -739,7 +736,6 @@ class Sync (microtime(true) - $this->runStartTime) * 1000 ))->store(); - return $this->run->id; } }