diff --git a/modules/dashboards/application/controllers/DashletsController.php b/modules/dashboards/application/controllers/DashletsController.php new file mode 100644 index 00000000000..c5c82f5e1c1 --- /dev/null +++ b/modules/dashboards/application/controllers/DashletsController.php @@ -0,0 +1,22 @@ +setTitle('New Dashlet'); + + $dashletsForm = new NewDashletsForm(); + $this->addContent($dashletsForm); + } +} diff --git a/modules/dashboards/application/views/scripts/dashlets/new.phtml b/modules/dashboards/application/views/scripts/dashlets/new.phtml new file mode 100644 index 00000000000..3041ffac390 --- /dev/null +++ b/modules/dashboards/application/views/scripts/dashlets/new.phtml @@ -0,0 +1,2 @@ + '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()); + } +}