Sync: redirect to history on sync run
This commit is contained in:
parent
c1c9c849ba
commit
de544110b2
|
@ -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 {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue