Skip to content

Commit

Permalink
Merge pull request #522 from k2maan/#517
Browse files Browse the repository at this point in the history
Fixed: 'now' option for run time not working (#517)
  • Loading branch information
adityasharma7 authored Jun 16, 2023
2 parents d225c0a + 09ddad0 commit 8e217ae
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/InitialJobConfiguration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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()
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)) {
Expand Down
4 changes: 1 addition & 3 deletions src/components/JobConfiguration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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()
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) => {
Expand Down
7 changes: 5 additions & 2 deletions src/store/modules/job/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ const actions: ActionTree<JobState, RootState> = {
}
return resp;
},
async updateCurrentJob({ commit, state, dispatch }, payload) {
async updateCurrentJob({ commit, state }, payload) {
const cachedJobs = state.cached;
const pendingJobs = state.pending.list;

Expand Down Expand Up @@ -837,7 +837,10 @@ const actions: ActionTree<JobState, RootState> = {
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,
Expand Down

0 comments on commit 8e217ae

Please sign in to comment.