icingaweb2-module-graphite/application/forms/Config/BackendForm.php

70 lines
2.3 KiB
PHP
Raw Permalink Normal View History

<?php
2017-09-26 05:20:49 -04:00
namespace Icinga\Module\Graphite\Forms\Config;
2017-09-26 05:20:49 -04:00
use Icinga\Forms\ConfigForm;
use Icinga\Module\Graphite\Web\Form\Validator\HttpUserValidator;
2017-09-26 05:20:49 -04:00
class BackendForm extends ConfigForm
{
public function init()
{
2017-09-26 05:20:49 -04:00
$this->setName('form_config_graphite_backend');
$this->setSubmitLabel($this->translate('Save Changes'));
}
public function createElements(array $formData)
{
$this->addElements([
[
'text',
2017-11-27 04:32:01 -05:00
'graphite_url',
[
'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',
[
'label' => $this->translate('Graphite Web user'),
'description' => $this->translate(
'A user with access to your Graphite Web via HTTP basic authentication'
),
'validators' => [new HttpUserValidator()]
]
],
[
'password',
2017-11-27 04:32:01 -05:00
'graphite_password',
[
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-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')
]
],
[
'number',
'graphite_timeout',
[
'label' => $this->translate('Request timeout'),
'description' => $this->translate('The timeout for HTTP requests to Graphite Web'),
'min' => 0,
'placeholder' => 10
]
]
]);
}
}