-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
210 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
modules/dashboards/application/controllers/DashletsController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Icinga\Module\Dashboards\Controllers; | ||
|
||
use Icinga\Module\Dashboards\Web\Controller; | ||
use Icinga\Module\Dashboards\Form\NewDashletsForm; | ||
|
||
class DashletsController extends Controller | ||
{ | ||
public function indexAction() | ||
{ | ||
|
||
} | ||
|
||
public function newAction() | ||
{ | ||
$this->setTitle('New Dashlet'); | ||
|
||
$dashletsForm = new NewDashletsForm(); | ||
$this->addContent($dashletsForm); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
modules/dashboards/application/views/scripts/dashlets/new.phtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?php | ||
var_dump("Hello World"); |
186 changes: 186 additions & 0 deletions
186
modules/dashboards/library/Dashboards/Form/NewDashletsForm.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
<?php | ||
|
||
namespace Icinga\Module\Dashboards\Form; | ||
|
||
use ipl\Html\Form; | ||
use ipl\Html\Html; | ||
|
||
class NewDashletsForm extends Form | ||
{ | ||
protected $defaultAttributes = [ | ||
'name' => 'dashboard_addurl', | ||
'class' => 'icinga-form icinga-controls', | ||
]; | ||
|
||
public function newAction() | ||
{ | ||
$form = new Form(); | ||
$form->setAction('dashboards/dashlets/new'); | ||
|
||
$form->add(Html::tag('h1', ['class' => 'hint'], 'Add Dashlet To Dashboard')); | ||
$form->addElement('hidden', 'org_pane', [ | ||
'value' => true, | ||
'id' => 'form_dashboard_addurl_org_pane-ksrlagijhocp' | ||
]); | ||
|
||
$form->addElement('hidden', 'org_dashlet', [ | ||
'value' => true, | ||
'id' => 'form_dashboard_addurl_org_dashlet-ksrlagijhocp' | ||
]); | ||
|
||
$form->add(Html::tag('div', [ | ||
'class' => 'control-group' | ||
], [Html::tag('div', [ | ||
'class' => 'control-label-group' | ||
], Html::tag('span', [ | ||
'id' => 'form_dashboard_addurl_url-tjucoyahpznm-label' | ||
], Html::tag('label', [ | ||
'for' => 'form_dashboard_addurl_url-tjucoyahpznm', | ||
'class' => 'control-label required' | ||
], ['Url', Html::tag('span', [ | ||
'aria-hidden' => 'true' | ||
], ' *')]))), Html::tag('textarea', [ | ||
'name' => 'url', | ||
'rows' => '3', | ||
'id' => 'url_textarea', | ||
'required' => true, | ||
'aria-describedby' => 'desc_form_dashboard_addurl_url-qvzeyghfujib', | ||
'cols' => '80' | ||
]), Html::tag('i', [ | ||
'class' => 'control-info icon-info-circled', | ||
'aria-hidden' => true, | ||
'role' => 'img', | ||
'title' => 'Enter url to be loaded in the dashlet. You can paste the full URL, including filters.' | ||
])])); | ||
|
||
$form->add(Html::tag('div', [ | ||
'class' => 'control-group' | ||
], [Html::tag('div', [ | ||
'class' => 'control-label-group' | ||
], Html::tag('span', [ | ||
'id' => 'form_dashboard_addurl_dashlet-qnpsbfrlizec-label', | ||
], Html::tag('label', [ | ||
'for' => 'form_dashboard_addurl_dashlet-qnpsbfrlizec', | ||
'class' => 'control-label required' | ||
], ['Dashlet Name', Html::tag('span', [ | ||
'aria-hidden' => 'true' | ||
], '*')]))), Html::tag('input', [ | ||
'type' => 'text', | ||
'name' => 'dashlet', | ||
'id' => 'dashlet_name', | ||
'value' => true, | ||
'aria-required' => 'true', | ||
'required' => true, | ||
'aria-describedby' => 'desc_form_dashboard_addurl_dashlet-yubfwqingarm' | ||
]), Html::tag('i', [ | ||
'class' => 'control-info icon-info-circled', | ||
'aria-hidden' => 'true', | ||
'role' => 'img', | ||
'title' => 'Enter a title for the dashlet.' | ||
])])); | ||
|
||
$form->add(Html::tag('hr')); | ||
|
||
$form->add(Html::tag('div', [ | ||
'class' => 'control-group' | ||
], [Html::tag('span', [ | ||
'id' => 'autosubmit_warning_form_dashboard_addurl_create_new_pane-jtyoxcgivlsq', | ||
'class' => 'sr-only' | ||
], 'The page will be automatically updated upon change of the value'), | ||
Html::tag('div', [ | ||
'class' => 'control-label-group' | ||
], Html::tag('span', [ | ||
'id' => 'form_dashboard_addurl_create_new_pane-jtyoxcgivlsq-label' | ||
], Html::tag('label', [ | ||
'for' => 'form_dashboard_addurl_create_new_pane-jtyoxcgivlsq', | ||
'class' => 'control-label optional' | ||
], 'New dashboard'))), Html::tag('input', [ | ||
'type' => 'hidden', | ||
'class' => 'create_new_pane', | ||
'value' => '0' | ||
]), Html::tag('input', [ | ||
'type' => 'checkbox', | ||
'name' => 'create_new_pane', | ||
'id' => 'create_new_dashboard', | ||
'value' => '1', | ||
'class' => 'autosubmit sr-only', | ||
'aria-describedby' => 'desc_form_dashboard_addurl_create_new_pane-jtyoxcgivlsq autosubmit_warning_form | ||
_dashboard_addurl_create_new_pane-jtyoxcgivlsq' | ||
]), Html::tag('label', [ | ||
'for' => 'form_dashboard_addurl_create_new_pane-scxfgqkmjzya', | ||
'class' => 'toggle-switch' | ||
], Html::tag('span', [ | ||
'class' => 'toggle-slider' | ||
])), Html::tag('i', [ | ||
'aria-hidden' => 'true', | ||
'class' => 'spinner autosubmit-info icon-cw', | ||
'role' => 'img', | ||
'title' => 'This page will be automatically updated upon change of the value' | ||
]), Html::tag('i', [ | ||
'class' => 'control-info icon-info-circled', | ||
'aria-hidden' => 'true', | ||
'role' => 'img', | ||
'title' => 'Check this box if you want to add the dashlet to a new dashboard' | ||
]), Html::tag('span', [ | ||
'id' => 'desc_form_dashboard_addurl_create_new_pane-scxfgqkmjzya', | ||
'class' => 'sr-only' | ||
], 'Check this box if you want to add the dashlet to a new dashboard') | ||
])); | ||
|
||
$form->add(Html::tag('div', [ | ||
'class' => 'control-group', | ||
], [Html::tag('div', [ | ||
'class' => 'control-label-group' | ||
], Html::tag('span', [ | ||
'id' => 'form_dashboard_addurl_pane-ifmxqlncwujp-label', | ||
], Html::tag('label', [ | ||
'for' => 'form_dashboard_addurl_pane-ifmxqlncwujp', | ||
'class' => 'control-label required' | ||
], ['Dashboard', Html::tag('span', [ | ||
'aria-hidden' => 'true' | ||
], ' *')]))), Html::tag('select', [ | ||
'name' => 'pane', | ||
'id' => 'dashboards_select', | ||
'aria-required' => 'true', | ||
'aria-describedby' => 'desc_form_dashboard_addurl_pane-ifmxqlncwujp' | ||
], [Html::tag('option', [ | ||
'value' => 'Current Incidents' | ||
], 'Current Incidents'), Html::tag('option', [ | ||
'value' => 'Muted' | ||
], 'Muted')]), Html::tag('i', [ | ||
'class' => 'control-info icon-info-circled', | ||
'aria-hidden' => 'true', | ||
'role' => 'img', | ||
'title' => 'Select a dashboard you want to add the dashlet to' | ||
]), Html::tag('span', [ | ||
'id' => 'desc_form_dashboard_addurl_pane-onmwybfqarvi', | ||
'class' => 'sr-only' | ||
], 'Select a dashboard you want to add the dashlet to')])); | ||
|
||
$form->add(Html::tag('div', [ | ||
'class' => 'control-group form-controls' | ||
], [Html::tag('input', [ | ||
'type' => 'submit', | ||
'name' => 'btn_submit', | ||
'id' => 'submit_button', | ||
'value' => 'Add To Dashboard', | ||
'class' => 'btn-primary' | ||
]), Html::tag('div', [ | ||
'class' => 'spinner' | ||
], Html::tag('i', [ | ||
'class' => 'icon-spin6', | ||
'aria-hidden' => 'true' | ||
]))])); | ||
|
||
$form->add(Html::tag('ul', [ | ||
'class' => 'form-info' | ||
], Html::tag('li', null, '* Required field'))); | ||
|
||
return $form; | ||
} | ||
|
||
protected function assemble() | ||
{ | ||
$this->addFrom($this->newAction()); | ||
} | ||
} |