diff --git a/packages/data-table-view/package.json b/packages/data-table-view/package.json index 8a50aa1333355f5097a431a2180642b4f2c4a775..e1b605104feb67e02c907620233c383902a13a70 100644 --- a/packages/data-table-view/package.json +++ b/packages/data-table-view/package.json @@ -20,7 +20,6 @@ "rollup-plugin-multi-entry": "^2.1.0", "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-postcss": "^2.0.3", - "rollup-plugin-replace": "^2.2.0", "rollup-plugin-serve": "^1.0.1", "rollup-plugin-terser": "^5.1.1", "rollup-plugin-url": "^2.2.2", diff --git a/packages/data-table-view/rollup.config.js b/packages/data-table-view/rollup.config.js index 200cf882e4a28af2da4b2d5690f7099deb728ed1..939a2ddca32aa7e8f3b5aacda0cc5e5d2245e905 100644 --- a/packages/data-table-view/rollup.config.js +++ b/packages/data-table-view/rollup.config.js @@ -4,7 +4,6 @@ import commonjs from 'rollup-plugin-commonjs'; import copy from 'rollup-plugin-copy'; import {terser} from "rollup-plugin-terser"; import json from 'rollup-plugin-json'; -import replace from "rollup-plugin-replace"; import serve from 'rollup-plugin-serve'; import multiEntry from 'rollup-plugin-multi-entry'; import url from "rollup-plugin-url"; @@ -61,9 +60,6 @@ export default { emitFiles: true, fileName: 'shared/[name].[hash][extname]' }), - replace({ - "process.env.BUILD": '"' + build + '"', - }), (build !== 'local' && build !== 'test') ? terser() : false, copy({ targets: [ diff --git a/packages/data-table-view/src/utils.js b/packages/data-table-view/src/utils.js deleted file mode 100644 index 9fb5d57dacdae99fb6ae428c7dc3621f09549b21..0000000000000000000000000000000000000000 --- a/packages/data-table-view/src/utils.js +++ /dev/null @@ -1,34 +0,0 @@ -import vars from './vars.js'; - -export const getAPiUrl = function(path = "", withPrefix = true) { - return vars.apiBaseUrl + (withPrefix ? vars.apiUrlPrefix : "") + path; -} - -/** - * Finds an object in a JSON result by identifier - * - * @param identifier - * @param results - * @param identifierAttribute - */ -export const findObjectInApiResults = (identifier, results, identifierAttribute = "@id") => { - const members = results["hydra:member"]; - - if (members === undefined) { - return; - } - - for (const object of members){ - if (object[identifierAttribute] === identifier) { - return object; - } - } -} - -/** - * Reads a setting - * - * @param key - * @returns {*} - */ -export const setting = (key) => vars[key]; diff --git a/packages/data-table-view/src/vars.js b/packages/data-table-view/src/vars.js deleted file mode 100644 index 0e25edd8790c49edf590d995c992267aa2f11926..0000000000000000000000000000000000000000 --- a/packages/data-table-view/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/data-table-view/src/vpu-data-table-view-demo.js b/packages/data-table-view/src/vpu-data-table-view-demo.js index c3de4f64f70a63703e2bcc1e475a1520f823a293..5744b927df226e7a1b6b0fb2cfd96cef1d24ac1d 100644 --- a/packages/data-table-view/src/vpu-data-table-view-demo.js +++ b/packages/data-table-view/src/vpu-data-table-view-demo.js @@ -1,6 +1,5 @@ import 'vpu-auth'; import './vpu-data-table-view.js'; -import {setting,} from './utils.js'; import {i18n} from './i18n'; import {html, LitElement} from 'lit-element'; import * as commonUtils from 'vpu-common/utils'; @@ -99,7 +98,7 @@ class DataTableViewDemo extends LitElement { getAuthComponentHtml() { return this.noAuth ? html`` : html` <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> `; } diff --git a/packages/data-table-view/src/vpu-data-table-view.js b/packages/data-table-view/src/vpu-data-table-view.js index 3bff7bbc50605774c39188fa9ed1b3e1ceee60c5..ae1ae1c23c02ab8e5c95feecf0612567e90fa24e 100644 --- a/packages/data-table-view/src/vpu-data-table-view.js +++ b/packages/data-table-view/src/vpu-data-table-view.js @@ -8,7 +8,6 @@ import de from '../assets/datatables/i18n/German'; import en from '../assets/datatables/i18n/English'; import * as commonUtils from 'vpu-common/utils'; -import * as utils from "./utils"; import bulmaCSSPath from "bulma/css/bulma.min.css"; dt(window, $);