From 6f3d20198b582b0224b1e903340f5bd1e0c013c4 Mon Sep 17 00:00:00 2001 From: k2maan Date: Thu, 6 Oct 2022 12:11:35 +0530 Subject: [PATCH 01/50] Implement filters on pipeline page (#2uw73h5) --- src/components/Filters.vue | 256 ++++++++++++++++++++++++ src/store/modules/job/JobState.ts | 4 + src/store/modules/job/actions.ts | 31 ++- src/store/modules/job/getters.ts | 3 + src/store/modules/job/index.ts | 4 + src/store/modules/job/mutation-types.ts | 3 +- src/store/modules/job/mutations.ts | 4 + src/views/Pipeline.vue | 39 ++-- 8 files changed, 323 insertions(+), 21 deletions(-) create mode 100644 src/components/Filters.vue diff --git a/src/components/Filters.vue b/src/components/Filters.vue new file mode 100644 index 00000000..8261ae9f --- /dev/null +++ b/src/components/Filters.vue @@ -0,0 +1,256 @@ + + + + + diff --git a/src/store/modules/job/JobState.ts b/src/store/modules/job/JobState.ts index 3eeacaa7..5dea5e27 100644 --- a/src/store/modules/job/JobState.ts +++ b/src/store/modules/job/JobState.ts @@ -19,4 +19,8 @@ export default interface JobState { current: any; temporalExp: any; enumIds: any; + pipelineFilters: { + status: any, + category: any, + } } \ No newline at end of file diff --git a/src/store/modules/job/actions.ts b/src/store/modules/job/actions.ts index e4293d29..2af33826 100644 --- a/src/store/modules/job/actions.ts +++ b/src/store/modules/job/actions.ts @@ -42,7 +42,6 @@ const actions: ActionTree = { async fetchJobHistory({ commit, dispatch, state }, payload){ const params = { "inputFields": { - "statusId": ["SERVICE_CANCELLED", "SERVICE_CRASHED", "SERVICE_FAILED", "SERVICE_FINISHED"], "statusId_op": "in", "systemJobEnumId_op": "not-empty", "shopId_fld0_value": store.state.user.currentShopifyConfig?.shopId, @@ -51,13 +50,19 @@ const actions: ActionTree = { "shopId_fld1_grp": "2", "shopId_fld1_op": "empty" } as any, - "fieldList": [ "systemJobEnumId", "runTime", "tempExprId", "parentJobId", "serviceName", "jobId", "jobName", "statusId", "cancelDateTime", "finishDateTime", "startDateTime" ], + "fieldList": [ "systemJobEnumId", "runTime", "tempExprId", "parentJobId", "serviceName", "jobId", "jobName", "statusId", "cancelDateTime", "finishDateTime", "startDateTime" , "enumTypeId" ], "noConditionFind": "Y", "viewSize": payload.viewSize, "viewIndex": payload.viewIndex, "orderBy": "runTime DESC" } + if(payload.statusId && (payload.statusId.length >= 3 || payload.statusId.length == 0)) { + params.inputFields["statusId"] = ["SERVICE_CANCELLED", "SERVICE_CRASHED", "SERVICE_FAILED", "SERVICE_FINISHED"]; + } else { + params.inputFields["statusId"] = payload.statusId; + } + if(payload.systemJobEnumId && payload.systemJobEnumId.length > 0) { params.inputFields["systemJobEnumId"] = payload.systemJobEnumId params.inputFields["systemJobEnumId_op"] = "in" @@ -69,6 +74,11 @@ const actions: ActionTree = { params.inputFields["productStoreId_op"] = "empty" } + if(payload.enumTypeId && payload.enumTypeId.length > 0) { + params.inputFields["enumTypeId"] = payload.enumTypeId; + params.inputFields["enumTypeId_op"] = "in" + } + if (payload.queryString) { params.inputFields["enumName_value"] = "%"+ payload.queryString + "%" params.inputFields["enumName_op"] = "like" @@ -126,7 +136,7 @@ const actions: ActionTree = { "shopId_fld1_grp": "2", "shopId_fld1_op": "empty" } as any, - "fieldList": [ "systemJobEnumId", "runTime", "tempExprId", "parentJobId", "serviceName", "jobId", "jobName", "statusId" ], + "fieldList": [ "systemJobEnumId", "runTime", "tempExprId", "parentJobId", "serviceName", "jobId", "jobName", "statusId", "enumTypeId" ], "noConditionFind": "Y", "viewSize": payload.viewSize, "viewIndex": payload.viewIndex, @@ -144,6 +154,11 @@ const actions: ActionTree = { params.inputFields["productStoreId_op"] = "empty" } + if(payload.enumTypeId && payload.enumTypeId.length > 0) { + params.inputFields["enumTypeId"] = payload.enumTypeId; + params.inputFields["enumTypeId_op"] = "in" + } + if (payload.queryString) { params.inputFields["enumName_value"] = "%"+ payload.queryString + "%" params.inputFields["jobName_op"] = "like" @@ -199,7 +214,7 @@ const actions: ActionTree = { "shopId_fld1_grp": "2", "shopId_fld1_op": "empty", } as any, - "fieldList": [ "systemJobEnumId", "runTime", "tempExprId", "parentJobId", "serviceName", "jobId", "jobName", "currentRetryCount", "statusId", "productStoreId", "runtimeDataId", "shopId", "description" ], + "fieldList": [ "systemJobEnumId", "runTime", "tempExprId", "parentJobId", "serviceName", "jobId", "jobName", "currentRetryCount", "statusId", "productStoreId", "runtimeDataId", "shopId", "description", "enumTypeId" ], "noConditionFind": "Y", "viewSize": payload.viewSize, "viewIndex": payload.viewIndex, @@ -217,6 +232,11 @@ const actions: ActionTree = { params.inputFields["productStoreId_op"] = "empty" } + if(payload.enumTypeId && payload.enumTypeId.length > 0) { + params.inputFields["enumTypeId"] = payload.enumTypeId; + params.inputFields["enumTypeId_op"] = "in" + } + if (payload.queryString) { params.inputFields["enumName_value"] = "%"+ payload.queryString + "%" params.inputFields["enumName_op"] = "like" @@ -751,6 +771,9 @@ const actions: ActionTree = { } catch (err) { console.error(err); } + }, + setPipelineFilters({ commit }, filters) { + commit(types.JOB_PIPELINE_FILTERS_UPDATED, { filters }); } } export default actions; \ No newline at end of file diff --git a/src/store/modules/job/getters.ts b/src/store/modules/job/getters.ts index d27fa45f..56ee3a15 100644 --- a/src/store/modules/job/getters.ts +++ b/src/store/modules/job/getters.ts @@ -57,6 +57,9 @@ const getters: GetterTree = { isMiscellaneousJobsScrollable: (state) => { return state.miscellaneous.list?.length > 0 && state.miscellaneous.list?.length < state.miscellaneous.total }, + getPipelineFilters: (state) => { + return state.pipelineFilters; + }, } 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 83fba826..bc41db79 100644 --- a/src/store/modules/job/index.ts +++ b/src/store/modules/job/index.ts @@ -28,6 +28,10 @@ const jobModule: Module = { temporalExp: [], enumIds: {}, current: {}, + pipelineFilters: { + status: [], + category: [], + }, }, getters, actions, diff --git a/src/store/modules/job/mutation-types.ts b/src/store/modules/job/mutation-types.ts index 3311ab80..573f5303 100644 --- a/src/store/modules/job/mutation-types.ts +++ b/src/store/modules/job/mutation-types.ts @@ -7,4 +7,5 @@ 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' -export const JOB_MISCELLANEOUS_UPDATED = SN_JOB + '/MISCELLANEOUS_UPDATED' \ No newline at end of file +export const JOB_MISCELLANEOUS_UPDATED = SN_JOB + '/MISCELLANEOUS_UPDATED' +export const JOB_PIPELINE_FILTERS_UPDATED = SN_JOB + '/PIPELINE_FILTERS_UPDATED' \ No newline at end of file diff --git a/src/store/modules/job/mutations.ts b/src/store/modules/job/mutations.ts index 7d5dcad2..3b76616b 100644 --- a/src/store/modules/job/mutations.ts +++ b/src/store/modules/job/mutations.ts @@ -44,6 +44,10 @@ const mutations: MutationTree = { [types.JOB_MISCELLANEOUS_UPDATED] (state, payload){ state.miscellaneous.list = payload.jobs; state.miscellaneous.total = payload.total; + }, + [types.JOB_PIPELINE_FILTERS_UPDATED] (state, payload){ + state.pipelineFilters.category = payload.filters.category; + state.pipelineFilters.status = payload.filters.status; } } export default mutations; \ No newline at end of file diff --git a/src/views/Pipeline.vue b/src/views/Pipeline.vue index 5b209ce4..dcbe9256 100644 --- a/src/views/Pipeline.vue +++ b/src/views/Pipeline.vue @@ -1,15 +1,22 @@