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: maarg jobs related to query product feed in the products page (#767) #768

Merged
merged 2 commits into from
Jan 31, 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
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ VUE_APP_INVENTORY_MAARG_JOB_ENUMS={"GNRT_SHIP_RCPT_FEED":"GEN_SHPMNT_RCPT_FD","G
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
4 changes: 4 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
"Failed to cancel job": "Failed to cancel job",
"Failed to schedule service(s)": "Failed to schedule {count} service(s)",
"Failed to update service": "Failed to update service",
"Feed": "Feed",
"Fetching jobs": "Fetching jobs",
"Fetching TimeZones": "Fetching TimeZones",
"File upload status": "File upload status",
Expand Down Expand Up @@ -188,6 +189,7 @@
"No parameters available": "No parameters available",
"No previous occurrence": "No previous occurrence",
"No time zone found": "No time zone found",
"Not found": "Not found",
"Notes": "Notes",
"Notification": "Notification",
"Notify customers of any changed promise dates for their orders.": "Notify customers of any changed promise dates for their orders.",
Expand Down Expand Up @@ -231,6 +233,8 @@
"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
53 changes: 47 additions & 6 deletions src/views/Product.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,27 @@
</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('QUEUE_CRTD_PRD_FEED')" @click="viewMaargJobConfiguration('QUEUE_CRTD_PRD_FEED')">
<ion-label class="ion-text-wrap">{{ translate("Queue created product feed") }}</ion-label>
<ion-label slot="end" >{{ isMaargJobFound('QUEUE_CRTD_PRD_FEED') ? getMaargJobStatus("QUEUE_CRTD_PRD_FEED") : translate("Not found") }}</ion-label>
</ion-item>
<ion-item button detail :disabled="!isMaargJobFound('QUEUE_UPDT_PRD_FEED')" @click="viewMaargJobConfiguration('QUEUE_UPDT_PRD_FEED')">
<ion-label class="ion-text-wrap">{{ translate("Queue updated product feed") }}</ion-label>
<ion-label slot="end">{{ isMaargJobFound('QUEUE_UPDT_PRD_FEED') ? getMaargJobStatus("QUEUE_UPDT_PRD_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 All @@ -80,7 +96,8 @@
import { defineComponent } from 'vue';
import { mapGetters, useStore } from 'vuex';
import JobConfiguration from '@/components/JobConfiguration.vue'
import { isFutureDate, showToast } from '@/utils';
import MaargJobConfiguration from '@/components/MaargJobConfiguration.vue';
import { getCronString, hasError, isFutureDate, showToast } from '@/utils';

Check warning on line 100 in src/views/Product.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)

'hasError' is defined but never used

Check warning on line 100 in src/views/Product.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (20.x)

'hasError' is defined but never used
import emitter from '@/event-bus';
import { useRouter } from 'vue-router'
import MoreJobs from '@/components/MoreJobs.vue'
Expand All @@ -104,6 +121,7 @@
IonToolbar,
IonToggle,
JobConfiguration,
MaargJobConfiguration,
MoreJobs
},
computed: {
Expand All @@ -113,7 +131,9 @@
getJob: 'job/getJob',
currentShopifyConfig: 'user/getCurrentShopifyConfig',
getCachedWebhook: 'webhook/getCachedWebhook',
getMoreJobs: 'job/getMoreJobs'
getMoreJobs: 'job/getMoreJobs',
getMaargJob: 'maargJob/getMaargJob',
currentMaargJob: 'maargJob/getCurrentMaargJob'
}),
newProductsWebhook(): boolean {
const webhookTopic = this.webhookEnums['NEW_PRODUCTS']
Expand All @@ -136,7 +156,8 @@
webhookEnums: JSON.parse(process.env?.VUE_APP_WEBHOOK_ENUMS as string) as any,
enumTypeId: 'PRODUCT_SYS_JOB',
initialLoadJobEnums: JSON.parse(process.env?.VUE_APP_INITIAL_JOB_ENUMS as string) as any,
isLoading: false
isLoading: false,
maargJobEnums: JSON.parse(process.env.VUE_APP_PRD_MAARG_JOB_ENUMS as string) as any,
}
},
mounted () {
Expand Down Expand Up @@ -211,9 +232,28 @@
"enumTypeId": "PRODUCT_SYS_JOB"
}
});
await this.store.dispatch("maargJob/fetchMaargJobs", Object.values(this.maargJobEnums));
this.store.dispatch('webhook/fetchWebhooks')
this.isLoading = false
}
},
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 customPopoverOptions: any = {
Expand All @@ -224,6 +264,7 @@
const router = useRouter();
return {
Actions,
getCronString,
hasPermission,
customPopoverOptions,
store,
Expand Down
Loading