From 1ef7f601995bd9d62701a37e7af97f516844d85f Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Wed, 4 Oct 2023 19:14:24 +0530 Subject: [PATCH 1/5] Implemented: facility Switcher from dxp-components in settings page (dxp/138) --- package-lock.json | 340 +++++++++++++++++++++++++++-------------- package.json | 4 +- src/adapter/index.ts | 3 +- src/main.ts | 5 +- src/views/Settings.vue | 63 +++----- vue.config.js | 11 +- 6 files changed, 262 insertions(+), 164 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6af436a4..b69e6528 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,8 +14,8 @@ "@casl/ability": "^6.0.0", "@hotwax/app-version-info": "^1.0.0", "@hotwax/apps-theme": "^1.1.0", - "@hotwax/dxp-components": "^1.3.4", - "@hotwax/oms-api": "^1.7.0", + "@hotwax/dxp-components": "file:../dxp-components", + "@hotwax/oms-api": "^1.10.0", "@ionic/core": "6.7.5", "@ionic/vue": "6.7.5", "@ionic/vue-router": "6.7.5", @@ -62,6 +62,38 @@ "vue-cli-plugin-i18n": "^1.0.1" } }, + "../dxp-components": { + "version": "1.7.5", + "license": "Apache-2.0", + "dependencies": { + "@hotwax/oms-api": "^1.8.1", + "@ionic/core": "^6.7.5", + "@ionic/vue": "^6.7.5", + "@types/vue-barcode-reader": "^0.0.0", + "firebase": "^10.3.1", + "luxon": "^3.3.0", + "pinia": "2.0.36", + "pinia-plugin-persistedstate": "^3.1.0", + "vue": "^3.3.4", + "vue-barcode-reader": "^1.0.3", + "vue-i18n": "^9.2.2" + }, + "devDependencies": { + "@babel/types": "^7.22.11", + "@types/luxon": "^3.3.0", + "@types/node": "^20.5.7", + "@vitejs/plugin-vue": "^4.3.4", + "@vue/eslint-config-prettier": "^8.0.0", + "@vue/eslint-config-typescript": "^11.0.3", + "@vue/tsconfig": "^0.1.3", + "eslint": "^8.48.0", + "eslint-plugin-vue": "^9.17.0", + "rollup-plugin-typescript2": "^0.35.0", + "typescript": "~4.7.4", + "vite": "^4.4.9", + "vue-tsc": "^1.8.8" + } + }, "node_modules/@aashutoshrathi/word-wrap": { "version": "1.2.6", "dev": true, @@ -2127,20 +2159,13 @@ "license": "Apache-2.0" }, "node_modules/@hotwax/dxp-components": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/@hotwax/dxp-components/-/dxp-components-1.3.4.tgz", - "integrity": "sha512-uw0dmxm19lzsgcLWZ2fQBAZem0d7TkxGR0iSq1c7Bj1mkAJZXH5JbP12w0lYhtes7Q1MjhHPlWljCh6624E9XA==", - "dependencies": { - "@hotwax/oms-api": "^1.8.1", - "luxon": "^3.3.0", - "pinia": "2.0.36", - "pinia-plugin-persistedstate": "^3.1.0", - "vue": "^3.3.4" - } + "resolved": "../dxp-components", + "link": true }, "node_modules/@hotwax/oms-api": { - "version": "1.8.1", - "license": "Apache-2.0", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@hotwax/oms-api/-/oms-api-1.10.0.tgz", + "integrity": "sha512-Li9vqTsGHqfTalL2FWDAIPSEdiZyRLDQOcHzXf5YFo8yTLEgiBM1kvfl12nXYWRpVtE9DPDMHkqxkWRlQTM/Lw==", "dependencies": { "@types/node-json-transform": "^1.0.0", "axios": "^0.21.1", @@ -6129,6 +6154,15 @@ "node": ">=0.10.0" } }, + "node_modules/@vue/cli-plugin-unit-jest/node_modules/is-wsl": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", + "integrity": "sha512-gfygJYZ2gLTDlmbWMI0CE2MwnFzSN/2SZfkMlItC4K/JBlsWVDB0bO6XhqcY13YXE7iMcAJnzTCJjPiTeJJ0Mw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/@vue/cli-plugin-unit-jest/node_modules/istanbul-lib-coverage": { "version": "2.0.5", "dev": true, @@ -6667,6 +6701,28 @@ "node": ">=0.10.0" } }, + "node_modules/@vue/cli-plugin-unit-jest/node_modules/node-notifier": { + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.4.5.tgz", + "integrity": "sha512-tVbHs7DyTLtzOiN78izLA85zRqB9NvEXkAf014Vx3jtSvn/xBl6bR8ZYifj+dFcFrKI21huSQgJZ6ZtL3B4HfQ==", + "dev": true, + "dependencies": { + "growly": "^1.3.0", + "is-wsl": "^1.1.0", + "semver": "^5.5.0", + "shellwords": "^0.1.1", + "which": "^1.3.0" + } + }, + "node_modules/@vue/cli-plugin-unit-jest/node_modules/node-notifier/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, "node_modules/@vue/cli-plugin-unit-jest/node_modules/normalize-path": { "version": "2.1.1", "dev": true, @@ -22616,33 +22672,77 @@ "license": "MIT" }, "node_modules/node-notifier": { - "version": "5.4.5", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-10.0.1.tgz", + "integrity": "sha512-YX7TSyDukOZ0g+gmzjB6abKu+hTGvO8+8+gIFDsRCU2t8fLV/P2unmt+LGFaIa4y64aX98Qksa97rgz4vMNeLQ==", "dev": true, - "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "growly": "^1.3.0", - "is-wsl": "^1.1.0", - "semver": "^5.5.0", + "is-wsl": "^2.2.0", + "semver": "^7.3.5", "shellwords": "^0.1.1", - "which": "^1.3.0" + "uuid": "^8.3.2", + "which": "^2.0.2" } }, - "node_modules/node-notifier/node_modules/is-wsl": { - "version": "1.1.0", + "node_modules/node-notifier/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dev": true, - "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "yallist": "^4.0.0" + }, "engines": { - "node": ">=4" + "node": ">=10" } }, "node_modules/node-notifier/node_modules/semver": { - "version": "5.7.2", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dev": true, - "license": "ISC", + "optional": true, + "peer": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, "bin": { - "semver": "bin/semver" + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-notifier/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "optional": true, + "peer": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" } }, + "node_modules/node-notifier/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "optional": true, + "peer": true + }, "node_modules/node-releases": { "version": "2.0.13", "dev": true, @@ -23437,61 +23537,6 @@ "node": ">=0.10.0" } }, - "node_modules/pinia": { - "version": "2.0.36", - "license": "MIT", - "dependencies": { - "@vue/devtools-api": "^6.5.0", - "vue-demi": "*" - }, - "funding": { - "url": "https://github.com/sponsors/posva" - }, - "peerDependencies": { - "@vue/composition-api": "^1.4.0", - "typescript": ">=4.4.4", - "vue": "^2.6.14 || ^3.2.0" - }, - "peerDependenciesMeta": { - "@vue/composition-api": { - "optional": true - }, - "typescript": { - "optional": true - } - } - }, - "node_modules/pinia-plugin-persistedstate": { - "version": "3.2.0", - "license": "MIT", - "peerDependencies": { - "pinia": "^2.0.0" - } - }, - "node_modules/pinia/node_modules/vue-demi": { - "version": "0.14.5", - "hasInstallScript": true, - "license": "MIT", - "bin": { - "vue-demi-fix": "bin/vue-demi-fix.js", - "vue-demi-switch": "bin/vue-demi-switch.js" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - }, - "peerDependencies": { - "@vue/composition-api": "^1.0.0-rc.1", - "vue": "^3.0.0-0 || ^2.6.0" - }, - "peerDependenciesMeta": { - "@vue/composition-api": { - "optional": true - } - } - }, "node_modules/pinkie": { "version": "2.0.4", "dev": true, @@ -27608,7 +27653,7 @@ }, "node_modules/typescript": { "version": "4.7.4", - "devOptional": true, + "dev": true, "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", @@ -31937,19 +31982,38 @@ "version": "1.2.3" }, "@hotwax/dxp-components": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/@hotwax/dxp-components/-/dxp-components-1.3.4.tgz", - "integrity": "sha512-uw0dmxm19lzsgcLWZ2fQBAZem0d7TkxGR0iSq1c7Bj1mkAJZXH5JbP12w0lYhtes7Q1MjhHPlWljCh6624E9XA==", + "version": "file:../dxp-components", "requires": { + "@babel/types": "^7.22.11", "@hotwax/oms-api": "^1.8.1", + "@ionic/core": "^6.7.5", + "@ionic/vue": "^6.7.5", + "@types/luxon": "^3.3.0", + "@types/node": "^20.5.7", + "@types/vue-barcode-reader": "^0.0.0", + "@vitejs/plugin-vue": "^4.3.4", + "@vue/eslint-config-prettier": "^8.0.0", + "@vue/eslint-config-typescript": "^11.0.3", + "@vue/tsconfig": "^0.1.3", + "eslint": "^8.48.0", + "eslint-plugin-vue": "^9.17.0", + "firebase": "^10.3.1", "luxon": "^3.3.0", "pinia": "2.0.36", "pinia-plugin-persistedstate": "^3.1.0", - "vue": "^3.3.4" + "rollup-plugin-typescript2": "^0.35.0", + "typescript": "~4.7.4", + "vite": "^4.4.9", + "vue": "^3.3.4", + "vue-barcode-reader": "^1.0.3", + "vue-i18n": "^9.2.2", + "vue-tsc": "^1.8.8" } }, "@hotwax/oms-api": { - "version": "1.8.1", + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@hotwax/oms-api/-/oms-api-1.10.0.tgz", + "integrity": "sha512-Li9vqTsGHqfTalL2FWDAIPSEdiZyRLDQOcHzXf5YFo8yTLEgiBM1kvfl12nXYWRpVtE9DPDMHkqxkWRlQTM/Lw==", "requires": { "@types/node-json-transform": "^1.0.0", "axios": "^0.21.1", @@ -34728,6 +34792,12 @@ } } }, + "is-wsl": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", + "integrity": "sha512-gfygJYZ2gLTDlmbWMI0CE2MwnFzSN/2SZfkMlItC4K/JBlsWVDB0bO6XhqcY13YXE7iMcAJnzTCJjPiTeJJ0Mw==", + "dev": true + }, "istanbul-lib-coverage": { "version": "2.0.5", "dev": true @@ -35123,6 +35193,27 @@ } } }, + "node-notifier": { + "version": "5.4.5", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-5.4.5.tgz", + "integrity": "sha512-tVbHs7DyTLtzOiN78izLA85zRqB9NvEXkAf014Vx3jtSvn/xBl6bR8ZYifj+dFcFrKI21huSQgJZ6ZtL3B4HfQ==", + "dev": true, + "requires": { + "growly": "^1.3.0", + "is-wsl": "^1.1.0", + "semver": "^5.5.0", + "shellwords": "^0.1.1", + "which": "^1.3.0" + }, + "dependencies": { + "semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true + } + } + }, "normalize-path": { "version": "2.1.1", "dev": true, @@ -45887,23 +45978,61 @@ } }, "node-notifier": { - "version": "5.4.5", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-10.0.1.tgz", + "integrity": "sha512-YX7TSyDukOZ0g+gmzjB6abKu+hTGvO8+8+gIFDsRCU2t8fLV/P2unmt+LGFaIa4y64aX98Qksa97rgz4vMNeLQ==", "dev": true, + "optional": true, + "peer": true, "requires": { "growly": "^1.3.0", - "is-wsl": "^1.1.0", - "semver": "^5.5.0", + "is-wsl": "^2.2.0", + "semver": "^7.3.5", "shellwords": "^0.1.1", - "which": "^1.3.0" + "uuid": "^8.3.2", + "which": "^2.0.2" }, "dependencies": { - "is-wsl": { - "version": "1.1.0", - "dev": true + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "yallist": "^4.0.0" + } }, "semver": { - "version": "5.7.2", - "dev": true + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "optional": true, + "peer": true } } }, @@ -46421,23 +46550,6 @@ "version": "2.3.0", "dev": true }, - "pinia": { - "version": "2.0.36", - "requires": { - "@vue/devtools-api": "^6.5.0", - "vue-demi": "*" - }, - "dependencies": { - "vue-demi": { - "version": "0.14.5", - "requires": {} - } - } - }, - "pinia-plugin-persistedstate": { - "version": "3.2.0", - "requires": {} - }, "pinkie": { "version": "2.0.4", "dev": true @@ -49284,7 +49396,7 @@ }, "typescript": { "version": "4.7.4", - "devOptional": true + "dev": true }, "uglify-js": { "version": "3.4.10", diff --git a/package.json b/package.json index e3e94bc3..9d1ccea2 100644 --- a/package.json +++ b/package.json @@ -18,8 +18,8 @@ "@casl/ability": "^6.0.0", "@hotwax/app-version-info": "^1.0.0", "@hotwax/apps-theme": "^1.1.0", - "@hotwax/dxp-components": "^1.3.4", - "@hotwax/oms-api": "^1.7.0", + "@hotwax/dxp-components": "file:../dxp-components", + "@hotwax/oms-api": "^1.10.0", "@ionic/core": "6.7.5", "@ionic/vue": "6.7.5", "@ionic/vue-router": "6.7.5", diff --git a/src/adapter/index.ts b/src/adapter/index.ts index 0d512378..99fa8352 100644 --- a/src/adapter/index.ts +++ b/src/adapter/index.ts @@ -1,8 +1,9 @@ -import { api, client, initialise, resetConfig, updateInstanceUrl, updateToken } from '@hotwax/oms-api' +import { api, client, getConfig, initialise, resetConfig, updateInstanceUrl, updateToken } from '@hotwax/oms-api' export { api, client, + getConfig, initialise, resetConfig, updateInstanceUrl, diff --git a/src/main.ts b/src/main.ts index d27124dd..b86d0a97 100644 --- a/src/main.ts +++ b/src/main.ts @@ -33,6 +33,7 @@ import permissionRules from '@/authorization/Rules'; import permissionActions from '@/authorization/Actions'; import { dxpComponents } from '@hotwax/dxp-components' import { login, logout, loader } from './user-utils'; +import { getConfig, initialise } from './adapter'; const app = createApp(App) .use(IonicVue, { @@ -50,7 +51,9 @@ const app = createApp(App) login, logout, loader, - appLoginUrl: process.env.VUE_APP_LOGIN_URL as string + appLoginUrl: process.env.VUE_APP_LOGIN_URL as string, + getConfig, + initialise }); // Filters are removed in Vue 3 and global filter introduced https://v3.vuejs.org/guide/migration/filters.html#global-filters diff --git a/src/views/Settings.vue b/src/views/Settings.vue index fd91a018..bc555ff7 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -51,22 +51,8 @@ - - - - {{ $t("Facility") }} - - - - {{ $t('Specify which facility you want to operate from. Order, inventory and other configuration data will be specific to the facility you select.') }} - - - {{ $t("Select facility") }} - - {{ facility.name }} - - - + +
@@ -111,7 +97,7 @@