blob: 1829ebe36a8ea34f0bec5443da6dfc4af4759541 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
<?php
namespace Icinga\Module\Director\Controllers;
use Icinga\Module\Director\DirectorObject\Automation\ImportExport;
use Icinga\Module\Director\Web\Table\SyncruleTable;
use Icinga\Module\Director\Web\Controller\ActionController;
use Icinga\Module\Director\Web\Tabs\ImportTabs;
class SyncrulesController extends ActionController
{
protected $isApified = true;
/**
* @throws \Icinga\Exception\ConfigurationError
* @throws \Icinga\Exception\Http\HttpNotFoundException
*/
public function indexAction()
{
if ($this->getRequest()->isApiRequest()) {
$this->sendExport();
return;
}
$this->addTitle($this->translate('Sync rule'))
->setAutoRefreshInterval(10)
->addAddLink(
$this->translate('Add a new Sync Rule'),
'director/syncrule/add'
)->tabs(new ImportTabs())->activate('syncrule');
(new SyncruleTable($this->db()))->renderTo($this);
}
/**
* @throws \Icinga\Exception\ConfigurationError
*/
protected function sendExport()
{
$this->sendJson(
$this->getResponse(),
(new ImportExport($this->db()))->serializeAllSyncRules()
);
}
}
|