49
49
</ion-toggle >
50
50
</ion-item >
51
51
</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
+
52
67
<MoreJobs v-if =" getMoreJobs({...jobEnums, ...initialLoadJobEnums}, enumTypeId).length" :jobs =" getMoreJobs({...jobEnums, ...initialLoadJobEnums}, enumTypeId)" />
53
68
</section >
54
69
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" />
57
73
</aside >
58
74
</main >
59
75
</ion-content >
@@ -80,7 +96,8 @@ import {
80
96
import { defineComponent } from ' vue' ;
81
97
import { mapGetters , useStore } from ' vuex' ;
82
98
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' ;
84
101
import emitter from ' @/event-bus' ;
85
102
import { useRouter } from ' vue-router'
86
103
import MoreJobs from ' @/components/MoreJobs.vue'
@@ -104,6 +121,7 @@ export default defineComponent({
104
121
IonToolbar ,
105
122
IonToggle ,
106
123
JobConfiguration ,
124
+ MaargJobConfiguration ,
107
125
MoreJobs
108
126
},
109
127
computed: {
@@ -113,7 +131,9 @@ export default defineComponent({
113
131
getJob: ' job/getJob' ,
114
132
currentShopifyConfig: ' user/getCurrentShopifyConfig' ,
115
133
getCachedWebhook: ' webhook/getCachedWebhook' ,
116
- getMoreJobs: ' job/getMoreJobs'
134
+ getMoreJobs: ' job/getMoreJobs' ,
135
+ getMaargJob: ' maargJob/getMaargJob' ,
136
+ currentMaargJob: ' maargJob/getCurrentMaargJob'
117
137
}),
118
138
newProductsWebhook(): boolean {
119
139
const webhookTopic = this .webhookEnums [' NEW_PRODUCTS' ]
@@ -136,7 +156,8 @@ export default defineComponent({
136
156
webhookEnums: JSON .parse (process .env ?.VUE_APP_WEBHOOK_ENUMS as string ) as any ,
137
157
enumTypeId: ' PRODUCT_SYS_JOB' ,
138
158
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 ,
140
161
}
141
162
},
142
163
mounted () {
@@ -211,9 +232,28 @@ export default defineComponent({
211
232
" enumTypeId" : " PRODUCT_SYS_JOB"
212
233
}
213
234
});
235
+ await this .store .dispatch (" maargJob/fetchMaargJobs" , Object .values (this .maargJobEnums ));
214
236
this .store .dispatch (' webhook/fetchWebhooks' )
215
237
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
+ },
217
257
},
218
258
setup() {
219
259
const customPopoverOptions: any = {
@@ -224,6 +264,7 @@ export default defineComponent({
224
264
const router = useRouter ();
225
265
return {
226
266
Actions ,
267
+ getCronString ,
227
268
hasPermission ,
228
269
customPopoverOptions ,
229
270
store ,
0 commit comments