Skip to content

Commit

Permalink
Implemented: logic to perform job scheduling actions (hotwax#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
amansinghbais committed Oct 4, 2024
1 parent 8a107c0 commit f1cef0a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ VUE_APP_BASE_URL=
VUE_APP_ORDER_IN_BRKRNG_FILTERS=["orderTypeId: SALES_ORDER", "facilityId: _NA_", "orderStatusId: ORDER_APPROVED", "!orderItemStatusId: ITEM_CANCELLED" ]
VUE_APP_PERMISSION_ID=
VUE_APP_ALIAS=
VUE_APP_CTGRY_AND_BRKRNG_JOB=["JOB_REL_PREODR_CAT", "JOB_BKR_ORD", "JOB_RLS_ORD_DTE"]
VUE_APP_CTGRY_AND_BRKRNG_JOB=["JOB_REL_PREODR_CAT", "JOB_RLS_ORD_DTE"]
VUE_APP_DEFAULT_ALIAS=
VUE_APP_DEFAULT_LOG_LEVEL="error"
VUE_APP_LOGIN_URL="http://launchpad.hotwax.io/login"
2 changes: 1 addition & 1 deletion src/views/catalog-product-details.vue
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@
</ion-item>
</div>
<div v-else>
<ion-item v-if="Object.keys(getCtgryAndBrkrngJob('JOB_REL_PREODR_CAT')).length" detail button @click="openJobActionsPopover($event, getCtgryAndBrkrngJob('JOB_REL_PREODR_CAT'), 'Pre-sell computation')">
<ion-item v-if="Object.keys(getCtgryAndBrkrngJob('JOB_REL_PREODR_CAT')).length" detail button @click.stop="openJobActionsPopover($event, getCtgryAndBrkrngJob('JOB_REL_PREODR_CAT'), 'Pre-sell computation')">
<ion-label class="ion-text-wrap">
<h3>{{ $t('Pre-sell computation') }}</h3>
<p>{{ getCtgryAndBrkrngJob('JOB_REL_PREODR_CAT').lastRunTime && timeTillJob(getCtgryAndBrkrngJob('JOB_REL_PREODR_CAT').lastRunTime) }}</p>
Expand Down
28 changes: 4 additions & 24 deletions src/views/job-actions-popover.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
<template>
<ion-content>
<!-- Show "Schedule in every 15 minutes" option for draft jobs only -->
<ion-list v-if="job.statusId === 'SERVICE_DRAFT'">
<ion-list v-if="(job.statusId === 'SERVICE_DRAFT') || (job.paused === 'Y' && job.nextExecutionDateTime)">
<ion-item lines="none" button @click="schdlInEvry15Mins()">
<ion-icon slot="start" :icon="timerOutline" />
{{ $t("Schedule in every 15 minutes") }}
</ion-item>
</ion-list>
<ion-list v-else-if="job.paused === 'Y' && job.nextExecutionDateTime">
<ion-item lines="none" button @click="schdlInEvry15Mins()">
<ion-icon slot="start" :icon="timerOutline" />
{{ $t("schedule") }}
</ion-item>
</ion-list>
<ion-list v-else>
<ion-item lines="none" button @click="runNow(job)">
<ion-icon slot="start" :icon="flashOutline" />
Expand Down Expand Up @@ -62,9 +56,6 @@ export default defineComponent({
IonItem,
IonList
},
mounted() {
console.log(this.job);
},
methods: {
closeJobActionsPopover() {
popoverController.dismiss({ dismissed: true });
Expand Down Expand Up @@ -109,15 +100,8 @@ export default defineComponent({
return await jobHistoryModal.present();
},
async cancelJob() {
let resp;
console.log(this.isMaargJob);
try {
if(this.isMaargJob) {
resp = await JobService.scheduleMaargJob({ routingGroupId: this.job.routingGroupId, paused: 'Y' })
} else {
resp = await JobService.cancelJob(this.job.jobId)
}
const resp = await (this.isMaargJob ? JobService.scheduleMaargJob({ routingGroupId: this.job.routingGroupId, paused: 'Y' }) : JobService.cancelJob(this.job.jobId))
if (!hasError(resp)) {
showToast(translate('Job cancelled successfully'))
Expand Down Expand Up @@ -150,13 +134,9 @@ export default defineComponent({
await alert.present();
},
async schdlInEvry15Mins() {
let resp;
try {
if(this.isMaargJob) {
resp = await JobService.scheduleMaargJob({ routingGroupId: this.job.routingGroupId, paused: 'N' })
} else {
resp = await JobService.scheduleJob({ job: this.job, frequency: 'EVERY_15_MIN', runTime: '' })
}
const resp = this.isMaargJob ? await JobService.scheduleMaargJob({ routingGroupId: this.job.routingGroupId, paused: 'N', cronExpression: '0 */15 * ? * *' }) : await JobService.scheduleJob({ job: this.job, frequency: 'EVERY_15_MIN', runTime: '' })
if (!hasError(resp)) {
showToast(translate('Service has been scheduled'));
await Promise.allSettled([this.store.dispatch('job/fetchBrokeringJob'), this.store.dispatch('job/fetchCtgryAndBrkrngJobs')])
Expand Down
2 changes: 0 additions & 2 deletions src/views/job-history-modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ export default defineComponent({
this.store.dispatch('util/getServiceStatusDesc')
await this.fetchJobHistory()
}
console.log(this.jobHistory);
},
setup() {
const store = useStore();
Expand Down

0 comments on commit f1cef0a

Please sign in to comment.