Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: 'now' option for run time not working (#517) #522

Merged
merged 3 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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