mirror of
https://github.com/Icinga/icingaweb2-module-graphite.git
synced 2026-05-28 04:34:57 -04:00
parent
2beedfb419
commit
f86bf88dcc
4 changed files with 57 additions and 0 deletions
16
application/controllers/ConfigController.php
Normal file
16
application/controllers/ConfigController.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Graphite\Controllers;
|
||||
|
||||
use Icinga\Module\Graphite\Forms\ConfigForm;
|
||||
use Icinga\Web\Controller;
|
||||
|
||||
class ConfigController extends Controller
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->form = $form = new ConfigForm();
|
||||
$form->setIniConfig($this->Config())->handleRequest();
|
||||
$this->view->tabs = $this->Module()->getConfigTabs()->activate('backend');
|
||||
}
|
||||
}
|
||||
28
application/forms/ConfigForm.php
Normal file
28
application/forms/ConfigForm.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace Icinga\Module\Graphite\Forms;
|
||||
|
||||
use Icinga\Forms\ConfigForm as BaseConfigForm;
|
||||
|
||||
class ConfigForm extends BaseConfigForm
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
$this->setName('form_config_graphite');
|
||||
$this->setSubmitLabel($this->translate('Save Changes'));
|
||||
}
|
||||
|
||||
public function createElements(array $formData)
|
||||
{
|
||||
$this->addElement(
|
||||
'text',
|
||||
'graphite_web_url',
|
||||
array(
|
||||
'required' => true,
|
||||
'label' => $this->translate('Graphite Web URL'),
|
||||
'description' => $this->translate('URL to your Graphite Web'),
|
||||
'validators' => ['UrlValidator']
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
7
application/views/scripts/config/index.phtml
Normal file
7
application/views/scripts/config/index.phtml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<div class="controls">
|
||||
<?= /** @var \Icinga\Web\Widget\Tabs $tabs */ $tabs ?>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<?= /** @var \Icinga\Module\Graphite\Forms\ConfigForm $form */ $form ?>
|
||||
</div>
|
||||
|
|
@ -4,3 +4,9 @@
|
|||
|
||||
$this->menuSection(N_('Graphite'), ['icon' => 'chart-area'])->setUrl('graphite/show/overview');
|
||||
|
||||
$this->provideConfigTab('backend', array(
|
||||
'title' => $this->translate('Configure the Graphite Web backend'),
|
||||
'label' => $this->translate('Backend'),
|
||||
'url' => 'config'
|
||||
));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue