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") => {
if (json["hydra:description"] !== undefined) {
// response is a JSON-LD and possibly also contains HTML!
body = json["hydra:description"];
} else if(json['detail'] !== undefined) {
} else if (json['detail'] !== undefined) {
// response is a plain JSON
body = json['detail'];
} else {
......
......@@ -30,7 +30,7 @@ export function numberFormat(i18n, number, options) {
export function humanFileSize(bytes, si = false) {
const thresh = si ? 1000 : 1024;
if(Math.abs(bytes) < thresh) {
if (Math.abs(bytes) < thresh) {
return bytes + ' B';
}
const units = ['kB','MB','GB','TB','PB','EB','ZB','YB'];
......
......@@ -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) => {
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) => {
if(typeof cell.getValue() === 'undefined') {
if (typeof cell.getValue() === 'undefined') {
return "";
}
const [fileMainType, fileSubType] = cell.getValue().split('/');
......@@ -131,7 +131,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
rowClick: (e, row) => {
const data = row.getData();
if(this.directoriesOnly) {
if (this.directoriesOnly) {
console.log("directory selected", data);
}
else
......@@ -147,20 +147,20 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
}
},
rowDblClick: (e, row) => {
if(this.directoriesOnly) {
if (this.directoriesOnly) {
const data = row.getData();
this.directoryClicked(e, data);
}
}
});
if(this.tabulatorTable.browserMobile === false)
if (this.tabulatorTable.browserMobile === false)
{
this.tabulatorTable.options.selectableRangeMode = "click";
}
function checkFileType(data, filterParams) {
// check if file is allowed
if(typeof data.mime === 'undefined') {
if (typeof data.mime === 'undefined') {
return true;
}
const [fileMainType, fileSubType] = data.mime.split('/');
......@@ -177,10 +177,10 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
}
return true;
}
if(typeof this.allowedMimeTypes !== 'undefined') {
if (typeof this.allowedMimeTypes !== 'undefined') {
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);
this.tabulatorTable.setFilter([
......@@ -191,7 +191,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
}
openFilePicker() {
if(this.webDavClient === null)
if (this.webDavClient === null)
{
this.statusText = i18n.t('nextcloud-file-picker.auth-progress');
const authUrl = this.authUrl + "?target-origin=" + encodeURIComponent(window.location.href);
......@@ -253,7 +253,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
console.error(error.message);
// on Error: try to reload with home directory
if(path != "/"){
if (path != "/"){
this.loadDirectory("/");
}
else {
......@@ -325,7 +325,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
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>`;
const directories = this.directoryPath.split('/');
if(directories[1] === "")
if (directories[1] === "")
{
return htmlpath;
}
......@@ -356,7 +356,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
getCloudLogo() {
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`
<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
const div = this._('#A1');
const img = this._('#A2');
const d = div.style.display;
if(d === '' || d === 'none') {
if (d === '' || d === 'none') {
div.style.display = 'block';
img.src = this.eyeClose;
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment