From 5373f210dd8317d71d05cea7bbc673ebbdaeb873 Mon Sep 17 00:00:00 2001 From: Sai Nikhil Date: Wed, 23 Apr 2025 05:49:00 +0530 Subject: [PATCH] fix: import dest , alert issues (#6612) fixes the issue of #6611 --- web/src/components/alerts/ImportAlert.vue | 56 ++++++++++++++++++- .../components/alerts/ImportDestination.vue | 7 ++- 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/web/src/components/alerts/ImportAlert.vue b/web/src/components/alerts/ImportAlert.vue index 6bae0eebb2..7b93b63511 100644 --- a/web/src/components/alerts/ImportAlert.vue +++ b/web/src/components/alerts/ImportAlert.vue @@ -397,6 +397,39 @@ along with this program. If not, see . /> + + {{ errorMessage.message }} +
+ + +
+
{{ errorMessage }} @@ -525,6 +558,17 @@ export default defineComponent({ const activeFolderId = ref(router.currentRoute.value.query.folder || router.currentRoute.value.query?.folderId); const activeFolderAlerts = ref([]); const isAlertImporting = ref(false); + const userSelectedOrgId = ref([]); + const organizationDataList = computed(() => { + return store.state.organizations.map((org: any) => { + return { + label: org.identifier, + value: org.identifier, + disable: !org.identifier || org.identifier !== store.state.selectedOrganization.identifier + }; + }); + }); + const getFormattedDestinations: any = computed(() => { return props.destinations.map((destination: any) => { return destination.name; @@ -768,7 +812,10 @@ export default defineComponent({ input.org_id != store.state.selectedOrganization.identifier ) { alertErrors.push( - `Alert - ${index}: Organization Id is mandatory, should exist in organization list and should be equal to ${store.state.selectedOrganization.identifier}.`, + { + message: `Alert - ${index}: Organization Id is mandatory, should exist in organization list and should be equal to ${store.state.selectedOrganization.identifier}.`, + field: "org_id", + } ); } @@ -1174,6 +1221,10 @@ export default defineComponent({ activeFolderAlerts.value = store.state.organizationData.allAlertsListByNames[folderId]; } + const updateOrgId = (orgId: string, index: number) => { + jsonArrayOfObj.value[index].org_id = orgId; + jsonStr.value = JSON.stringify(jsonArrayOfObj.value, null, 2); + } return { t, @@ -1222,6 +1273,9 @@ export default defineComponent({ activeFolderAlerts, store, isAlertImporting, + organizationDataList, + userSelectedOrgId, + updateOrgId, }; }, components: { diff --git a/web/src/components/alerts/ImportDestination.vue b/web/src/components/alerts/ImportDestination.vue index bf392255a1..cb42d00b8e 100644 --- a/web/src/components/alerts/ImportDestination.vue +++ b/web/src/components/alerts/ImportDestination.vue @@ -1007,9 +1007,10 @@ export default defineComponent({ // Check if 'name' is required for both webhook and email if (!input.name || typeof input.name !== "string") { - destinationErrors.push( - `Destination - ${index} 'name' is required and should be a string`, - ); + destinationErrors.push({ + message: `Destination - ${index} 'name' is required and should be a string`, + field: "destination_name", + }); } if (input.type === "action" && !isActionsEnabled.value) {