mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-31 01:34:09 +02:00
parent
b679c1e770
commit
769e8f2636
@ -63,6 +63,12 @@ class DashboardController extends ActionController
|
|||||||
$this->view->title = $dashboard->getActivePane()->getTitle() . ' :: Dashboard';
|
$this->view->title = $dashboard->getActivePane()->getTitle() . ' :: Dashboard';
|
||||||
$this->view->tabs = $dashboard->getTabs();
|
$this->view->tabs = $dashboard->getTabs();
|
||||||
|
|
||||||
|
if ($this->hasParam('remove')) {
|
||||||
|
$dashboard->getActivePane()->removeComponent($this->getParam('remove'));
|
||||||
|
$dashboard->write();
|
||||||
|
$this->redirectNow(URL::fromRequest()->remove('remove'));
|
||||||
|
}
|
||||||
|
|
||||||
/* Temporarily removed
|
/* Temporarily removed
|
||||||
$this->view->tabs->add(
|
$this->view->tabs->add(
|
||||||
'Add',
|
'Add',
|
||||||
|
@ -53,7 +53,7 @@ class Component extends UserWidget
|
|||||||
private $template =<<<'EOD'
|
private $template =<<<'EOD'
|
||||||
|
|
||||||
<div class="container" data-icinga-url="{URL}">
|
<div class="container" data-icinga-url="{URL}">
|
||||||
<h1>{REMOVE}<a href="{FULL_URL}" data-base-target="col1">{TITLE}</a></h1>
|
<h1><a href="{FULL_URL}" data-base-target="col1">{TITLE}</a> ({REMOVE})</h1>
|
||||||
<noscript>
|
<noscript>
|
||||||
<iframe src="{IFRAME_URL}" style="height:100%; width:99%" frameborder="no"></iframe>
|
<iframe src="{IFRAME_URL}" style="height:100%; width:99%" frameborder="no"></iframe>
|
||||||
</noscript>
|
</noscript>
|
||||||
@ -179,7 +179,6 @@ EOD;
|
|||||||
'{URL}',
|
'{URL}',
|
||||||
'{IFRAME_URL}',
|
'{IFRAME_URL}',
|
||||||
'{FULL_URL}',
|
'{FULL_URL}',
|
||||||
'{REMOVE_BTN}',
|
|
||||||
'{TITLE}',
|
'{TITLE}',
|
||||||
'{REMOVE}'
|
'{REMOVE}'
|
||||||
);
|
);
|
||||||
@ -188,9 +187,8 @@ EOD;
|
|||||||
$url,
|
$url,
|
||||||
$iframeUrl,
|
$iframeUrl,
|
||||||
$url->getUrlWithout(array('view', 'limit')),
|
$url->getUrlWithout(array('view', 'limit')),
|
||||||
$this->getRemoveForm($view),
|
|
||||||
$view->escape($this->getTitle()),
|
$view->escape($this->getTitle()),
|
||||||
$this->getRemoveForm()
|
$this->getRemoveLink()
|
||||||
);
|
);
|
||||||
|
|
||||||
return str_replace($searchTokens, $replaceTokens, $this->template);
|
return str_replace($searchTokens, $replaceTokens, $this->template);
|
||||||
@ -201,32 +199,13 @@ EOD;
|
|||||||
*
|
*
|
||||||
* @return string The html representation of the form
|
* @return string The html representation of the form
|
||||||
*/
|
*/
|
||||||
protected function getRemoveForm()
|
protected function getRemoveLink()
|
||||||
{
|
{
|
||||||
// TODO: temporarily disabled, should point to a form asking for confirmal
|
return sprintf(
|
||||||
return '';
|
'<a data-base-target="main" href="%s">%s</a>',
|
||||||
$removeUrl = Url::fromPath(
|
Url::fromRequest(array('remove' => $this->getTitle())),
|
||||||
'/dashboard/removecomponent',
|
t('Remove')
|
||||||
array(
|
|
||||||
'pane' => $this->pane->getName(),
|
|
||||||
'component' => $this->getTitle()
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
$form = new Form();
|
|
||||||
$form->setMethod('POST');
|
|
||||||
$form->setAttrib('class', 'inline');
|
|
||||||
$form->setAction($removeUrl);
|
|
||||||
$form->addElement(
|
|
||||||
new Zend_Form_Element_Button(
|
|
||||||
'remove_pane_btn',
|
|
||||||
array(
|
|
||||||
'class'=> 'link-like pull-right',
|
|
||||||
'type' => 'submit',
|
|
||||||
'label' => 'x'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
return $form;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -130,7 +130,13 @@ class Pane extends UserWidget
|
|||||||
public function removeComponent($title)
|
public function removeComponent($title)
|
||||||
{
|
{
|
||||||
if ($this->hasComponent($title)) {
|
if ($this->hasComponent($title)) {
|
||||||
unset($this->components[$title]);
|
$component = $this->getComponent($title);
|
||||||
|
if ($component->isUserWidget() === true) {
|
||||||
|
unset($this->components[$title]);
|
||||||
|
} else {
|
||||||
|
$component->setUserWidget();
|
||||||
|
$component->setDisabled(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user