mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-09-24 10:27:46 +02:00
Fix Add to Dashboard
feature
This commit is contained in:
parent
77e759fe8e
commit
f3de1dd2b6
@ -45,7 +45,7 @@ class DashboardsController extends CompatController
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$pane = $this->getParam('pane');
|
||||
$pane = $this->params->get('pane');
|
||||
|
||||
// If we don't load all dashboard homes here, the cog icon won't be rendered in the dashboard tabs
|
||||
$this->dashboard->load(DashboardHome::DEFAULT_HOME, $pane, true);
|
||||
@ -76,7 +76,7 @@ class DashboardsController extends CompatController
|
||||
*/
|
||||
public function homeAction()
|
||||
{
|
||||
$this->dashboard->load($this->params->getRequired('home'), $this->getParam('pane'));
|
||||
$this->dashboard->load($this->params->getRequired('home'), $this->params->get('pane'));
|
||||
|
||||
$activeHome = $this->dashboard->getActiveHome();
|
||||
if (! $activeHome->getEntries()) {
|
||||
@ -210,7 +210,7 @@ class DashboardsController extends CompatController
|
||||
{
|
||||
$home = $this->params->getRequired('home');
|
||||
|
||||
$this->dashboard->load($home, $this->getParam('pane'), true);
|
||||
$this->dashboard->load($home, $this->params->get('pane'), true);
|
||||
|
||||
$dashletForm = new DashletForm($this->dashboard);
|
||||
$dashletForm->populate($this->getRequest()->getPost());
|
||||
@ -228,10 +228,30 @@ class DashboardsController extends CompatController
|
||||
$this->addContent($dashletForm);
|
||||
}
|
||||
|
||||
public function addToDashletAction()
|
||||
{
|
||||
$this->dashboard->load(DashboardHome::DEFAULT_HOME, $this->params->get('pane'), true);
|
||||
|
||||
$dashletForm = new DashletForm($this->dashboard);
|
||||
$dashletForm->populate([
|
||||
'url' => rawurldecode($this->params->shift('url')),
|
||||
'btn_next' => 'y'
|
||||
]);
|
||||
|
||||
$dashletForm->on(DashletForm::ON_SUCCESS, function () {
|
||||
$params = $this->params->without('dashlet');
|
||||
$this->redirectNow(Url::fromPath(Dashboard::BASE_ROUTE . '/settings')->setParams($params));
|
||||
})->handleRequest($this->getServerRequest());
|
||||
|
||||
$this->setTitle(t('Add Dashlet To Dashboard'));
|
||||
|
||||
$this->addContent($dashletForm);
|
||||
}
|
||||
|
||||
public function editDashletAction()
|
||||
{
|
||||
$pane = $this->validateDashletParams();
|
||||
$dashlet = $pane->getEntry($this->getParam('dashlet'));
|
||||
$dashlet = $pane->getEntry($this->params->get('dashlet'));
|
||||
|
||||
$dashletForm = (new DashletForm($this->dashboard))
|
||||
->on(DashletForm::ON_SUCCESS, function () {
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
namespace Icinga\Web\Widget\Tabextension;
|
||||
|
||||
use Icinga\Web\Dashboard\Dashboard;
|
||||
use Icinga\Web\Url;
|
||||
use Icinga\Web\Widget\Tabs;
|
||||
|
||||
@ -25,9 +26,13 @@ class DashboardAction implements Tabextension
|
||||
array(
|
||||
'icon' => 'dashboard',
|
||||
'label' => t('Add To Dashboard'),
|
||||
'url' => Url::fromPath('dashboard/new-dashlet'),
|
||||
'url' => Url::fromPath(Dashboard::BASE_ROUTE . '/add-to-dashlet'),
|
||||
'urlParams' => array(
|
||||
'url' => rawurlencode(Url::fromRequest()->getRelativeUrl())
|
||||
'url' => rawurlencode(Url::fromRequest()->getRelativeUrl()),
|
||||
),
|
||||
'tagParams' => array(
|
||||
'data-icinga-modal' => true,
|
||||
'data-no-icinga-ajax' => true
|
||||
)
|
||||
)
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user