Skip to content

Commit

Permalink
Implemented: logic for fetching maarg job based on jobName (hotwax#734)
Browse files Browse the repository at this point in the history
  • Loading branch information
amansinghbais committed Oct 25, 2024
1 parent 50cbd0b commit c75bb23
Show file tree
Hide file tree
Showing 17 changed files with 1,061 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ VUE_APP_ALIAS=
VUE_APP_DEFAULT_LOG_LEVEL="error"
VUE_APP_LOGIN_URL="http://launchpad.hotwax.io/login"
VUE_APP_BROKER_JOB_ENUMS = {"REJ_ORDR":"JOB_BKR_REJ_ORD"}
VUE_APP_FULFILLMENT_MAARG_JOB_NAMES={"SND_FF_ACK_FEED":"sendShopifyFulfillmentAckFeed","GNRT_FF_ORD_ITM_FEED":"generate_FulfilledOrderItemsFeed"}
VUE_APP_CRON_EXPRESSIONS={"Every 5 minutes":"0 */5 * ? * *","Every 15 minutes":"0 */15 * ? * *","Every 30 minutes":"0 */30 * ? * *","Hourly":"0 0 * ? * *","Every six hours":"0 0 */6 ? * *","Every day at midnight":"0 0 0 * * ?"}
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"@ionic/vue-router": "^7.6.0",
"@types/file-saver": "^2.0.4",
"@types/papaparse": "^5.3.1",
"cronstrue": "^2.50.0",
"cron-parser": "^4.9.0",
"boon-js": "^2.0.3",
"core-js": "^3.6.5",
"file-saver": "^2.0.5",
Expand Down
42 changes: 36 additions & 6 deletions src/components/JobHistoryModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ion-icon slot="icon-only" :icon="closeOutline" />
</ion-button>
</ion-buttons>
<ion-title>{{ currentJob?.enumName }}</ion-title>
<ion-title>{{ currentJob?.enumName ? currentJob.enumName : currentJob?.jobName ? currentJob.jobName : currentJob?.description }}</ion-title>
</ion-toolbar>
</ion-header>

Expand All @@ -16,7 +16,18 @@
</div>

<div v-else>
<ion-list>
<ion-list v-if="isMaargJob">
<template v-for="(history, index) in jobHistory" :key="index">
<ion-item v-if="history.endTime">
<ion-label>
<h3>{{ getTime(history.startTime) }}</h3>
<p>{{ getDate(history.startTime) }}</p>
</ion-label>
<ion-badge color="dark" v-if="history.endTime">{{ timeTillRun(history.endTime) }}</ion-badge>
</ion-item>
</template>
</ion-list>
<ion-list v-else>
<ion-item v-for="(job, index) in jobHistory" :key="index">
<ion-label>
{{ job.runTime ? getTime(job.runTime) : "-" }}
Expand Down Expand Up @@ -49,8 +60,9 @@ import { closeOutline } from 'ionicons/icons';
import { mapGetters, useStore } from 'vuex';
import { DateTime } from 'luxon';
import { JobService } from '@/services/JobService'
import { hasError } from '@/utils';
import { hasError, timeTillRun } from '@/utils';
import { translate } from '@hotwax/dxp-components';
import logger from '@/logger';
export default defineComponent({
name: 'JobHistoryModal',
Expand All @@ -69,10 +81,10 @@ export default defineComponent({
},
data() {
return {
jobHistory: []
jobHistory: [] as any
}
},
props: ['currentJob'],
props: ['currentJob', 'isMaargJob'],
computed: {
...mapGetters({
getCurrentEComStore:'user/getCurrentEComStore',
Expand Down Expand Up @@ -119,17 +131,35 @@ export default defineComponent({
} catch(err) {
this.$log.error(err);
}
},
async fetchMaargJobHistory() {
try {
const resp = await JobService.fetchMaargJobHistory({
jobName: this.currentJob.jobName,
pageSize: 200,
orderByField: "startTime DESC"
});
if(!hasError(resp)) {
this.jobHistory = resp.data
} else {
throw resp;
}
} catch(error: any) {
logger.error(error);
}
}
},
mounted() {
this.fetchJobHistory()
this.isMaargJob ? this.fetchMaargJobHistory() : this.fetchJobHistory()
},
setup() {
const store = useStore();
return {
closeOutline,
store,
timeTillRun,
translate
};
},
Expand Down
Loading

0 comments on commit c75bb23

Please sign in to comment.