From 0b478745c151bdb570cca8f82ea3848a24122099 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Fri, 2 Feb 2024 19:19:34 +0530 Subject: [PATCH] Implemented: confirmation alert when disabling a schedule(#46) --- src/locales/en.json | 6 +++-- src/views/BrokeringRoute.vue | 46 +++++++++++++++++++++++------------- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index 8aca385..c9e0bcd 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -27,6 +27,8 @@ "Connection configuration is missing for oms.": "Connection configuration is missing for oms.", "Description": "Description", "Disable": "Disable", + "Disabling this schedule will cancel this occurrence and all following occurrences. This schedule will have to be re-enabled manually to run it again.": "Disabling this schedule will cancel this occurrence and all following occurrences. This schedule will have to be re-enabled manually to run it again.", + "Don't cancel": "Don't cancel", "duration": "duration", "Edit": "Edit", "Error getting user profile": "Error getting user profile", @@ -36,7 +38,7 @@ "Failed to create order routing": "Failed to create order routing", "Failed to identify selected inventory rule, please select a rule or refresh": "Failed to identify selected inventory rule, please select a rule or refresh", "Failed to update group information": "Failed to update group information", - "Failed to update job": "Failed to update job", + "Failed to update schedule": "Failed to update schedule", "Failed to schedule service": "Failed to schedule service", "Fetching filters and inventory rules": "Fetching filters and inventory rules", "Fetching groups": "Fetching groups", @@ -51,7 +53,6 @@ "Inventory Filters": "Inventory Filters", "Inventory rule created successfully": "Inventory rule created successfully", "Inventory Sort": "Inventory Sort", - "Job disabled": "Job disabled", "Job updated": "Job updated", "kms": "kms", "LEAVE": "LEAVE", @@ -108,6 +109,7 @@ "Save Changes": "Save Changes", "Save changes": "Save changes", "Schedule": "Schedule", + "Schedule disabled": "Schedule disabled", "Scheduler": "Scheduler", "Search time zones": "Search time zones", "Select": "Select", diff --git a/src/views/BrokeringRoute.vue b/src/views/BrokeringRoute.vue index 075e1d5..160743c 100644 --- a/src/views/BrokeringRoute.vue +++ b/src/views/BrokeringRoute.vue @@ -96,7 +96,7 @@
- {{ translate("Disable") }} + {{ translate("Disable") }}
{{ translate("Save changes") }} @@ -250,22 +250,36 @@ async function saveChanges() { } async function disable() { - const payload = { - routingGroupId: props.routingGroupId, - paused: "Y" // setting Y to disable the job - } + const alert = await alertController + .create({ + header: translate("Disable"), + message: translate("Disabling this schedule will cancel this occurrence and all following occurrences. This schedule will have to be re-enabled manually to run it again."), + buttons: [{ + text: translate("Don't cancel"), + role: "cancel" + }, { + text: translate("Cancel"), + handler: async () => { + const payload = { + routingGroupId: props.routingGroupId, + paused: "Y" // setting Y to disable the schedule + } - try { - const resp = await OrderRoutingService.scheduleBrokering(payload) - if(!hasError(resp)){ - showToast(translate("Job disabled")) - } else { - throw resp.data - } - } catch(err) { - showToast(translate("Failed to update job")) - logger.error(err) - } + try { + const resp = await OrderRoutingService.scheduleBrokering(payload) + if(!hasError(resp)){ + showToast(translate("Schedule disabled")) + } else { + throw resp.data + } + } catch(err) { + showToast(translate("Failed to update schedule")) + logger.error(err) + } + } + }], + }); + return alert.present(); } async function runNow() {