Skip to content
Snippets Groups Projects
Commit 589b5399 authored by Steinwender, Tamara's avatar Steinwender, Tamara
Browse files

Merge

parents 4669a5bd f69a2889
No related branches found
No related tags found
No related merge requests found
Pipeline #16169 passed
Showing
with 209 additions and 113 deletions
{
"extends": [
"config:base",
"group:allNonMajor",
"schedule:weekly"
],
"ignorePresets": [":prHourlyLimit2"],
"rangeStrategy": "update-lockfile",
"composer": {
"enabled": false
}
}
\ No newline at end of file
......@@ -14,15 +14,15 @@
"access": "public"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^10.0.0",
"@rollup/plugin-node-resolve": "^11.0.0",
"babel-eslint": "^10.1.0",
"chai": "^4.2.0",
"eslint": "^7.3.1",
"eslint-plugin-jsdoc": "^30.6.4",
"eslint-plugin-jsdoc": "^31.0.0",
"glob": "^7.1.6",
"karma": "^5.1.0",
"karma": "^6.0.0",
"karma-chrome-launcher": "^3.0.0",
"karma-firefox-launcher": "^2.1.0",
"karma-mocha": "^2.0.1",
......
import {createI18nInstance} from './i18n.js';
import {html, css, LitElement} from 'lit-element';
import {html, css} from 'lit-element';
import {ScopedElementsMixin} from '@open-wc/scoped-elements';
import {LanguageSelect} from '@dbp-toolkit/language-select';
import {Icon, EventBus} from '@dbp-toolkit/common';
......@@ -8,7 +8,6 @@ import {AuthMenuButton} from './auth-menu-button.js';
import {Notification} from '@dbp-toolkit/notification';
import * as commonStyles from '@dbp-toolkit/common/styles';
import * as commonUtils from '@dbp-toolkit/common/utils';
import buildinfo from 'consts:buildinfo';
import {classMap} from 'lit-html/directives/class-map.js';
import {Router} from './router.js';
import {BuildInfo} from './build-info.js';
......@@ -16,6 +15,7 @@ import {TUGrazLogo} from './tugraz-logo.js';
import {send as notify} from '@dbp-toolkit/common/notification';
import {appWelcomeMeta} from './dbp-app-shell-welcome.js';
import {MatomoElement} from "@dbp-toolkit/matomo/src/matomo";
import {AdapterLitElement} from "@dbp-toolkit/provider/src/adapter-lit-element";
const i18n = createI18nInstance();
......@@ -42,7 +42,7 @@ const importNotify = async (promise) => {
}
};
export class AppShell extends ScopedElementsMixin(LitElement) {
export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
constructor() {
super();
this.lang = i18n.language;
......@@ -57,6 +57,10 @@ export class AppShell extends ScopedElementsMixin(LitElement) {
this.keycloakConfig = null;
this.noWelcomePage = false;
this.menuHeight = -1;
this.gitInfo = '';
this.env = '';
this.buildUrl = '';
this.buildTime = '';
this._updateAuth = this._updateAuth.bind(this);
this._loginStatus = 'unknown';
......@@ -224,7 +228,7 @@ export class AppShell extends ScopedElementsMixin(LitElement) {
}
static get properties() {
return {
return this.getProperties({
lang: { type: String, reflect: true },
src: { type: String },
basePath: { type: String, attribute: 'base-path' },
......@@ -241,8 +245,12 @@ export class AppShell extends ScopedElementsMixin(LitElement) {
noWelcomePage: { type: Boolean, attribute: "no-welcome-page" },
shellName: { type: String, attribute: "shell-name" },
shellSubname: { type: String, attribute: "shell-subname" },
noBrand: { type: Boolean, attribute: "no-brand" }
};
noBrand: { type: Boolean, attribute: "no-brand" },
gitInfo: { type: String, attribute: "git-info" },
buildUrl: { type: String, attribute: "build-url" },
buildTime: { type: String, attribute: "build-time" },
env: { type: String },
});
}
_updateAuth(login) {
......@@ -347,6 +355,7 @@ export class AppShell extends ScopedElementsMixin(LitElement) {
}
switchComponent(componentTag) {
let offset = window.pageYOffset;
const changed = (componentTag !== this.activeView);
this.activeView = componentTag;
if (changed)
......@@ -358,8 +367,27 @@ export class AppShell extends ScopedElementsMixin(LitElement) {
}
let updateFunc = () => {
if (window.pageYOffset !== 0) {
window.scrollTo(0, 96);
if (offset > 0) {
const header = this.shadowRoot.querySelector("header");
const title = this.shadowRoot.querySelector("#headline");
if (header === null || title === null) {
return;
}
let style = getComputedStyle(title);
let marginTop = isNaN(parseInt(style.marginTop, 10)) ? 0 : parseInt(style.marginTop, 10);
let marginBottom = isNaN(parseInt(style.marginBottom, 10)) ? 0 : parseInt(style.marginBottom, 10);
let topValue = header.getBoundingClientRect().height + title.getBoundingClientRect().height + marginTop + marginBottom;
if (offset < topValue) {
window.scrollTo(0, offset);
} else {
window.scrollTo(0, topValue);
}
}
this.updatePageTitle();
this.subtitle = this.activeMetaDataText("short_name");
......@@ -725,8 +753,22 @@ export class AppShell extends ScopedElementsMixin(LitElement) {
return html``;
const elm = this._createActivityElement(act);
// add subscriptions for the provider component
if (act.subscribe !== undefined) {
elm.setAttribute("subscribe", act.subscribe);
}
// only add the entry-point-url attribute if it isn't subscribed
if (act.subscribe === undefined || !act.subscribe.includes("entry-point-url:")) {
elm.setAttribute("entry-point-url", this.entryPointUrl);
}
// only add the lang attribute if it isn't subscribed
if (act.subscribe === undefined || !act.subscribe.includes("lang:")) {
elm.setAttribute("lang", this.lang);
}
return elm;
}
......@@ -751,7 +793,7 @@ export class AppShell extends ScopedElementsMixin(LitElement) {
});
}
const prodClassMap = classMap({hidden: buildinfo.env === 'production' || buildinfo.env === 'demo'});
const prodClassMap = classMap({hidden: this.env === 'production' || this.env === 'demo' || this.env === ''});
this.updatePageTitle();
......@@ -774,7 +816,7 @@ export class AppShell extends ScopedElementsMixin(LitElement) {
return html`
<slot class="${slotClassMap}"></slot>
<dbp-auth-keycloak lang="${this.lang}" url="${kc.url}" realm="${kc.realm}" client-id="${kc.clientId}" silent-check-sso-redirect-uri="${kc.silentCheckSsoRedirectUri || ''}" scope="${kc.scope || ''}" idp-hint="${kc.idpHint || ''}" load-person ?force-login="${kc.forceLogin}" ?try-login="${!kc.forceLogin}"></dbp-auth-keycloak>
<dbp-matomo endpoint="${this.matomoUrl}" site-id="${this.matomoSiteId}"></dbp-matomo>
<dbp-matomo endpoint="${this.matomoUrl}" site-id="${this.matomoSiteId}" git-info="${this.gitInfo}"></dbp-matomo>
<div class="${mainClassMap}">
<div id="main">
<dbp-notification lang="${this.lang}"></dbp-notification>
......@@ -796,7 +838,6 @@ export class AppShell extends ScopedElementsMixin(LitElement) {
<dbp-tugraz-logo id="main-logo" lang="${this.lang}" class="${classMap({hidden: this.noBrand})}"></dbp-tugraz-logo>
</div>
</header>
<div id="headline">
<h1 class="title">${this.topicMetaDataText('name')}</h1>
</div>
......@@ -820,7 +861,7 @@ export class AppShell extends ScopedElementsMixin(LitElement) {
<a target="_blank" rel="noopener" class="int-link-external" href="https://datenschutz.tugraz.at/erklaerung/">${i18n.t('privacy-policy')}</a>
<a target="_blank" rel="noopener" class="int-link-external" href="${imprintUrl}">${i18n.t('imprint')}</a>
<a rel="noopener" class="int-link-external" href="mailto:it-support@tugraz.at">${i18n.t('contact')}</a>
<dbp-build-info class="${prodClassMap}"></dbp-build-info>
<dbp-build-info class="${prodClassMap}" git-info="${this.gitInfo}" env="${this.env}" build-url="${this.buildUrl}" build-time="${this.buildTime}"></dbp-build-info>
</footer>
</div>
</div>
......
......@@ -3,13 +3,13 @@ import {html, css} from 'lit-element';
import {unsafeHTML} from 'lit-html/directives/unsafe-html.js';
import {ScopedElementsMixin} from '@open-wc/scoped-elements';
import * as commonStyles from '@dbp-toolkit/common/styles';
import {LitElement} from "lit-element";
import {Icon, EventBus} from '@dbp-toolkit/common';
import {AdapterLitElement} from "@dbp-toolkit/provider/src/adapter-lit-element";
const i18n = createI18nInstance();
export class AuthMenuButton extends ScopedElementsMixin(LitElement) {
export class AuthMenuButton extends ScopedElementsMixin(AdapterLitElement) {
constructor() {
super();
......@@ -28,11 +28,11 @@ export class AuthMenuButton extends ScopedElementsMixin(LitElement) {
}
static get properties() {
return {
return this.getProperties({
lang: { type: String },
showImage: { type: Boolean, attribute: 'show-image' },
_loginData: { type: Object, attribute: false },
};
});
}
onWindowResize() {
......
import {html, LitElement, css} from 'lit-element';
import {html, css} from 'lit-element';
import * as commonStyles from '@dbp-toolkit/common/styles';
import buildinfo from 'consts:buildinfo';
import {AdapterLitElement} from "@dbp-toolkit/provider/src/adapter-lit-element";
export class BuildInfo extends LitElement {
export class BuildInfo extends AdapterLitElement {
constructor() {
super();
this.env = '';
this.gitInfo = '';
this.buildUrl = '';
this.buildTime = '';
}
static get properties() {
return this.getProperties({
env: { type: String },
buildUrl: { type: String, attribute: "build-url" },
buildTime: { type: String, attribute: "build-time" },
gitInfo: { type: String, attribute: "git-info" }
});
}
static get styles() {
......@@ -21,13 +34,13 @@ export class BuildInfo extends LitElement {
}
render() {
const date = new Date(buildinfo.time);
const date = new Date(this.buildTime);
return html`
<a href="${buildinfo.url}" style="float: right">
<a href="${this.buildUrl}" style="float: right">
<div class="tags has-addons" title="Build Time: ${date.toString()}">
<span class="tag is-light">build</span>
<span class="tag is-dark">${buildinfo.info} (${buildinfo.env})</span>
<span class="tag is-dark">${this.gitInfo} (${this.env})</span>
</div>
</a>
`;
......
import {html, LitElement, css} from 'lit-element';
import {html, css} from 'lit-element';
import * as commonStyles from '@dbp-toolkit/common/styles';
import {createI18nInstance} from './i18n.js';
import {AdapterLitElement} from "@dbp-toolkit/provider/src/adapter-lit-element";
const i18n = createI18nInstance();
export class TUGrazLogo extends LitElement {
export class TUGrazLogo extends AdapterLitElement {
constructor() {
super();
......@@ -13,9 +14,9 @@ export class TUGrazLogo extends LitElement {
}
static get properties() {
return {
return this.getProperties({
lang: { type: String }
};
});
}
update(changedProperties) {
......
......@@ -14,18 +14,18 @@
"access": "public"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^10.0.0",
"@rollup/plugin-node-resolve": "^11.0.0",
"@rollup/plugin-replace": "^2.3.3",
"@rollup/plugin-url": "^5.0.1",
"@rollup/plugin-url": "^6.0.0",
"babel-eslint": "^10.1.0",
"chai": "^4.2.0",
"eslint": "^7.3.1",
"eslint-plugin-jsdoc": "^30.6.4",
"eslint-plugin-jsdoc": "^31.0.0",
"glob": "^7.1.6",
"i18next-scanner": "^3.0.0",
"karma": "^5.1.0",
"karma": "^6.0.0",
"karma-chrome-launcher": "^3.0.0",
"karma-firefox-launcher": "^2.1.0",
"karma-mocha": "^2.0.1",
......@@ -40,7 +40,7 @@
"dependencies": {
"@dbp-toolkit/common": "^0.1.0",
"@open-wc/scoped-elements": "^1.3.2",
"event-target-shim": "^5.0.1",
"event-target-shim": "^6.0.0",
"lit-element": "^2.3.1"
},
"scripts": {
......
......@@ -3,8 +3,8 @@ import JSONLD from '@dbp-toolkit/common/jsonld';
import * as commonUtils from '@dbp-toolkit/common/utils';
import {EventBus} from '@dbp-toolkit/common';
import {KeycloakWrapper} from './keycloak.js';
import {LitElement} from "lit-element";
import {LoginStatus} from './util.js';
import {AdapterLitElement} from "@dbp-toolkit/provider/src/adapter-lit-element";
/**
......@@ -20,7 +20,7 @@ import {LoginStatus} from './util.js';
* window.DBPPerson: Person json object of the user (optional, enable by setting the `load-person` attribute,
* which will dispatch a `dbp-auth-person-init` event when loaded)
*/
export class AuthKeycloak extends LitElement {
export class AuthKeycloak extends AdapterLitElement {
constructor() {
super();
this.lang = 'de';
......@@ -87,6 +87,7 @@ export class AuthKeycloak extends LitElement {
window.DBPPersonId = this.personId;
window.DBPPerson = this.person;
this.sendSetPropertyEvents();
this._setLoginStatus(LoginStatus.LOGGED_IN, tokenChanged || newPerson);
} else {
if (this._loginStatus === LoginStatus.LOGGED_IN) {
......@@ -106,6 +107,7 @@ export class AuthKeycloak extends LitElement {
window.DBPPersonId = this.personId;
window.DBPPerson = this.person;
this.sendSetPropertyEvents();
this._setLoginStatus(LoginStatus.LOGGED_OUT);
}
......@@ -141,6 +143,15 @@ export class AuthKeycloak extends LitElement {
this.dispatchEvent(this.keycloakDataUpdateEvent);
}
sendSetPropertyEvents() {
this.sendSetPropertyEvent('auth-subject', this.subject);
this.sendSetPropertyEvent('auth-token', this.token);
this.sendSetPropertyEvent('auth-token-parsed', this.tokenParsed);
this.sendSetPropertyEvent('user-full-name', this.name);
this.sendSetPropertyEvent('person-id', this.personId);
this.sendSetPropertyEvent('person', this.person);
}
_setLoginStatus(status, force) {
if (this._loginStatus === status && !force)
return;
......@@ -158,7 +169,7 @@ export class AuthKeycloak extends LitElement {
}
static get properties() {
return {
return this.getProperties({
lang: { type: String },
forceLogin: { type: Boolean, attribute: 'force-login' },
tryLogin: { type: Boolean, attribute: 'try-login' },
......@@ -176,7 +187,7 @@ export class AuthKeycloak extends LitElement {
silentCheckSsoRedirectUri: { type: String, attribute: 'silent-check-sso-redirect-uri' },
scope: { type: String },
idpHint: { type: String, attribute: 'idp-hint' },
};
});
}
connectedCallback() {
......
......@@ -14,14 +14,16 @@
"access": "public"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^10.0.0",
"@rollup/plugin-node-resolve": "^11.0.0",
"@rollup/plugin-replace": "^2.3.3",
"@rollup/plugin-url": "^5.0.1",
"@rollup/plugin-url": "^6.0.0",
"chai": "^4.2.0",
"eslint": "^7.3.1",
"eslint-plugin-jsdoc": "^31.0.0",
"i18next-scanner": "^3.0.0",
"karma": "^5.1.0",
"karma": "^6.0.0",
"karma-chrome-launcher": "^3.0.0",
"karma-firefox-launcher": "^2.1.0",
"karma-mocha": "^2.0.1",
......@@ -31,9 +33,7 @@
"rollup-plugin-copy": "^3.1.0",
"rollup-plugin-delete": "^2.0.0",
"rollup-plugin-serve": "^1.0.1",
"rollup-plugin-terser": "^7.0.2",
"eslint": "^7.3.1",
"eslint-plugin-jsdoc": "^30.6.4"
"rollup-plugin-terser": "^7.0.2"
},
"dependencies": {
"@dbp-toolkit/auth": "^0.1.0",
......
......@@ -2,7 +2,7 @@ import {findObjectInApiResults} from './utils.js';
import select2LangDe from './i18n/de/select2';
import select2LangEn from './i18n/en/select2';
import JSONLD from '@dbp-toolkit/common/jsonld';
import {css, html, LitElement} from 'lit-element';
import {css, html} from 'lit-element';
import {ScopedElementsMixin} from '@open-wc/scoped-elements';
import {i18n} from './i18n.js';
import {Icon} from '@dbp-toolkit/common';
......@@ -10,6 +10,7 @@ import * as commonUtils from '@dbp-toolkit/common/utils';
import * as commonStyles from '@dbp-toolkit/common/styles';
import select2CSSPath from 'select2/dist/css/select2.min.css';
import * as errorUtils from "@dbp-toolkit/common/error";
import {AdapterLitElement} from "@dbp-toolkit/provider/src/adapter-lit-element";
const checkInPlaceContext = {
......@@ -19,7 +20,7 @@ const checkInPlaceContext = {
};
export class CheckInPlaceSelect extends ScopedElementsMixin(LitElement) {
export class CheckInPlaceSelect extends ScopedElementsMixin(AdapterLitElement) {
constructor() {
super();
......@@ -56,7 +57,7 @@ export class CheckInPlaceSelect extends ScopedElementsMixin(LitElement) {
}
static get properties() {
return {
return this.getProperties({
lang: { type: String },
active: { type: Boolean, attribute: false },
entryPointUrl: { type: String, attribute: 'entry-point-url' },
......@@ -65,7 +66,7 @@ export class CheckInPlaceSelect extends ScopedElementsMixin(LitElement) {
showReloadButton: { type: Boolean, attribute: 'show-reload-button' },
reloadButtonTitle: { type: String, attribute: 'reload-button-title' },
showCapacity: { type: Boolean, attribute: 'show-capacity' },
};
});
}
clear() {
......
import {LitElement} from "lit-element";
import {AdapterLitElement} from "@dbp-toolkit/provider/src/adapter-lit-element";
export default class DBPLitElement extends LitElement {
export default class DBPLitElement extends AdapterLitElement {
_(selector) {
return this.shadowRoot === null ? this.querySelector(selector) : this.shadowRoot.querySelector(selector);
}
......
import * as Sentry from '@sentry/browser';
import environment from 'consts:environment';
let _isInitialized = false;
let _canReportEvent = false;
......@@ -24,12 +23,16 @@ export function init(options) {
if (_isInitialized)
throw new Error("Already initialized");
let sentryOptions = {debug: actual.debug, environment: environment};
let sentryOptions = {debug: actual.debug};
if (actual.release) {
sentryOptions['release'] = actual.release;
}
if (actual.environment) {
sentryOptions['environment'] = actual.environment;
}
if (!sentryDSN) {
if (options.debug)
console.log("No sentry DSN set, sentry disabled");
......
......@@ -10,14 +10,14 @@
"directory": "packages/common"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^10.0.0",
"@rollup/plugin-node-resolve": "^11.0.0",
"babel-eslint": "^10.1.0",
"chai": "^4.2.0",
"eslint": "^7.3.1",
"eslint-plugin-jsdoc": "^30.6.4",
"karma": "^5.1.0",
"eslint-plugin-jsdoc": "^31.0.0",
"karma": "^6.0.0",
"karma-chrome-launcher": "^3.0.0",
"karma-firefox-launcher": "^2.1.0",
"karma-mocha": "^2.0.1",
......
......@@ -14,14 +14,16 @@
"access": "public"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^10.0.0",
"@rollup/plugin-url": "^5.0.1",
"@rollup/plugin-node-resolve": "^11.0.0",
"@rollup/plugin-url": "^6.0.0",
"chai": "^4.2.0",
"eslint": "^7.3.1",
"eslint-plugin-jsdoc": "^31.0.0",
"glob": "^7.1.6",
"i18next-scanner": "^3.0.0",
"karma": "^5.1.0",
"karma": "^6.0.0",
"karma-chrome-launcher": "^3.0.0",
"karma-mocha": "^2.0.1",
"mocha": "^8.0.1",
......@@ -30,9 +32,7 @@
"rollup-plugin-copy": "^3.1.0",
"rollup-plugin-delete": "^2.0.0",
"rollup-plugin-serve": "^1.0.1",
"rollup-plugin-terser": "^7.0.2",
"eslint": "^7.3.1",
"eslint-plugin-jsdoc": "^30.6.4"
"rollup-plugin-terser": "^7.0.2"
},
"dependencies": {
"@dbp-toolkit/auth": "^0.1.0",
......
......@@ -8,13 +8,14 @@ import bttn2 from 'datatables.net-buttons';
import bttnHtml5 from 'datatables.net-buttons/js/buttons.html5.js';
import bttnPrint from 'datatables.net-buttons/js/buttons.print.js';
import {i18n} from './i18n';
import {css, html, LitElement, unsafeCSS} from 'lit-element';
import {css, html, unsafeCSS} from 'lit-element';
import de from '../assets/datatables/i18n/German';
import en from '../assets/datatables/i18n/English';
import {getIconSVGURL} from '@dbp-toolkit/common';
import * as commonUtils from '@dbp-toolkit/common/utils';
import * as commonStyles from '@dbp-toolkit/common/styles';
import {name as pkgName} from './../package.json';
import {AdapterLitElement} from "@dbp-toolkit/provider/src/adapter-lit-element";
dt(window, $);
resp(window, $);
......@@ -24,7 +25,7 @@ bttn2(window, $);
bttnHtml5(window, $, jszip);
bttnPrint(window, $);
export class DataTableView extends LitElement {
export class DataTableView extends AdapterLitElement {
constructor() {
super();
this.lang = 'de';
......@@ -48,7 +49,7 @@ export class DataTableView extends LitElement {
}
static get properties() {
return {
return this.getProperties({
lang: { type: String },
table: { type: Object, attribute: false },
paging: { type: Boolean },
......@@ -61,7 +62,7 @@ export class DataTableView extends LitElement {
exportName: { type: String, attribute: 'export-name' },
columnSearching: { type: Boolean, attribute: 'column-searching'},
defaultOrder: { type: Array, attribute: 'default-order'}
};
});
}
set_columns(cols) {
......
......@@ -71,6 +71,8 @@ files from a [Nextcloud](https://nextcloud.com/) instance.
- `nextcloud-web-dav-url` (optional): Nextcloud WebDav Url to use with the Nextcloud file picker
- example `<dbp-file-source nextcloud-web-dav-url="http://localhost:8081/remote.php/dav/files"></dbp-file-source>`
- `nextcloud-auth-url` also needs to be set for the Nextcloud file picker to be active
- `nextcloud-file-url` (optional): Nextcloud File Url to use with the Nextcloud file picker
- example `<dbp-file-source nextcloud-file-url="http://localhost:8081/apps/files/?dir="></dbp-file-source>`
- `dialog-open` (optional): if this attribute is set at runtime the dialog for selecting local or Nextcloud files will open
- example `document.querySelector("dbp-file-source").setAttribute("dialog-open", "")`
- `text` (optional): the text that is shown above the button to select files
......@@ -112,6 +114,8 @@ files to a [Nextcloud](https://nextcloud.com/) instance.
- `nextcloud-web-dav-url` (optional): Nextcloud WebDav Url to use with the Nextcloud file picker
- example `<dbp-file-sink nextcloud-web-dav-url="http://localhost:8081/remote.php/dav/files"></dbp-file-sink>`
- `nextcloud-auth-url` also needs to be set for the Nextcloud file picker to be active
- `nextcloud-file-url` (optional): Nextcloud File Url to use with the Nextcloud file picker
- example `<dbp-file-source nextcloud-file-url="http://localhost:8081/apps/files/?dir="></dbp-file-source>`
- `text` (optional): the text that is shown above the button to download the zip file
- example `<dbp-file-sink text="Download files as ZIP-file"></dbp-file-sink>`
- `button-label` (optional): the text that is shown on the button to download the zip file
......
......@@ -14,12 +14,14 @@
"access": "public"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-json": "^4.0.2",
"@rollup/plugin-node-resolve": "^10.0.0",
"@rollup/plugin-node-resolve": "^11.0.0",
"chai": "^4.2.0",
"eslint": "^7.3.1",
"eslint-plugin-jsdoc": "^31.0.0",
"i18next-scanner": "^3.0.0",
"karma": "^5.0.1",
"karma": "^6.0.0",
"karma-chrome-launcher": "^3.0.0",
"karma-firefox-launcher": "^2.1.0",
"karma-mocha": "^2.0.0",
......@@ -29,9 +31,7 @@
"rollup-plugin-copy": "^3.1.0",
"rollup-plugin-delete": "^2.0.0",
"rollup-plugin-serve": "^1.0.1",
"rollup-plugin-terser": "^7.0.2",
"eslint": "^7.3.1",
"eslint-plugin-jsdoc": "^30.6.4"
"rollup-plugin-terser": "^7.0.2"
},
"dependencies": {
"@dbp-toolkit/common": "^0.1.0",
......
......@@ -9,7 +9,6 @@ import {createClient} from 'webdav/web';
import {classMap} from 'lit-html/directives/class-map.js';
import {humanFileSize} from '@dbp-toolkit/common/i18next';
import Tabulator from 'tabulator-tables';
import nextcloudFileURL from 'consts:nextcloudFileURL';
import MicroModal from './micromodal.es';
import {name as pkgName} from './../package.json';
......@@ -23,6 +22,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
this.authUrl = '';
this.webDavUrl = '';
this.nextcloudName = 'Nextcloud';
this.nextcloudFileURL = '';
this.loginWindow = null;
this.isPickerActive = false;
this.statusText = '';
......@@ -64,10 +64,11 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
* See: https://lit-element.polymer-project.org/guide/properties#initialize
*/
static get properties() {
return {
return this.getProperties({
lang: { type: String },
authUrl: { type: String, attribute: 'auth-url' },
webDavUrl: { type: String, attribute: 'web-dav-url' },
nextcloudFileURL: { type: String, attribute: 'nextcloud-file-url' },
nextcloudName: { type: String, attribute: 'nextcloud-name' },
isPickerActive: { type: Boolean, attribute: false },
statusText: { type: String, attribute: false },
......@@ -84,8 +85,8 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
activeDirectoryACL: { type: String, attribute: false },
selectAllButton: { type: Boolean, attribute: false },
abortUploadButton: { type: Boolean, attribute: false },
});
};
}
update(changedProperties) {
......@@ -946,8 +947,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
* @returns {string} actual directory Nextcloud link
*/
getNextCloudLink() {
let link = nextcloudFileURL + this.directoryPath;
return link;
return this.nextcloudFileURL + this.directoryPath;
}
getCloudLogo() {
......
......@@ -26,6 +26,7 @@ export class FileSink extends ScopedElementsMixin(DBPLitElement) {
this.nextcloudName ='Nextcloud';
this.nextcloudDefaultDir = '';
this.nextcloudDir = '';
this.nextcloudFileURL = '';
this.text = '';
this.buttonLabel = '';
this.filename = "files.zip";
......@@ -49,7 +50,7 @@ export class FileSink extends ScopedElementsMixin(DBPLitElement) {
* See: https://lit-element.polymer-project.org/guide/properties#initialize
*/
static get properties() {
return {
return this.getProperties({
context: {type: String, attribute: 'context'},
lang: {type: String},
filename: {type: String},
......@@ -58,17 +59,20 @@ export class FileSink extends ScopedElementsMixin(DBPLitElement) {
nextcloudAuthUrl: {type: String, attribute: 'nextcloud-auth-url'},
nextcloudWebDavUrl: {type: String, attribute: 'nextcloud-web-dav-url'},
nextcloudName: {type: String, attribute: 'nextcloud-name'},
nextcloudFileURL: {type: String, attribute: 'nextcloud-file-url'},
text: {type: String},
buttonLabel: {type: String, attribute: 'button-label'},
isDialogOpen: {type: Boolean, attribute: false},
activeDestination: {type: String, attribute: 'active-destination'},
defaultSink: {type: String, attribute: 'default-sink'},
firstOpen: {type: Boolean, attribute: false},
nextcloudDefaultDir: {type: String, attribute: 'nextcloud-default'},
nextcloudDir: {type: String, attribute: false},
};
});
}
connectedCallback() {
super.connectedCallback();
......@@ -279,6 +283,7 @@ export class FileSink extends ScopedElementsMixin(DBPLitElement) {
web-dav-url="${this.nextcloudWebDavUrl}"
nextcloud-name="${this.nextcloudName}"
directory-path="${this.nextcloudDir}"
nextcloud-file-url="${this.nextcloudFileURL}"
@dbp-nextcloud-file-picker-file-uploaded="${(event) => {
this.uploadToNextcloud(event.detail);
}}"
......
......@@ -41,6 +41,7 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) {
this.nextcloudWebDavUrl = '';
this.nextcloudDefaultDir = '';
this.nextcloudDir = '';
this.nextcloudFileURL = '';
this.dropArea = null;
this.allowedMimeTypes = '*/*';
this.enabledSources = 'local';
......@@ -67,7 +68,7 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) {
* See: https://lit-element.polymer-project.org/guide/properties#initialize
*/
static get properties() {
return {
return this.getProperties({
context: { type: String, attribute: 'context'},
lang: { type: String },
allowedMimeTypes: { type: String, attribute: 'allowed-mime-types' },
......@@ -75,17 +76,19 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) {
nextcloudAuthUrl: { type: String, attribute: 'nextcloud-auth-url' },
nextcloudWebDavUrl: { type: String, attribute: 'nextcloud-web-dav-url' },
nextcloudName: { type: String, attribute: 'nextcloud-name' },
nextcloudFileURL: { type: String, attribute: 'nextcloud-file-url' },
text: { type: String },
buttonLabel: { type: String, attribute: 'button-label' },
disabled: { type: Boolean },
decompressZip: { type: Boolean, attribute: 'decompress-zip' },
activeSource: { type: String, attribute: 'active-source' },
isDialogOpen: { type: Boolean, attribute: 'dialog-open' },
defaultSource: { type: String, attribute: 'default-source' },
firstOpen: { type: Boolean, attribute: false },
nextcloudDefaultDir: { type: String, attribute: 'nextcloud-default' },
nextcloudDir: { type: String, attribute: false },
};
});
}
update(changedProperties) {
......@@ -485,6 +488,7 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) {
auth-url="${this.nextcloudAuthUrl}"
web-dav-url="${this.nextcloudWebDavUrl}"
nextcloud-name="${this.nextcloudName}"
nextcloud-file-url="${this.nextcloudFileURL}"
allowed-mime-types="${this.allowedMimeTypes}"
@dbp-nextcloud-file-picker-file-downloaded="${(event) => {
this.sendFileEvent(event.detail.file);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment