Skip to content

Commit

Permalink
Improved: code to only dismiss the configuration card in case of prod…
Browse files Browse the repository at this point in the history
…uct store change (hotwax#720)
  • Loading branch information
amansinghbais committed Nov 25, 2024
1 parent 6365792 commit 7e556a9
Show file tree
Hide file tree
Showing 11 changed files with 101 additions and 74 deletions.
4 changes: 2 additions & 2 deletions src/components/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ export default defineComponent({
async setEComStore(event: CustomEvent) {
if(this.userProfile && this.eComStore?.productStoreId !== event.detail.value) {
await this.store.dispatch('user/setEcomStore', { 'productStoreId': event.detail.value })
emitter.emit("productStoreOrConfigChanged")
emitter.emit("productStoreOrConfigChanged", true)
}
},
async setShopifyConfig(event: CustomEvent){
await this.store.dispatch('user/setCurrentShopifyConfig', { 'shopifyConfigId': event.detail.value });
emitter.emit("productStoreOrConfigChanged")
emitter.emit("productStoreOrConfigChanged", true)
}
},
setup() {
Expand Down
16 changes: 9 additions & 7 deletions src/views/Brokering.vue
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,15 @@ export default defineComponent({
this.getTemporalExpr(this.getJobStatus(this.jobEnums[enumId]))?.description :
translate('Disabled')
},
async fetchJobs() {
this.jobsLoading = true;
this.currentJob = "";
await this.store.dispatch('job/updateCurrentJob', { });
this.currentJobStatus = "";
this.freqType = "";
this.isJobDetailAnimationCompleted = false;
async fetchJobs(JobDetailDismissRequired = false) {
if(JobDetailDismissRequired) {
this.jobsLoading = true;
this.currentJob = "";
await this.store.dispatch('job/updateCurrentJob', { });
this.currentJobStatus = "";
this.freqType = "";
this.isJobDetailAnimationCompleted = false;
}
await this.store.dispatch("job/fetchJobs", {
"inputFields": {
// If we fetch broker sys job by not passing systemJobEnumId filter then this api
Expand Down
16 changes: 9 additions & 7 deletions src/views/Fulfillment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,15 @@ export default defineComponent({
this.store.dispatch('job/updateJob', job)
}
},
async fetchJobs(){
this.jobsLoading = true;
this.currentJob = "";
await this.store.dispatch('job/updateCurrentJob', { });
this.currentJobStatus = "";
this.freqType = "";
this.isJobDetailAnimationCompleted = false;
async fetchJobs(JobDetailDismissRequired = false){
if(JobDetailDismissRequired) {
this.jobsLoading = true;
this.currentJob = "";
await this.store.dispatch('job/updateCurrentJob', { });
this.currentJobStatus = "";
this.freqType = "";
this.isJobDetailAnimationCompleted = false;
}
await this.store.dispatch("job/fetchJobs", {
"inputFields": {
"enumTypeId": "FULFILLMENT_SYS_JOB"
Expand Down
16 changes: 9 additions & 7 deletions src/views/InitialLoad.vue
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,15 @@ export default defineComponent({
this.isJobDetailAnimationCompleted = true;
}
},
async fetchJobs(){
this.jobsLoading = true;
this.currentSelectedJobModal = "";
await this.store.dispatch('job/updateCurrentJob', { });
this.job = {};
this.lastShopifyOrderId = "";
this.isJobDetailAnimationCompleted = false;
async fetchJobs(JobDetailDismissRequired = false){
if(JobDetailDismissRequired) {
this.jobsLoading = true;
this.currentSelectedJobModal = "";
await this.store.dispatch('job/updateCurrentJob', { });
this.job = {};
this.lastShopifyOrderId = "";
this.isJobDetailAnimationCompleted = false;
}
await this.store.dispatch("job/fetchJobs", {
"inputFields":{
"systemJobEnumId": Object.values(this.jobEnums),
Expand Down
16 changes: 9 additions & 7 deletions src/views/Inventory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,15 @@ export default defineComponent({
}
});
},
async fetchData() {
this.jobsLoading = true;
this.currentJob = "";
await this.store.dispatch('job/updateCurrentJob', { });
this.currentJobStatus = "";
this.freqType = "";
this.isJobDetailAnimationCompleted = false;
async fetchData(JobDetailDismissRequired = false) {
if(JobDetailDismissRequired) {
this.jobsLoading = true;
this.currentJob = "";
await this.store.dispatch('job/updateCurrentJob', { });
this.currentJobStatus = "";
this.freqType = "";
this.isJobDetailAnimationCompleted = false;
}
this.store.dispatch('webhook/fetchWebhooks')
await this.fetchJobs()
this.jobsLoading = false;
Expand Down
19 changes: 12 additions & 7 deletions src/views/Miscellaneous.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ export default defineComponent({
mounted() {
emitter.on('jobUpdated', this.getMiscellaneousJobs);
this.getMiscellaneousJobs();
emitter.on("productStoreOrConfigChanged", this.getMiscellaneousJobs);
emitter.on("productStoreOrConfigChanged", this.updateProductStoreConfig);
},
unmounted() {
emitter.off("productStoreOrConfigChanged", this.getMiscellaneousJobs);
emitter.off("productStoreOrConfigChanged", this.updateProductStoreConfig);
emitter.off('jobUpdated', this.getMiscellaneousJobs);
},
data() {
Expand Down Expand Up @@ -157,12 +157,17 @@ export default defineComponent({
}
},
async getMiscellaneousJobs(viewSize = 100, viewIndex = 0) {
this.jobsLoading = true;
this.currentJob = "";
await this.store.dispatch('job/updateCurrentJob', { });
this.currentJobStatus = "";
this.isJobDetailAnimationCompleted = false;
await this.store.dispatch('job/fetchMiscellaneousJobs', {eComStoreId: this.getCurrentEComStore.productStoreId, viewSize, viewIndex});
},
async updateProductStoreConfig(JobDetailDismissRequired = false) {
if(JobDetailDismissRequired) {
this.jobsLoading = true;
this.currentJob = "";
await this.store.dispatch('job/updateCurrentJob', { });
this.currentJobStatus = "";
this.isJobDetailAnimationCompleted = false;
}
this.getMiscellaneousJobs();
this.jobsLoading = false;
},
async loadMoreMiscellaneousJobs (event: any) {
Expand Down
16 changes: 9 additions & 7 deletions src/views/Orders.vue
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,15 @@ export default defineComponent({
this.getTemporalExpr(this.getJobStatus(this.jobEnums[enumId]))?.description :
translate('Disabled')
},
async fetchJobs(){
this.jobsLoading = true;
this.currentJob = ""
await this.store.dispatch('job/updateCurrentJob', { });
this.currentJobStatus = ""
this.freqType = ""
this.isJobDetailAnimationCompleted = false
async fetchJobs(JobDetailDismissRequired = false){
if(JobDetailDismissRequired) {
this.jobsLoading = true;
this.currentJob = ""
await this.store.dispatch('job/updateCurrentJob', { });
this.currentJobStatus = ""
this.freqType = ""
this.isJobDetailAnimationCompleted = false
}
this.store.dispatch('webhook/fetchWebhooks')
await this.store.dispatch("job/fetchJobs", {
"inputFields": {
Expand Down
21 changes: 12 additions & 9 deletions src/views/Pipeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -508,17 +508,17 @@ export default defineComponent({
async refreshJobs(event: any, isRetrying = false ) {
this.isRetrying = isRetrying;
if(this.segmentSelected === 'pending') {
this.getPendingJobs().then(() => {
await this.getPendingJobs().then(() => {
if(event) event.target.complete();
this.isRetrying = false;
});
} else if(this.segmentSelected === 'running') {
this.getRunningJobs().then(() => {
await this.getRunningJobs().then(() => {
if(event) event.target.complete();
this.isRetrying = false;
});
} else {
this.getJobHistory().then(() => {
await this.getJobHistory().then(() => {
if(event) event.target.complete();
this.isRetrying = false;
});
Expand Down Expand Up @@ -645,12 +645,15 @@ export default defineComponent({
this.getPendingJobs();
}
},
async updateProductStoreConfig() {
this.jobsLoading = true;
await this.store.dispatch('job/updateCurrentJob', { job: {} });
this.currentJobStatus = ""
this.freqType = ""
this.isJobDetailAnimationCompleted = false
async updateProductStoreConfig(JobDetailDismissRequired = false) {
if(JobDetailDismissRequired) {
this.jobsLoading = true;
console.log('if')
await this.store.dispatch('job/updateCurrentJob', { job: {} });
this.currentJobStatus = ""
this.freqType = ""
this.isJobDetailAnimationCompleted = false
}
await this.refreshJobs(undefined);
this.jobsLoading = false;
}
Expand Down
16 changes: 9 additions & 7 deletions src/views/PreOrder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -372,13 +372,15 @@ export default defineComponent({
}
});
},
async fetchInitialData() {
this.jobsLoading = true;
this.currentJob = "";
await this.store.dispatch('job/updateCurrentJob', { });
this.currentJobStatus = ""
this.freqType = '';
this.isJobDetailAnimationCompleted = false;
async fetchInitialData(JobDetailDismissRequired = false) {
if(JobDetailDismissRequired) {
this.jobsLoading = true;
this.currentJob = "";
await this.store.dispatch('job/updateCurrentJob', { });
this.currentJobStatus = ""
this.freqType = '';
this.isJobDetailAnimationCompleted = false;
}
await this.fetchJobs();
await this.getPreOrderBackorderCategory();
this.jobsLoading = false;
Expand Down
16 changes: 9 additions & 7 deletions src/views/Product.vue
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,15 @@ export default defineComponent({
this.getTemporalExpr(this.getJobStatus(this.jobEnums[enumId]))?.description :
translate('Disabled')
},
async fetchJobs(){
this.jobsLoading = true;
this.currentJob = ""
await this.store.dispatch('job/updateCurrentJob', { });
this.currentJobStatus = ""
this.freqType = ""
this.isJobDetailAnimationCompleted = false
async fetchJobs(JobDetailDismissRequired = false){
if(JobDetailDismissRequired) {
this.jobsLoading = true;
this.currentJob = ""
await this.store.dispatch('job/updateCurrentJob', { });
this.currentJobStatus = ""
this.freqType = ""
this.isJobDetailAnimationCompleted = false
}
await this.store.dispatch("job/fetchJobs", {
"inputFields":{
"enumTypeId": "PRODUCT_SYS_JOB"
Expand Down
19 changes: 12 additions & 7 deletions src/views/Reports.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ export default defineComponent({
mounted() {
emitter.on('jobUpdated', this.getReportsJobs);
this.getReportsJobs();
emitter.on("productStoreOrConfigChanged", this.getReportsJobs);
emitter.on("productStoreOrConfigChanged", this.updateProductStoreConfig);
},
unmounted() {
emitter.on('jobUpdated', this.getReportsJobs);
emitter.off("productStoreOrConfigChanged", this.getReportsJobs);
emitter.off("productStoreOrConfigChanged", this.updateProductStoreConfig);
},
methods: {
async viewJobConfiguration(job: any) {
Expand All @@ -145,12 +145,17 @@ export default defineComponent({
}
},
async getReportsJobs(viewSize = 200, viewIndex = 0) {
this.jobsLoading = true;
this.currentJob = "";
await this.store.dispatch('job/updateCurrentJob', { });
this.currentJobStatus = "";
this.isJobDetailAnimationCompleted = false;
await this.store.dispatch('job/fetchReportsJobs', { eComStoreId: this.getCurrentEComStore.productStoreId, viewSize, viewIndex });
},
async updateProductStoreConfig(JobDetailDismissRequired = false) {
if(JobDetailDismissRequired) {
this.jobsLoading = true;
this.currentJob = "";
await this.store.dispatch('job/updateCurrentJob', { });
this.currentJobStatus = "";
this.isJobDetailAnimationCompleted = false;
}
await this.getReportsJobs()
this.jobsLoading = false;
},
async loadMoreReportsJobs(event: any) {
Expand Down

0 comments on commit 7e556a9

Please sign in to comment.