Skip to content

Commit

Permalink
Implemeted: support for showing maarg jobs in the app (hotwax#734)
Browse files Browse the repository at this point in the history
  • Loading branch information
amansinghbais committed Nov 14, 2024
1 parent 2d85b8d commit 59779b5
Show file tree
Hide file tree
Showing 25 changed files with 1,211 additions and 19 deletions.
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
43 changes: 37 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,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 +82,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 +132,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 59779b5

Please sign in to comment.