Merge pull request #6693 from RetiredWizard/sort_filemanager
Add filename sort to web workflow file manager
This commit is contained in:
commit
b423520eb3
@ -6,6 +6,15 @@ var current_path;
|
||||
var editable = undefined;
|
||||
|
||||
async function refresh_list() {
|
||||
|
||||
function compareValues(a, b) {
|
||||
if (a.directory == b.directory && a.name.toLowerCase() === b.name.toLowerCase()) {
|
||||
return 0;
|
||||
} else {
|
||||
return a.directory.toString().substring(3,4)+a.name.toLowerCase() < b.directory.toString().substring(3,4)+b.name.toLowerCase() ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
current_path = window.location.hash.substr(1);
|
||||
if (current_path == "") {
|
||||
current_path = "/";
|
||||
@ -56,6 +65,8 @@ async function refresh_list() {
|
||||
new_children.push(clone);
|
||||
}
|
||||
|
||||
data.sort(compareValues);
|
||||
|
||||
for (const f of data) {
|
||||
// Clone the new row and insert it into the table
|
||||
var clone = template.content.cloneNode(true);
|
||||
@ -92,9 +103,11 @@ async function refresh_list() {
|
||||
delete_button.disabled = !editable;
|
||||
delete_button.onclick = del;
|
||||
|
||||
edit_url = new URL(edit_url, url_base);
|
||||
let edit_link = clone.querySelector(".edit_link");
|
||||
edit_link.href = edit_url
|
||||
if (editable && !f.directory) {
|
||||
edit_url = new URL(edit_url, url_base);
|
||||
let edit_link = clone.querySelector(".edit_link");
|
||||
edit_link.href = edit_url
|
||||
}
|
||||
|
||||
new_children.push(clone);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user