File: BackendForm.php

package info (click to toggle)
icingaweb2-module-graphite 1.2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,000 kB
  • sloc: php: 3,546; javascript: 88; sh: 54; makefile: 15
file content (69 lines) | stat: -rw-r--r-- 2,352 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php

namespace Icinga\Module\Graphite\Forms\Config;

use Icinga\Forms\ConfigForm;
use Icinga\Module\Graphite\Web\Form\Validator\HttpUserValidator;

class BackendForm extends ConfigForm
{
    public function init()
    {
        $this->setName('form_config_graphite_backend');
        $this->setSubmitLabel($this->translate('Save Changes'));
    }

    public function createElements(array $formData)
    {
        $this->addElements([
            [
                'text',
                'graphite_url',
                [
                    'required'      => true,
                    'label'         => $this->translate('Graphite Web URL'),
                    'description'   => $this->translate('URL to your Graphite Web'),
                    'validators'    => ['UrlValidator']
                ]
            ],
            [
                'text',
                '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',
                'graphite_password',
                [
                    'renderPassword'    => true,
                    'label'             => $this->translate('Graphite Web password'),
                    'description'       => $this->translate('The above user\'s password')
                ]
            ],
            [
                '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
                ]
            ]
        ]);
    }
}