diff --git a/src/components/JobConfiguration.vue b/src/components/JobConfiguration.vue index 4d9879e9..029f722c 100644 --- a/src/components/JobConfiguration.vue +++ b/src/components/JobConfiguration.vue @@ -2,7 +2,7 @@

{{ $t(title) }}

- {{ $t("running") }} {{ timeTillJob(currentJob.runTime) }} + {{ $t("running") }} {{ timeTillJob(currentJob.runTime) }}
diff --git a/src/components/Menu.vue b/src/components/Menu.vue index ed682157..644dd560 100644 --- a/src/components/Menu.vue +++ b/src/components/Menu.vue @@ -54,7 +54,7 @@ import { } from "@ionic/vue"; import { defineComponent, ref } from "vue"; import { mapGetters } from "vuex"; -import { pulseOutline, calendarNumberOutline, ticketOutline, albumsOutline, shirtOutline, settings, iceCreamOutline } from "ionicons/icons"; +import { pulseOutline, calendarNumberOutline, ticketOutline, albumsOutline, shirtOutline, settings, iceCreamOutline, libraryOutline } from "ionicons/icons"; import { useStore } from "@/store"; export default defineComponent({ name: "Menu", @@ -142,6 +142,13 @@ export default defineComponent({ mdIcon: shirtOutline, dependsOnBaseURL: false }, + { + title: "Miscellaneous", + url: "/miscellaneous", + iosIcon: libraryOutline, + mdIcon: libraryOutline, + dependsOnBaseURL: false + }, { title: "Settings", url: "/settings", @@ -163,7 +170,8 @@ export default defineComponent({ shirtOutline, settings, iceCreamOutline, - store + store, + libraryOutline }; }, }); diff --git a/src/locales/en.json b/src/locales/en.json index bd485a36..a2456703 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -79,6 +79,8 @@ "Last Shopify Order ID": "Last Shopify Order ID", "Login": "Login", "Logout": "Logout", + "Miscellaneous": "Miscellaneous", + "Miscellaneous jobs": "Miscellaneous jobs", "More options": "More options", "New broker run": "New broker run", "New orders": "New orders", diff --git a/src/router/index.ts b/src/router/index.ts index 74b916e4..cf7e3458 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -7,6 +7,7 @@ import PreOrder from '@/views/PreOrder.vue' import Orders from '@/views/Orders.vue' import JobDetails from '@/views/JobDetails.vue' import InitialLoad from '@/views/InitialLoad.vue' +import Miscellaneous from '@/views/Miscellaneous.vue' import Login from '@/views/Login.vue' import Settings from "@/views/Settings.vue" import store from '@/store' @@ -74,6 +75,12 @@ const routes: Array = [ component: InitialLoad, beforeEnter: authGuard }, + { + path: '/miscellaneous', + name: 'Miscellaneous', + component: Miscellaneous, + beforeEnter: authGuard + }, { path: '/login', name: 'Login', diff --git a/src/store/modules/job/JobState.ts b/src/store/modules/job/JobState.ts index 0f8dfcc2..3eeacaa7 100644 --- a/src/store/modules/job/JobState.ts +++ b/src/store/modules/job/JobState.ts @@ -11,7 +11,11 @@ export default interface JobState { history: { list: any, total: 0 - }, + } + miscellaneous: { + list: any, + total: 0 + } current: any; temporalExp: any; enumIds: any; diff --git a/src/store/modules/job/actions.ts b/src/store/modules/job/actions.ts index 71f665a8..38aca0b4 100644 --- a/src/store/modules/job/actions.ts +++ b/src/store/modules/job/actions.ts @@ -254,6 +254,63 @@ const actions: ActionTree = { showToast(translate("Something went wrong")); }) }, + async fetchMiscellaneousJobs({ commit, dispatch, state }, payload){ + const params = { + "inputFields": { + "enumTypeId": "MISC_SYS_JOB", + "statusId": ["SERVICE_PENDING", "SERVICE_DRAFT"], + "statusId_op": "in", + "systemJobEnumId_op": "not-empty", + "shopId_fld0_value": store.state.user.currentShopifyConfig?.shopId, + "shopId_fld0_grp": "1", + "shopId_fld0_op": "equals", + "shopId_fld1_grp": "2", + "shopId_fld1_op": "empty" + } as any, + "fieldList": [ "systemJobEnumId", "runTime", "tempExprId", "parentJobId", "serviceName", "jobId", "jobName", "currentRetryCount", "statusId", "productStoreId", "runTimeDataId", "enumName", "shopId", "description" ], + "noConditionFind": "Y", + "viewSize": payload.viewSize, + "viewIndex": payload.viewIndex, + } + + if(payload.eComStoreId) { + params.inputFields["productStoreId"] = payload.eComStoreId + } else { + params.inputFields["productStoreId_op"] = "empty" + } + + try { + const resp = await JobService.fetchJobInformation(params) + if (resp.status === 200 && !hasError(resp) && resp.data.docs?.length > 0) { + const total = resp.data.count; + let jobs = resp.data.docs.map((job: any) => { + return { + ...job, + 'status': job?.statusId + } + }) + if(payload.viewIndex && payload.viewIndex > 0){ + jobs = state.miscellaneous.list.concat(jobs); + } + commit(types.JOB_MISCELLANEOUS_UPDATED, { jobs, total }); + const tempExprList = [] as any; + const enumIds = [] as any; + resp.data.docs.map((item: any) => { + enumIds.push(item.systemJobEnumId); + tempExprList.push(item.tempExprId); + }) + const tempExpr = [...new Set(tempExprList)]; + dispatch('fetchTemporalExpression', tempExpr); + dispatch('fetchJobDescription', enumIds); + } else { + commit(types.JOB_MISCELLANEOUS_UPDATED, { jobs: [], total: 0 }); + } + } catch (err) { + commit(types.JOB_MISCELLANEOUS_UPDATED, { jobs: [], total: 0 }); + console.error(err); + showToast(translate("Something went wrong")); + } + }, async fetchTemporalExpression({ state, commit }, tempExprIds){ const tempIds = [] as any; const cachedTempExprId = Object.keys(state.temporalExp); diff --git a/src/store/modules/job/getters.ts b/src/store/modules/job/getters.ts index 315a816d..d27fa45f 100644 --- a/src/store/modules/job/getters.ts +++ b/src/store/modules/job/getters.ts @@ -50,7 +50,13 @@ const getters: GetterTree = { }, getCurrentJob (state) { return state.current; - } + }, + getMiscellaneousJobs (state){ + return state.miscellaneous.list; + }, + isMiscellaneousJobsScrollable: (state) => { + return state.miscellaneous.list?.length > 0 && state.miscellaneous.list?.length < state.miscellaneous.total + }, } export default getters; \ No newline at end of file diff --git a/src/store/modules/job/index.ts b/src/store/modules/job/index.ts index be7a1a4b..83fba826 100644 --- a/src/store/modules/job/index.ts +++ b/src/store/modules/job/index.ts @@ -21,6 +21,10 @@ const jobModule: Module = { list: [], total: 0 }, + miscellaneous: { + list: [], + total: 0 + }, temporalExp: [], enumIds: {}, current: {}, diff --git a/src/store/modules/job/mutation-types.ts b/src/store/modules/job/mutation-types.ts index 3836509a..3311ab80 100644 --- a/src/store/modules/job/mutation-types.ts +++ b/src/store/modules/job/mutation-types.ts @@ -6,4 +6,5 @@ export const JOB_TEMPORAL_EXPRESSION_UPDATED = SN_JOB + '/TEMPORAL_EXPRESSION_UP export const JOB_DESCRIPTION_UPDATED = SN_JOB + '/DESCRIPTION_UPDATED' export const JOB_HISTORY_UPDATED = SN_JOB + '/HISTORY_UPDATED' export const JOB_RUNNING_UPDATED = SN_JOB + '/RUNNING_UPDATED' -export const JOB_CURRENT_UPDATED = SN_JOB + '/CURRENT_UPDATED' \ No newline at end of file +export const JOB_CURRENT_UPDATED = SN_JOB + '/CURRENT_UPDATED' +export const JOB_MISCELLANEOUS_UPDATED = SN_JOB + '/MISCELLANEOUS_UPDATED' \ No newline at end of file diff --git a/src/store/modules/job/mutations.ts b/src/store/modules/job/mutations.ts index 6a451777..7d5dcad2 100644 --- a/src/store/modules/job/mutations.ts +++ b/src/store/modules/job/mutations.ts @@ -40,6 +40,10 @@ const mutations: MutationTree = { }, [types.JOB_CURRENT_UPDATED] (state, payload){ state.current = payload + }, + [types.JOB_MISCELLANEOUS_UPDATED] (state, payload){ + state.miscellaneous.list = payload.jobs; + state.miscellaneous.total = payload.total; } } export default mutations; \ No newline at end of file diff --git a/src/views/Miscellaneous.vue b/src/views/Miscellaneous.vue new file mode 100644 index 00000000..1bc05437 --- /dev/null +++ b/src/views/Miscellaneous.vue @@ -0,0 +1,153 @@ + + + + +