worked out the issue (#14588)

(cherry picked from commit 50386d622c)
This commit is contained in:
calvin 2023-07-19 18:46:46 +08:00 committed by Jay Chung
parent 8b922675c9
commit 12511c4e0e
3 changed files with 16 additions and 6 deletions

View File

@ -42,7 +42,6 @@ export function useAlertGroup(): IJsonItem {
field: 'alertGroups',
span: 12,
name: t('project.workflow.alarm_group'),
options: options,
value: 'default'
options: options
}
}

View File

@ -42,7 +42,6 @@ export function useTenant(): IJsonItem {
field: 'tenant',
span: 12,
name: t('project.workflow.tenant_code'),
options: options,
value: 'default'
options: options
}
}

View File

@ -68,8 +68,20 @@ export function useEnvironmentName(
options.value = environmentList.filter((option: IEnvironmentNameOption) =>
filterByWorkerGroup(option)
)
model.environmentCode =
options.value.length === 0 ? null : options.value[0].value
if (model?.environmentCode) {
if (options.value) {
let elementExists =
options.value.find(
(item) => item.value === model.environmentCode
) !== undefined
if (!elementExists) {
model.environmentCode = null
}
}
} else {
model.environmentCode =
options.value.length === 0 ? null : options.value[0].value
}
}
)