From 22b48a98074f781aa66a85a8496b882e06d09747 Mon Sep 17 00:00:00 2001 From: k2maan Date: Tue, 13 Jun 2023 18:14:28 +0530 Subject: [PATCH 1/3] Fixed: now option as run time not working (#517) --- src/components/InitialJobConfiguration.vue | 2 +- src/components/JobConfiguration.vue | 4 +--- src/store/modules/job/actions.ts | 5 ++++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/InitialJobConfiguration.vue b/src/components/InitialJobConfiguration.vue index bfd1af70..cfa6d357 100644 --- a/src/components/InitialJobConfiguration.vue +++ b/src/components/InitialJobConfiguration.vue @@ -216,7 +216,7 @@ export default defineComponent({ // Handling the case for 'Now'. Sending the now value will fail the API as by the time // the job is ran, the given 'now' time would have passed. Hence, passing empty 'run time' - !isCustomRunTime(this.runTime) && this.runTime == 0 ? job.runTime = '' : job.runTime += DateTime.now().toMillis() + !isCustomRunTime(this.runTime) ? job.runTime = DateTime.now().toMillis() + this.runTime : job.runTime = this.runTime // if job runTime is not a valid date then making runTime as empty if (job?.runTime && !isFutureDate(job?.runTime)) { diff --git a/src/components/JobConfiguration.vue b/src/components/JobConfiguration.vue index a733a860..694bd714 100644 --- a/src/components/JobConfiguration.vue +++ b/src/components/JobConfiguration.vue @@ -292,11 +292,9 @@ export default defineComponent({ const job = this.currentJob; job['jobStatus'] = this.jobStatus !== 'SERVICE_DRAFT' ? this.jobStatus : 'HOURLY'; - job.runTime = this.runTime - // Handling the case for 'Now'. Sending the now value will fail the API as by the time // the job is ran, the given 'now' time would have passed. Hence, passing empty 'run time' - !isCustomRunTime(this.runTime) && this.runTime == 0 ? job.runTime = '' : job.runTime += DateTime.now().toMillis() + !isCustomRunTime(this.runTime) ? job.runTime = DateTime.now().toMillis() + this.runTime : job.runTime = this.runTime if (job?.statusId === 'SERVICE_DRAFT') { this.store.dispatch('job/scheduleService', job).then((job: any) => { diff --git a/src/store/modules/job/actions.ts b/src/store/modules/job/actions.ts index d095528d..d5b71825 100644 --- a/src/store/modules/job/actions.ts +++ b/src/store/modules/job/actions.ts @@ -837,7 +837,10 @@ const actions: ActionTree = { return payload.jobs.reduce((jobParams: any, job: any) => { // Handling the case for 'Now'. Sending the now value will fail the API as by the time // the job is ran, the given 'now' time would have passed. Hence, passing empty 'run time' - !isCustomRunTime(job.runTime) && job.runTime == 0 ? job.runTime = '' : job.runTime += DateTime.now().toMillis() + if (!isCustomRunTime(job.runTime)) { + // scheduleJob service takes empty runTime for scheduling the job now + job.runTime === 0 ? job.runTime = '' : job.runTime += DateTime.now().toMillis() + } const params = { 'JOB_NAME': job.jobName, From 9ef7b55f374b0c926f8f16200003f829fc2d8e6a Mon Sep 17 00:00:00 2001 From: k2maan Date: Fri, 16 Jun 2023 10:53:15 +0530 Subject: [PATCH 2/3] Improved: conditional code for setting job run time (#517) --- src/components/InitialJobConfiguration.vue | 2 +- src/components/JobConfiguration.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/InitialJobConfiguration.vue b/src/components/InitialJobConfiguration.vue index cfa6d357..75aba2cf 100644 --- a/src/components/InitialJobConfiguration.vue +++ b/src/components/InitialJobConfiguration.vue @@ -216,7 +216,7 @@ export default defineComponent({ // Handling the case for 'Now'. Sending the now value will fail the API as by the time // the job is ran, the given 'now' time would have passed. Hence, passing empty 'run time' - !isCustomRunTime(this.runTime) ? job.runTime = DateTime.now().toMillis() + this.runTime : job.runTime = this.runTime + job.runTime = !isCustomRunTime(this.runTime) ? DateTime.now().toMillis() + this.runTime : this.runTime // if job runTime is not a valid date then making runTime as empty if (job?.runTime && !isFutureDate(job?.runTime)) { diff --git a/src/components/JobConfiguration.vue b/src/components/JobConfiguration.vue index 694bd714..bb410647 100644 --- a/src/components/JobConfiguration.vue +++ b/src/components/JobConfiguration.vue @@ -294,7 +294,7 @@ export default defineComponent({ // Handling the case for 'Now'. Sending the now value will fail the API as by the time // the job is ran, the given 'now' time would have passed. Hence, passing empty 'run time' - !isCustomRunTime(this.runTime) ? job.runTime = DateTime.now().toMillis() + this.runTime : job.runTime = this.runTime + job.runTime = !isCustomRunTime(this.runTime) ? DateTime.now().toMillis() + this.runTime : this.runTime if (job?.statusId === 'SERVICE_DRAFT') { this.store.dispatch('job/scheduleService', job).then((job: any) => { From 09ddad05f18a559ff93a9b0d4d712d41e8f5552f Mon Sep 17 00:00:00 2001 From: k2maan Date: Fri, 16 Jun 2023 10:54:09 +0530 Subject: [PATCH 3/3] Removed: unused import (#517) --- src/store/modules/job/actions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/modules/job/actions.ts b/src/store/modules/job/actions.ts index d5b71825..18b16000 100644 --- a/src/store/modules/job/actions.ts +++ b/src/store/modules/job/actions.ts @@ -737,7 +737,7 @@ const actions: ActionTree = { } return resp; }, - async updateCurrentJob({ commit, state, dispatch }, payload) { + async updateCurrentJob({ commit, state }, payload) { const cachedJobs = state.cached; const pendingJobs = state.pending.list;