mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-26 18:50:28 -06:00
List files/folders alphabetically, and don't excessively truncate their names. Fixes #1792
This commit is contained in:
parent
11e486f96d
commit
df09f02e80
@ -415,7 +415,7 @@ class Filemanager(object):
|
||||
except:
|
||||
drive_size = 0
|
||||
protected = 1 if drive_size == 0 else 0
|
||||
files[drive] = {
|
||||
files[file_name] = {
|
||||
"Filename": file_name,
|
||||
"Path": path,
|
||||
"file_type": 'drive',
|
||||
@ -441,7 +441,12 @@ class Filemanager(object):
|
||||
|
||||
orig_path = unquote(orig_path)
|
||||
try:
|
||||
for f in sorted(os.listdir(orig_path)):
|
||||
def custom_sort(x, y):
|
||||
return y.lower() > x.lower()
|
||||
|
||||
mylist = [x for x in sorted(os.listdir(orig_path),
|
||||
cmp=custom_sort)]
|
||||
for f in mylist:
|
||||
protected = 0
|
||||
system_path = os.path.join(os.path.join(orig_path, f))
|
||||
|
||||
@ -474,7 +479,7 @@ class Filemanager(object):
|
||||
continue
|
||||
|
||||
# create a list of files and folders
|
||||
files[user_path] = {
|
||||
files[f] = {
|
||||
"Filename": f,
|
||||
"Path": user_path,
|
||||
"file_type": file_extension,
|
||||
|
@ -236,7 +236,7 @@ var setUploader = function(path) {
|
||||
|
||||
// template for creating new folder
|
||||
folder_div =
|
||||
"<li class='cap_downloadcap_deletecap_select_filecap_select_foldercap_renamecap_createcap_upload'>" +
|
||||
"<li class='cap_download cap_delete cap_select_file cap_select_folder cap_rename cap_create cap_upload'>" +
|
||||
"<div class='clip'><span data-alt='' class='fa fa-folder-open fm_folder'></span></div>" +
|
||||
"<p><input type='text' class='fm_file_rename'><span title=''>New_Folder</span></p>" +
|
||||
"<span class='meta size'></span><span class='meta created'></span><span class='meta modified'></span></li>";
|
||||
@ -686,7 +686,9 @@ var getFolderInfo = function(path, file_type) {
|
||||
if (!_.isEmpty(data)) {
|
||||
if ($('.fileinfo').data('view') == 'grid') {
|
||||
result += '<ul id="contents" class="grid">';
|
||||
Object.keys(data).forEach(function (key) {
|
||||
Object.keys(data).sort(function keyOrder(x, y) {
|
||||
return pgAdmin.natural_sort(x.toLowerCase(), y.toLowerCase());
|
||||
}).forEach(function (key) {
|
||||
var props = (data[key]).Properties,
|
||||
cap_classes = "";
|
||||
|
||||
@ -760,7 +762,9 @@ var getFolderInfo = function(path, file_type) {
|
||||
result += '<span>' + lg.modified + '</span></th></tr></thead>';
|
||||
result += '<tbody>';
|
||||
|
||||
Object.keys(data).forEach(function (key) {
|
||||
Object.keys(data).sort(function keyOrder(x, y) {
|
||||
return pgAdmin.natural_sort(x.toLowerCase(), y.toLowerCase());
|
||||
}).forEach(function (key) {
|
||||
var path = encodeURI((data[key]).Path),
|
||||
props = (data[key]).Properties,
|
||||
cap_classes = "", cap, class_type;
|
||||
@ -787,8 +791,8 @@ var getFolderInfo = function(path, file_type) {
|
||||
result += '<tr class="' + cap_classes + '">';
|
||||
|
||||
var fm_filename = (data[key]).Filename;
|
||||
if (fm_filename.length > 15 ) {
|
||||
fm_filename = (data[key]).Filename.substr(0, 10) +'...';
|
||||
if (fm_filename.length > 48) {
|
||||
fm_filename = (data[key]).Filename.substr(0, 48) +'...';
|
||||
}
|
||||
|
||||
result += '<td title="' + path + '" class="'+class_type+'">';
|
||||
|
Loading…
Reference in New Issue
Block a user