Skip to content
Snippets Groups Projects
Commit f52e60c4 authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire: Committed by Reiter, Christoph
Browse files

Do some code beautifying

parent 697b5463
No related branches found
No related tags found
No related merge requests found
...@@ -82,10 +82,10 @@ export class NextcloudFilePicker extends ScopedElementsMixin(VPULitElement) { ...@@ -82,10 +82,10 @@ export class NextcloudFilePicker extends ScopedElementsMixin(VPULitElement) {
layout: "fitDataStretch", layout: "fitDataStretch",
selectable: true, selectable: true,
columns: [ columns: [
{title: "Type", field: "type", align:"center", formatter:function(cell, formatterParams, onRendered){ {title: "Type", field: "type", align:"center", formatter: (cell, formatterParams, onRendered) => {
const icon_tag = that.constructor.getScopedTagName("vpu-icon"); const icon_tag = that.constructor.getScopedTagName("vpu-icon");
let icon = `<${icon_tag} name="empty-file"></${icon_tag}>`; let icon = `<${icon_tag} name="empty-file"></${icon_tag}>`;
return (cell.getValue() == "directory") ? `<${icon_tag} name="folder"></${icon_tag}>` : icon; return (cell.getValue() === "directory") ? `<${icon_tag} name="folder"></${icon_tag}>` : icon;
}}, }},
{title: "Filename", field: "basename"}, {title: "Filename", field: "basename"},
{title: "Size", field: "size", formatter: (cell, formatterParams, onRendered) => { {title: "Size", field: "size", formatter: (cell, formatterParams, onRendered) => {
...@@ -97,20 +97,19 @@ export class NextcloudFilePicker extends ScopedElementsMixin(VPULitElement) { ...@@ -97,20 +97,19 @@ export class NextcloudFilePicker extends ScopedElementsMixin(VPULitElement) {
const [fileMainType, fileSubType] = cell.getValue().split('/'); const [fileMainType, fileSubType] = cell.getValue().split('/');
return fileSubType; return fileSubType;
}}, }},
{title: "Last modified", field: "lastmod",sorter:function(a, b, aRow, bRow, column, dir, sorterParams){ {title: "Last modified", field: "lastmod",sorter: (a, b, aRow, bRow, column, dir, sorterParams) => {
var a_timestamp = Date.parse(a); const a_timestamp = Date.parse(a);
var b_timestamp = Date.parse(b); const b_timestamp = Date.parse(b);
return a_timestamp - b_timestamp; //you must return the difference between the two values return a_timestamp - b_timestamp; //you must return the difference between the two values
}, formatter:function(cell, formatterParams, onRendered) { }, formatter:function(cell, formatterParams, onRendered) {
var d = Date.parse(cell.getValue()); const d = Date.parse(cell.getValue());
var timestamp = new Date(d); const timestamp = new Date(d);
var year = timestamp.getFullYear(); const year = timestamp.getFullYear();
var month = ("0" + (timestamp.getMonth() + 1)).slice(-2); const month = ("0" + (timestamp.getMonth() + 1)).slice(-2);
var date = ("0" + timestamp.getDate()).slice(-2); const date = ("0" + timestamp.getDate()).slice(-2);
var hours = ("0" + timestamp.getHours()).slice(-2); const hours = ("0" + timestamp.getHours()).slice(-2);
var minutes = ("0" + timestamp.getMinutes()).slice(-2); const minutes = ("0" + timestamp.getMinutes()).slice(-2);
var date_formatted = date + "." + month + "." + year + " " + hours + ":" + minutes; return date + "." + month + "." + year + " " + hours + ":" + minutes;
return date_formatted;
}}, }},
], ],
rowClick: (e, row) => { rowClick: (e, row) => {
...@@ -151,8 +150,6 @@ export class NextcloudFilePicker extends ScopedElementsMixin(VPULitElement) { ...@@ -151,8 +150,6 @@ export class NextcloudFilePicker extends ScopedElementsMixin(VPULitElement) {
this.tabulatorTable.setFilter(checkFileType, this.allowedMimeTypes); this.tabulatorTable.setFilter(checkFileType, this.allowedMimeTypes);
} }
}); });
} }
openFilePicker() { openFilePicker() {
......
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