diff --git a/web/src/components/alerts/AlertList.vue b/web/src/components/alerts/AlertList.vue index f997cba39c..b9efd23a2f 100644 --- a/web/src/components/alerts/AlertList.vue +++ b/web/src/components/alerts/AlertList.vue @@ -560,6 +560,11 @@ along with this program. If not, see . hide-selected :input-debounce="400" /> +
(false); const filteredResults: Ref = ref([]); const selectedAlertToMove: Ref = ref({}); + const folderIdToBeCloned = ref(router.currentRoute.value.query.folder ?? "default"); const getAlertsByFolderId = async (store: any, folderId: any) => { try { //this is the condition where we are fetching the alerts from the server @@ -1016,6 +1024,7 @@ export default defineComponent({ watch( () => activeFolderId.value, async (newVal) => { + folderIdToBeCloned.value = newVal; selectedAlerts.value = []; allSelectedAlerts.value = false; if(newVal == router.currentRoute.value.query.folder){ @@ -1189,13 +1198,14 @@ export default defineComponent({ if (toBeClonedAlert.value?.id) { delete toBeClonedAlert.value?.id; } + //here using the folderIdToBeCloned.value because we need to clone the alert in the folder which is selected by the user alertsService .create_by_alert_id( store.state.selectedOrganization.identifier, toBeClonedAlert.value, - activeFolderId.value, + folderIdToBeCloned.value, ) - .then((res) => { + .then(async (res) => { dismiss(); if (res.data.code == 200) { $q.notify({ @@ -1204,7 +1214,8 @@ export default defineComponent({ timeout: 2000, }); showForm.value = false; - getAlertsFn(store, activeFolderId.value); + await getAlertsFn(store, folderIdToBeCloned.value); + activeFolderId.value = folderIdToBeCloned.value; } else { $q.notify({ type: "negative", @@ -1765,6 +1776,9 @@ export default defineComponent({ const refreshImportedAlerts = async (store: any, folderId: any) => { await getAlertsFn(store, folderId); }; + const updateFolderIdToBeCloned = (folderId: any) => { + folderIdToBeCloned.value = folderId.value; + }; return { @@ -1867,6 +1881,8 @@ export default defineComponent({ tabs, filterAlertsByTab, refreshImportedAlerts, + folderIdToBeCloned, + updateFolderIdToBeCloned, }; }, });