Skip to content

Commit b4a36a2

Browse files
author
Prachya Saechua
committed
fix: ensure proper handling of select type variables in TaskParamsForm for default value normalization
Signed-off-by: Prachya Saechua <psaechua@cpaxtra.co.th>
1 parent 7f00817 commit b4a36a2

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

web/src/components/TaskParamsForm.vue

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ export default {
255255
if (surveyVar.type === 'select' && this.editedEnvironment[surveyVar.name] !== undefined) {
256256
const currentValue = this.editedEnvironment[surveyVar.name];
257257
if (!Array.isArray(currentValue)) {
258-
this.editedEnvironment[surveyVar.name] =
259-
currentValue == null || currentValue === '' ? [] : [currentValue];
258+
this.editedEnvironment[surveyVar.name] = currentValue == null || currentValue === ''
259+
? [] : [currentValue];
260260
}
261261
}
262262
});
@@ -287,22 +287,22 @@ export default {
287287
[this.buildTasks, this.inventory] = await Promise.all([
288288
this.template.type === 'deploy'
289289
? (
290-
await axios({
291-
keys: 'get',
292-
url: `/api/project/${this.projectId}/templates/${this.template.build_template_id}/tasks?status=success&limit=20`,
293-
responseType: 'json',
294-
})
295-
).data.filter((task) => task.status === 'success')
290+
await axios({
291+
keys: 'get',
292+
url: `/api/project/${this.projectId}/templates/${this.template.build_template_id}/tasks?status=success&limit=20`,
293+
responseType: 'json',
294+
})
295+
).data.filter((task) => task.status === 'success')
296296
: [],
297297
298298
this.needInventory
299299
? (
300-
await axios({
301-
keys: 'get',
302-
url: this.getInventoryUrl(),
303-
responseType: 'json',
304-
})
305-
).data
300+
await axios({
301+
keys: 'get',
302+
url: this.getInventoryUrl(),
303+
responseType: 'json',
304+
})
305+
).data
306306
: [],
307307
]);
308308
@@ -322,10 +322,7 @@ export default {
322322
{},
323323
);
324324
325-
this.editedEnvironment = {
326-
...defaultVars,
327-
...this.editedEnvironment,
328-
};
325+
this.editedEnvironment = { ...defaultVars, ...this.editedEnvironment };
329326
330327
// Ensure select type variables without values are initialized as empty arrays
331328
(this.template.survey_vars || []).forEach((surveyVar) => {

0 commit comments

Comments
 (0)