diff --git a/src/views/BrokeringRoute.vue b/src/views/BrokeringRoute.vue index 801b19f..702dbe7 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) }}

@@ -114,9 +114,9 @@
- - {{ translate("Schedule") }} - {{ "-" }} + + {{ translate("Schedule") }} + {{ "-" }} {{ description }} @@ -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", // passing Y as we just need to configure the scheduler and do not need to schedule it in active state + } + + 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) {