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

Merge branch 'master' of gitlab.tugraz.at:dbp/web-components/toolkit

parents 711e48a0 a04c04dd
No related branches found
No related tags found
No related merge requests found
Pipeline #12266 passed
...@@ -65,7 +65,7 @@ export const handleFetchError = async (error, summary = "", icon = "sad") => { ...@@ -65,7 +65,7 @@ export const handleFetchError = async (error, summary = "", icon = "sad") => {
if (json["hydra:description"] !== undefined) { if (json["hydra:description"] !== undefined) {
// response is a JSON-LD and possibly also contains HTML! // response is a JSON-LD and possibly also contains HTML!
body = json["hydra:description"]; body = json["hydra:description"];
} else if(json['detail'] !== undefined) { } else if (json['detail'] !== undefined) {
// response is a plain JSON // response is a plain JSON
body = json['detail']; body = json['detail'];
} else { } else {
......
...@@ -30,7 +30,7 @@ export function numberFormat(i18n, number, options) { ...@@ -30,7 +30,7 @@ export function numberFormat(i18n, number, options) {
export function humanFileSize(bytes, si = false) { export function humanFileSize(bytes, si = false) {
const thresh = si ? 1000 : 1024; const thresh = si ? 1000 : 1024;
if(Math.abs(bytes) < thresh) { if (Math.abs(bytes) < thresh) {
return bytes + ' B'; return bytes + ' B';
} }
const units = ['kB','MB','GB','TB','PB','EB','ZB','YB']; const units = ['kB','MB','GB','TB','PB','EB','ZB','YB'];
......
...@@ -102,7 +102,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -102,7 +102,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
{title: i18n.t('nextcloud-file-picker.size'), responsive: 4, widthGrow:1, minWidth: 50, field: "size", formatter: (cell, formatterParams, onRendered) => { {title: i18n.t('nextcloud-file-picker.size'), responsive: 4, widthGrow:1, minWidth: 50, field: "size", formatter: (cell, formatterParams, onRendered) => {
return cell.getRow().getData().type === "directory" ? "" : humanFileSize(cell.getValue());}}, return cell.getRow().getData().type === "directory" ? "" : humanFileSize(cell.getValue());}},
{title: i18n.t('nextcloud-file-picker.mime-type'), responsive: 2, widthGrow:1, field: "mime", formatter: (cell, formatterParams, onRendered) => { {title: i18n.t('nextcloud-file-picker.mime-type'), responsive: 2, widthGrow:1, field: "mime", formatter: (cell, formatterParams, onRendered) => {
if(typeof cell.getValue() === 'undefined') { if (typeof cell.getValue() === 'undefined') {
return ""; return "";
} }
const [fileMainType, fileSubType] = cell.getValue().split('/'); const [fileMainType, fileSubType] = cell.getValue().split('/');
...@@ -131,7 +131,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -131,7 +131,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
rowClick: (e, row) => { rowClick: (e, row) => {
const data = row.getData(); const data = row.getData();
if(this.directoriesOnly) { if (this.directoriesOnly) {
console.log("directory selected", data); console.log("directory selected", data);
} }
else else
...@@ -147,20 +147,20 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -147,20 +147,20 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
} }
}, },
rowDblClick: (e, row) => { rowDblClick: (e, row) => {
if(this.directoriesOnly) { if (this.directoriesOnly) {
const data = row.getData(); const data = row.getData();
this.directoryClicked(e, data); this.directoryClicked(e, data);
} }
} }
}); });
if(this.tabulatorTable.browserMobile === false) if (this.tabulatorTable.browserMobile === false)
{ {
this.tabulatorTable.options.selectableRangeMode = "click"; this.tabulatorTable.options.selectableRangeMode = "click";
} }
function checkFileType(data, filterParams) { function checkFileType(data, filterParams) {
// check if file is allowed // check if file is allowed
if(typeof data.mime === 'undefined') { if (typeof data.mime === 'undefined') {
return true; return true;
} }
const [fileMainType, fileSubType] = data.mime.split('/'); const [fileMainType, fileSubType] = data.mime.split('/');
...@@ -177,10 +177,10 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -177,10 +177,10 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
} }
return true; return true;
} }
if(typeof this.allowedMimeTypes !== 'undefined') { if (typeof this.allowedMimeTypes !== 'undefined') {
this.tabulatorTable.setFilter(checkFileType, this.allowedMimeTypes); this.tabulatorTable.setFilter(checkFileType, this.allowedMimeTypes);
} }
if(typeof this.directoriesOnly !== 'undefined' && this.directoriesOnly) if (typeof this.directoriesOnly !== 'undefined' && this.directoriesOnly)
{ {
console.log("filter " + this.directoriesOnly); console.log("filter " + this.directoriesOnly);
this.tabulatorTable.setFilter([ this.tabulatorTable.setFilter([
...@@ -191,7 +191,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -191,7 +191,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
} }
openFilePicker() { openFilePicker() {
if(this.webDavClient === null) if (this.webDavClient === null)
{ {
this.statusText = i18n.t('nextcloud-file-picker.auth-progress'); this.statusText = i18n.t('nextcloud-file-picker.auth-progress');
const authUrl = this.authUrl + "?target-origin=" + encodeURIComponent(window.location.href); const authUrl = this.authUrl + "?target-origin=" + encodeURIComponent(window.location.href);
...@@ -253,7 +253,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -253,7 +253,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
console.error(error.message); console.error(error.message);
// on Error: try to reload with home directory // on Error: try to reload with home directory
if(path != "/"){ if (path != "/"){
this.loadDirectory("/"); this.loadDirectory("/");
} }
else { else {
...@@ -325,7 +325,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -325,7 +325,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
let htmlpath = []; let htmlpath = [];
htmlpath[0] = html`<a @click="${() => { this.loadDirectory("/"); }}" title="${i18n.t('nextcloud-file-picker.folder-home')}"><dbp-icon name="home"></dbp-icon> ${this.nextcloudName}</a>`; htmlpath[0] = html`<a @click="${() => { this.loadDirectory("/"); }}" title="${i18n.t('nextcloud-file-picker.folder-home')}"><dbp-icon name="home"></dbp-icon> ${this.nextcloudName}</a>`;
const directories = this.directoryPath.split('/'); const directories = this.directoryPath.split('/');
if(directories[1] === "") if (directories[1] === "")
{ {
return htmlpath; return htmlpath;
} }
...@@ -356,7 +356,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) { ...@@ -356,7 +356,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
getCloudLogo() { getCloudLogo() {
let cloudLogo = html `<dbp-icon name="cloud" class="nextcloud-logo-icon"></dbp-icon>`; let cloudLogo = html `<dbp-icon name="cloud" class="nextcloud-logo-icon"></dbp-icon>`;
if(this.nextcloudName === "TU Graz cloud") if (this.nextcloudName === "TU Graz cloud")
{ {
cloudLogo = html` cloudLogo = html`
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 97.6 81.74"> <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 97.6 81.74">
......
...@@ -149,7 +149,7 @@ export class KnowledgeBaseWebPageElementView extends ScopedElementsMixin(LitElem ...@@ -149,7 +149,7 @@ export class KnowledgeBaseWebPageElementView extends ScopedElementsMixin(LitElem
const div = this._('#A1'); const div = this._('#A1');
const img = this._('#A2'); const img = this._('#A2');
const d = div.style.display; const d = div.style.display;
if(d === '' || d === 'none') { if (d === '' || d === 'none') {
div.style.display = 'block'; div.style.display = 'block';
img.src = this.eyeClose; img.src = this.eyeClose;
} else { } else {
......
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