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;
|
var editable = undefined;
|
||||||
|
|
||||||
async function refresh_list() {
|
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);
|
current_path = window.location.hash.substr(1);
|
||||||
if (current_path == "") {
|
if (current_path == "") {
|
||||||
current_path = "/";
|
current_path = "/";
|
||||||
@ -56,6 +65,8 @@ async function refresh_list() {
|
|||||||
new_children.push(clone);
|
new_children.push(clone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data.sort(compareValues);
|
||||||
|
|
||||||
for (const f of data) {
|
for (const f of data) {
|
||||||
// Clone the new row and insert it into the table
|
// Clone the new row and insert it into the table
|
||||||
var clone = template.content.cloneNode(true);
|
var clone = template.content.cloneNode(true);
|
||||||
@ -92,9 +103,11 @@ async function refresh_list() {
|
|||||||
delete_button.disabled = !editable;
|
delete_button.disabled = !editable;
|
||||||
delete_button.onclick = del;
|
delete_button.onclick = del;
|
||||||
|
|
||||||
edit_url = new URL(edit_url, url_base);
|
if (editable && !f.directory) {
|
||||||
let edit_link = clone.querySelector(".edit_link");
|
edit_url = new URL(edit_url, url_base);
|
||||||
edit_link.href = edit_url
|
let edit_link = clone.querySelector(".edit_link");
|
||||||
|
edit_link.href = edit_url
|
||||||
|
}
|
||||||
|
|
||||||
new_children.push(clone);
|
new_children.push(clone);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user