From ebf073a47c1fa6e997c4c9ed876500bef060fa92 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Fri, 26 Apr 2024 18:48:28 +0530 Subject: [PATCH 1/3] Fixed: case to handle the case when enum data is missing for specific type Added empty state in option selection modal when the enum data is missing Added check to display the code if the enum label is missing --- src/components/AddInventoryFilterOptionsModal.vue | 7 +++++-- src/components/AddOrderRouteFilterOptions.vue | 7 +++++-- src/views/BrokeringQuery.vue | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/components/AddInventoryFilterOptionsModal.vue b/src/components/AddInventoryFilterOptionsModal.vue index 48130d8..9c3753f 100644 --- a/src/components/AddInventoryFilterOptionsModal.vue +++ b/src/components/AddInventoryFilterOptionsModal.vue @@ -9,7 +9,10 @@ - +
+

{{ translate(`Failed to fetch ${props.label?.toLowerCase()} options`) }}

+
+ {{ condition.description || condition.enumCode }} @@ -66,7 +69,7 @@ const associatedOptions = { IIP_PROXIMITY: { enum: "IIP_MSMNT_SYSTEM", defaultVa onMounted(() => { inventoryRuleConditions.value = props.ruleConditions ? JSON.parse(JSON.stringify(props.ruleConditions)) : {} - enumerations.value = Object.values(enums.value[props.parentEnumId]).filter((enumeration: any) => !hiddenOptions.includes(enumeration.enumId)) + enumerations.value = enums.value[props.parentEnumId] ? Object.values(enums.value[props.parentEnumId]).filter((enumeration: any) => !hiddenOptions.includes(enumeration.enumId)) : [] }) function checkFilters() { diff --git a/src/components/AddOrderRouteFilterOptions.vue b/src/components/AddOrderRouteFilterOptions.vue index a173721..1f6b913 100644 --- a/src/components/AddOrderRouteFilterOptions.vue +++ b/src/components/AddOrderRouteFilterOptions.vue @@ -9,8 +9,11 @@ - - +
+

{{ translate(`Failed to fetch ${$props.label?.toLowerCase()} options`) }}

+
+ + {{ sort.description || sort.enumCode }} diff --git a/src/views/BrokeringQuery.vue b/src/views/BrokeringQuery.vue index 1f799cb..1b44ee1 100644 --- a/src/views/BrokeringQuery.vue +++ b/src/views/BrokeringQuery.vue @@ -793,7 +793,7 @@ function getSelectedValue(options: any, enumerations: any, parameter: string) { function getLabel(parentType: string, code: string) { const enumerations = enums.value[parentType] - const enumInfo: any = Object.values(enumerations).find((enumeration: any) => enumeration.enumCode === code) + const enumInfo: any = enumerations ? Object.values(enumerations).find((enumeration: any) => enumeration.enumCode === code) : null return enumInfo?.description } From 676cf56354ee13f6387f79b5ab77e2feb007af79 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Fri, 26 Apr 2024 18:57:35 +0530 Subject: [PATCH 2/3] Improved: locale file to include static text --- src/locales/en.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/locales/en.json b/src/locales/en.json index ea01790..202b698 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -48,6 +48,8 @@ "Failed to create brokering run": "Failed to create brokering run", "Failed to create inventory rule": "Failed to create inventory rule", "Failed to create order routing": "Failed to create order routing", + "Failed to fetch filter options": "Failed to fetch filter options", + "Failed to fetch sort options": "Failed to fetch sort options", "Failed to update group information": "Failed to update group information", "Failed to update group status": "Failed to update group status", "Failed to schedule service": "Failed to schedule service", From 4993d4b5fd3f3333ac782464c938b24a5c8c5742 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Fri, 26 Apr 2024 19:08:05 +0530 Subject: [PATCH 3/3] Improved: check for finding the enum data before fetching the value --- src/views/BrokeringQuery.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/BrokeringQuery.vue b/src/views/BrokeringQuery.vue index 1b44ee1..27d6813 100644 --- a/src/views/BrokeringQuery.vue +++ b/src/views/BrokeringQuery.vue @@ -770,7 +770,7 @@ function getPromiseDateValue() { } function getFilterValue(options: any, enums: any, parameter: string) { - return options?.[enums[parameter].code] + return enums[parameter] ? options?.[enums[parameter].code] : undefined } function getSelectedValue(options: any, enumerations: any, parameter: string) {