mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
BranchedObjectsHint: new hints for lists
This commit is contained in:
parent
48ac87cff5
commit
085cec0eb7
@ -23,6 +23,7 @@ use Icinga\Module\Director\Web\Tabs\ObjectsTabs;
|
||||
use Icinga\Module\Director\Web\Tree\TemplateTreeRenderer;
|
||||
use gipfl\IcingaWeb2\Link;
|
||||
use Icinga\Module\Director\Web\Widget\AdditionalTableActions;
|
||||
use Icinga\Module\Director\Web\Widget\BranchedObjectsHint;
|
||||
|
||||
abstract class ObjectsController extends ActionController
|
||||
{
|
||||
@ -119,6 +120,8 @@ abstract class ObjectsController extends ActionController
|
||||
->addTitle($this->translate(ucfirst($this->getPluralType())))
|
||||
->actions(new ObjectsActionBar($this->getBaseObjectUrl(), $this->url()));
|
||||
|
||||
$this->content()->add(new BranchedObjectsHint($this->getBranch(), $this->Auth()));
|
||||
|
||||
if ($type === 'command' && $this->params->get('type') === 'external_object') {
|
||||
$this->tabs()->activate('external');
|
||||
}
|
||||
|
27
library/Director/Web/Widget/BranchedObjectsHint.php
Normal file
27
library/Director/Web/Widget/BranchedObjectsHint.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Icinga\Module\Director\Web\Widget;
|
||||
|
||||
use gipfl\Translation\TranslationHelper;
|
||||
use gipfl\Web\Widget\Hint;
|
||||
use Icinga\Authentication\Auth;
|
||||
use Icinga\Module\Director\Db\Branch\Branch;
|
||||
use ipl\Html\Html;
|
||||
use ipl\Html\HtmlDocument;
|
||||
|
||||
class BranchedObjectsHint extends HtmlDocument
|
||||
{
|
||||
use TranslationHelper;
|
||||
|
||||
public function __construct(Branch $branch, Auth $auth)
|
||||
{
|
||||
if (! $branch->isBranch()) {
|
||||
return;
|
||||
}
|
||||
$hook = Branch::requireHook();
|
||||
$this->add(Hint::info(Html::sprintf(
|
||||
$this->translate('Showing a branched view, with potential changes being visible only in this %s'),
|
||||
$hook->linkToBranch($branch, $auth, $this->translate('configuration branch'))
|
||||
)));
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user