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

Implemented: app version component from dxp-components(#214) #268

Merged
merged 4 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"Are you sure you want to change the time zone to?": "Are you sure you want to change the time zone to {timeZoneId}?",
"Authenticating": "Authenticating",
"Back to Launchpad": "Back to Launchpad",
"Built: ": "Built: {builtDateTime}",
"Camera permission denied.": "Camera permission denied.",
"Cancel": "Cancel",
"Change": "Change",
Expand Down Expand Up @@ -80,6 +81,7 @@
"Variance": "Variance",
"Variance reason": "Variance reason",
"Variance updated successfully": "Variance updated successfully",
"Version: ": "Version: {appVersion}",
"View": "View",
"You do not have permission to access the app.": "You do not have permission to access the app.",
"You do not have permission to access this page": "You do not have permission to access this page"
Expand Down
5 changes: 5 additions & 0 deletions src/locales/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import en from "./en.json"

export default {
"en-US": en
};
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import permissionActions from '@/authorization/Actions';
import { dxpComponents } from '@hotwax/dxp-components'
import { login, logout, loader } from './user-utils';
import { getConfig, getProductIdentificationPref, initialise, setProductIdentificationPref } from '@/adapter';
import localeMessages from './locales';

const app = createApp(App)
.use(IonicVue, {
Expand All @@ -55,6 +56,7 @@ const app = createApp(App)
getConfig,
getProductIdentificationPref,
initialise,
localeMessages,
setProductIdentificationPref
});

Expand Down
1 change: 1 addition & 0 deletions src/store/modules/user/UserState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export default interface UserState {
current: any;
currentFacility: object | null;
permissions: any;
pwaState: any;
instanceUrl: string;
config: any;
currentEComStore: any;
Expand Down
4 changes: 4 additions & 0 deletions src/store/modules/user/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,9 @@ const actions: ActionTree<UserState, RootState> = {
updateViewQOHConfig({ commit }, config) {
commit(types.USER_VIEW_QOH_CNFG_UPDATED, config)
},

updatePwaState({ commit }, payload) {
commit(types.USER_PWA_STATE_UPDATED, payload);
}
}
export default actions;
3 changes: 3 additions & 0 deletions src/store/modules/user/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ const getters: GetterTree <UserState, RootState> = {
},
getViewQOHConfig (state) {
return state.config;
},
getPwaState(state) {
return state.pwaState;
}
}
export default getters;
6 changes: 5 additions & 1 deletion src/store/modules/user/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ const userModule: Module<UserState, RootState> = {
currentQOHViewConfig: {},
viewQOH: false
},
currentEComStore: {}
currentEComStore: {},
pwaState: {
updateExists: false,
registration: null,
}
},
getters,
actions,
Expand Down
3 changes: 2 additions & 1 deletion src/store/modules/user/mutation-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export const USER_CURRENT_FACILITY_UPDATED = SN_USER + '/CURRENT_FACILITY_UPDATE
export const USER_INSTANCE_URL_UPDATED = SN_USER + '/INSTANCE_URL_UPDATED'
export const USER_PERMISSIONS_UPDATED = SN_USER + '/PERMISSIONS_UPDATED'
export const USER_CURRENT_ECOM_STORE_UPDATED = SN_USER + '/CURRENT_ECOM_STORE_UPDATED'
export const USER_VIEW_QOH_CNFG_UPDATED = SN_USER + '/VIEW_QOH_CNFG_UPDATED'
export const USER_VIEW_QOH_CNFG_UPDATED = SN_USER + '/VIEW_QOH_CNFG_UPDATED'
export const USER_PWA_STATE_UPDATED = SN_USER + '/PWA_STATE_UPDATED'
6 changes: 5 additions & 1 deletion src/store/modules/user/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ const mutations: MutationTree <UserState> = {
[types.USER_VIEW_QOH_CNFG_UPDATED] (state, payload) {
state.config.viewQOH = payload.viewQOH;
state.config.currentQOHViewConfig = payload.currentQOHViewConfig;
}
},
[types.USER_PWA_STATE_UPDATED](state, payload) {
state.pwaState.registration = payload.registration;
state.pwaState.updateExists = payload.updateExists;
},
}
export default mutations;
19 changes: 3 additions & 16 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,9 @@
</ion-card>
</section>
<hr />
<div class="section-header">
<h1>
{{ $t('App') }}
<p class="overline" >{{ "Version: " + appVersion }}</p>
</h1>
<p class="overline">{{ "Built: " + getDateTime(appInfo.builtTime) }}</p>
Ritika-Patel08 marked this conversation as resolved.
Show resolved Hide resolved
</div>

<DxpAppVersionInfo />

<section>
<DxpProductIdentifier />

Expand Down Expand Up @@ -103,7 +99,6 @@ import { codeWorkingOutline, ellipsisVertical, personCircleOutline, storefrontOu
import { mapGetters, useStore } from 'vuex';
import { useRouter } from 'vue-router';
import Image from '@/components/Image.vue'
import { DateTime } from 'luxon';
import TimeZoneModal from '@/views/TimezoneModal.vue';
import { Actions, hasPermission } from '@/authorization'
import { UserService } from '@/services/UserService'
Expand Down Expand Up @@ -136,15 +131,10 @@ export default defineComponent({
data() {
return {
baseURL: process.env.VUE_APP_BASE_URL,
appInfo: (process.env.VUE_APP_VERSION_INFO ? JSON.parse(process.env.VUE_APP_VERSION_INFO) : {}) as any,
appVersion: "",
currentFacilityId: "",
currentQOHViewConfig: {} as any
};
},
mounted() {
this.appVersion = this.appInfo.branch ? (this.appInfo.branch + "-" + this.appInfo.revision) : this.appInfo.tag;
},
ionViewWillEnter() {
this.currentFacilityId = this.currentFacility.facilityId;
this.getViewQOHConfig();
Expand Down Expand Up @@ -270,9 +260,6 @@ export default defineComponent({
},
goToLaunchpad() {
window.location.href = `${process.env.VUE_APP_LOGIN_URL}`
},
getDateTime(time: any) {
return DateTime.fromMillis(time).toLocaleString(DateTime.DATETIME_MED);
Ritika-Patel08 marked this conversation as resolved.
Show resolved Hide resolved
}
},
setup(){
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
Expand Down
Loading