Skip to content

Commit

Permalink
Implemented: maarg jobs in the inventory, misc, orders and preorder p…
Browse files Browse the repository at this point in the history
…age (hotwax#734)
  • Loading branch information
amansinghbais committed Nov 26, 2024
1 parent 0d4f6cb commit 579d644
Show file tree
Hide file tree
Showing 5 changed files with 204 additions and 22 deletions.
4 changes: 4 additions & 0 deletions src/views/Fulfillment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@
<ion-label class="ion-text-wrap">{{ translate("Send shopify acknowledge feed") }}</ion-label>
<ion-label slot="end">{{ isMaargJobFound('SND_FF_ACK_FEED') ? getMaargJobStatus("SND_FF_ACK_FEED") : translate("Not found") }}</ion-label>
</ion-item>
<ion-item button detail :disabled="!isMaargJobFound('POL_OMS_FLFLMNT_FEED')" @click="viewMaargJobConfiguration('POL_OMS_FLFLMNT_FEED')">
<ion-label class="ion-text-wrap">{{ translate("Poll OMS fulfillment feed") }}</ion-label>
<ion-label slot="end">{{ isMaargJobFound('POL_OMS_FLFLMNT_FEED') ? getMaargJobStatus("POL_OMS_FLFLMNT_FEED") : translate("Not found") }}</ion-label>
</ion-item>

<ion-item lines="none">
<ion-label class="ion-text-wrap">
Expand Down
55 changes: 50 additions & 5 deletions src/views/Inventory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,31 @@
</ion-toggle>
</ion-item>
</ion-card>

<ion-card>
<ion-card-header>
<ion-card-title>{{ translate("Feed") }}</ion-card-title>
</ion-card-header>
<ion-item button detail :disabled="!isMaargJobFound('GEN_TO_RCPT_FEED')" @click="viewMaargJobConfiguration('GEN_TO_RCPT_FEED')">
<ion-label class="ion-text-wrap">{{ translate("Transfer order feed") }}</ion-label>
<ion-label slot="end" >{{ isMaargJobFound('GEN_TO_RCPT_FEED') ? getMaargJobStatus("GEN_TO_RCPT_FEED") : translate("Not found") }}</ion-label>
</ion-item>
<ion-item button detail :disabled="!isMaargJobFound('GEN_INV_VAR_FEED')" @click="viewMaargJobConfiguration('GEN_INV_VAR_FEED')">
<ion-label class="ion-text-wrap">{{ translate("Inventory variance feed") }}</ion-label>
<ion-label slot="end">{{ isMaargJobFound('GEN_INV_VAR_FEED') ? getMaargJobStatus("GEN_INV_VAR_FEED") : translate("Not found") }}</ion-label>
</ion-item>
<ion-item button detail :disabled="!isMaargJobFound('GEN_INVCYC_COUNT_VAR_FEED')" @click="viewMaargJobConfiguration('GEN_INVCYC_COUNT_VAR_FEED')">
<ion-label class="ion-text-wrap">{{ translate("Inventory cycle count variance feed") }}</ion-label>
<ion-label slot="end">{{ isMaargJobFound('GEN_INVCYC_COUNT_VAR_FEED') ? getMaargJobStatus("GEN_INVCYC_COUNT_VAR_FEED") : translate("Not found") }}</ion-label>
</ion-item>
</ion-card>

<MoreJobs v-if="getMoreJobs(jobEnums, enumTypeId).length" :jobs="getMoreJobs(jobEnums, enumTypeId)" />
</section>

<aside class="desktop-only" v-if="isDesktop" v-show="currentJob">
<JobConfiguration :status="currentJobStatus" :type="freqType" :key="currentJob"/>
<aside class="desktop-only" v-if="isDesktop" v-show="currentJob || Object.keys(currentMaargJob).length">
<JobConfiguration v-if="currentJob" :status="currentJobStatus" :type="freqType" :key="currentJob"/>
<MaargJobConfiguration v-else-if="Object.keys(currentMaargJob).length" :key="currentMaargJob" />
</aside>
</main>
</ion-content>
Expand All @@ -64,12 +84,13 @@ import {
import { defineComponent } from 'vue';
import { mapGetters, useStore } from 'vuex';
import JobConfiguration from '@/components/JobConfiguration.vue'
import { isFutureDate, showToast } from '@/utils';
import { getCronString, isFutureDate, showToast } from '@/utils';
import emitter from '@/event-bus';
import { useRouter } from 'vue-router'
import { translate } from '@hotwax/dxp-components';
import MoreJobs from '@/components/MoreJobs.vue';
import { Actions, hasPermission } from '@/authorization'
import MaargJobConfiguration from '@/components/MaargJobConfiguration.vue';
export default defineComponent({
name: 'Inventory',
Expand All @@ -87,6 +108,7 @@ export default defineComponent({
IonToggle,
IonToolbar,
JobConfiguration,
MaargJobConfiguration,
MoreJobs
},
data() {
Expand All @@ -100,6 +122,7 @@ export default defineComponent({
isDesktop: isPlatform('desktop'),
enumTypeId: 'INVENTORY_SYS_JOB',
webhookEnums: JSON.parse(process.env?.VUE_APP_WEBHOOK_ENUMS as string) as any,
maargJobEnums: JSON.parse(process.env.VUE_APP_INVENTORY_MAARG_JOB_NAMES as string) as any,
}
},
computed: {
Expand All @@ -111,6 +134,8 @@ export default defineComponent({
getTemporalExpr: 'job/getTemporalExpr',
getMoreJobs: 'job/getMoreJobs',
getCachedWebhook: 'webhook/getCachedWebhook',
getMaargJob: 'maargJob/getMaargJob',
currentMaargJob: 'maargJob/getCurrentMaargJob'
}),
isInventoryLevelUpdated (): boolean {
const webhookTopic = this.webhookEnums['INVENTORY_LEVEL_UPDATE']
Expand Down Expand Up @@ -165,17 +190,36 @@ export default defineComponent({
this.getTemporalExpr(this.getJobStatus(this.jobEnums[enumId]))?.description :
translate('Disabled')
},
fetchJobs(){
async fetchJobs(){
this.store.dispatch("job/fetchJobs", {
"inputFields":{
"enumTypeId": "INVENTORY_SYS_JOB"
}
});
await this.store.dispatch("maargJob/fetchMaargJobs", Object.values(this.maargJobEnums));
},
fetchData() {
this.store.dispatch('webhook/fetchWebhooks')
this.fetchJobs()
}
},
isMaargJobFound(id: string) {
const job = this.getMaargJob(this.maargJobEnums[id])
return job && Object.keys(job)?.length
},
getMaargJobStatus(id: string) {
const job = this.getMaargJob(this.maargJobEnums[id])
return (job?.paused === "N" && job?.cronExpression) ? this.getCronString(job.cronExpression) ? this.getCronString(job.cronExpression) : job.cronExpression : 'Disabled'
},
async viewMaargJobConfiguration(id: any) {
const enumId = this.maargJobEnums[id];
const job = this.getMaargJob(enumId);
await this.store.dispatch("maargJob/updateCurrentMaargJob", { job })
this.currentJob = ""
if(!this.isJobDetailAnimationCompleted) {
emitter.emit('playAnimation');
this.isJobDetailAnimationCompleted = true;
}
},
},
mounted () {
this.fetchData();
Expand All @@ -191,6 +235,7 @@ export default defineComponent({
const router = useRouter();
return {
Actions,
getCronString,
hasPermission,
store,
router,
Expand Down
60 changes: 55 additions & 5 deletions src/views/Miscellaneous.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,28 @@
<ion-infinite-scroll-content loading-spinner="crescent" :loading-text="translate('Loading')"/>
</ion-infinite-scroll>
</div>

<div>
<ion-card>
<ion-card-header>
<ion-card-title>{{ translate("Shopify bulk query") }}</ion-card-title>
</ion-card-header>

<ion-item button detail :disabled="!isMaargJobFound('BLK_SYS_MESS_SHPFY')" @click="viewMaargJobConfiguration('BLK_SYS_MESS_SHPFY')">
<ion-label class="ion-text-wrap">{{ translate("Poll bulk system message") }}</ion-label>
<ion-label slot="end" >{{ isMaargJobFound('BLK_SYS_MESS_SHPFY') ? getMaargJobStatus("BLK_SYS_MESS_SHPFY") : translate("Not found") }}</ion-label>
</ion-item>
<ion-item button detail :disabled="!isMaargJobFound('BLK_RSLT_SHPFY')" @click="viewMaargJobConfiguration('BLK_RSLT_SHPFY')">
<ion-label class="ion-text-wrap">{{ translate("Poll bulk operation result") }}</ion-label>
<ion-label slot="end" >{{ isMaargJobFound('BLK_RSLT_SHPFY') ? getMaargJobStatus("BLK_RSLT_SHPFY") : translate("Not found") }}</ion-label>
</ion-item>
</ion-card>
</div>
</section>

<aside class="desktop-only" v-if="isDesktop" v-show="currentJob && Object.keys(currentJob).length">
<JobConfiguration :status="currentJobStatus" :key="currentJob"/>
<aside class="desktop-only" v-if="isDesktop" v-show="currentJob || Object.keys(currentMaargJob).length">
<JobConfiguration v-if="currentJob" :status="currentJobStatus" :type="freqType" :key="currentJob"/>
<MaargJobConfiguration v-else-if="Object.keys(currentMaargJob).length" :key="currentMaargJob" />
</aside>
</main>
</ion-content>
Expand All @@ -48,6 +66,9 @@
import { DateTime } from 'luxon';
import {
IonButton,
IonCard,
IonCardHeader,
IonCardTitle,
IonContent,
IonHeader,
IonInfiniteScroll,
Expand All @@ -69,13 +90,17 @@ import { useRouter } from 'vue-router'
import { mapGetters, useStore } from 'vuex'
import emitter from '@/event-bus';
import JobConfiguration from '@/components/JobConfiguration.vue';
import { isFutureDate } from '@/utils';
import { getCronString, isFutureDate } from '@/utils';
import { translate } from '@hotwax/dxp-components';
import MaargJobConfiguration from '@/components/MaargJobConfiguration.vue';
export default defineComponent({
name: 'Miscellaneous',
components: {
IonButton,
IonCard,
IonCardHeader,
IonCardTitle,
IonContent,
IonHeader,
IonInfiniteScroll,
Expand All @@ -90,7 +115,8 @@ export default defineComponent({
IonSpinner,
IonTitle,
IonToolbar,
JobConfiguration
JobConfiguration,
MaargJobConfiguration
},
mounted() {
emitter.on('jobUpdated', this.getMiscellaneousJobs);
Expand All @@ -108,13 +134,16 @@ export default defineComponent({
isJobDetailAnimationCompleted: false,
isDesktop: isPlatform('desktop'),
isRetrying: false,
maargJobEnums: JSON.parse(process.env.VUE_APP_MISC_MAARG_JOB_NAMES as string) as any
}
},
computed: {
...mapGetters({
miscellaneousJobs: 'job/getMiscellaneousJobs',
getCurrentEComStore:'user/getCurrentEComStore',
isMiscellaneousJobsScrollable: 'job/isMiscellaneousJobsScrollable'
isMiscellaneousJobsScrollable: 'job/isMiscellaneousJobsScrollable',
getMaargJob: 'maargJob/getMaargJob',
currentMaargJob: 'maargJob/getCurrentMaargJob'
}),
prepareMiscJobs() {
// preparing the jobs to display single instance of a job if the job is in pending and draft status
Expand Down Expand Up @@ -151,6 +180,7 @@ export default defineComponent({
},
async getMiscellaneousJobs(viewSize = 100, viewIndex = 0) {
await this.store.dispatch('job/fetchMiscellaneousJobs', {eComStoreId: this.getCurrentEComStore.productStoreId, viewSize, viewIndex});
await this.store.dispatch("maargJob/fetchMaargJobs", Object.values(this.maargJobEnums));
},
async loadMoreMiscellaneousJobs (event: any) {
this.getMiscellaneousJobs(
Expand All @@ -173,13 +203,33 @@ export default defineComponent({
},
getJobRuntime(job: any) {
return job.statusId !== 'SERVICE_DRAFT' && this.timeFromNow(job.runTime) ? this.timeFromNow(job.runTime) : translate('Disabled')
},
isMaargJobFound(id: string) {
const job = this.getMaargJob(this.maargJobEnums[id])
return job && Object.keys(job)?.length
},
getMaargJobStatus(id: string) {
const job = this.getMaargJob(this.maargJobEnums[id])
return (job?.paused === "N" && job?.cronExpression) ? this.getCronString(job.cronExpression) ? this.getCronString(job.cronExpression) : job.cronExpression : 'Disabled'
},
async viewMaargJobConfiguration(id: any) {
const enumId = this.maargJobEnums[id];
const job = this.getMaargJob(enumId);
await this.store.dispatch("maargJob/updateCurrentMaargJob", { job })
this.currentJob = ""
if(!this.isJobDetailAnimationCompleted) {
emitter.emit('playAnimation');
this.isJobDetailAnimationCompleted = true;
}
}
},
setup() {
const store = useStore();
const router = useRouter();
return {
getCronString,
router,
store,
translate
Expand Down
57 changes: 51 additions & 6 deletions src/views/Orders.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,31 @@
<ion-label slot="end">{{ getTemporalExpression('UPLD_REFUNDS') }}</ion-label>
</ion-item>
</ion-card>

<ion-card>
<ion-card-header>
<ion-card-title>{{ translate("Generate Feed") }}</ion-card-title>
</ion-card-header>
<ion-item button detail :disabled="!isMaargJobFound('GEN_BRKD_ORDITM_FEED')" @click="viewMaargJobConfiguration('GEN_BRKD_ORDITM_FEED')">
<ion-label class="ion-text-wrap">{{ translate("Brokered order items feed") }}</ion-label>
<ion-label slot="end" >{{ isMaargJobFound('GEN_BRKD_ORDITM_FEED') ? getMaargJobStatus("GEN_BRKD_ORDITM_FEED") : translate("Not found") }}</ion-label>
</ion-item>
<ion-item button detail :disabled="!isMaargJobFound('GEN_APPEASE_FIN_FEED')" @click="viewMaargJobConfiguration('GEN_APPEASE_FIN_FEED')">
<ion-label class="ion-text-wrap">{{ translate("Appeasements financial feed") }}</ion-label>
<ion-label slot="end">{{ isMaargJobFound('GEN_APPEASE_FIN_FEED') ? getMaargJobStatus("GEN_APPEASE_FIN_FEED") : translate("Not found") }}</ion-label>
</ion-item>
<ion-item button detail :disabled="!isMaargJobFound('GEN_RTRN_FIN_FEED')" @click="viewMaargJobConfiguration('GEN_RTRN_FIN_FEED')">
<ion-label class="ion-text-wrap">{{ translate("Returns financial feed") }}</ion-label>
<ion-label slot="end">{{ isMaargJobFound('GEN_RTRN_FIN_FEED') ? getMaargJobStatus("GEN_RTRN_FIN_FEED") : translate("Not found") }}</ion-label>
</ion-item>
</ion-card>

<MoreJobs v-if="getMoreJobs({...jobEnums, ...initialLoadJobEnums}, enumTypeId).length" :jobs="getMoreJobs({...jobEnums, ...initialLoadJobEnums}, enumTypeId)" />
</section>

<aside class="desktop-only" v-if="isDesktop" v-show="currentJob">
<JobConfiguration :status="currentJobStatus" :type="freqType" :key="currentJob"/>
<aside class="desktop-only" v-if="isDesktop" v-show="currentJob || Object.keys(currentMaargJob).length">
<JobConfiguration v-if="currentJob" :status="currentJobStatus" :type="freqType" :key="currentJob"/>
<MaargJobConfiguration v-else-if="Object.keys(currentMaargJob).length" :key="currentMaargJob" />
</aside>
</main>
</ion-content>
Expand Down Expand Up @@ -116,10 +136,11 @@ import { useStore } from "@/store";
import { useRouter } from 'vue-router'
import { mapGetters } from "vuex";
import JobConfiguration from '@/components/JobConfiguration.vue';
import { generateJobCustomParameters, isFutureDate, showToast, prepareRuntime, hasJobDataError } from '@/utils';
import { generateJobCustomParameters, getCronString, isFutureDate, showToast, prepareRuntime, hasJobDataError } from '@/utils';
import emitter from '@/event-bus';
import MoreJobs from '@/components/MoreJobs.vue';
import { Actions, hasPermission } from '@/authorization'
import MaargJobConfiguration from '@/components/MaargJobConfiguration.vue';
export default defineComponent({
name: 'Orders',
Expand All @@ -137,6 +158,7 @@ export default defineComponent({
IonToggle,
IonToolbar,
JobConfiguration,
MaargJobConfiguration,
MoreJobs
},
data() {
Expand All @@ -150,7 +172,8 @@ export default defineComponent({
isJobDetailAnimationCompleted: false,
isDesktop: isPlatform('desktop'),
enumTypeId: 'ORDER_SYS_JOB',
initialLoadJobEnums: JSON.parse(process.env?.VUE_APP_INITIAL_JOB_ENUMS as string) as any
initialLoadJobEnums: JSON.parse(process.env?.VUE_APP_INITIAL_JOB_ENUMS as string) as any,
maargJobEnums: JSON.parse(process.env.VUE_APP_ORDERS_MAARG_JOB_NAMES as string) as any,
}
},
computed: {
Expand All @@ -161,7 +184,9 @@ export default defineComponent({
currentEComStore: 'user/getCurrentEComStore',
getTemporalExpr: 'job/getTemporalExpr',
getCachedWebhook: 'webhook/getCachedWebhook',
getMoreJobs: 'job/getMoreJobs'
getMoreJobs: 'job/getMoreJobs',
getMaargJob: 'maargJob/getMaargJob',
currentMaargJob: 'maargJob/getCurrentMaargJob'
}),
promiseDateChanges(): boolean {
const status = this.getJobStatus(this.jobEnums['NTS_PRMS_DT_CHNG']);
Expand Down Expand Up @@ -274,7 +299,26 @@ export default defineComponent({
"enumTypeId": "ORDER_SYS_JOB"
}
});
}
await this.store.dispatch("maargJob/fetchMaargJobs", Object.values(this.maargJobEnums));
},
isMaargJobFound(id: string) {
const job = this.getMaargJob(this.maargJobEnums[id])
return job && Object.keys(job)?.length
},
getMaargJobStatus(id: string) {
const job = this.getMaargJob(this.maargJobEnums[id])
return (job?.paused === "N" && job?.cronExpression) ? this.getCronString(job.cronExpression) ? this.getCronString(job.cronExpression) : job.cronExpression : 'Disabled'
},
async viewMaargJobConfiguration(id: any) {
const enumId = this.maargJobEnums[id];
const job = this.getMaargJob(enumId);
await this.store.dispatch("maargJob/updateCurrentMaargJob", { job })
this.currentJob = ""
if(!this.isJobDetailAnimationCompleted) {
emitter.emit('playAnimation');
this.isJobDetailAnimationCompleted = true;
}
},
},
mounted () {
this.fetchJobs();
Expand All @@ -291,6 +335,7 @@ export default defineComponent({
return {
Actions,
getCronString,
hasPermission,
router,
store,
Expand Down
Loading

0 comments on commit 579d644

Please sign in to comment.