diff --git a/packages/person-select/src/person-select-demo.js b/packages/person-select/src/person-select-demo.js index cd69e2c8ecfdd4fd52c7dcbef86cb1ca9ee1bb54..677221e29b00e7af1ddd1330dd4d7b1d71fe6a5a 100644 --- a/packages/person-select/src/person-select-demo.js +++ b/packages/person-select/src/person-select-demo.js @@ -1,4 +1,3 @@ -import {setting, getAPiUrl} from './utils.js'; import {i18n} from './i18n.js'; import {html, LitElement} from 'lit-element'; import './person-select.js'; @@ -35,20 +34,20 @@ class PersonSelectDemo extends LitElement { <h1 class="title">Person-Select-Demo</h1> </div> <div class="container"> - <vpu-auth lang="${this.lang}" client-id="${setting('keyCloakClientId')}" load-person force-login></vpu-auth> + <vpu-auth lang="${this.lang}" client-id="${commonUtils.setting('keyCloakClientId')}" load-person force-login></vpu-auth> </div> <div class="container"> <form> <div class="field"> <label class="label">Person 1</label> <div class="control"> - <vpu-person-select lang="${this.lang}" entry-point-url="${getAPiUrl()}"></vpu-person-select> + <vpu-person-select lang="${this.lang}" entry-point-url="${commonUtils.getAPiUrl()}"></vpu-person-select> </div> </div> <div class="field"> <label class="label">Person 2</label> <div class="control"> - <vpu-person-select lang="${this.lang}" entry-point-url="${getAPiUrl()}"></vpu-person-select> + <vpu-person-select lang="${this.lang}" entry-point-url="${commonUtils.getAPiUrl()}"></vpu-person-select> </div> </div> </form> diff --git a/packages/person-select/src/person-select.js b/packages/person-select/src/person-select.js index 53cccc24342204280f82d688f481de19bcbfdc28..1ac0bef0521e474a3043fb4a8442018380e81670 100644 --- a/packages/person-select/src/person-select.js +++ b/packages/person-select/src/person-select.js @@ -1,5 +1,5 @@ import $ from 'jquery'; -import {getAPiUrl, getAssetURL, findObjectInApiResults} from './utils.js'; +import {getAssetURL, findObjectInApiResults} from './utils.js'; import select2 from 'select2'; import select2LangDe from './i18n/de/select2' import select2LangEn from './i18n/en/select2' @@ -18,7 +18,7 @@ class PersonSelect extends VPULitElementJQuery { constructor() { super(); this.lang = 'de'; - this.entryPointUrl = getAPiUrl(); + this.entryPointUrl = commonUtils.getAPiUrl(); this.jsonld = null; this.$select = null; // For some reason using the same ID on the whole page twice breaks select2 (regardless if they are in different custom elements) diff --git a/packages/person-select/src/utils.js b/packages/person-select/src/utils.js index a1365827a5636b0c3123e8b5fc0f7f24a089b61c..c56cdbfc34bf97116504fc85e6eeea52e423aa6d 100644 --- a/packages/person-select/src/utils.js +++ b/packages/person-select/src/utils.js @@ -1,5 +1,3 @@ -import vars from './vars.js'; - export const getAssetURL = (path) => { const elm = document.getElementById('vpu-library-shelving-wc-src'); if (!elm) @@ -10,10 +8,6 @@ export const getAssetURL = (path) => { return new URL(path, url).href; } -export const getAPiUrl = function(path = "", withPrefix = true) { - return vars.apiBaseUrl + (withPrefix ? vars.apiUrlPrefix : "") + path; -} - /** * Finds an object in a JSON result by identifier * @@ -34,11 +28,3 @@ export const findObjectInApiResults = (identifier, results, identifierAttribute } } } - -/** - * Reads a setting - * - * @param key - * @returns {*} - */ -export const setting = (key) => vars[key] diff --git a/packages/person-select/src/vars.js b/packages/person-select/src/vars.js deleted file mode 100644 index 0e25edd8790c49edf590d995c992267aa2f11926..0000000000000000000000000000000000000000 --- a/packages/person-select/src/vars.js +++ /dev/null @@ -1,35 +0,0 @@ -var config; - -switch(process.env.BUILD) { - case "development": - config = { - apiBaseUrl: 'https://mw-dev.tugraz.at', - apiUrlPrefix: '', - keyCloakClientId: 'auth-dev-mw-frontend', - }; - - break; - case "production": - config = { - apiBaseUrl: 'https://mw.tugraz.at', - apiUrlPrefix: '', - keyCloakClientId: 'auth-prod-mw-frontend', - }; - break; - case "demo": - config = { - apiBaseUrl: 'https://api-demo.tugraz.at', - apiUrlPrefix: '', - keyCloakClientId: 'auth-dev-mw-frontend', - }; - break; - case "local": - default: - config = { - apiBaseUrl: 'http://127.0.0.1:8000', - apiUrlPrefix: '', - keyCloakClientId: 'auth-dev-mw-frontend-local', - }; -} - -export default config; diff --git a/packages/person-select/vendor/auth b/packages/person-select/vendor/auth index a84042737467c0649c083746aa35b43613fdf64a..159424d24146333ea48ff59d907120acf976ed37 160000 --- a/packages/person-select/vendor/auth +++ b/packages/person-select/vendor/auth @@ -1 +1 @@ -Subproject commit a84042737467c0649c083746aa35b43613fdf64a +Subproject commit 159424d24146333ea48ff59d907120acf976ed37 diff --git a/packages/person-select/vendor/common b/packages/person-select/vendor/common index 332288561f010110799081f426d4addfc0b1ffcd..fdcb4c14ef0375b5dc61d48ca4f59bd6c2561708 160000 --- a/packages/person-select/vendor/common +++ b/packages/person-select/vendor/common @@ -1 +1 @@ -Subproject commit 332288561f010110799081f426d4addfc0b1ffcd +Subproject commit fdcb4c14ef0375b5dc61d48ca4f59bd6c2561708