diff --git a/src/services/UtilService.ts b/src/services/UtilService.ts index d662f5e..ea217a5 100644 --- a/src/services/UtilService.ts +++ b/src/services/UtilService.ts @@ -32,7 +32,15 @@ const fetchFacilityGroups = async (payload: any): Promise => { }); } +const checkOmsConnection = async (): Promise => { + return api({ + url: `checkOmsConnection`, + method: "GET" + }); +} + export const UtilService = { + checkOmsConnection, fetchEnums, fetchFacilities, fetchFacilityGroups, diff --git a/src/store/modules/user/actions.ts b/src/store/modules/user/actions.ts index 7ca094e..f46c5c5 100644 --- a/src/store/modules/user/actions.ts +++ b/src/store/modules/user/actions.ts @@ -48,6 +48,7 @@ const actions: ActionTree = { // TODO add any other tasks if need commit(types.USER_END_SESSION) this.dispatch("orderRouting/clearRouting") + this.dispatch("util/clearUtilState") }, /** diff --git a/src/store/modules/util/UtilState.ts b/src/store/modules/util/UtilState.ts index c4036f1..a58bcf9 100644 --- a/src/store/modules/util/UtilState.ts +++ b/src/store/modules/util/UtilState.ts @@ -8,5 +8,6 @@ export default interface UtilState { }; facilities: object; shippingMethods: object; - facilityGroups: object + facilityGroups: object; + isOmsConnectionExist: boolean | undefined; } \ No newline at end of file diff --git a/src/store/modules/util/actions.ts b/src/store/modules/util/actions.ts index 808d7f3..b9579de 100644 --- a/src/store/modules/util/actions.ts +++ b/src/store/modules/util/actions.ts @@ -119,6 +119,25 @@ const actions: ActionTree = { } commit(types.UTIL_FACILITY_GROUP_UPDATED, facilityGroups) + }, + + async checkOmsConnectionStatus({ commit }) { + let isOmsConnectionExist = false + try { + const resp = await UtilService.checkOmsConnection(); + + if(!hasError(resp)) { + isOmsConnectionExist = true + } + } catch(err) { + logger.error('error', err) + } + + commit(types.UTIL_OMS_CONNECTION_STATUS_UPDATED, isOmsConnectionExist) + }, + + async clearUtilState({ commit }) { + commit(types.UTIL_CLEARED) } } diff --git a/src/store/modules/util/getters.ts b/src/store/modules/util/getters.ts index 9a1d198..1642515 100644 --- a/src/store/modules/util/getters.ts +++ b/src/store/modules/util/getters.ts @@ -14,6 +14,9 @@ const getters: GetterTree = { }, getFacilityGroups(state) { return state.facilityGroups + }, + isOmsConnectionExist(state) { + return state.isOmsConnectionExist } } diff --git a/src/store/modules/util/index.ts b/src/store/modules/util/index.ts index c8c2d73..3719b3e 100644 --- a/src/store/modules/util/index.ts +++ b/src/store/modules/util/index.ts @@ -11,7 +11,8 @@ const utilModule: Module = { enums: {}, facilities: {}, shippingMethods: {}, - facilityGroups: {} + facilityGroups: {}, + isOmsConnectionExist: undefined }, getters, actions, diff --git a/src/store/modules/util/mutation-types.ts b/src/store/modules/util/mutation-types.ts index b3224b2..db37ed1 100644 --- a/src/store/modules/util/mutation-types.ts +++ b/src/store/modules/util/mutation-types.ts @@ -2,4 +2,6 @@ export const SN_UTIL = "util" export const UTIL_ENUMS_UPDATED = SN_UTIL + "/ENUMS_UPDATED" export const UTIL_FACILITIES_UPDATED = SN_UTIL + "/FACILITIES_UPDATED" export const UTIL_SHIPPING_METHOD_UPDATED = SN_UTIL + "/SHIPPING_METHOD_UPDATED" -export const UTIL_FACILITY_GROUP_UPDATED = SN_UTIL + "/FACILITY_GROUP_UPDATED" \ No newline at end of file +export const UTIL_FACILITY_GROUP_UPDATED = SN_UTIL + "/FACILITY_GROUP_UPDATED" +export const UTIL_OMS_CONNECTION_STATUS_UPDATED = SN_UTIL + "/OMS_CONNECTION_STATUS_UPDATED" +export const UTIL_CLEARED = SN_UTIL + "/CLEARED" \ No newline at end of file diff --git a/src/store/modules/util/mutations.ts b/src/store/modules/util/mutations.ts index 3d90026..a02263d 100644 --- a/src/store/modules/util/mutations.ts +++ b/src/store/modules/util/mutations.ts @@ -14,6 +14,16 @@ const mutations: MutationTree = { }, [types.UTIL_FACILITY_GROUP_UPDATED](state, payload) { state.facilityGroups = payload + }, + [types.UTIL_OMS_CONNECTION_STATUS_UPDATED](state, payload) { + state.isOmsConnectionExist = payload + }, + [types.UTIL_CLEARED](state) { + state.enums = {} + state.facilities = {} + state.shippingMethods = {} + state.facilityGroups = {} + state.isOmsConnectionExist = undefined } } export default mutations; \ No newline at end of file diff --git a/src/views/BrokeringRoute.vue b/src/views/BrokeringRoute.vue index 4a87afb..7d7cc31 100644 --- a/src/views/BrokeringRoute.vue +++ b/src/views/BrokeringRoute.vue @@ -71,6 +71,14 @@ {{ "Scheduler" }} + + + {{ "Connection configuration is missing for oms." }} + + + + + @@ -80,10 +88,10 @@
- {{ "Disable" }} + {{ "Disable" }}
- {{ "Save changes" }} + {{ "Save changes" }}
@@ -106,7 +114,7 @@