diff --git a/src/components/BatchModal.vue b/src/components/BatchModal.vue index 2ccb12ef..98cea914 100644 --- a/src/components/BatchModal.vue +++ b/src/components/BatchModal.vue @@ -35,7 +35,7 @@ {{ $t('More parameters') }} - + {{ $t('Required Parameters') }} @@ -66,7 +66,7 @@ {{ $t('Schedule') }} - + {{ $t('Run time') }} @@ -84,7 +84,7 @@ - + {{ $t('Frequency') }} @@ -226,9 +226,7 @@ export default defineComponent({ this.jobStatus = currentFrequency; }, async updateJob() { - const jobEnum: any = Object.values(this.jobEnums)?.find((job: any) => { - return job.unfillable === this.unfillableOrder && job.facilityId === this.batchFacilityId - }); + const jobEnum: any = Object.values(this.jobEnums)?.find((job: any) => job.unfillable === this.unfillableOrder && job.facilityId === this.batchFacilityId); const job = this.getJob(jobEnum.id)?.find((job: any) => job.status === 'SERVICE_DRAFT'); if (!job) { @@ -246,10 +244,11 @@ export default defineComponent({ job.runTime = '' } - job['jobStatus'] = this.jobStatus !== 'SERVICE_DRAFT' ? this.jobStatus : 'HOURLY'; + job['jobStatus'] = this.jobStatus ? this.jobStatus : 'HOURLY'; job['jobName'] = this.jobName || this.currentDateTime; const jobCustomParameters = generateJobCustomParameters(this.customRequiredParameters, this.customOptionalParameters, job.runtimeData) + await this.store.dispatch('job/scheduleService', { job, jobCustomParameters }) this.closeModal() }, @@ -271,9 +270,7 @@ export default defineComponent({ else showToast(translate("Provide a future date and time")) }, updateCustomParameters() { - const jobEnum: any = Object.values(this.jobEnums)?.find((job: any) => { - return job.unfillable === this.unfillableOrder && job.facilityId === this.batchFacilityId - }); + const jobEnum: any = Object.values(this.jobEnums)?.find((job: any) => job.unfillable === this.unfillableOrder && job.facilityId === this.batchFacilityId); const job = this.getJob(jobEnum.id)?.find((job: any) => job.status === 'SERVICE_DRAFT'); this.customOptionalParameters = generateJobCustomOptions(job).optionalParameters; diff --git a/src/store/modules/job/actions.ts b/src/store/modules/job/actions.ts index c0225028..b7a7019e 100644 --- a/src/store/modules/job/actions.ts +++ b/src/store/modules/job/actions.ts @@ -483,7 +483,23 @@ const actions: ActionTree = { }); // fetching temp expressions - const tempExpr = Object.values(cached).map((job: any) => job.tempExprId) + // added check to loop over cachedJob (in else part), as in case of batch job same enum contains multiple jobs as an array + // and thus tempExprId is not available by default on the root + // Before looping over cachedJob, checking whether the tempExprId is directly available on the root or not, + // if tempExprId is available on root it simply means that we have a single job against the enum + const tempExpr = Object.values(cached).reduce((tempExprIds: any, cachedJob: any) => { + if(cachedJob.tempExprId && !tempExprIds.includes(cachedJob.tempExprId)) { + tempExprIds.push(cachedJob.tempExprId) + } else if (cachedJob?.length) { + cachedJob.map((job: any) => { + if(job.tempExprId && !tempExprIds.includes(job.tempExprId)) { + tempExprIds.push(job.tempExprId) + } + }); + } + + return tempExprIds; + }, []) await dispatch('fetchTemporalExpression', tempExpr) commit(types.JOB_UPDATED_BULK, cached); diff --git a/src/views/Brokering.vue b/src/views/Brokering.vue index 56ffc117..22cba048 100644 --- a/src/views/Brokering.vue +++ b/src/views/Brokering.vue @@ -37,7 +37,7 @@ {{ batch?.temporalExpression?.description }} - {{ batch?.runTime ? getTime(batch.runTime) : "-" }} + {{ batch?.runTime ? getTime(batch.runTime) : "-" }} @@ -58,7 +58,7 @@ @@ -163,21 +163,19 @@ export default defineComponent({ return DateTime.fromMillis(time).toFormat('hh:mm a'); }, getBrokerQueue(job: any){ - if(job.status === 'SERVICE_PENDING'){ - const brokerQueueId = this.batchJobEnums[job?.enumId].id - - if(brokerQueueId === "_NA_"){ - return "Brokering queue" - }else if(brokerQueueId === "PRE_ORDER_PARKING"){ - return "Pre-order parking" - }else{ - return "Back-order parking" - } + const brokerQueueId = this.batchJobEnums[job?.enumId].facilityId + + if(brokerQueueId === "_NA_"){ + return "Brokering queue" + }else if(brokerQueueId === "PRE_ORDER_PARKING"){ + return "Pre-order parking" + }else{ + return "Back-order parking" } }, async viewJobConfiguration(jobInformation: any) { this.currentJob = jobInformation.job || this.getJob(this.jobEnums[jobInformation.id]) - this.currentJobStatus = jobInformation.status + this.currentJobStatus = this.currentJob.statusId === 'SERVICE_DRAFT' ? 'SERVICE_DRAFT' : this.currentJob.frequency this.freqType = jobInformation.id && this.jobFrequencyType[jobInformation.id] // if job runTime is not a valid date then making runTime as empty