2017-08-30 08:55:36 -04:00
|
|
|
<?php
|
|
|
|
|
|
2017-09-26 05:20:49 -04:00
|
|
|
namespace Icinga\Module\Graphite\Forms\Config;
|
2017-08-30 08:55:36 -04:00
|
|
|
|
2017-09-26 05:20:49 -04:00
|
|
|
use Icinga\Forms\ConfigForm;
|
2017-08-31 08:34:32 -04:00
|
|
|
use Icinga\Module\Graphite\Web\Form\Validator\HttpUserValidator;
|
2017-08-30 08:55:36 -04:00
|
|
|
|
2017-09-26 05:20:49 -04:00
|
|
|
class BackendForm extends ConfigForm
|
2017-08-30 08:55:36 -04:00
|
|
|
{
|
|
|
|
|
public function init()
|
|
|
|
|
{
|
2017-09-26 05:20:49 -04:00
|
|
|
$this->setName('form_config_graphite_backend');
|
2017-08-30 08:55:36 -04:00
|
|
|
$this->setSubmitLabel($this->translate('Save Changes'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function createElements(array $formData)
|
|
|
|
|
{
|
2017-08-31 08:34:32 -04:00
|
|
|
$this->addElements([
|
|
|
|
|
[
|
|
|
|
|
'text',
|
2017-11-27 04:32:01 -05:00
|
|
|
'graphite_url',
|
2017-08-31 08:34:32 -04:00
|
|
|
[
|
|
|
|
|
'required' => true,
|
|
|
|
|
'label' => $this->translate('Graphite Web URL'),
|
|
|
|
|
'description' => $this->translate('URL to your Graphite Web'),
|
|
|
|
|
'validators' => ['UrlValidator']
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'text',
|
2017-11-27 04:32:01 -05:00
|
|
|
'graphite_user',
|
2017-08-31 08:34:32 -04:00
|
|
|
[
|
|
|
|
|
'label' => $this->translate('Graphite Web user'),
|
2017-09-01 10:38:33 -04:00
|
|
|
'description' => $this->translate(
|
|
|
|
|
'A user with access to your Graphite Web via HTTP basic authentication'
|
|
|
|
|
),
|
2017-08-31 08:34:32 -04:00
|
|
|
'validators' => [new HttpUserValidator()]
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'password',
|
2017-11-27 04:32:01 -05:00
|
|
|
'graphite_password',
|
2017-08-31 08:34:32 -04:00
|
|
|
[
|
2017-11-21 13:14:34 -05:00
|
|
|
'renderPassword' => true,
|
|
|
|
|
'label' => $this->translate('Graphite Web password'),
|
|
|
|
|
'description' => $this->translate('The above user\'s password')
|
2017-08-31 08:34:32 -04:00
|
|
|
]
|
2017-12-18 06:17:32 -05:00
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'checkbox',
|
|
|
|
|
'graphite_insecure',
|
|
|
|
|
[
|
|
|
|
|
'label' => $this->translate('Connect insecurely'),
|
|
|
|
|
'description' => $this->translate('Check this to not verify the remote\'s TLS certificate')
|
|
|
|
|
]
|
2024-02-01 06:57:12 -05:00
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
'number',
|
|
|
|
|
'graphite_timeout',
|
|
|
|
|
[
|
|
|
|
|
'label' => $this->translate('Request timeout'),
|
|
|
|
|
'description' => $this->translate('The timeout for HTTP requests to Graphite Web'),
|
|
|
|
|
'min' => 0,
|
|
|
|
|
'placeholder' => 10
|
|
|
|
|
]
|
2017-08-31 08:34:32 -04:00
|
|
|
]
|
|
|
|
|
]);
|
2017-08-30 08:55:36 -04:00
|
|
|
}
|
|
|
|
|
}
|