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

Implemented: added process pending upload job to initial load (#739) #750

Merged
merged 3 commits into from
Dec 6, 2024
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
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ VUE_APP_I18N_FALLBACK_LOCALE=en-US
VUE_APP_CACHE_MAX_AGE=3600
VUE_APP_VIEW_SIZE=10
VUE_APP_FULFILLMENT_JOB_ENUMS={"AUTO_CNCL_DAL":"JOB_CNCL_ORD_DTE","ODR_FLMNT_HST":"JOB_ORD_FLMNT_HST","SHIP_PKD_ODRS":"JOB_SHIP_ORD_PKD", "OPN_BOPIS_ORD_NT":"JOB_OPN_BOPIS_ORD_NT", "READYPICK_BOPIS_ORD_NT": "JOB_RP_BOPIS_ORD_NT", "OPEN_SHIPPING_ORD_NT" : "JOB_OPEN_SHIP_ORD_NT"}
VUE_APP_JOB_FREQUENCY_TYPE={"PRE_ORDER_CTLG":"default","ADD_PRODR_TG_SHPFY":"default","REMV_PRODR_TG_SHPFY":"default","ADD_PRODR_SHPG_DTE_SHPFY":"default","ADD_BACKODR_TG_SHPFY":"default","IMP_NEW_ORDERS":"default","IMP_CANCELLED_ORDERS":"default","REMV_BACKODR_TG_SHPFY":"default","IMP_CANCELLED_ITEMS":"default","AUTO_RELSE_DAILY":"default","IMP_RETURNS":"default","UPLD_CMPLT_ORDRS":"default","UPLD_CNCLD_ORDRS":"default","UPLD_REFUNDS":"default","NTS_PRMS_DT_CHNG":"default","REJ_ORDR":"default","UNFIL_ORDERS":"default","AUTO_CNCL_DAL":"default","BTCH_BRKR_ORD":"default","LIST_PRE_ORDER":"slow","LIST_BACK_ORDER":"slow","IMP_PRDTS":"default","SYNC_PRDTS":"slow","HARD_SYNC":"slow","IMP_PRDTS_BLK":"default","IMP_ORDERS_BLK":"default"}
VUE_APP_JOB_FREQUENCY_TYPE={"PRE_ORDER_CTLG":"default","ADD_PRODR_TG_SHPFY":"default","REMV_PRODR_TG_SHPFY":"default","ADD_PRODR_SHPG_DTE_SHPFY":"default","ADD_BACKODR_TG_SHPFY":"default","IMP_NEW_ORDERS":"default","IMP_CANCELLED_ORDERS":"default","REMV_BACKODR_TG_SHPFY":"default","IMP_CANCELLED_ITEMS":"default","AUTO_RELSE_DAILY":"default","IMP_RETURNS":"default","UPLD_CMPLT_ORDRS":"default","UPLD_CNCLD_ORDRS":"default","UPLD_REFUNDS":"default","NTS_PRMS_DT_CHNG":"default","REJ_ORDR":"default","UNFIL_ORDERS":"default","AUTO_CNCL_DAL":"default","BTCH_BRKR_ORD":"default","LIST_PRE_ORDER":"slow","LIST_BACK_ORDER":"slow","IMP_PRDTS":"default","SYNC_PRDTS":"slow","HARD_SYNC":"slow","IMP_PRDTS_BLK":"default","IMP_ORDERS_BLK":"default","JOB_IMP_QUEUE":"default"}
VUE_APP_ODR_JOB_ENUMS={"IMP_NEW_ORDERS":"JOB_IMP_ORD","APR_ORD":"JOB_APR_ORD","UPDT_ORDS":"JOB_IMP_ORD_UPD","IMP_CANCELLED_ORDERS":"JOB_IMP_ORD_CNCL","IMP_CANCELLED_ITEMS":"JOB_IMP_ITM_CNCL","IMP_RETURNS":"JOB_IMP_RTN","UPLD_CMPLT_ORDRS":"JOB_UL_CMPLT_ORD","UPLD_CNCLD_ORDRS":"JOB_UL_CNCLD_ORD","UPLD_REFUNDS":"JOB_UL_REFUNDS","UNFIL_ORDERS":"JOB_BKR_ORD_UNF","AUTO_CNCL_DAL":"JOB_CNCL_ORD_DTE","BTCH_BRKR_ORD":"JOB_BKR_ORD"}
VUE_APP_PRODR_JOB_ENUMS={"ADD_PRODR_TG_SHPFY":"JOB_ADD_PREORD_VRT","REMV_PRODR_TG_SHPFY":"JOB_RMV_PREORD_VRT", "ADD_BACKODR_TG_SHPFY":"JOB_ADD_BACKORD_VRT","REMV_BACKODR_TG_SHPFY":"JOB_RMV_BACKORD_VRT","AUTO_RELSE_DAILY":"JOB_RLS_ORD_DTE", "REL_PREODR_CAT": "JOB_REL_PREODR_CAT", "PREORDER_CAT_SYC": "JOB_PREORDER_CAT_SYC", "ADD_TAG_BACKORD": "JOB_ADD_TAG_BACKORD", "ADD_TAG_PREORD": "JOB_ADD_TAG_PREORD", "UL_PRMS_DTE": "JOB_UL_PRMS_DTE", "UL_PRMS_DTE_UPD": "JOB_UL_PRMS_DTE_UPD", "SD_PRMSDDTE_CNG_NOTI": "SD_PRMSDDTE_CNG_NOTI", "UL_PRMS_DTE_UPD": "JOB_UL_PRMS_DTE_UPD" }
VUE_APP_PRD_JOB_ENUMS={"IMP_PRDTS":"JOB_IMP_PROD_NEW","SYNC_PRDTS":"JOB_IMP_PROD_UPD"}
VUE_APP_INV_JOB_ENUMS={"HARD_SYNC":"JOB_UL_INV"}
VUE_APP_INITIAL_JOB_ENUMS={"IMP_PRDTS_BLK":"JOB_IMP_PROD_NEW_BLK","IMP_ORDERS_BLK":"JOB_IMP_ORD_BLK","UL_PRCS":"JOB_UL_PRCS"}
VUE_APP_INITIAL_JOB_ENUMS={"IMP_PRDTS_BLK":"JOB_IMP_PROD_NEW_BLK","IMP_ORDERS_BLK":"JOB_IMP_ORD_BLK","UL_PRCS":"JOB_UL_PRCS","JOB_IMP_QUEUE":"JOB_PRC_PND_DML"}
VUE_APP_INITIAL_JOB_TYPES={"JOB_IMP_PROD_NEW_BLK":"products","JOB_IMP_ORD_BLK":"orders"}
VUE_APP_BASE_URL=
VUE_APP_BATCH_JOB_ENUMS={"JOB_BKR_ORD_UNF":{"id":"JOB_BKR_ORD_UNF","facilityId":"_NA_","unfillable": true},"JOB_BKR_ORD":{"id": "JOB_BKR_ORD","facilityId":"_NA_","unfillable": false},"JOB_BKR_PREORD_UNF":{"id":"JOB_BKR_PREORD_UNF","facilityId":"PRE_ORDER_PARKING","unfillable":true},"JOB_BKR_PREORD":{"id":"JOB_BKR_PREORD","facilityId":"PRE_ORDER_PARKING","unfillable":false},"JOB_BKR_BACKORD_UNF":{"id":"JOB_BKR_BACKORD_UNF","facilityId":"BACKORDER_PARKING","unfillable":true},"JOB_BKR_BACKORD":{"id":"JOB_BKR_BACKORD","facilityId":"BACKORDER_PARKING","unfillable":false}}
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
"Import orders in bulk": "Import orders in bulk",
"Import products": "Import products",
"Import products in bulk": "Import products in bulk",
"Import queue": "Import queue",
"In 15 minutes": "In 15 minutes",
"In 5 minutes": "In 5 minutes",
"In an hour": "In an hour",
Expand Down
68 changes: 61 additions & 7 deletions src/views/InitialLoad.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<ion-card-header>
<ion-card-title>{{ translate("Products") }}</ion-card-title>
</ion-card-header>
<ion-button expand="block" fill="outline" @click="viewJobConfiguration('products', jobEnums['IMP_PRDTS_BLK'])">{{ translate("Import products in bulk") }}</ion-button>
<ion-button expand="block" fill="outline" @click="viewInitialJobConfiguration('products', jobEnums['IMP_PRDTS_BLK'])">{{ translate("Import products in bulk") }}</ion-button>
<ion-item lines="none">
<ion-label class="ion-text-wrap">
<p>{{ translate("Import all products from Shopify. Make sure you run this before importing orders in bulk during intial setup.") }}</p>
Expand All @@ -26,7 +26,7 @@
<ion-card-header>
<ion-card-title>{{ translate("Orders") }}</ion-card-title>
</ion-card-header>
<ion-button expand="block" fill="outline" @click="viewJobConfiguration('orders', jobEnums['IMP_ORDERS_BLK'])">{{ translate("Import orders in bulk") }}</ion-button>
<ion-button expand="block" fill="outline" @click="viewInitialJobConfiguration('orders', jobEnums['IMP_ORDERS_BLK'])">{{ translate("Import orders in bulk") }}</ion-button>
<ion-item lines="none">
<ion-label class="ion-text-wrap">
<p>{{ translate("Before importing historical orders in bulk, make sure all products are set up or else order import will not run correctly.") }}</p>
Expand All @@ -40,6 +40,11 @@
<ion-card-header>
<ion-card-title>{{ translate("Process Uploads") }}</ion-card-title>
</ion-card-header>
<ion-item button @click="viewJobConfiguration({ id: 'JOB_IMP_QUEUE', status: getJobStatus(jobEnums['JOB_IMP_QUEUE']) })" detail>
<ion-label class="ion-text-wrap">{{ translate("Import queue") }}</ion-label>
<ion-label v-if="!isLoading" slot="end">{{ getTemporalExpression('JOB_IMP_QUEUE') }}</ion-label>
<ion-skeleton-text v-else style="width: 30%;" animated />
</ion-item>
<ion-item>
<ion-toggle :disabled="!hasPermission(Actions.APP_JOB_UPDATE)" :checked="fileStatusUpdateWebhook" color="secondary" @ionChange="updateWebhook($event['detail'].checked, 'BULK_OPERATIONS_FINISH')">
<ion-label>{{ translate("File upload status") }}</ion-label>
Expand All @@ -53,8 +58,9 @@
</ion-card>
</section>

<aside class="desktop-only" v-if="isDesktop" v-show="currentSelectedJobModal">
<InitialJobConfiguration :type='currentSelectedJobModal' :shopifyOrderId='lastShopifyOrderId' :key="job" />
<aside class="desktop-only" v-if="isDesktop" v-show="currentSelectedJobModal || Object.keys(currentJob)?.length">
<InitialJobConfiguration v-if="currentSelectedJobModal" :type='currentSelectedJobModal' :shopifyOrderId='lastShopifyOrderId' :key="job" />
<JobConfiguration v-else :status="currentJobStatus" :type="freqType" :key="currentJob"/>
</aside>
</main>
</ion-content>
Expand All @@ -74,6 +80,7 @@ import {
IonLabel,
IonMenuButton,
IonPage,
IonSkeletonText,
IonTitle,
IonToggle,
IonToolbar,
Expand All @@ -84,13 +91,15 @@ import { mapGetters, useStore } from 'vuex';
import { hasJobDataError, generateJobCustomParameters, isFutureDate, showToast } from '@/utils';
import emitter from '@/event-bus';
import InitialJobConfiguration from '@/components/InitialJobConfiguration.vue';
import JobConfiguration from '@/components/JobConfiguration.vue';
import { useRouter } from 'vue-router';
import { translate } from '@hotwax/dxp-components';
import { Actions, hasPermission } from '@/authorization'

export default defineComponent({
name: 'InitialLoad',
components: {
JobConfiguration,
InitialJobConfiguration,
IonButton,
IonCard,
Expand All @@ -103,6 +112,7 @@ export default defineComponent({
IonLabel,
IonMenuButton,
IonPage,
IonSkeletonText,
IonTitle,
IonToggle,
IonToolbar
Expand All @@ -111,11 +121,16 @@ export default defineComponent({
return {
jobEnums: JSON.parse(process.env?.VUE_APP_INITIAL_JOB_ENUMS as string) as any,
webhookEnums: JSON.parse(process.env?.VUE_APP_WEBHOOK_ENUMS as string) as any,
jobFrequencyType: JSON.parse(process.env?.VUE_APP_JOB_FREQUENCY_TYPE as string) as any,
ymaheshwari1 marked this conversation as resolved.
Show resolved Hide resolved
currentSelectedJobModal: '',
job: {} as any,
lastShopifyOrderId: '',
isJobDetailAnimationCompleted: false,
isDesktop: isPlatform('desktop')
isDesktop: isPlatform('desktop'),
isLoading: false,
currentJob: '' as any,
currentJobStatus: '',
freqType: '',
}
},
mounted() {
Expand All @@ -131,7 +146,8 @@ export default defineComponent({
getJob: 'job/getJob',
currentShopifyConfig: 'user/getCurrentShopifyConfig',
currentEComStore: 'user/getCurrentEComStore',
getCachedWebhook: 'webhook/getCachedWebhook'
getCachedWebhook: 'webhook/getCachedWebhook',
getTemporalExpr: 'job/getTemporalExpr',
}),
fileStatusUpdateWebhook(): boolean {
const webhookTopic = this.webhookEnums['BULK_OPERATIONS_FINISH']
Expand Down Expand Up @@ -177,7 +193,7 @@ export default defineComponent({
this.store.dispatch('job/updateJob', job)
}
},
async viewJobConfiguration(label: string, id: string) {
async viewInitialJobConfiguration(label: string, id: string) {
this.currentSelectedJobModal = label;
this.job = this.getJob(id);

Expand All @@ -192,6 +208,7 @@ export default defineComponent({
const job = await this.store.dispatch('job/updateCurrentJob', { job: this.job, jobId: id });
if(job) {
this.job = job
this.currentJob = {}
} else {
showToast(translate('Configuration missing'))
return;
Expand All @@ -207,7 +224,38 @@ export default defineComponent({
this.isJobDetailAnimationCompleted = true;
}
},
async viewJobConfiguration(jobInformation: any) {
this.currentJob = jobInformation.job || this.getJob(this.jobEnums[jobInformation.id])
this.currentJobStatus = jobInformation.status
this.freqType = jobInformation.id && this.jobFrequencyType[jobInformation.id]

// if job runTime is not a valid date then making runTime as empty
if (this.currentJob?.runTime && !isFutureDate(this.currentJob?.runTime)) {
this.currentJob.runTime = ''
}

const job = await this.store.dispatch('job/updateCurrentJob', { job: this.currentJob, jobId: this.jobEnums[jobInformation.id] });
if(job) {
this.currentJob = job
this.job = {}
this.currentSelectedJobModal = ""
this.lastShopifyOrderId = ""
} else {
showToast(translate('Configuration missing'))
return;
}

if(!this.isDesktop && this.currentJob) {
this.router.push({ name: 'JobDetails', params: { jobId: this.currentJob.jobId, category: "orders" } });
return;
}
if (this.currentJob && !this.isJobDetailAnimationCompleted) {
emitter.emit('playAnimation');
this.isJobDetailAnimationCompleted = true;
}
},
async fetchJobs(isCurrentJobUpdateRequired = false){
this.isLoading = true
if(isCurrentJobUpdateRequired) {
this.currentSelectedJobModal = "";
await this.store.dispatch('job/updateCurrentJob', { });
Expand All @@ -222,6 +270,7 @@ export default defineComponent({
}
})
this.store.dispatch('webhook/fetchWebhooks')
this.isLoading = false
},
async updateWebhook(checked: boolean, enumId: string) {
const webhook = this.getCachedWebhook[this.webhookEnums[enumId]]
Expand All @@ -237,6 +286,11 @@ export default defineComponent({
} else {
await this.store.dispatch('webhook/unsubscribeWebhook', { webhookId: webhook?.id, shopifyConfigId: this.currentShopifyConfig.shopifyConfigId })
}
},
getTemporalExpression(enumId: string) {
return this.getTemporalExpr(this.getJobStatus(this.jobEnums[enumId]))?.description ?
this.getTemporalExpr(this.getJobStatus(this.jobEnums[enumId]))?.description :
translate('Disabled')
}
},
setup() {
Expand Down
Loading