Skip to content
Commits on Source (8)
{
"extends": "./../../eslint.common.json"
"extends": "./../../eslint.common.json",
"root": true
}
\ No newline at end of file
{
"name": "@dbp-toolkit/app-shell",
"homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/app-shell",
"version": "0.2.1",
"version": "0.2.2",
"main": "src/index.js",
"license": "LGPL-2.1-or-later",
"repository": {
......@@ -34,12 +34,12 @@
"rollup-plugin-serve": "^1.0.1"
},
"dependencies": {
"@dbp-toolkit/auth": "^0.2.1",
"@dbp-toolkit/common": "^0.2.1",
"@dbp-toolkit/language-select": "^0.2.1",
"@dbp-toolkit/matomo": "^0.2.1",
"@dbp-toolkit/notification": "^0.2.1",
"@dbp-toolkit/person-profile": "^0.2.1",
"@dbp-toolkit/auth": "^0.2.2",
"@dbp-toolkit/common": "^0.2.2",
"@dbp-toolkit/language-select": "^0.2.2",
"@dbp-toolkit/matomo": "^0.2.2",
"@dbp-toolkit/notification": "^0.2.2",
"@dbp-toolkit/person-profile": "^0.2.2",
"@open-wc/scoped-elements": "^1.3.2",
"i18next": "^19.8.4",
"lit-element": "^2.4.0",
......
......@@ -61,6 +61,7 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
this.buildUrl = '';
this.buildTime = '';
this._loginStatus = 'unknown';
this._roles = [];
this.matomoUrl = '';
this.matomoSiteId = -1;
......@@ -138,6 +139,7 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
activity.visible = visible;
// Resolve module_src relative to the location of the json file
activity.module_src = new URL(activity.module_src, actURL).href;
activity.required_roles = activity.required_roles || [];
metadata[activity.routing_name] = activity;
routes.push(activity.routing_name);
} catch (error) {
......@@ -238,6 +240,7 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
subtitle: { type: String, attribute: false },
description: { type: String, attribute: false },
_loginStatus: { type: Boolean, attribute: false },
_roles: { type: Array, attribute: false },
matomoUrl: { type: String, attribute: "matomo-url" },
matomoSiteId: { type: Number, attribute: "matomo-site-id" },
noWelcomePage: { type: Boolean, attribute: "no-welcome-page" },
......@@ -290,6 +293,12 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
break;
case 'auth':
{
if (this.auth.person) {
this._roles = this.auth.person['roles'];
} else {
this._roles = [];
}
const loginStatus = this.auth['login-status'];
if (loginStatus !== this._loginStatus) {
console.log('Login status: ' + loginStatus);
......@@ -790,8 +799,18 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
let menuTemplates = [];
for (let routingName of this.routes) {
const data = this.metadata[routingName];
const requiredRoles = data['required_roles'];
let visible = data['visible'];
// Hide them until the user is logged in and we knwo the roles of the user
for (let role of requiredRoles) {
if (!this._roles.includes(role)) {
visible = false;
break;
}
}
if (data['visible']) {
if (visible) {
menuTemplates.push(html`<li><a @click="${(e) => this.onMenuItemClick(e)}" href="${this.router.getPathname({component: routingName})}" data-nav class="${getSelectClasses(routingName)}" title="${this.metaDataText(routingName, "description")}">${this.metaDataText(routingName, "short_name")}</a></li>`);
}
}
......
......@@ -41,7 +41,11 @@ class AppShellWelcome extends ScopedElementsMixin(LitElement) {
p { line-height: 1.8em }
.item {padding-top: 0.5em;}
.description {padding-left: 2em;}
.description {
padding-left: 2em;
font-style: italic;
margin-top: -5px;
}
h2 a:hover {
color: #E4154B;
......@@ -95,7 +99,8 @@ export const appWelcomeMeta = {
"de": "",
"en": ""
},
visible: true
visible: true,
required_roles: [],
};
commonUtils.defineCustomElement('dbp-app-shell-welcome', AppShellWelcome);
{
"name": "@dbp-toolkit/auth",
"homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/auth",
"version": "0.2.1",
"version": "0.2.2",
"main": "src/index.js",
"license": "LGPL-2.1-or-later",
"repository": {
......@@ -37,7 +37,7 @@
"rollup-plugin-terser": "^7.0.2"
},
"dependencies": {
"@dbp-toolkit/common": "^0.2.1",
"@dbp-toolkit/common": "^0.2.2",
"@open-wc/scoped-elements": "^1.3.2",
"event-target-shim": "^6.0.0",
"lit-element": "^2.4.0"
......
{
"name": "@dbp-toolkit/check-in-place-select",
"homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/check-in-place-select",
"version": "0.2.1",
"version": "0.2.2",
"main": "src/index.js",
"license": "LGPL-2.1-or-later",
"repository": {
......@@ -35,8 +35,8 @@
"rollup-plugin-terser": "^7.0.2"
},
"dependencies": {
"@dbp-toolkit/auth": "^0.2.1",
"@dbp-toolkit/common": "^0.2.1",
"@dbp-toolkit/auth": "^0.2.2",
"@dbp-toolkit/common": "^0.2.2",
"@open-wc/scoped-elements": "^1.3.2",
"jquery": "^3.4.1",
"lit-element": "^2.4.0",
......
{
"name": "@dbp-toolkit/common",
"homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/common",
"version": "0.2.1",
"version": "0.2.2",
"module": "index.js",
"license": "LGPL-2.1-or-later",
"repository": {
......
{
"name": "@dbp-toolkit/data-table-view",
"homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/data-table-view",
"version": "0.2.1",
"version": "0.2.2",
"main": "src/index.js",
"license": "LGPL-2.1-or-later",
"repository": {
......@@ -34,8 +34,8 @@
"rollup-plugin-terser": "^7.0.2"
},
"dependencies": {
"@dbp-toolkit/auth": "^0.2.1",
"@dbp-toolkit/common": "^0.2.1",
"@dbp-toolkit/auth": "^0.2.2",
"@dbp-toolkit/common": "^0.2.2",
"@open-wc/scoped-elements": "^1.3.2",
"datatables.net-buttons": "^1.6.1",
"datatables.net-buttons-dt": "^1.6.1",
......
{
"name": "@dbp-toolkit/file-handling",
"homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/file-handling",
"version": "0.2.1",
"version": "0.2.2",
"main": "src/index.js",
"license": "LGPL-2.1-or-later",
"repository": {
......@@ -33,7 +33,7 @@
"rollup-plugin-terser": "^7.0.2"
},
"dependencies": {
"@dbp-toolkit/common": "^0.2.1",
"@dbp-toolkit/common": "^0.2.2",
"@open-wc/scoped-elements": "^1.3.2",
"file-saver": "^2.0.2",
"i18next": "^19.8.4",
......
......@@ -1269,6 +1269,13 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
border-bottom: none;
}
.breadcrumb a{
display: inline-block;
height: 33px;
vertical-align: middle;
line-height: 31px;
}
input:disabled+label{
color: #aaa;
}
......
......@@ -386,7 +386,7 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) {
this.nextcloudPath = this.initialFileHandlingState.path;
if (this._('#nextcloud-file-picker').webDavClient !== null) {
this._('#nextcloud-file-picker').loadDirectory(this.initialFileHandlingState.path);
console.log("load default nextcloud source", this.initialFileHandlingState.target);
//console.log("load default nextcloud source", this.initialFileHandlingState.target);
}
this.firstOpen = false;
}
......
{
"name": "@dbp-toolkit/font-source-sans-pro",
"version": "0.2.1",
"version": "0.2.2",
"author": "",
"license": "OFL-1.1",
"repository": {
......
{
"name": "@dbp-toolkit/knowledge-base-web-page-element-view",
"homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/knowledge-base-web-page-element-view",
"version": "0.2.1",
"version": "0.2.2",
"main": "src/index.js",
"license": "LGPL-2.1-or-later",
"repository": {
......@@ -33,8 +33,8 @@
"rollup-plugin-terser": "^7.0.2"
},
"dependencies": {
"@dbp-toolkit/auth": "^0.2.1",
"@dbp-toolkit/common": "^0.2.1",
"@dbp-toolkit/auth": "^0.2.2",
"@dbp-toolkit/common": "^0.2.2",
"@open-wc/scoped-elements": "^1.3.2",
"i18next": "^19.8.4",
"lit-element": "^2.4.0",
......
{
"name": "@dbp-toolkit/language-select",
"homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/language-select",
"version": "0.2.1",
"version": "0.2.2",
"main": "src/index.js",
"license": "LGPL-2.1-or-later",
"repository": {
......@@ -33,7 +33,7 @@
"rollup-plugin-terser": "^7.0.2"
},
"dependencies": {
"@dbp-toolkit/common": "^0.2.1",
"@dbp-toolkit/common": "^0.2.2",
"@open-wc/scoped-elements": "^1.3.2",
"lit-element": "^2.4.0"
},
......
{
"name": "@dbp-toolkit/matomo",
"homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/matomo",
"version": "0.2.1",
"version": "0.2.2",
"main": "src/index.js",
"license": "LGPL-2.1-or-later",
"repository": {
......@@ -34,8 +34,8 @@
"rollup-plugin-terser": "^7.0.2"
},
"dependencies": {
"@dbp-toolkit/auth": "^0.2.1",
"@dbp-toolkit/common": "^0.2.1",
"@dbp-toolkit/auth": "^0.2.2",
"@dbp-toolkit/common": "^0.2.2",
"@open-wc/scoped-elements": "^1.3.2",
"lit-element": "^2.4.0"
},
......
{
"name": "@dbp-toolkit/notification",
"homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/notification",
"version": "0.2.1",
"version": "0.2.2",
"main": "src/index.js",
"license": "LGPL-2.1-or-later",
"repository": {
......@@ -34,7 +34,7 @@
"rollup-plugin-terser": "^7.0.2"
},
"dependencies": {
"@dbp-toolkit/common": "^0.2.1",
"@dbp-toolkit/common": "^0.2.2",
"@open-wc/scoped-elements": "^1.3.2",
"lit-element": "^2.4.0"
},
......
{
"name": "@dbp-toolkit/person-profile",
"homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/person-profile",
"version": "0.2.1",
"version": "0.2.2",
"main": "src/index.js",
"license": "LGPL-2.1-or-later",
"repository": {
......@@ -34,9 +34,9 @@
"rollup-plugin-terser": "^7.0.2"
},
"dependencies": {
"@dbp-toolkit/auth": "^0.2.1",
"@dbp-toolkit/common": "^0.2.1",
"@dbp-toolkit/person-select": "^0.2.1",
"@dbp-toolkit/auth": "^0.2.2",
"@dbp-toolkit/common": "^0.2.2",
"@dbp-toolkit/person-select": "^0.2.2",
"@open-wc/scoped-elements": "^1.3.2",
"jquery": "^3.4.1",
"lit-element": "^2.4.0"
......
{
"name": "@dbp-toolkit/person-select",
"homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/person-select",
"version": "0.2.1",
"version": "0.2.2",
"main": "src/index.js",
"license": "LGPL-2.1-or-later",
"repository": {
......@@ -35,8 +35,8 @@
"rollup-plugin-terser": "^7.0.2"
},
"dependencies": {
"@dbp-toolkit/auth": "^0.2.1",
"@dbp-toolkit/common": "^0.2.1",
"@dbp-toolkit/auth": "^0.2.2",
"@dbp-toolkit/common": "^0.2.2",
"@open-wc/scoped-elements": "^1.3.2",
"jquery": "^3.4.1",
"lit-element": "^2.4.0",
......
{
"name": "@dbp-toolkit/provider",
"homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/provider",
"version": "0.2.1",
"version": "0.2.2",
"main": "src/index.js",
"license": "LGPL-2.1-or-later",
"repository": {
......@@ -35,13 +35,14 @@
"rollup-plugin-terser": "^7.0.2"
},
"dependencies": {
"@dbp-toolkit/auth": "^0.2.1",
"@dbp-toolkit/common": "^0.2.1",
"@dbp-toolkit/auth": "^0.2.2",
"@dbp-toolkit/common": "^0.2.2",
"@open-wc/scoped-elements": "^1.1.1",
"lit-element": "^2.4.0"
},
"scripts": {
"clean": "rm dist/*",
"build": "npm run build-local",
"build-local": "rollup -c",
"build-dev": "rollup -c --environment BUILD:development",
"build-prod": "rollup -c --environment BUILD:production",
......
......@@ -23,7 +23,7 @@ export class AdapterLitElement extends LitElement {
// We need to store our own "last values" because we cannot be sure what the MutationObserver detects
this.lastProperties = {};
console.log('AdapterLitElement(' + this.tagName + ') constructor()');
console.debug('AdapterLitElement(' + this.tagName + ') constructor()');
}
getProperty(name) {
......@@ -41,7 +41,7 @@ export class AdapterLitElement extends LitElement {
setProperty(name, value) {
// TODO: check if lit attribute really present?
if (typeof value === 'object' && value !== null) {
// console.log("value is object", value);
// console.debug("value is object", value);
this.setPropertyByAttributeName(name, value);
} else {
this.attributeChangedCallback(name, this.getPropertyByAttributeName(name), value);
......@@ -83,7 +83,7 @@ export class AdapterLitElement extends LitElement {
this.addEventListener('dbp-subscribe', function (e) {
const name = e.detail.name;
if (that.hasProperty(name) || that.root) {
console.log('AdapterLitElementProvider(' + that.tagName + ') eventListener("dbp-subscribe",..) name "' + name + '" found.');
console.debug('AdapterLitElementProvider(' + that.tagName + ') eventListener("dbp-subscribe",..) name "' + name + '" found.');
that.callbackStore.push({name: name, callback: e.detail.callback, sender: e.detail.sender});
e.detail.callback(that.getProperty(name));
......@@ -95,12 +95,12 @@ export class AdapterLitElement extends LitElement {
const name = e.detail.name;
const sender = e.detail.sender;
if (that.hasProperty(name) || that.root) {
console.log('AdapterLitElementProvider(' + that.tagName + ') eventListener("dbp-unsubscribe",..) name "' + name + '" found.');
console.debug('AdapterLitElementProvider(' + that.tagName + ') eventListener("dbp-unsubscribe",..) name "' + name + '" found.');
that.callbackStore.forEach(item => {
if (item.sender === sender && item.name === name) {
const index = that.callbackStore.indexOf(item);
that.callbackStore.splice(index, 1);
console.log('AdapterLitElementProvider(' + that.tagName + ') eventListener for name "' + name + '" removed.');
console.debug('AdapterLitElementProvider(' + that.tagName + ') eventListener for name "' + name + '" removed.');
}
});
......@@ -114,7 +114,7 @@ export class AdapterLitElement extends LitElement {
const value = e.detail.value;
if (that.hasProperty(name) || that.root) {
console.log('AdapterLitElementProvider(' + that.tagName + ') eventListener("dbp-set-property",..) name "' + name + '" found.');
console.debug('AdapterLitElementProvider(' + that.tagName + ') eventListener("dbp-set-property",..) name "' + name + '" found.');
that.setProperty(name, value);
that.callbackStore.forEach(item => {
......@@ -139,7 +139,7 @@ export class AdapterLitElement extends LitElement {
const value = that.getAttribute(name);
if (that.hasPropertyChanged(name, value)) {
console.log('AdapterLitElementProvider (' + that.tagName + ') observed attribute "' + name + '" changed');
console.debug('AdapterLitElementProvider (' + that.tagName + ') observed attribute "' + name + '" changed');
that.setProperty(name, value);
that.callbackStore.forEach(item => {
......@@ -167,7 +167,7 @@ export class AdapterLitElement extends LitElement {
}
this.setProperty(attrs[i].name, attrs[i].value);
console.log('AdapterLitElementProvider (' + that.tagName + ') found attribute "' + attrs[i].name + '" = "' + attrs[i].value + '"');
console.debug('AdapterLitElementProvider (' + that.tagName + ') found attribute "' + attrs[i].name + '" = "' + attrs[i].value + '"');
}
}
}
......@@ -180,7 +180,7 @@ export class AdapterLitElement extends LitElement {
}
subscribeProviderFor(element) {
console.log('AdapterLitElement(' + this.tagName + ') subscribeProviderFor( ' + element + ' )');
console.debug('AdapterLitElement(' + this.tagName + ') subscribeProviderFor( ' + element + ' )');
const pair = element.trim().split(':');
const local = pair[0];
const global = pair[1] || local;
......@@ -192,14 +192,14 @@ export class AdapterLitElement extends LitElement {
detail: {
name: global,
callback: (value) => {
console.log('AdapterLitElement(' + that.tagName + ') sub/Callback ' + global + ' -> ' + local + ' = ' + value);
console.debug('AdapterLitElement(' + that.tagName + ') sub/Callback ' + global + ' -> ' + local + ' = ' + value);
// If value is an object set it directly as property
if (typeof value === 'object' && value !== null) {
// console.log("value is object", value);
// console.debug("value is object", value);
that.setPropertyByAttributeName(local, value);
} else {
// console.log("local, that.getPropertyByAttributeName(local), value", local, that.getPropertyByAttributeName(local), value);
// console.debug("local, that.getPropertyByAttributeName(local), value", local, that.getPropertyByAttributeName(local), value);
that.attributeChangedCallback(local, that.getPropertyByAttributeName(local), value);
// check if an attribute also exists in the tag
......@@ -221,7 +221,7 @@ export class AdapterLitElement extends LitElement {
}
unSubscribeProviderFor(element) {
console.log('AdapterLitElement(' + this.tagName + ') unSubscribeProviderFor( ' + element + ' )');
console.debug('AdapterLitElement(' + this.tagName + ') unSubscribeProviderFor( ' + element + ' )');
const pair = element.trim().split(':');
const global = pair[1] || pair[0];
const event = new CustomEvent('dbp-unsubscribe',
......@@ -246,10 +246,10 @@ export class AdapterLitElement extends LitElement {
findPropertyName(attributeName) {
let resultName = attributeName;
const properties = this.constructor.properties;
// console.log("properties", properties);
// console.debug("properties", properties);
for (const propertyName in properties) {
// console.log("findPropertyName", `${propertyName}: ${properties[propertyName]}`);
// console.debug("findPropertyName", `${propertyName}: ${properties[propertyName]}`);
const attribute = properties[propertyName].attribute;
if (attribute === attributeName) {
resultName = propertyName;
......@@ -263,7 +263,7 @@ export class AdapterLitElement extends LitElement {
attributeChangedCallback(name, oldValue, newValue) {
switch(name) {
case 'subscribe':
console.log('AdapterLitElement() attributeChangesCallback( ' + name + ', ' + oldValue + ', ' + newValue + ')');
console.debug('AdapterLitElement() attributeChangesCallback( ' + name + ', ' + oldValue + ', ' + newValue + ')');
if (this.subscribe && this.subscribe.length > 0) {
if (this.connected) {
......@@ -291,12 +291,12 @@ export class AdapterLitElement extends LitElement {
if (newValue || !oldValue || !name) {
super.attributeChangedCallback(name, oldValue, newValue);
// } else {
// console.log("attributeChangedCallback ignored", name, oldValue, newValue);
// console.debug("attributeChangedCallback ignored", name, oldValue, newValue);
}
}
// console.log("this.lang", this.tagName, name, this.lang);
// console.log("this.entryPointUrl", this.tagName, name, this.entryPointUrl);
// console.debug("this.lang", this.tagName, name, this.lang);
// console.debug("this.entryPointUrl", this.tagName, name, this.entryPointUrl);
// console.trace();
}
......@@ -308,7 +308,7 @@ export class AdapterLitElement extends LitElement {
* @returns {boolean}
*/
sendSetPropertyEvent(name, value) {
// console.log("dbp-set-property", name, value);
// console.debug("dbp-set-property", name, value);
const event = new CustomEvent('dbp-set-property', {
bubbles: true,
......