Skip to content

Commit a66100a

Browse files
committed
Simulation Experiment view: fixed a small issue with a select input's default value.
1 parent 1e05675 commit a66100a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/renderer/src/components/views/SimulationExperimentView.vue

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,22 @@ const interactiveUiJsonIssues = vue.ref<locApi.IIssue[]>(
223223
);
224224
const interactiveInstanceIssues = vue.ref<locApi.IIssue[]>([]);
225225
const interactiveInputValues = vue.ref<number[]>(
226-
interactiveModeAvailable.value ? props.uiJson.input.map((input: locApi.IUiJsonInput) => input.defaultValue) : []
226+
interactiveModeAvailable.value
227+
? props.uiJson.input.map((input: locApi.IUiJsonInput) => {
228+
// If the input has some possible values then we want to return the index of the possible value that matches the
229+
// default value otherwise we just return the default value.
230+
231+
if (input.possibleValues !== undefined) {
232+
for (let i = 0; i < input.possibleValues.length; ++i) {
233+
if (input.possibleValues[i].value === input.defaultValue) {
234+
return i;
235+
}
236+
}
237+
}
238+
239+
return input.defaultValue;
240+
})
241+
: []
227242
);
228243
const interactiveShowInput = vue.ref<string[]>(
229244
interactiveModeAvailable.value ? props.uiJson.input.map((input: locApi.IUiJsonInput) => input.visible ?? 'true') : []

0 commit comments

Comments
 (0)