Skip to content
Snippets Groups Projects
Commit 0d29e5e0 authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Port to new common env api

parent 099321f9
No related branches found
No related tags found
No related merge requests found
import 'vpu-auth';
import './vpu-kb-wpe-view.js';
import {setting, getAPiUrl} from './utils.js';
import {i18n} from './i18n';
import {html, LitElement} from 'lit-element';
import commonUtils from 'vpu-common/utils';
......@@ -38,17 +37,17 @@ class KnowledgeBaseWebPageElementViewDemo extends LitElement {
<h1 class="title">KnowledgeBaseWebPageElementView-Demo</h1>
</div>
<div class="content">
<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="content">
<h2 class="subtitle">Deutsch</h2>
<p>Ein erster Schritt</p>
<vpu-knowledge-base-web-page-element-view lang="de" entry-point-url="${getAPiUrl()}" value="bedienstete/bibliothek/buch-ausleihen" text="Ein Buch ausleihen"></vpu-knowledge-base-web-page-element-view>
<vpu-knowledge-base-web-page-element-view lang="de" entry-point-url="${commonUtils.getAPiUrl()}" value="bedienstete/bibliothek/buch-ausleihen" text="Ein Buch ausleihen"></vpu-knowledge-base-web-page-element-view>
</div>
<div class="content">
<h2 class="subtitle">Englisch</h2>
<p>A first step</p>
<vpu-knowledge-base-web-page-element-view lang="en" entry-point-url="${getAPiUrl()}" value="bedienstete/bibliothek/buch-ausleihen" text="Borrow a book"></vpu-knowledge-base-web-page-element-view>
<vpu-knowledge-base-web-page-element-view lang="en" entry-point-url="${commonUtils.getAPiUrl()}" value="bedienstete/bibliothek/buch-ausleihen" text="Borrow a book"></vpu-knowledge-base-web-page-element-view>
</div>
<hr>
<div class="content">
......
import vars from './vars.js';
export const getAPiUrl = function(path = "", withPrefix = true) {
return vars.apiBaseUrl + (withPrefix ? vars.apiUrlPrefix : "") + path;
}
/**
* Reads a setting
*
* @param key
* @returns {*}
*/
export const setting = (key) => vars[key]
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;
......@@ -2,7 +2,6 @@ import {i18n} from './i18n';
import {html} from 'lit-element';
// import JSONLD from 'vpu-common/jsonld';
import VPULitElement from 'vpu-common/vpu-lit-element'
import {getAPiUrl} from "./utils";
import commonUtils from "vpu-common/utils";
import "vpu-common/vpu-mini-spinner.js";
import {unsafeHTML} from 'lit-html/directives/unsafe-html.js';
......@@ -16,7 +15,7 @@ class VPUKnowledgeBaseWebPageElementView extends VPULitElement {
this.lang = 'de';
this.value = '';
this.html = '';
this.entryPointUrl = getAPiUrl();
this.entryPointUrl = commonUtils.getAPiUrl();
this.error = '';
this.eyeClose = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA1ElEQVQ4ja3SMU5CURCF4c+ejpiILe5DZAGyASuJS5CKEoMGKhdAwWKgMkriKjQWFkAkBizgmckNPEgeJ7nVuee/M3eGI2mCehFAHZ/Hgtygizd84wsjPOHsEMgUqx1njvtd4R7uAmSIMipo4SeAHtLwdTCbG8gHLsOdVlJN9LwEY4nSFsh5AhhHwGtinoY/ySDlPEAjMbvByyDDvBbgOZi/eNxUkrUTp9NJw3CCNhbJS0vcBshgWzjqAn28W899Zr1U1dBObR8kT9nGXhWFTIoA/vUHQydS/iUcHx4AAAAASUVORK5CYII=';
this.eyeOpen = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA5UlEQVQ4jc3SvS7EURAF8B+JioSsCokHUFgNiWewQqvzICRew2v4WLFUnoNS/msrazUaFOYm12RlVeIkk9ycM2fmztzLf8U02tiPaAc3EbM4Rh8fKfo4wdxP5nXcV4YhLnGO54p/wEY2b6akHhYqfR7dVHyriMt4qsQRWtiNaw+wFwWHaaQlcc161l4UblIyXKTcM7hL5FUk14tsgsvNumIhb2NG6ISxiXMrtJI3wErZwyHeK/E2DAWLuKn0F2xLOEgdRriOeK34sc9YsIpT37dd4hFHvj7bRMxElw52sIap3xj/Hp9rzGFBhiMSxAAAAABJRU5ErkJggg==';
......
common @ fdcb4c14
Subproject commit 8535e4d2813417d35e592fc82bd7cee552b2d1ed
Subproject commit fdcb4c14ef0375b5dc61d48ca4f59bd6c2561708
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment