Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.

Commit 6e3d02e

Browse files
authored
Add optionLabels (#120)
1 parent b1f78df commit 6e3d02e

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

gui/js/comp/ControlItem.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,13 @@ export function ControlItem(props) {
9797
for (let i = 0; i < props.conditionalAttributes.options.length; i++) {
9898
if (data == props.conditionalAttributes.options[i]) {
9999
isOption = true;
100-
}
101-
options = <>{options}<option value={props.conditionalAttributes.options[i]}>{props.conditionalAttributes.options[i]}</option></>;
100+
}
101+
let optionLabel = props.conditionalAttributes.options[i];
102+
if (typeof props.conditionalAttributes.optionLabels[i] !== "undefined") {
103+
optionLabel = props.conditionalAttributes.optionLabels[i];
104+
}
105+
106+
options = <>{options}<option value={props.conditionalAttributes.options[i]}>{optionLabel}</option></>;
102107
}
103108

104109
if (!isOption) {

gui/js/comp/DashboardItems.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ export function DashboardItems(props) {
175175

176176
case "select":
177177
conditionalAttributes.options = props.items[i].options;
178+
conditionalAttributes.optionLabels = props.items[i].optionLabels;
178179
break;
179180
}
180181

@@ -213,8 +214,12 @@ export function DashboardItems(props) {
213214
case "config":
214215
if (inputType == "select") {
215216
let options;
216-
for (let i = 0; i < conditionalAttributes.options.length; i++) {
217-
options = <>{options}<option value={conditionalAttributes.options[i]}>{conditionalAttributes.options[i]}</option></>;
217+
for (let i = 0; i < conditionalAttributes.options.length; i++) {
218+
let label = conditionalAttributes.options[i];
219+
if (typeof conditionalAttributes.optionLabels[i] !== "undefined") {
220+
label = conditionalAttributes.optionLabels[i];
221+
}
222+
options = <>{options}<option value={conditionalAttributes.options[i]}>{label}</option></>;
218223
}
219224
confItems = <>{confItems}
220225
<p>

0 commit comments

Comments
 (0)