From 085cec0eb761d6f0de1e7cd6a4ab9fed94072a2b Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Mon, 23 Aug 2021 08:56:16 +0200 Subject: [PATCH] BranchedObjectsHint: new hints for lists --- .../Web/Controller/ObjectsController.php | 3 +++ .../Web/Widget/BranchedObjectsHint.php | 27 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 library/Director/Web/Widget/BranchedObjectsHint.php diff --git a/library/Director/Web/Controller/ObjectsController.php b/library/Director/Web/Controller/ObjectsController.php index 1db7af64..bd9a73cc 100644 --- a/library/Director/Web/Controller/ObjectsController.php +++ b/library/Director/Web/Controller/ObjectsController.php @@ -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'); } diff --git a/library/Director/Web/Widget/BranchedObjectsHint.php b/library/Director/Web/Widget/BranchedObjectsHint.php new file mode 100644 index 00000000..d689178b --- /dev/null +++ b/library/Director/Web/Widget/BranchedObjectsHint.php @@ -0,0 +1,27 @@ +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')) + ))); + } +}