Skip to content

Commit 41f35f0

Browse files
authored
Merge pull request #37 from NETWAYS/fix/configform
Fix accessmode conditional in config form
2 parents f204a8d + 62f153e commit 41f35f0

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

application/forms/Config/GeneralConfigForm.php

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public function createElements(array $formData)
3434
'required' => true
3535
]
3636
);
37+
3738
$this->addElement(
3839
'select',
3940
'grafana_protocol',
@@ -48,6 +49,7 @@ public function createElements(array $formData)
4849
]
4950
);
5051

52+
// TLS configuration
5153
if (isset($formData['grafana_protocol']) && $formData['grafana_protocol'] === 'https') {
5254
$this->addElement(
5355
'checkbox',
@@ -69,6 +71,8 @@ public function createElements(array $formData)
6971
]
7072
);
7173
}
74+
75+
// Timerange configuration
7276
$this->addElement(
7377
'select',
7478
'grafana_timerange',
@@ -88,6 +92,8 @@ public function createElements(array $formData)
8892
'description' => $this->translate('The default timerange to use for show all graphs.')
8993
]
9094
);
95+
96+
// Custom Variable configuration
9197
$this->addElement(
9298
'text',
9399
'grafana_custvardisable',
@@ -104,6 +110,8 @@ public function createElements(array $formData)
104110
'description' => $this->translate('Name of the custom variable that, if set, hold the config name to be used.'),
105111
]
106112
);
113+
114+
// Grafana dashboard configuration
107115
$this->addElement(
108116
'text',
109117
'grafana_defaultdashboard',
@@ -141,6 +149,8 @@ public function createElements(array $formData)
141149
'description' => $this->translate('ID of the default organization.'),
142150
]
143151
);
152+
153+
// Graphs shadow configuration
144154
$this->addElement(
145155
'checkbox',
146156
'grafana_shadows',
@@ -150,6 +160,8 @@ public function createElements(array $formData)
150160
'description' => $this->translate('Show shadows around the graph.'),
151161
]
152162
);
163+
164+
// Grafana datasource configuration
153165
$this->addElement(
154166
'select',
155167
'grafana_datasource',
@@ -162,6 +174,8 @@ public function createElements(array $formData)
162174
'description' => $this->translate('Select the Grafana datasource.')
163175
]
164176
);
177+
178+
// Grafana access mode configuration
165179
$this->addElement(
166180
'select',
167181
'grafana_accessmode',
@@ -177,6 +191,7 @@ public function createElements(array $formData)
177191
]
178192
);
179193

194+
// Indirect proxy mode configuration
180195
if (isset($formData['grafana_accessmode']) && $formData['grafana_accessmode'] === 'indirectproxy') {
181196
$this->addElement(
182197
'number',
@@ -202,6 +217,8 @@ public function createElements(array $formData)
202217
'class' => 'autosubmit'
203218
]
204219
);
220+
221+
// Indirect proxy mode authentication configuration
205222
if (isset($formData['grafana_authentication']) && $formData['grafana_authentication'] === 'basic') {
206223
$this->addElement(
207224
'text',
@@ -236,6 +253,7 @@ public function createElements(array $formData)
236253
}
237254
}
238255

256+
// Indirect proxy mode cache configuration
239257
if (isset($formData['grafana_accessmode']) && $formData['grafana_accessmode'] === 'indirectproxy') {
240258
$this->addElement(
241259
'select',
@@ -252,6 +270,7 @@ public function createElements(array $formData)
252270
);
253271
}
254272

273+
// iFrame mode configuration
255274
if (isset($formData['grafana_accessmode']) && ( $formData['grafana_accessmode'] != 'iframe' )) {
256275
$this->addElement(
257276
'number',
@@ -271,8 +290,6 @@ public function createElements(array $formData)
271290
'description' => $this->translate('The default graph width in pixels.')
272291
]
273292
);
274-
}
275-
if (( $formData['grafana_accessmode'] != 'iframe' )) {
276293
$this->addElement(
277294
'select',
278295
'grafana_usepublic',
@@ -288,6 +305,8 @@ public function createElements(array $formData)
288305
]
289306
);
290307
}
308+
309+
// iFrame mode public link configuration
291310
if (isset($formData['grafana_usepublic']) && ( $formData['grafana_usepublic'] === 'yes' ) && ( $formData['grafana_accessmode'] != 'iframe' )) {
292311
$this->addElement(
293312
'text',

0 commit comments

Comments
 (0)