From ae2ab9d3387b6c460c155ab023878f4d93681a2f Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Thu, 4 Apr 2024 16:00:05 +0530 Subject: [PATCH 1/3] Improved: logic to run the job successfully on clicking runNow(#147) Clicking runNow when the group does not have a scheduler configured(job is not already scheduled) results in an error. Improved support to check whether the scheduler is configured for the group or not, if not then before calling runNow service, scheduling the job as draft to configure the scheduler and then making the runNow request --- src/views/BrokeringRoute.vue | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/views/BrokeringRoute.vue b/src/views/BrokeringRoute.vue index 801b19f..7510337 100644 --- a/src/views/BrokeringRoute.vue +++ b/src/views/BrokeringRoute.vue @@ -75,7 +75,7 @@

{{ translate("History") }}

{{ translate("View All") }} -

{{ translate("No available history for this group") }}

+

{{ translate("No available history for this group") }}

{{ getTime(groupHistory[0].startTime) }}

@@ -352,6 +352,27 @@ async function runNow() { { text: translate("Run now"), handler: async () => { + // Checking that if we already have the job schedule before calling runNow, because if the job scheduler is not present then runNow action can't be performed + // If the scheduler for the job is available then we will have jobName, if not then first scheduling the job in draft status just to create a routing schedule and then calling runNow action + if(!job.value.jobName) { + const payload = { + routingGroupId: props.routingGroupId, + paused: "Y", + } + + try { + const resp = await OrderRoutingService.scheduleBrokering(payload) + if(hasError(resp)) { + throw resp.data + } + // Updating jobName as if the user again clicks the runNow button then in that we don't want to call the scheduleBrokering service + job.value.jobName = resp.data.jobName + } catch(err) { + logger.error(err) + return; + } + } + try { const resp = await OrderRoutingService.runNow(props.routingGroupId) if(!hasError(resp) && resp.data.jobRunId) { From ef330b6273cc743bc462ab3a87f5f27093ce0e9c Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Thu, 4 Apr 2024 16:02:50 +0530 Subject: [PATCH 2/3] Improved: comments in the code(#147) --- src/views/BrokeringRoute.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/BrokeringRoute.vue b/src/views/BrokeringRoute.vue index 7510337..9e90bb7 100644 --- a/src/views/BrokeringRoute.vue +++ b/src/views/BrokeringRoute.vue @@ -357,7 +357,7 @@ async function runNow() { if(!job.value.jobName) { const payload = { routingGroupId: props.routingGroupId, - paused: "Y", + paused: "Y", // passing Y as we just need to configure the scheduler and do not need to schedule it in active state } try { From 0029dab4d1dc274ac88d8b4bd9184cabe0c3ed33 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Thu, 4 Apr 2024 16:26:30 +0530 Subject: [PATCH 3/3] Improved: support to not allow user to select the schedule until the status for job is draft(#147) --- src/views/BrokeringRoute.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/views/BrokeringRoute.vue b/src/views/BrokeringRoute.vue index 9e90bb7..702dbe7 100644 --- a/src/views/BrokeringRoute.vue +++ b/src/views/BrokeringRoute.vue @@ -114,9 +114,9 @@
- - {{ translate("Schedule") }} - {{ "-" }} + + {{ translate("Schedule") }} + {{ "-" }} {{ description }}