Skip to content

Commit 4857171

Browse files
authored
Merge pull request #768 from amansinghbais/#767
Implemented: maarg jobs related to query product feed in the products page (#767)
2 parents caab1d9 + 5d1e735 commit 4857171

File tree

3 files changed

+52
-6
lines changed

3 files changed

+52
-6
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ VUE_APP_INVENTORY_MAARG_JOB_ENUMS={"GNRT_SHIP_RCPT_FEED":"GEN_SHPMNT_RCPT_FD","G
2323
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"}
2424
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"}
2525
VUE_APP_PREORD_MAARG_JOB_ENUMS={"PO_RCPT_FEED": "GEN_PO_RCPT_FD"}
26+
VUE_APP_PRD_MAARG_JOB_ENUMS={"QUEUE_CRTD_PRD_FEED":"QueueCreatedProductsFeed","QUEUE_UPDT_PRD_FEED":"QueueUpdatedProductsFeed"}
2627
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 * * ?"}
2728
VUE_APP_GITBOOK_API_KEY=""
2829
VUE_APP_SPACE_ID=""

src/locales/en.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
"Failed to cancel job": "Failed to cancel job",
104104
"Failed to schedule service(s)": "Failed to schedule {count} service(s)",
105105
"Failed to update service": "Failed to update service",
106+
"Feed": "Feed",
106107
"Fetching jobs": "Fetching jobs",
107108
"Fetching TimeZones": "Fetching TimeZones",
108109
"File upload status": "File upload status",
@@ -188,6 +189,7 @@
188189
"No parameters available": "No parameters available",
189190
"No previous occurrence": "No previous occurrence",
190191
"No time zone found": "No time zone found",
192+
"Not found": "Not found",
191193
"Notes": "Notes",
192194
"Notification": "Notification",
193195
"Notify customers of any changed promise dates for their orders.": "Notify customers of any changed promise dates for their orders.",
@@ -231,6 +233,8 @@
231233
"Promise date changes": "Promise date changes",
232234
"Provide a future date and time": "Provide a future date and time",
233235
"Queued": "Queued",
236+
"Queue created product feed": "Queue created product feed",
237+
"Queue updated product feed": "Queue updated product feed",
234238
"Ready to create an app?": "Ready to create an app?",
235239
"Realtime adjustments": "Realtime adjustments",
236240
"Realtime POS sales": "Realtime POS sales",

src/views/Product.vue

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,27 @@
4949
</ion-toggle>
5050
</ion-item>
5151
</ion-card>
52+
53+
<ion-card>
54+
<ion-card-header>
55+
<ion-card-title>{{ translate("Feed") }}</ion-card-title>
56+
</ion-card-header>
57+
<ion-item button detail :disabled="!isMaargJobFound('QUEUE_CRTD_PRD_FEED')" @click="viewMaargJobConfiguration('QUEUE_CRTD_PRD_FEED')">
58+
<ion-label class="ion-text-wrap">{{ translate("Queue created product feed") }}</ion-label>
59+
<ion-label slot="end" >{{ isMaargJobFound('QUEUE_CRTD_PRD_FEED') ? getMaargJobStatus("QUEUE_CRTD_PRD_FEED") : translate("Not found") }}</ion-label>
60+
</ion-item>
61+
<ion-item button detail :disabled="!isMaargJobFound('QUEUE_UPDT_PRD_FEED')" @click="viewMaargJobConfiguration('QUEUE_UPDT_PRD_FEED')">
62+
<ion-label class="ion-text-wrap">{{ translate("Queue updated product feed") }}</ion-label>
63+
<ion-label slot="end">{{ isMaargJobFound('QUEUE_UPDT_PRD_FEED') ? getMaargJobStatus("QUEUE_UPDT_PRD_FEED") : translate("Not found") }}</ion-label>
64+
</ion-item>
65+
</ion-card>
66+
5267
<MoreJobs v-if="getMoreJobs({...jobEnums, ...initialLoadJobEnums}, enumTypeId).length" :jobs="getMoreJobs({...jobEnums, ...initialLoadJobEnums}, enumTypeId)" />
5368
</section>
5469

55-
<aside class="desktop-only" v-if="isDesktop" v-show="currentJob">
56-
<JobConfiguration :status="currentJobStatus" :type="freqType" :key="currentJob"/>
70+
<aside class="desktop-only" v-if="isDesktop" v-show="currentJob || Object.keys(currentMaargJob).length">
71+
<JobConfiguration v-if="currentJob" :status="currentJobStatus" :type="freqType" :key="currentJob"/>
72+
<MaargJobConfiguration v-else-if="Object.keys(currentMaargJob).length" :key="currentMaargJob" />
5773
</aside>
5874
</main>
5975
</ion-content>
@@ -80,7 +96,8 @@ import {
8096
import { defineComponent } from 'vue';
8197
import { mapGetters, useStore } from 'vuex';
8298
import JobConfiguration from '@/components/JobConfiguration.vue'
83-
import { isFutureDate, showToast } from '@/utils';
99+
import MaargJobConfiguration from '@/components/MaargJobConfiguration.vue';
100+
import { getCronString, hasError, isFutureDate, showToast } from '@/utils';
84101
import emitter from '@/event-bus';
85102
import { useRouter } from 'vue-router'
86103
import MoreJobs from '@/components/MoreJobs.vue'
@@ -104,6 +121,7 @@ export default defineComponent({
104121
IonToolbar,
105122
IonToggle,
106123
JobConfiguration,
124+
MaargJobConfiguration,
107125
MoreJobs
108126
},
109127
computed: {
@@ -113,7 +131,9 @@ export default defineComponent({
113131
getJob: 'job/getJob',
114132
currentShopifyConfig: 'user/getCurrentShopifyConfig',
115133
getCachedWebhook: 'webhook/getCachedWebhook',
116-
getMoreJobs: 'job/getMoreJobs'
134+
getMoreJobs: 'job/getMoreJobs',
135+
getMaargJob: 'maargJob/getMaargJob',
136+
currentMaargJob: 'maargJob/getCurrentMaargJob'
117137
}),
118138
newProductsWebhook(): boolean {
119139
const webhookTopic = this.webhookEnums['NEW_PRODUCTS']
@@ -136,7 +156,8 @@ export default defineComponent({
136156
webhookEnums: JSON.parse(process.env?.VUE_APP_WEBHOOK_ENUMS as string) as any,
137157
enumTypeId: 'PRODUCT_SYS_JOB',
138158
initialLoadJobEnums: JSON.parse(process.env?.VUE_APP_INITIAL_JOB_ENUMS as string) as any,
139-
isLoading: false
159+
isLoading: false,
160+
maargJobEnums: JSON.parse(process.env.VUE_APP_PRD_MAARG_JOB_ENUMS as string) as any,
140161
}
141162
},
142163
mounted () {
@@ -211,9 +232,28 @@ export default defineComponent({
211232
"enumTypeId": "PRODUCT_SYS_JOB"
212233
}
213234
});
235+
await this.store.dispatch("maargJob/fetchMaargJobs", Object.values(this.maargJobEnums));
214236
this.store.dispatch('webhook/fetchWebhooks')
215237
this.isLoading = false
216-
}
238+
},
239+
isMaargJobFound(id: string) {
240+
const job = this.getMaargJob(this.maargJobEnums[id])
241+
return job && Object.keys(job)?.length
242+
},
243+
getMaargJobStatus(id: string) {
244+
const job = this.getMaargJob(this.maargJobEnums[id])
245+
return (job?.paused === "N" && job?.cronExpression) ? this.getCronString(job.cronExpression) ? this.getCronString(job.cronExpression) : job.cronExpression : 'Disabled'
246+
},
247+
async viewMaargJobConfiguration(id: any) {
248+
const enumId = this.maargJobEnums[id];
249+
const job = this.getMaargJob(enumId);
250+
await this.store.dispatch("maargJob/updateCurrentMaargJob", { job })
251+
this.currentJob = ""
252+
if(!this.isJobDetailAnimationCompleted) {
253+
emitter.emit('playAnimation');
254+
this.isJobDetailAnimationCompleted = true;
255+
}
256+
},
217257
},
218258
setup() {
219259
const customPopoverOptions: any = {
@@ -224,6 +264,7 @@ export default defineComponent({
224264
const router = useRouter();
225265
return {
226266
Actions,
267+
getCronString,
227268
hasPermission,
228269
customPopoverOptions,
229270
store,

0 commit comments

Comments
 (0)