-
Notifications
You must be signed in to change notification settings - Fork 32
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
Fixed: Jobs repeatation in moreJobs sections on all pages(#2vjxdha) #296
Changes from 1 commit
ae88800
2d20cc7
3534d5d
de8f57e
a809d59
f244750
400b3e6
b1dff67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,17 +57,15 @@ const getters: GetterTree <JobState, RootState> = { | |
isMiscellaneousJobsScrollable: (state) => { | ||
return state.miscellaneous.list?.length > 0 && state.miscellaneous.list?.length < state.miscellaneous.total | ||
}, | ||
getMoreJobs (state){ | ||
let jobs = state.more.draft.list.reduce((jobs: any, draftJob: any) => { | ||
jobs[draftJob.systemJobEnumId] = draftJob; | ||
return jobs; | ||
}, {}) | ||
jobs = state.more.pending.list.reduce((jobs: any, pendingJob: any) => { | ||
jobs[pendingJob.systemJobEnumId] = pendingJob; | ||
return jobs; | ||
}, jobs) | ||
getMoreJobs: (state) => (jobEnums: any, enumTypeId: string): any => { | ||
const orderJobEnumIds = Object.values(jobEnums) as any; | ||
|
||
return Object.values(jobs) | ||
return Object.keys(state.cached).reduce((orders: any, enumId: any) => { | ||
if(orderJobEnumIds.indexOf(enumId) === -1 && state.cached[enumId]?.enumTypeId === enumTypeId) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead in place of indexOf, I think using includes will be a good option. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure sir |
||
orders.push(state.cached[enumId]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should change There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right sir. Fixed it. |
||
} | ||
return orders | ||
}, []) | ||
}, | ||
getPipelineFilters: (state) => { | ||
return state.pipelineFilters; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ | |
</ion-label> | ||
</ion-item> | ||
</ion-card> | ||
<MoreJobs v-if="moreJobs.length" :jobs="moreJobs" :jobEnums="jobEnums" /> | ||
<MoreJobs v-if="getMoreJobs(jobEnums, 'INVENTORY_SYS_JOB').length" :jobs="getMoreJobs(jobEnums, 'INVENTORY_SYS_JOB')" :jobEnums="jobEnums" /> | ||
</section> | ||
|
||
<aside class="desktop-only" v-if="isDesktop" v-show="currentJob"> | ||
|
@@ -171,22 +171,16 @@ export default defineComponent({ | |
this.getTemporalExpr(this.getJobStatus(this.jobEnums[enumId]))?.description : | ||
this.$t('Disabled') | ||
}, | ||
async fetchMoreJobs() { | ||
await this.store.dispatch("job/fetchMoreJobs", { | ||
"inputFields":{ | ||
"enumTypeId": "INVENTORY_SYS_JOB", | ||
}, | ||
}); | ||
getMoreJobs(jobEnums: any, enumTypeId: string) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this is needed? we could directly use moreJobs(jobEnums, enumTypeId) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes sir. Fixed it. |
||
return this.moreJobs(jobEnums, enumTypeId); | ||
} | ||
}, | ||
mounted () { | ||
this.store.dispatch("job/fetchJobs", { | ||
"inputFields":{ | ||
"systemJobEnumId": Object.values(this.jobEnums), | ||
"systemJobEnumId_op": "in" | ||
"enumTypeId": "INVENTORY_SYS_JOB" | ||
} | ||
}); | ||
this.fetchMoreJobs(); | ||
emitter.on('viewJobConfiguration', this.viewJobConfiguration) | ||
}, | ||
unmounted() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,7 +143,7 @@ | |
</ion-item-sliding> | ||
</ion-list> | ||
</ion-card> | ||
<MoreJobs v-if="moreJobs.length" :jobs="moreJobs" :jobEnums="jobEnums" /> | ||
<MoreJobs v-if="getMoreJobs(jobEnums, 'ORDER_SYS_JOB').length" :jobs="getMoreJobs(jobEnums, 'ORDER_SYS_JOB')" :jobEnums="jobEnums" /> | ||
</section> | ||
|
||
<aside class="desktop-only" v-if="isDesktop" v-show="currentJob"> | ||
|
@@ -475,19 +475,14 @@ export default defineComponent({ | |
this.autoCancelDays = ""; | ||
} | ||
}, | ||
async fetchMoreJobs() { | ||
await this.store.dispatch("job/fetchMoreJobs", { | ||
"inputFields":{ | ||
"enumTypeId": "ORDER_SYS_JOB", | ||
}, | ||
}); | ||
getMoreJobs(jobEnums: any, enumTypeId: string) { | ||
return this.moreJobs(jobEnums, enumTypeId); | ||
} | ||
}, | ||
mounted () { | ||
this.store.dispatch("job/fetchJobs", { | ||
"inputFields":{ | ||
"systemJobEnumId": Object.values(this.jobEnums), | ||
"systemJobEnumId_op": "in" | ||
"enumTypeId": "ORDER_SYS_JOB" | ||
} | ||
}); | ||
this.store.dispatch("job/fetchJobs", { | ||
|
@@ -500,7 +495,7 @@ export default defineComponent({ | |
if (this.currentEComStore.productStoreId) { | ||
this.getAutoCancelDays(); | ||
} | ||
this.fetchMoreJobs(); | ||
// this.moreJobs = this.getMoreJobs(this.jobEnums, "ORDER_SYS_JOB"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this comment if not needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done sir |
||
emitter.on('viewJobConfiguration', this.viewJobConfiguration) | ||
}, | ||
unmounted() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ | |
<ion-toggle slot="end" :checked="deleteProductsWebhook" @ionChange="updateWebhook($event['detail'].checked, 'DELETE_PRODUCTS')" color="secondary" /> | ||
</ion-item> | ||
</ion-card> | ||
<MoreJobs v-if="moreJobs.length" :jobs="moreJobs" :jobEnums="jobEnums" /> | ||
<MoreJobs v-if="getMoreJobs(jobEnums, 'PRODUCT_SYS_JOB').length" :jobs="getMoreJobs(jobEnums, 'PRODUCT_SYS_JOB').length" :jobEnums="jobEnums" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Define a local property to declare the enumTypeId value. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done sir |
||
</section> | ||
|
||
<aside class="desktop-only" v-if="isDesktop" v-show="currentJob"> | ||
|
@@ -127,12 +127,10 @@ export default defineComponent({ | |
mounted () { | ||
this.store.dispatch("job/fetchJobs", { | ||
"inputFields":{ | ||
"systemJobEnumId": Object.values(this.jobEnums), | ||
"systemJobEnumId_op": "in" | ||
"enumTypeId": "PRODUCT_SYS_JOB" | ||
} | ||
}); | ||
this.store.dispatch('webhook/fetchWebhooks') | ||
this.fetchMoreJobs(); | ||
emitter.on('viewJobConfiguration', this.viewJobConfiguration) | ||
}, | ||
unmounted() { | ||
|
@@ -180,12 +178,8 @@ export default defineComponent({ | |
this.getTemporalExpr(this.getJobStatus(this.jobEnums[enumId]))?.description : | ||
this.$t('Disabled') | ||
}, | ||
async fetchMoreJobs() { | ||
await this.store.dispatch("job/fetchMoreJobs", { | ||
"inputFields":{ | ||
"enumTypeId": "PRODUCT_SYS_JOB", | ||
}, | ||
}); | ||
getMoreJobs(jobEnums: any, enumTypeId: string) { | ||
return this.moreJobs(jobEnums, enumTypeId); | ||
} | ||
}, | ||
setup() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done