Skip to content

Commit 929ebca

Browse files
authored
Merge pull request #721 from amansinghbais/#720
Improved: logic to show spinner and close configuration card in case of product store change (#720)
2 parents 5ddd6ab + 7e0ebb0 commit 929ebca

File tree

12 files changed

+118
-36
lines changed

12 files changed

+118
-36
lines changed

src/components/Menu.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ export default defineComponent({
8383
async setEComStore(event: CustomEvent) {
8484
if(this.userProfile && this.eComStore?.productStoreId !== event.detail.value) {
8585
await this.store.dispatch('user/setEcomStore', { 'productStoreId': event.detail.value })
86-
emitter.emit("productStoreOrConfigChanged")
86+
emitter.emit("productStoreOrConfigChanged", true)
8787
}
8888
},
8989
async setShopifyConfig(event: CustomEvent){
9090
await this.store.dispatch('user/setCurrentShopifyConfig', { 'shopifyConfigId': event.detail.value });
91-
emitter.emit("productStoreOrConfigChanged")
91+
emitter.emit("productStoreOrConfigChanged", true)
9292
}
9393
},
9494
setup() {

src/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
"Failed records": "Failed records",
9494
"Failed job reason": "Failed job reason",
9595
"Failed to schedule service(s)": "Failed to schedule {count} service(s)",
96+
"Fetching jobs": "Fetching jobs",
9697
"Fetching TimeZones": "Fetching TimeZones",
9798
"File upload status": "File upload status",
9899
"Filters": "Filters",

src/views/Brokering.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<MoreJobs v-if="getMoreJobs({...jobEnums, ...initialLoadJobEnums}, enumTypeId).length" :jobs="getMoreJobs({...jobEnums, ...initialLoadJobEnums}, enumTypeId)" />
5959
</section>
6060

61-
<aside class="desktop-only" v-if="isDesktop" v-show="currentJob">
61+
<aside class="desktop-only" v-if="isDesktop" v-show="currentJob && Object.keys(currentJob).length">
6262
<JobConfiguration :status="currentJobStatus" :type="freqType" :key="currentJob" :isBrokerJob="orderBatchJobs.includes(currentJob) ? true : false"/>
6363
</aside>
6464
</main>
@@ -208,7 +208,14 @@ export default defineComponent({
208208
this.getTemporalExpr(this.getJobStatus(this.jobEnums[enumId]))?.description :
209209
translate('Disabled')
210210
},
211-
async fetchJobs() {
211+
async fetchJobs(isCurrentJobUpdateRequired = false) {
212+
if(isCurrentJobUpdateRequired) {
213+
this.currentJob = "";
214+
await this.store.dispatch('job/updateCurrentJob', { });
215+
this.currentJobStatus = "";
216+
this.freqType = "";
217+
this.isJobDetailAnimationCompleted = false;
218+
}
212219
await this.store.dispatch("job/fetchJobs", {
213220
"inputFields": {
214221
// If we fetch broker sys job by not passing systemJobEnumId filter then this api

src/views/Fulfillment.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,15 @@ export default defineComponent({
240240
this.store.dispatch('job/updateJob', job)
241241
}
242242
},
243-
async fetchJobs(){
244-
this.isLoading = true
243+
async fetchJobs(isCurrentJobUpdateRequired = false){
244+
this.isLoading = true;
245+
if(isCurrentJobUpdateRequired) {
246+
this.currentJob = "";
247+
await this.store.dispatch('job/updateCurrentJob', { });
248+
this.currentJobStatus = "";
249+
this.freqType = "";
250+
this.isJobDetailAnimationCompleted = false;
251+
}
245252
await this.store.dispatch("job/fetchJobs", {
246253
"inputFields": {
247254
"enumTypeId": "FULFILLMENT_SYS_JOB"

src/views/InitialLoad.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,15 @@ export default defineComponent({
207207
this.isJobDetailAnimationCompleted = true;
208208
}
209209
},
210-
fetchJobs(){
211-
this.store.dispatch("job/fetchJobs", {
210+
async fetchJobs(isCurrentJobUpdateRequired = false){
211+
if(isCurrentJobUpdateRequired) {
212+
this.currentSelectedJobModal = "";
213+
await this.store.dispatch('job/updateCurrentJob', { });
214+
this.job = {};
215+
this.lastShopifyOrderId = "";
216+
this.isJobDetailAnimationCompleted = false;
217+
}
218+
await this.store.dispatch("job/fetchJobs", {
212219
"inputFields":{
213220
"systemJobEnumId": Object.values(this.jobEnums),
214221
"systemJobEnumId_op": "in"

src/views/Inventory.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,16 @@ export default defineComponent({
178178
});
179179
this.isLoading = false
180180
},
181-
fetchData() {
181+
async fetchData(isCurrentJobUpdateRequired = false) {
182+
if(isCurrentJobUpdateRequired) {
183+
this.currentJob = "";
184+
await this.store.dispatch('job/updateCurrentJob', { });
185+
this.currentJobStatus = "";
186+
this.freqType = "";
187+
this.isJobDetailAnimationCompleted = false;
188+
}
182189
this.store.dispatch('webhook/fetchWebhooks')
183-
this.fetchJobs()
190+
await this.fetchJobs()
184191
}
185192
},
186193
mounted () {

src/views/Miscellaneous.vue

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ import {
5959
IonMenuButton,
6060
IonNote,
6161
IonPage,
62-
IonSpinner,
6362
IonTitle,
6463
IonToolbar,
6564
isPlatform,
@@ -87,18 +86,17 @@ export default defineComponent({
8786
IonMenuButton,
8887
IonNote,
8988
IonPage,
90-
IonSpinner,
9189
IonTitle,
9290
IonToolbar,
9391
JobConfiguration
9492
},
9593
mounted() {
9694
emitter.on('jobUpdated', this.getMiscellaneousJobs);
9795
this.getMiscellaneousJobs();
98-
emitter.on("productStoreOrConfigChanged", this.getMiscellaneousJobs);
96+
emitter.on("productStoreOrConfigChanged", this.updateProductStoreConfig);
9997
},
10098
unmounted() {
101-
emitter.off("productStoreOrConfigChanged", this.getMiscellaneousJobs);
99+
emitter.off("productStoreOrConfigChanged", this.updateProductStoreConfig);
102100
emitter.off('jobUpdated', this.getMiscellaneousJobs);
103101
},
104102
data() {
@@ -107,7 +105,7 @@ export default defineComponent({
107105
currentJobStatus: '',
108106
isJobDetailAnimationCompleted: false,
109107
isDesktop: isPlatform('desktop'),
110-
isRetrying: false,
108+
isRetrying: false
111109
}
112110
},
113111
computed: {
@@ -152,6 +150,15 @@ export default defineComponent({
152150
async getMiscellaneousJobs(viewSize = 100, viewIndex = 0) {
153151
await this.store.dispatch('job/fetchMiscellaneousJobs', {eComStoreId: this.getCurrentEComStore.productStoreId, viewSize, viewIndex});
154152
},
153+
async updateProductStoreConfig(isCurrentJobUpdateRequired = false) {
154+
if(isCurrentJobUpdateRequired) {
155+
this.currentJob = "";
156+
await this.store.dispatch('job/updateCurrentJob', { });
157+
this.currentJobStatus = "";
158+
this.isJobDetailAnimationCompleted = false;
159+
}
160+
this.getMiscellaneousJobs();
161+
},
155162
async loadMoreMiscellaneousJobs (event: any) {
156163
this.getMiscellaneousJobs(
157164
undefined,

src/views/Orders.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,15 @@ export default defineComponent({
279279
this.getTemporalExpr(this.getJobStatus(this.jobEnums[enumId]))?.description :
280280
translate('Disabled')
281281
},
282-
async fetchJobs(){
282+
async fetchJobs(isCurrentJobUpdateRequired = false){
283283
this.isLoading = true;
284+
if(isCurrentJobUpdateRequired) {
285+
this.currentJob = ""
286+
await this.store.dispatch('job/updateCurrentJob', { });
287+
this.currentJobStatus = ""
288+
this.freqType = ""
289+
this.isJobDetailAnimationCompleted = false
290+
}
284291
this.store.dispatch('webhook/fetchWebhooks')
285292
await this.store.dispatch("job/fetchJobs", {
286293
"inputFields": {

src/views/Pipeline.vue

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@
3131
</ion-header>
3232

3333
<ion-content ref="contentRef" :scroll-events="true" @ionScroll="enableScrolling()" id="filter-content">
34-
<main>
34+
<div class="empty-state" v-if="jobsLoading">
35+
<ion-item lines="none">
36+
<ion-spinner name="crescent" slot="start" />
37+
{{ translate("Fetching jobs") }}
38+
</ion-item>
39+
</div>
40+
<main v-else>
3541
<section v-if="segmentSelected === 'pending'">
3642
<!-- Empty state -->
3743
<div v-if="pendingJobs?.length === 0">
@@ -368,6 +374,7 @@ export default defineComponent({
368374
isRetrying: false,
369375
queryString: '' as any,
370376
isScrollingEnabled: false,
377+
jobsLoading: false,
371378
selectedJobId: '' as any
372379
}
373380
},
@@ -516,17 +523,17 @@ export default defineComponent({
516523
async refreshJobs(event: any, isRetrying = false ) {
517524
this.isRetrying = isRetrying;
518525
if(this.segmentSelected === 'pending') {
519-
this.getPendingJobs().then(() => {
526+
await this.getPendingJobs().then(() => {
520527
if(event) event.target.complete();
521528
this.isRetrying = false;
522529
});
523530
} else if(this.segmentSelected === 'running') {
524-
this.getRunningJobs().then(() => {
531+
await this.getRunningJobs().then(() => {
525532
if(event) event.target.complete();
526533
this.isRetrying = false;
527534
});
528535
} else {
529-
this.getJobHistory().then(() => {
536+
await this.getJobHistory().then(() => {
530537
if(event) event.target.complete();
531538
this.isRetrying = false;
532539
});
@@ -555,7 +562,7 @@ export default defineComponent({
555562
text: translate('Skip'),
556563
handler: async () => {
557564
if(this.isRuntimePassed(job)) {
558-
await this.refreshJobs(undefined, true)
565+
await this.refreshJobs(undefined)
559566
showToast(translate("Job runtime has passed. The job data has refreshed. Please try again."))
560567
await this.store.dispatch('job/updateCurrentJob', { job: {} });
561568
return;
@@ -601,7 +608,7 @@ export default defineComponent({
601608
text: translate("CANCEL"),
602609
handler: async () => {
603610
if(this.isRuntimePassed(job)) {
604-
await this.refreshJobs(undefined, true)
611+
await this.refreshJobs(undefined)
605612
showToast(translate("Job runtime has passed. The job data has refreshed. Please try again."))
606613
await this.store.dispatch('job/updateCurrentJob', { job: {} });
607614
return;
@@ -654,6 +661,17 @@ export default defineComponent({
654661
this.getPendingJobs();
655662
}
656663
},
664+
async updateProductStoreConfig(isCurrentJobUpdateRequired = false) {
665+
if(isCurrentJobUpdateRequired) {
666+
this.jobsLoading = true;
667+
await this.store.dispatch('job/updateCurrentJob', { job: {} });
668+
this.currentJobStatus = ""
669+
this.freqType = ""
670+
this.isJobDetailAnimationCompleted = false
671+
}
672+
await this.refreshJobs(undefined);
673+
this.jobsLoading = false;
674+
}
657675
},
658676
async created() {
659677
this.getPendingJobs();
@@ -665,11 +683,11 @@ export default defineComponent({
665683
await this.store.dispatch('job/updateCurrentJob', { job: {} });
666684
},
667685
mounted(){
668-
emitter.on("productStoreOrConfigChanged", this.refreshJobs);
686+
emitter.on("productStoreOrConfigChanged", this.updateProductStoreConfig);
669687
emitter.on("pinnedJobsUpdated", (this as any).updateSelectedPinnedJob);
670688
},
671689
unmounted(){
672-
emitter.off("productStoreOrConfigChanged", this.refreshJobs);
690+
emitter.off("productStoreOrConfigChanged", this.updateProductStoreConfig);
673691
emitter.off('jobUpdated', this.updateJobs);
674692
emitter.off("pinnedJobsUpdated", (this as any).updateSelectedPinnedJob);
675693
},

src/views/PreOrder.vue

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -356,16 +356,23 @@ export default defineComponent({
356356
this.getTemporalExpr(this.getJobStatus(this.jobEnums[enumId]))?.description :
357357
translate('Disabled')
358358
},
359-
fetchJobs(){
360-
this.store.dispatch("job/fetchJobs", {
359+
async fetchJobs(){
360+
await this.store.dispatch("job/fetchJobs", {
361361
"inputFields":{
362362
"enumTypeId": "PRE_ORD_SYS_JOB"
363363
}
364364
});
365365
},
366-
fetchInitialData() {
367-
this.fetchJobs();
368-
this.getPreOrderBackorderCategory();
366+
async fetchInitialData(isCurrentJobUpdateRequired = false) {
367+
if(isCurrentJobUpdateRequired) {
368+
this.currentJob = "";
369+
await this.store.dispatch('job/updateCurrentJob', { });
370+
this.currentJobStatus = ""
371+
this.freqType = '';
372+
this.isJobDetailAnimationCompleted = false;
373+
}
374+
await this.fetchJobs();
375+
await this.getPreOrderBackorderCategory();
369376
}
370377
},
371378
mounted () {

src/views/Product.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,15 @@ export default defineComponent({
192192
this.getTemporalExpr(this.getJobStatus(this.jobEnums[enumId]))?.description :
193193
translate('Disabled')
194194
},
195-
async fetchJobs(){
196-
this.isLoading = true
195+
async fetchJobs(isCurrentJobUpdateRequired = false){
196+
this.isLoading = true;
197+
if(isCurrentJobUpdateRequired) {
198+
this.currentJob = ""
199+
await this.store.dispatch('job/updateCurrentJob', { });
200+
this.currentJobStatus = ""
201+
this.freqType = ""
202+
this.isJobDetailAnimationCompleted = false
203+
}
197204
await this.store.dispatch("job/fetchJobs", {
198205
"inputFields":{
199206
"enumTypeId": "PRODUCT_SYS_JOB"

src/views/Reports.vue

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ import {
5757
IonMenuButton,
5858
IonNote,
5959
IonPage,
60-
IonSpinner,
6160
IonTitle,
6261
IonToolbar,
6362
isPlatform,
@@ -85,7 +84,6 @@ export default defineComponent({
8584
IonMenuButton,
8685
IonNote,
8786
IonPage,
88-
IonSpinner,
8987
IonTitle,
9088
IonToolbar,
9189
JobConfiguration
@@ -97,7 +95,7 @@ export default defineComponent({
9795
currentJobStatus: '',
9896
isJobDetailAnimationCompleted: false,
9997
isDesktop: isPlatform('desktop'),
100-
isRetrying: false,
98+
isRetrying: false
10199
}
102100
},
103101
computed: {
@@ -110,11 +108,11 @@ export default defineComponent({
110108
mounted() {
111109
emitter.on('jobUpdated', this.getReportsJobs);
112110
this.getReportsJobs();
113-
emitter.on("productStoreOrConfigChanged", this.getReportsJobs);
111+
emitter.on("productStoreOrConfigChanged", this.updateProductStoreConfig);
114112
},
115113
unmounted() {
116114
emitter.on('jobUpdated', this.getReportsJobs);
117-
emitter.off("productStoreOrConfigChanged", this.getReportsJobs);
115+
emitter.off("productStoreOrConfigChanged", this.updateProductStoreConfig);
118116
},
119117
methods: {
120118
async viewJobConfiguration(job: any) {
@@ -140,6 +138,15 @@ export default defineComponent({
140138
async getReportsJobs(viewSize = 200, viewIndex = 0) {
141139
await this.store.dispatch('job/fetchReportsJobs', { eComStoreId: this.getCurrentEComStore.productStoreId, viewSize, viewIndex });
142140
},
141+
async updateProductStoreConfig(isCurrentJobUpdateRequired = false) {
142+
if(isCurrentJobUpdateRequired) {
143+
this.currentJob = "";
144+
await this.store.dispatch('job/updateCurrentJob', { });
145+
this.currentJobStatus = "";
146+
this.isJobDetailAnimationCompleted = false;
147+
}
148+
await this.getReportsJobs()
149+
},
143150
async loadMoreReportsJobs(event: any) {
144151
this.getReportsJobs(
145152
undefined,

0 commit comments

Comments
 (0)