mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-01-01 19:29:34 -05:00
ProcessController: change tab rendering and more
This commit is contained in:
parent
74d614be37
commit
b73eed20b0
3 changed files with 24 additions and 17 deletions
|
|
@ -19,6 +19,7 @@ use Icinga\Module\Businessprocess\Web\Controller;
|
|||
use Icinga\Module\Businessprocess\Web\Url;
|
||||
use Icinga\Web\Notification;
|
||||
use Icinga\Web\Widget\Tabextension\DashboardAction;
|
||||
use Icinga\Web\Widget\Tabs;
|
||||
|
||||
class ProcessController extends Controller
|
||||
{
|
||||
|
|
@ -101,7 +102,7 @@ class ProcessController extends Controller
|
|||
);
|
||||
}
|
||||
|
||||
$this->addProcessTabs($bp);
|
||||
$controls->add($this->getProcessTabs($bp, $renderer));
|
||||
if (! $this->view->compact) {
|
||||
$controls->add(Element::create('h1')->setContent($this->view->title));
|
||||
}
|
||||
|
|
@ -138,16 +139,18 @@ class ProcessController extends Controller
|
|||
return $this->renderer;
|
||||
}
|
||||
|
||||
protected function addProcessTabs($bp)
|
||||
protected function getProcessTabs(BusinessProcess $bp, Renderer $renderer)
|
||||
{
|
||||
if ($this->showFullscreen || $this->view->compact) {
|
||||
return;
|
||||
}
|
||||
|
||||
$tabs = $this->defaultTab();
|
||||
if (! $bp->isLocked()) {
|
||||
$tabs = $this->singleTab($bp->getTitle());
|
||||
if (! $renderer->isLocked()) {
|
||||
$tabs->extend(new DashboardAction());
|
||||
}
|
||||
|
||||
return $tabs;
|
||||
}
|
||||
|
||||
protected function handleSimulations(BusinessProcess $bp)
|
||||
|
|
@ -264,8 +267,6 @@ class ProcessController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Show the source code for a process
|
||||
*/
|
||||
|
|
@ -364,6 +365,9 @@ class ProcessController extends Controller
|
|||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Tabs
|
||||
*/
|
||||
protected function tabsForCreate()
|
||||
{
|
||||
return $this->tabs()->add('create', array(
|
||||
|
|
|
|||
|
|
@ -201,8 +201,7 @@ class BusinessProcess
|
|||
|
||||
public function getTitle()
|
||||
{
|
||||
$meta = $this->getMetadata();
|
||||
return $meta->has('Title') ? $meta->get('Title') : $this->getName();
|
||||
return $this->getMetadata()->getTitle();
|
||||
}
|
||||
|
||||
public function hasTitle()
|
||||
|
|
|
|||
|
|
@ -4,19 +4,17 @@ namespace Icinga\Module\Businessprocess\Web;
|
|||
|
||||
use Icinga\Application\Icinga;
|
||||
use Icinga\Module\Businessprocess\BusinessProcess;
|
||||
use Icinga\Module\Businessprocess\Html\HtmlString;
|
||||
use Icinga\Module\Businessprocess\Modification\ProcessChanges;
|
||||
use Icinga\Module\Businessprocess\Storage\LegacyStorage;
|
||||
use Icinga\Module\Businessprocess\Storage\Storage;
|
||||
use Icinga\Module\Businessprocess\Web\Component\ActionBar;
|
||||
use Icinga\Module\Businessprocess\Web\Component\Controls;
|
||||
use Icinga\Module\Businessprocess\Web\Component\Content;
|
||||
use Icinga\Module\Businessprocess\Web\Component\Tabs;
|
||||
use Icinga\Module\Businessprocess\Web\Form\FormLoader;
|
||||
use Icinga\Web\Controller as ModuleController;
|
||||
use Icinga\Web\Notification;
|
||||
use Icinga\Web\View;
|
||||
use Icinga\Web\Widget;
|
||||
use Icinga\Web\Widget\Tabs;
|
||||
|
||||
class Controller extends ModuleController
|
||||
{
|
||||
|
|
@ -30,7 +28,7 @@ class Controller extends ModuleController
|
|||
protected $bp;
|
||||
|
||||
/** @var Tabs */
|
||||
protected $tabs;
|
||||
protected $mytabs;
|
||||
|
||||
/** @var Storage */
|
||||
private $storage;
|
||||
|
|
@ -150,13 +148,13 @@ class Controller extends ModuleController
|
|||
protected function tabs()
|
||||
{
|
||||
// Todo: do not add to view once all of them render controls()
|
||||
if ($this->view->tabs === null) {
|
||||
$tabs = Widget::create('tabs');
|
||||
$this->controls()->add(HtmlString::create($tabs));
|
||||
$this->view->tabs = $tabs;
|
||||
if ($this->mytabs === null) {
|
||||
$tabs = new Tabs();
|
||||
//$this->controls()->add($tabs);
|
||||
$this->mytabs = $tabs;
|
||||
}
|
||||
|
||||
return $this->view->tabs;
|
||||
return $this->mytabs;
|
||||
}
|
||||
|
||||
protected function session()
|
||||
|
|
@ -258,6 +256,9 @@ class Controller extends ModuleController
|
|||
return FormLoader::load($name, $this->Module());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return LegacyStorage|Storage
|
||||
*/
|
||||
protected function storage()
|
||||
{
|
||||
if ($this->storage === null) {
|
||||
|
|
@ -269,6 +270,9 @@ class Controller extends ModuleController
|
|||
return $this->storage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
protected function loadSlas()
|
||||
{
|
||||
$bpconf = $this->bpconf;
|
||||
|
|
|
|||
Loading…
Reference in a new issue