Skip to content
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

Added shop selector to menu footer (#2a7ymj3) #283

Merged
merged 29 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
94fb58e
Add shop selector to menu footer(#2a7ymj3)
Mayank909 May 10, 2022
e02e479
Implemented: On shop selection update the jobs on Pipeline.vue(#2a7ymj3)
Mayank909 May 11, 2022
973e3cf
Improved: changed the position of emitter.off subscriber in pipeline.…
Mayank909 May 11, 2022
9b96946
Remove console.log from the refreshJobs function(#2a7ymj3)
Mayank909 May 11, 2022
8df5946
Implemented: menu footerselection change the jobs details in all page…
Mayank909 May 12, 2022
60e4a02
Implemented: call fetchJobs method when component is mounted(#2a7ymj3)
Mayank909 May 16, 2022
c173227
Changed: suggested naming conventions of variable(#2a7ymj3)
Mayank909 May 16, 2022
7fd343d
Merge branch 'main' of https://github.com/hotwax/job-manager into #2a…
Mayank909 May 17, 2022
77df679
Merge branch 'main' of https://github.com/hotwax/job-manager into #2a…
Mayank909 May 19, 2022
39bdbc4
Improved: code by removing unwanted changes(#2a7ymj3)
Mayank909 May 19, 2022
220ee76
Improved: code by removing unwanted console satements(#2a7ymj3)
Mayank909 May 19, 2022
8099cc7
Improved: code sytex and naming conventions(#2a7ymj3)
Mayank909 May 23, 2022
102dc74
Merge branch 'main' of https://github.com/hotwax/job-manager into #2a…
Mayank909 May 23, 2022
1ee9478
Merge branch 'main' of https://github.com/hotwax/job-manager into #2a…
Mayank909 May 26, 2022
50cf09a
Fixed: Retry button spinner is moving on store changed(#2a7ymj3)
Mayank909 May 26, 2022
7ec6cf5
Removed: unwanted changes(#2a7ymj3)
Mayank909 May 26, 2022
e85443a
Merge branch 'main' of https://github.com/hotwax/job-manager into #2a…
disha1202 Sep 27, 2022
e635e8c
Reverted unwanted changes(#2a7ymj3)
disha1202 Sep 27, 2022
ceda856
Added a null check and reverted unwanted code(#2a7ymj3)
disha1202 Oct 6, 2022
12e477e
Improved code to emit product store change if user profile is not und…
disha1202 Oct 17, 2022
a6524cc
Fixed infinite loading and the event.target.complete is not a functi…
k2maan Nov 17, 2022
5db51f0
Resolved merge conflicts (#2a7ymj3)
k2maan Nov 29, 2022
553d042
Resolved merge conflicts (#2a7ymj3)
k2maan Nov 30, 2022
c097cc6
Fixed jobs not updating on changing stores from menu footer (#2a7ymj3)
k2maan Dec 1, 2022
72a7d02
Refactored code by removing unused function paramter (#2a7ymj)
k2maan Dec 5, 2022
7137435
Fixed ion-refresher spinning infinitely by adding event.target.comple…
k2maan Dec 6, 2022
792f198
Fixed refreshJobs in Miscallaneous page by re-adding event in the fun…
k2maan Dec 6, 2022
2240067
Merge branch 'main' into #2a7ymj3
adityasharma7 Dec 6, 2022
9f64c50
Fixed: passing undefined explicitly is not needed (#2a7ymj3)
adityasharma7 Dec 6, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions src/components/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,19 @@
<ion-item lines="none">
<ion-label class="ion-text-wrap">
<p class="overline">{{ instanceUrl }}</p>
{{ eComStore.storeName }}
<p>{{ currentShopifyConfig.name ? currentShopifyConfig.name : currentShopifyConfig.shopifyConfigName }}</p>
</ion-label>
<ion-note slot="end">{{ userProfile?.userTimeZone }}</ion-note>
</ion-item>
<ion-item lines="none">
<ion-select interface="popover" :value="eComStore.productStoreId" @ionChange="setEComStore($event)">
<ion-select-option v-for="store in (userProfile?.stores ? userProfile.stores : [])" :key="store.productStoreId" :value="store.productStoreId" >{{ store.storeName }}</ion-select-option>
</ion-select>
</ion-item>
<ion-item lines="none">
<ion-label class="ion-text-wrap">
<p>{{ currentShopifyConfig.name ? currentShopifyConfig.name : currentShopifyConfig.shopifyConfigName }}</p>
</ion-label>
</ion-item>
</ion-toolbar>
</ion-footer>
</ion-menu>
Expand All @@ -54,13 +62,16 @@ import {
IonMenu,
IonMenuToggle,
IonNote,
IonSelect,
IonSelectOption,
IonTitle,
IonToolbar
} from "@ionic/vue";
import { defineComponent, ref } from "vue";
import { mapGetters } from "vuex";
import { pulseOutline, calendarNumberOutline, terminalOutline, ticketOutline, albumsOutline, shirtOutline, settings, iceCreamOutline, libraryOutline } from "ionicons/icons";
import { useStore } from "@/store";
import emitter from "@/event-bus"
export default defineComponent({
name: "Menu",
components: {
Expand All @@ -75,6 +86,8 @@ export default defineComponent({
IonMenu,
IonMenuToggle,
IonNote,
IonSelect,
IonSelectOption,
IonTitle,
IonToolbar
},
Expand All @@ -94,6 +107,14 @@ export default defineComponent({
currentShopifyConfig: 'user/getCurrentShopifyConfig'
})
},
methods: {
async setEComStore(event: CustomEvent) {
if(this.userProfile) {
await this.store.dispatch('user/setEcomStore', { 'productStoreId': event.detail.value })
emitter.emit("productStoreChanged")
}
},
},
watch:{
$route (to) {
// When logout and login it should point to Oth index
Expand Down
1 change: 0 additions & 1 deletion src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ const actions: ActionTree<UserState, RootState> = {
if(!productStore) {
productStore = this.state.user.current.stores.find((store: any) => store.productStoreId === payload.productStoreId);
}

commit(types.USER_CURRENT_ECOM_STORE_UPDATED, productStore);
dispatch('getShopifyConfig', productStore.productStoreId);
await UserService.setUserPreference({
Expand Down
23 changes: 15 additions & 8 deletions src/views/InitialLoad.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,12 @@ export default defineComponent({
isDesktop: isPlatform('desktop')
}
},
mounted () {
this.store.dispatch("job/fetchJobs", {
"inputFields":{
"systemJobEnumId": Object.values(this.jobEnums),
"systemJobEnumId_op": "in"
}
})
this.store.dispatch('webhook/fetchWebhooks')
mounted() {
this.fetchJobs();
emitter.on("productStoreChanged", this.fetchJobs);
},
unmounted() {
emitter.off("productStoreChanged", this.fetchJobs);
},
computed: {
...mapGetters({
Expand Down Expand Up @@ -195,6 +193,15 @@ export default defineComponent({
this.isJobDetailAnimationCompleted = true;
}
},
fetchJobs(){
this.store.dispatch("job/fetchJobs", {
"inputFields":{
"systemJobEnumId": Object.values(this.jobEnums),
"systemJobEnumId_op": "in"
}
})
this.store.dispatch('webhook/fetchWebhooks')
},
async updateWebhook(checked: boolean, enumId: string) {
const webhook = this.getCachedWebhook[this.webhookEnums[enumId]]

Expand Down
15 changes: 10 additions & 5 deletions src/views/Inventory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,17 +171,22 @@ export default defineComponent({
return this.getTemporalExpr(this.getJobStatus(this.jobEnums[enumId]))?.description ?
this.getTemporalExpr(this.getJobStatus(this.jobEnums[enumId]))?.description :
this.$t('Disabled')
},
fetchJobs(){
this.store.dispatch("job/fetchJobs", {
"inputFields":{
"enumTypeId": "INVENTORY_SYS_JOB"
}
});
}
},
mounted () {
this.store.dispatch("job/fetchJobs", {
"inputFields":{
"enumTypeId": "INVENTORY_SYS_JOB"
}
});
this.fetchJobs();
emitter.on("productStoreChanged", this.fetchJobs);
emitter.on('viewJobConfiguration', this.viewJobConfiguration)
},
unmounted() {
emitter.off("productStoreChanged", this.fetchJobs);
emitter.off('viewJobConfiguration', this.viewJobConfiguration)
},
setup() {
Expand Down
35 changes: 20 additions & 15 deletions src/views/Orders.vue
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,23 @@ export default defineComponent({
});
return jobAlert.present();
},
fetchJobs(){
this.store.dispatch("job/fetchJobs", {
"inputFields": {
"enumTypeId": "ORDER_SYS_JOB"
}
});
this.store.dispatch("job/fetchJobs", {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think batch jobs should have enumTypeId as ORDER_SYS_JOB and we are already fetching those jobs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sir, the More Jobs section is not visible if we remove the code.

"inputFields": {
"systemJobEnumId": Object.values(this.batchJobEnums).map((jobEnum: any) => jobEnum.id),
"systemJobEnumId_op": "in"
}
});
this.store.dispatch('webhook/fetchWebhooks')
if (this.currentEComStore.productStoreId) {
this.getAutoCancelDays();
}
},
async getAutoCancelDays(){
const payload = {
"inputFields": {
Expand All @@ -479,24 +496,12 @@ export default defineComponent({
}
},
mounted () {
this.store.dispatch("job/fetchJobs", {
"inputFields":{
"enumTypeId": "ORDER_SYS_JOB"
}
});
this.store.dispatch("job/fetchJobs", {
"inputFields":{
"systemJobEnumId": Object.values(this.batchJobEnums).map((jobEnum: any) => jobEnum.id),
"systemJobEnumId_op": "in"
}
});
this.store.dispatch('webhook/fetchWebhooks')
if (this.currentEComStore.productStoreId) {
this.getAutoCancelDays();
}
this.fetchJobs();
emitter.on("productStoreChanged", this.fetchJobs);
emitter.on('viewJobConfiguration', this.viewJobConfiguration)
},
unmounted() {
emitter.off("productStoreChanged", this.fetchJobs);
emitter.off('viewJobConfiguration', this.viewJobConfiguration)
},
setup() {
Expand Down
12 changes: 7 additions & 5 deletions src/views/Pipeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<div v-if="pendingJobs?.length === 0">
<p class="ion-text-center">{{ $t("There are no jobs pending right now")}}</p>
<div class="ion-text-center">
<ion-button fill="outline" @click="refreshJobs()">
<ion-button fill="outline" @click="refreshJobs(undefined, true)">
{{ $t('retry') }}
<ion-spinner v-if="isRetrying" name="crescent" />
</ion-button>
Expand Down Expand Up @@ -97,7 +97,7 @@
<div v-if="runningJobs?.length === 0">
<p class="ion-text-center">{{ $t("There are no jobs running right now")}}</p>
<div class="ion-text-center">
<ion-button fill="outline" @click="refreshJobs()">
<ion-button fill="outline" @click="refreshJobs(undefined, true)">
{{ $t('retry') }}
<ion-spinner slot="end" v-if="isRetrying" name="crescent" />
</ion-button>
Expand Down Expand Up @@ -167,7 +167,7 @@
<div v-if="jobHistory?.length === 0">
<p class="ion-text-center">{{ $t("No jobs have run yet")}}</p>
<div class="ion-text-center">
<ion-button fill="outline" @click="refreshJobs()">
<ion-button fill="outline" @click="refreshJobs(undefined, true)">
{{ $t('retry') }}
<ion-spinner v-if="isRetrying" name="crescent" />
</ion-button>
Expand Down Expand Up @@ -457,8 +457,8 @@ export default defineComponent({
event.target.complete();
})
},
async refreshJobs(event: any) {
this.isRetrying = true;
async refreshJobs(event: any, isRetrying = false ) {
this.isRetrying = isRetrying;
if(this.segmentSelected === 'pending') {
this.getPendingJobs().then(() => {
if(event) event.target.complete();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if it is not breaking pull to refresh (ion-refresher)
https://ionicframework.com/docs/api/refresher#complete

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried "pull to refresh" on Pipeline page & loader keeps on spinning.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's running infinitely. How should I proceed now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could pass event as undefined for all the other cases then pull to refresh

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done sir.

Expand Down Expand Up @@ -589,9 +589,11 @@ export default defineComponent({
await this.store.dispatch('job/updateCurrentJob', { job: {} });
},
mounted(){
emitter.on("productStoreChanged", this.refreshJobs);
emitter.on("pinnedJobsUpdated", (this as any).updateSelectedPinnedJob);
},
unmounted(){
emitter.off("productStoreChanged", this.refreshJobs);
emitter.off('jobUpdated', this.updateJobs);
emitter.off("pinnedJobsUpdated", (this as any).updateSelectedPinnedJob);
},
Expand Down
15 changes: 10 additions & 5 deletions src/views/PreOrder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -311,18 +311,23 @@ export default defineComponent({
return this.getTemporalExpr(this.getJobStatus(this.jobEnums[enumId]))?.description ?
this.getTemporalExpr(this.getJobStatus(this.jobEnums[enumId]))?.description :
this.$t('Disabled')
},
fetchJobs(){
this.store.dispatch("job/fetchJobs", {
"inputFields":{
"enumTypeId": "PRE_ORD_SYS_JOB"
}
});
}
},
mounted () {
this.store.dispatch("job/fetchJobs", {
"inputFields":{
"enumTypeId": "PRE_ORD_SYS_JOB"
}
});
this.fetchJobs();
emitter.on("productStoreChanged", this.fetchJobs);
emitter.on('viewJobConfiguration', this.viewJobConfiguration)
},
unmounted() {
emitter.on('viewJobConfiguration', this.viewJobConfiguration)
emitter.off("productStoreChanged", this.fetchJobs);
},
setup() {
const store = useStore();
Expand Down
16 changes: 11 additions & 5 deletions src/views/Product.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,13 @@ export default defineComponent({
}
},
mounted () {
this.store.dispatch("job/fetchJobs", {
"inputFields":{
"enumTypeId": "PRODUCT_SYS_JOB"
}
});
this.fetchJobs();
emitter.on("productStoreChanged", this.fetchJobs);
this.store.dispatch('webhook/fetchWebhooks')
emitter.on('viewJobConfiguration', this.viewJobConfiguration)
},
unmounted() {
emitter.off("productStoreChanged", this.fetchJobs);
emitter.off('viewJobConfiguration', this.viewJobConfiguration)
},
methods: {
Expand Down Expand Up @@ -179,6 +177,14 @@ export default defineComponent({
return this.getTemporalExpr(this.getJobStatus(this.jobEnums[enumId]))?.description ?
this.getTemporalExpr(this.getJobStatus(this.jobEnums[enumId]))?.description :
this.$t('Disabled')
},
fetchJobs(){
this.store.dispatch("job/fetchJobs", {
"inputFields":{
"enumTypeId": "PRODUCT_SYS_JOB"
}
});
this.store.dispatch('webhook/fetchWebhooks')
}
},
setup() {
Expand Down