Skip to content

Commit

Permalink
Merge pull request #744 from amansinghbais/#734-maarg-jobs
Browse files Browse the repository at this point in the history
Implemeted: support for showing maarg jobs in the app (#734)
  • Loading branch information
ymaheshwari1 authored Dec 6, 2024
2 parents 5b8cd39 + 1b6511e commit 70827e4
Show file tree
Hide file tree
Showing 30 changed files with 1,527 additions and 38 deletions.
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ 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_ENUMS={"SND_FF_ACK_FEED":"SND_SHPFY_FUL_ACK_FD","GNRT_FF_ORD_ITM_FEED":"GEN_FLFLD_ORD_ITM_FD","POL_OMS_FLFLMNT_FEED":"POL_OMS_FLFLMNT_FD","GNRT_TO_FLFLD_ITM_FEED":"GEN_TO_FLFD_ITM_FD"}
VUE_APP_INVENTORY_MAARG_JOB_ENUMS={"GNRT_SHIP_RCPT_FEED":"GEN_SHPMNT_RCPT_FD","GEN_INV_VAR_FEED":"GEN_INV_VAR_FD","GEN_INVCYC_COUNT_VAR_FEED":"GEN_INV_CYCLE_VAR_FD"}
VUE_APP_ORDERS_MAARG_JOB_ENUMS={"GEN_BRKD_ORDITM_FEED":"GEN_BRKR_ORD_ITM_FD","GEN_APPEASE_FIN_FEED":"GEN_APSMNT_FNCL_FD", "GEN_RTRN_FIN_FEED": "GEN_RTNS_FNCL_FD"}
VUE_APP_MISC_MAARG_JOB_ENUMS={"BLK_SYS_MESS_SHPFY": "SND_BLK_SYS_M_SHPFY","BLK_RSLT_SHPFY":"POL_BLK_RSLT_SHPFY","ALL_RCVD_SYS_MSG":"CNSM_RCVD_SYS_MSG","ALL_PRDCD_SYS_MSG":"SND_PRDCD_SYS_MSG"}
VUE_APP_PREORD_MAARG_JOB_ENUMS={"PO_RCPT_FEED": "GEN_PO_RCPT_FD"}
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 * * ?"}
VUE_APP_GITBOOK_API_KEY=""
VUE_APP_SPACE_ID=""
VUE_APP_GITBOOK_BASE_URL="https://api.gitbook.com/v1"
Expand Down
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
44 changes: 38 additions & 6 deletions src/components/JobHistoryModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<ion-icon slot="icon-only" :icon="closeOutline" />
</ion-button>
</ion-buttons>
<ion-title>{{ currentJob?.enumName }}</ion-title>
<ion-title v-if="isMaargJob">{{ currentJob?.enumDescription ? currentJob.enumDescription : currentJob.jobName }}</ion-title>
<ion-title v-else>{{ currentJob?.enumName ? currentJob.enumName : currentJob?.description }}</ion-title>
</ion-toolbar>
</ion-header>

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

<div v-else>
<ion-list>
<ion-list v-if="isMaargJob">
<template v-for="(history, index) in jobHistory" :key="index">
<ion-item>
<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 +61,10 @@ 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';
import { MaargJobService } from '@/services/MaargJobService';
export default defineComponent({
name: 'JobHistoryModal',
Expand All @@ -69,10 +83,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 +133,35 @@ export default defineComponent({
} catch(err) {
this.$log.error(err);
}
},
async fetchMaargJobHistory() {
try {
const resp = await MaargJobService.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 70827e4

Please sign in to comment.