Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved: made the maarg jobs showing logic dynamic based on enumTypeId (#767) #772

Merged
merged 3 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ 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_PRD_MAARG_JOB_ENUMS={"QUEUE_CRTD_PRD_FEED":"QueueCreatedProductsFeed","QUEUE_UPDT_PRD_FEED":"QueueUpdatedProductsFeed"}
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=""
Expand Down
17 changes: 0 additions & 17 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"Completed orders": "Completed orders",
"Configuration missing": "Configuration missing",
"Confirm": "Confirm",
"Consume All Received System Messages": "Consume All Received System Messages",
"Copied job details to clipboard": "Copied job details to clipboard",
"Copied to clipboard": "Copied to clipboard",
"Copy details": "Copy details",
Expand Down Expand Up @@ -117,15 +116,6 @@
"Fulfillment": "Fulfillment",
"Fulfillment status": "Fulfillment status",
"Generating answer...": "Generating answer...",
"Generate appeasements financial feed": "Generate appeasements financial feed",
"Generate Brokered order items feed": "Generate Brokered order items feed",
"Generate inventory cycle count variance feed": "Generate inventory cycle count variance feed",
"Generate inventory variance feed": "Generate inventory variance feed",
"Generate order items feed": "Generate order items feed",
"Generate PO shipment receipt feed": "Generate PO shipment receipt feed",
"Generate returns financial feed": "Generate returns financial feed",
"Generate Shipments Receipt Feed": "Generate Shipments Receipt Feed",
"Generate TO order items feed": "Generate TO order items feed",
"Get Paid Transactions": "Get Paid Transactions",
"Go to OMS": "Go to OMS",
"Go to Launchpad": "Go to Launchpad",
Expand Down Expand Up @@ -217,8 +207,6 @@
"Pipeline": "Pipeline",
"Provide a valid cron expression": "Provide a valid cron expression",
"Please select a scheduling for job": "Please select a scheduling for job",
"Poll current bulk operation query result": "Poll current bulk operation query result",
"Poll OMS fulfilled items feed": "Poll OMS fulfilled items feed",
"Pre-order": "Pre-order",
"Pre-Order": "Pre-Order",
"Pre-order parking": "Pre-order parking",
Expand All @@ -233,8 +221,6 @@
"Promise date changes": "Promise date changes",
"Provide a future date and time": "Provide a future date and time",
"Queued": "Queued",
"Queue created product feed": "Queue created product feed",
"Queue updated product feed": "Queue updated product feed",
"Ready to create an app?": "Ready to create an app?",
"Realtime adjustments": "Realtime adjustments",
"Realtime POS sales": "Realtime POS sales",
Expand Down Expand Up @@ -287,12 +273,9 @@
"Selected TimeZone": "Selected TimeZone",
"Select a different time zone": "Select a different time zone",
"Select time zone": "Select time zone",
"Send All Produced System Messages": "Send All Produced System Messages",
"Send Broker Order Mail": "Send Broker Order Mail",
"Send Completed Order Mail": "Send Completed Order Mail",
"Send next bulk query system message in queue": "Send next bulk query system message in queue",
"Send Packed Order Mail": "Send Packed Order Mail",
"Send shopify fulfillment ack feed": "Send shopify fulfillment ack feed",
"Sends notifications for open, ready-for-pickup BOPIS orders and brokered, packed, and completed Sales orders.": "Sends notifications for open, ready-for-pickup BOPIS orders and brokered, packed, and completed Sales orders.",
"Service has been scheduled": "Service has been scheduled",
"Service updated successfully": "Service updated successfully",
Expand Down
4 changes: 2 additions & 2 deletions src/store/modules/maargJob/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import logger from "@/logger";
import { MaargJobService } from '@/services/MaargJobService'

const actions: ActionTree<JobState, RootState> = {
async fetchMaargJobs({ commit, dispatch }, jobTypeEnumIds){
async fetchMaargJobs({ commit, dispatch }, enumTypeId){
const productStoreId = store.getters["user/getCurrentEComStore"]?.productStoreId

let resp = {} as any;
const maargJobs = {} as any;

try {
resp = await MaargJobService.fetchMaargJobs({ jobTypeEnumId: jobTypeEnumIds, jobTypeEnumId_op: "in" })
resp = await MaargJobService.fetchMaargJobs({ enumTypeId })
if(!hasError(resp) && resp.data?.length) {
const jobs = resp.data;
const jobEnumIdsToFetch = jobs.map((job: any) => job.jobTypeEnumId);
Expand Down
3 changes: 3 additions & 0 deletions src/store/modules/maargJob/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ const getters: GetterTree <MaargJobState, RootState> = {
getMaargJob: (state) => (jobTypeEnumId: string): any => {
return state.maargJobs[jobTypeEnumId] ? state.maargJobs[jobTypeEnumId] : {}
},
getMaargJobsList: (state) => {
return state.maargJobs ? Object.values(state.maargJobs) : []
},
getCurrentMaargJob: (state) => {
return state.currentMaargJob
},
Expand Down
34 changes: 8 additions & 26 deletions src/views/Fulfillment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,25 +107,13 @@
</ion-item>
</ion-card>

<ion-card>
<ion-card v-if="maargJobs?.length">
<ion-card-header>
<ion-card-title>{{ translate("Feed") }}</ion-card-title>
</ion-card-header>
<ion-item button detail :disabled="!isMaargJobFound('GNRT_FF_ORD_ITM_FEED')" @click="viewMaargJobConfiguration('GNRT_FF_ORD_ITM_FEED')">
<ion-label class="ion-text-wrap">{{ translate("Generate order items feed") }}</ion-label>
<ion-label slot="end" >{{ isMaargJobFound('GNRT_FF_ORD_ITM_FEED') ? getMaargJobStatus("GNRT_FF_ORD_ITM_FEED") : translate("Not found") }}</ion-label>
</ion-item>
<ion-item button detail :disabled="!isMaargJobFound('SND_FF_ACK_FEED')" @click="viewMaargJobConfiguration('SND_FF_ACK_FEED')">
<ion-label class="ion-text-wrap">{{ translate("Send shopify fulfillment ack 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 fulfilled items 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 button detail :disabled="!isMaargJobFound('GNRT_TO_FLFLD_ITM_FEED')" @click="viewMaargJobConfiguration('GNRT_TO_FLFLD_ITM_FEED')">
<ion-label class="ion-text-wrap">{{ translate("Generate TO order items feed") }}</ion-label>
<ion-label slot="end">{{ isMaargJobFound('GNRT_TO_FLFLD_ITM_FEED') ? getMaargJobStatus("GNRT_TO_FLFLD_ITM_FEED") : translate("Not found") }}</ion-label>
<ion-item v-for="(job, index) in maargJobs" :key="index" button detail @click="viewMaargJobConfiguration(job.jobTypeEnumId)">
<ion-label class="ion-text-wrap">{{ job.enumDescription ? job.enumDescription : job.jobName }}</ion-label>
<ion-label slot="end" >{{ getMaargJobStatus(job.jobTypeEnumId) }}</ion-label>
</ion-item>
</ion-card>

Expand Down Expand Up @@ -208,7 +196,6 @@ export default defineComponent({
autoCancelDays: '',
enumTypeId: 'FULFILLMENT_SYS_JOB',
initialLoadJobEnums: JSON.parse(process.env?.VUE_APP_INITIAL_JOB_ENUMS as string) as any,
maargJobEnums: JSON.parse(process.env.VUE_APP_FULFILLMENT_MAARG_JOB_ENUMS as string) as any,
isLoading: false
}
},
Expand All @@ -220,6 +207,7 @@ export default defineComponent({
getTemporalExpr: 'job/getTemporalExpr',
getMoreJobs: 'job/getMoreJobs',
getMaargJob: 'maargJob/getMaargJob',
maargJobs: 'maargJob/getMaargJobsList',
currentMaargJob: 'maargJob/getCurrentMaargJob'
}),
autoCancelCheckDaily(): boolean {
Expand Down Expand Up @@ -298,7 +286,7 @@ export default defineComponent({
"enumTypeId": "FULFILLMENT_SYS_JOB"
}
});
await this.store.dispatch("maargJob/fetchMaargJobs", Object.values(this.maargJobEnums));
await this.store.dispatch("maargJob/fetchMaargJobs", "FULFILLMENT_SYS_JOB");
if (this.currentEComStore.productStoreId) {
this.getAutoCancelDays();
}
Expand Down Expand Up @@ -359,18 +347,12 @@ export default defineComponent({
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])
const job = this.getMaargJob(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];
async viewMaargJobConfiguration(enumId: any) {
const job = this.getMaargJob(enumId);

await this.store.dispatch("maargJob/updateCurrentMaargJob", { job })
Expand Down
29 changes: 8 additions & 21 deletions src/views/Inventory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,13 @@
</ion-item>
</ion-card>

<ion-card>
<ion-card v-if="maargJobs?.length">
<ion-card-header>
<ion-card-title>{{ translate("Feed") }}</ion-card-title>
</ion-card-header>
<ion-item button detail :disabled="!isMaargJobFound('GNRT_SHIP_RCPT_FEED')" @click="viewMaargJobConfiguration('GNRT_SHIP_RCPT_FEED')">
<ion-label class="ion-text-wrap">{{ translate("Generate Shipments Receipt Feed") }}</ion-label>
<ion-label slot="end" >{{ isMaargJobFound('GNRT_SHIP_RCPT_FEED') ? getMaargJobStatus("GNRT_SHIP_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("Generate 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("Generate 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 v-for="(job, index) in maargJobs" :key="index" button detail @click="viewMaargJobConfiguration(job.jobTypeEnumId)">
<ion-label class="ion-text-wrap">{{ job.enumDescription ? job.enumDescription : job.jobName }}</ion-label>
<ion-label slot="end" >{{ getMaargJobStatus(job.jobTypeEnumId) }}</ion-label>
</ion-item>
</ion-card>

Expand Down Expand Up @@ -130,7 +122,6 @@ 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_ENUMS as string) as any,
isLoading: false
}
},
Expand All @@ -144,6 +135,7 @@ export default defineComponent({
getMoreJobs: 'job/getMoreJobs',
getCachedWebhook: 'webhook/getCachedWebhook',
getMaargJob: 'maargJob/getMaargJob',
maargJobs: 'maargJob/getMaargJobsList',
currentMaargJob: 'maargJob/getCurrentMaargJob'
}),
isInventoryLevelUpdated (): boolean {
Expand Down Expand Up @@ -206,7 +198,7 @@ export default defineComponent({
"enumTypeId": "INVENTORY_SYS_JOB"
}
});
await this.store.dispatch("maargJob/fetchMaargJobs", Object.values(this.maargJobEnums));
await this.store.dispatch("maargJob/fetchMaargJobs", "INVENTORY_SYS_JOB");
this.isLoading = false
},
async fetchData(isCurrentJobUpdateRequired = false) {
Expand All @@ -220,16 +212,11 @@ export default defineComponent({
this.store.dispatch('webhook/fetchWebhooks')
await 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])
const job = this.getMaargJob(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];
async viewMaargJobConfiguration(enumId: any) {
const job = this.getMaargJob(enumId);
await this.store.dispatch("maargJob/updateCurrentMaargJob", { job })
this.currentJob = ""
Expand Down
37 changes: 9 additions & 28 deletions src/views/Miscellaneous.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,13 @@
<ion-list>
<ion-list-header>{{ translate("Miscellaneous jobs") }}</ion-list-header>

<ion-card>
<ion-card v-if="maargJobs?.length">
<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>{{ translate("Send next bulk query system message in queue") }}</ion-label>
<ion-note slot="end" >{{ isMaargJobFound('BLK_SYS_MESS_SHPFY') ? getMaargJobStatus("BLK_SYS_MESS_SHPFY") : translate("Not found") }}</ion-note>
</ion-item>
<ion-item button detail :disabled="!isMaargJobFound('BLK_RSLT_SHPFY')" @click="viewMaargJobConfiguration('BLK_RSLT_SHPFY')">
<ion-label>{{ translate("Poll current bulk operation query result") }}</ion-label>
<ion-note slot="end" >{{ isMaargJobFound('BLK_RSLT_SHPFY') ? getMaargJobStatus("BLK_RSLT_SHPFY") : translate("Not found") }}</ion-note>
</ion-item>
<ion-item button detail :disabled="!isMaargJobFound('ALL_RCVD_SYS_MSG')" @click="viewMaargJobConfiguration('ALL_RCVD_SYS_MSG')">
<ion-label>{{ translate("Consume All Received System Messages") }}</ion-label>
<ion-note slot="end" >{{ isMaargJobFound('ALL_RCVD_SYS_MSG') ? getMaargJobStatus("ALL_RCVD_SYS_MSG") : translate("Not found") }}</ion-note>
</ion-item>
<ion-item button detail :disabled="!isMaargJobFound('ALL_PRDCD_SYS_MSG')" @click="viewMaargJobConfiguration('ALL_PRDCD_SYS_MSG')">
<ion-label>{{ translate("Send All Produced System Messages") }}</ion-label>
<ion-note slot="end" >{{ isMaargJobFound('ALL_PRDCD_SYS_MSG') ? getMaargJobStatus("ALL_PRDCD_SYS_MSG") : translate("Not found") }}</ion-note>
<ion-item v-for="(job, index) in maargJobs" :key="index" button detail @click="viewMaargJobConfiguration(job.jobTypeEnumId)">
<ion-label class="ion-text-wrap">{{ job.enumDescription ? job.enumDescription : job.jobName }}</ion-label>
<ion-label slot="end" >{{ getMaargJobStatus(job.jobTypeEnumId) }}</ion-label>
</ion-item>
</ion-card>

Expand Down Expand Up @@ -138,8 +125,7 @@ export default defineComponent({
currentJobStatus: '',
isJobDetailAnimationCompleted: false,
isDesktop: isPlatform('desktop'),
isRetrying: false,
maargJobEnums: JSON.parse(process.env.VUE_APP_MISC_MAARG_JOB_ENUMS as string) as any
isRetrying: false
}
},
computed: {
Expand All @@ -148,6 +134,7 @@ export default defineComponent({
getCurrentEComStore:'user/getCurrentEComStore',
isMiscellaneousJobsScrollable: 'job/isMiscellaneousJobsScrollable',
getMaargJob: 'maargJob/getMaargJob',
maargJobs: 'maargJob/getMaargJobsList',
currentMaargJob: 'maargJob/getCurrentMaargJob'
}),
prepareMiscJobs() {
Expand Down Expand Up @@ -185,7 +172,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));
await this.store.dispatch("maargJob/fetchMaargJobs", "MISC_SYS_JOB");
},
async updateProductStoreConfig(isCurrentJobUpdateRequired = false) {
if(isCurrentJobUpdateRequired) {
Expand Down Expand Up @@ -218,17 +205,11 @@ 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])
const job = this.getMaargJob(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];
async viewMaargJobConfiguration(enumId: any) {
const job = this.getMaargJob(enumId);
await this.store.dispatch("maargJob/updateCurrentMaargJob", { job })
this.currentJob = ""
Expand Down
Loading
Loading