Skip to content

Commit

Permalink
Implemented support for the default alias
Browse files Browse the repository at this point in the history
If default alias configuration is set the login page should prepopulate the OMS field
  • Loading branch information
adityasharma7 committed Jul 4, 2023
1 parent 7dc4b74 commit e9b4bec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ VUE_APP_BASE_URL=
VUE_APP_ORDER_IN_BRKRNG_FILTERS=["orderTypeId: SALES_ORDER", "facilityId: _NA_", "orderStatusId: ORDER_APPROVED", "!orderItemStatusId: ITEM_CANCELLED" ]
VUE_APP_PERMISSION_ID=
VUE_APP_ALIAS=
VUE_APP_CTGRY_AND_BRKRNG_JOB=["JOB_REL_PREODR_CAT", "JOB_BKR_ORD", "JOB_RLS_ORD_DTE"]
VUE_APP_CTGRY_AND_BRKRNG_JOB=["JOB_REL_PREODR_CAT", "JOB_BKR_ORD", "JOB_RLS_ORD_DTE"]
VUE_APP_DEFAULT_ALIAS=
14 changes: 12 additions & 2 deletions src/views/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export default defineComponent({
password: "",
instanceUrl: "",
baseURL: process.env.VUE_APP_BASE_URL,
alias: process.env.VUE_APP_ALIAS ? JSON.parse(process.env.VUE_APP_ALIAS) : {}
alias: process.env.VUE_APP_ALIAS ? JSON.parse(process.env.VUE_APP_ALIAS) : {},
defaultAlias: process.env.VUE_APP_DEFAULT_ALIAS,
};
},
computed: {
Expand All @@ -65,7 +66,16 @@ export default defineComponent({
})
},
mounted() {
this.instanceUrl= this.currentInstanceUrl;
this.instanceUrl = this.currentInstanceUrl;
if (this.currentInstanceUrl) {
// If the current URL is available in alias show it for consistency
const currentInstanceUrlAlias = Object.keys(this.alias).find((key) => this.alias[key] === this.currentInstanceUrl);
currentInstanceUrlAlias && (this.instanceUrl = currentInstanceUrlAlias);
}
// If there is no current preference set the default one
if (!this.instanceUrl && this.defaultAlias) {
this.instanceUrl = this.defaultAlias;
}
},
methods: {
login: function () {
Expand Down

0 comments on commit e9b4bec

Please sign in to comment.