diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:43:12 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:43:12 +0000 |
commit | cd989f9c3aff968e19a3aeabc4eb9085787a6673 (patch) | |
tree | fbff2135e7013f196b891bbde54618eb050e4aaf /library/Director/Web/ActionBar/AutomationObjectActionBar.php | |
parent | Initial commit. (diff) | |
download | icingaweb2-module-director-cd989f9c3aff968e19a3aeabc4eb9085787a6673.tar.xz icingaweb2-module-director-cd989f9c3aff968e19a3aeabc4eb9085787a6673.zip |
Adding upstream version 1.10.2.upstream/1.10.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/Director/Web/ActionBar/AutomationObjectActionBar.php')
-rw-r--r-- | library/Director/Web/ActionBar/AutomationObjectActionBar.php | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/library/Director/Web/ActionBar/AutomationObjectActionBar.php b/library/Director/Web/ActionBar/AutomationObjectActionBar.php new file mode 100644 index 0000000..247677f --- /dev/null +++ b/library/Director/Web/ActionBar/AutomationObjectActionBar.php @@ -0,0 +1,65 @@ +<?php + +namespace Icinga\Module\Director\Web\ActionBar; + +use gipfl\IcingaWeb2\Link; +use gipfl\Translation\TranslationHelper; +use gipfl\IcingaWeb2\Widget\ActionBar; +use Icinga\Web\Request; + +class AutomationObjectActionBar extends ActionBar +{ + use TranslationHelper; + + /** @var Request */ + protected $request; + + protected $label; + + public function __construct(Request $request) + { + $this->request = $request; + } + + protected function assemble() + { + $request = $this->request; + $action = $request->getActionName(); + $controller = $request->getControllerName(); + $params = ['id' => $request->getParam('id')]; + $links = [ + 'index' => Link::create( + $this->translate('Overview'), + "director/$controller", + $params, + ['class' => 'icon-info'] + ), + 'edit' => Link::create( + $this->translate('Modify'), + "director/$controller/edit", + $params, + ['class' => 'icon-edit'] + ), + 'clone' => Link::create( + $this->translate('Clone'), + "director/$controller/clone", + $params, + ['class' => 'icon-paste'] + ), + /* + // TODO: enable once handled in the controller + 'export' => Link::create( + $this->translate('Download JSON'), + $this->request->getUrl()->with('format', 'json'), + null, + [ + 'data-base-target' => '_blank', + ] + ) + */ + + ]; + unset($links[$action]); + $this->add($links); + } +} |