summaryrefslogtreecommitdiffstats
path: root/application/controllers/BasketsController.php
blob: 6b50b6278f05fad41b535313e47d48d1475b9194 (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
46
47
48
49
50
51
52
53
<?php

namespace Icinga\Module\Director\Controllers;

use ipl\Html\Html;
use gipfl\IcingaWeb2\Link;
use Icinga\Module\Director\Web\Controller\ActionController;
use Icinga\Module\Director\Web\Table\BasketTable;

class BasketsController extends ActionController
{
    protected $isApified = false;

    public function indexAction()
    {
        $this->setAutorefreshInterval(10);
        $this->addSingleTab($this->translate('Baskets'));
        $this->actions()->add([
            Link::create(
                $this->translate('Create'),
                'director/basket/create',
                null,
                ['class' => 'icon-plus']
            ),
            Link::create(
                $this->translate('Upload'),
                'director/basket/upload',
                null,
                ['class' => 'icon-upload']
            ),
        ]);
        $this->addTitle($this->translate('Configuration Baskets'));
        $this->content()->add(Html::tag('p', $this->translate(
            'A Configuration Basket references specific Configuration'
            . ' Objects or all objects of a specific type. It has been'
            . ' designed to share Templates, Import/Sync strategies and'
            . ' other base Configuration Objects. It is not a tool to'
            . ' operate with single Hosts or Services.'
        )));
        $this->content()->add(Html::tag('p', $this->translate(
            'You can create Basket snapshots at any time, this will persist'
            . ' a serialized representation of all involved objects at that'
            . ' moment in time. Snapshots can be exported, imported, shared'
            . ' and restored - to the very same or another Director instance.'
        )));
        $table = (new BasketTable($this->db()))
            ->setAttribute('data-base-target', '_self');
        // TODO: temporarily disabled, this was a thing in dipl
        if (/*$table->hasSearch() || */count($table)) {
            $table->renderTo($this);
        }
    }
}