mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
File management dialogue enhancements:
- Double click on file/folder icon or name will navigate to the folder/file. - Selected file/folder can be renamed by Rename button only. Double click rename is removed. - Filename text box will not hide on smaller screen. Setting minimum width of File Browser fixed it. - Path at top will only show directory name, not the file name and it is greyed out
This commit is contained in:
committed by
Dave Page
parent
efb254c966
commit
1a129cf30e
@@ -24,11 +24,15 @@
|
|||||||
float: left;
|
float: left;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
line-height:1.9em;
|
line-height:1.9em;
|
||||||
text-shadow:1px 1px 0px #ffffff;
|
max-width: 367px;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
#uploader h1 b {
|
#uploader h1 b {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
|
color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uploadresponse {
|
.uploadresponse {
|
||||||
@@ -346,6 +350,7 @@ button.list span {
|
|||||||
-moz-border-radius: 5px;
|
-moz-border-radius: 5px;
|
||||||
float: left;
|
float: left;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
|
background: #EEE;
|
||||||
}
|
}
|
||||||
|
|
||||||
.file_manager #uploader .btn-group .btn[disabled] {
|
.file_manager #uploader .btn-group .btn[disabled] {
|
||||||
@@ -528,7 +533,9 @@ button.list span {
|
|||||||
-moz-border-radius: 3px;
|
-moz-border-radius: 3px;
|
||||||
height: 22px;
|
height: 22px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
|
font-weight: normal;
|
||||||
display: inline;
|
display: inline;
|
||||||
|
width: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.allowed_file_types .change_file_types {
|
.allowed_file_types .change_file_types {
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ define([
|
|||||||
$container.find('.storage_content').remove();
|
$container.find('.storage_content').remove();
|
||||||
$container.append("<div class='storage_content'></div>");
|
$container.append("<div class='storage_content'></div>");
|
||||||
renderStoragePanel(params);
|
renderStoragePanel(params);
|
||||||
|
this.elements.dialog.style.minWidth = '630px';
|
||||||
this.show();
|
this.show();
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
@@ -203,6 +204,7 @@ define([
|
|||||||
$container.find('.storage_content').remove();
|
$container.find('.storage_content').remove();
|
||||||
$container.append("<div class='storage_content'></div>");
|
$container.append("<div class='storage_content'></div>");
|
||||||
renderStoragePanel(params);
|
renderStoragePanel(params);
|
||||||
|
this.elements.dialog.style.minWidth = '630px';
|
||||||
this.show();
|
this.show();
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
@@ -314,6 +316,7 @@ define([
|
|||||||
$container.find('.storage_content').remove();
|
$container.find('.storage_content').remove();
|
||||||
$container.append("<div class='storage_content'></div>");
|
$container.append("<div class='storage_content'></div>");
|
||||||
renderStoragePanel(params);
|
renderStoragePanel(params);
|
||||||
|
this.elements.dialog.style.minWidth = '630px';
|
||||||
this.show();
|
this.show();
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
@@ -425,6 +428,7 @@ define([
|
|||||||
$container.find('.storage_content').remove();
|
$container.find('.storage_content').remove();
|
||||||
$container.append("<div class='storage_content'></div>");
|
$container.append("<div class='storage_content'></div>");
|
||||||
renderStoragePanel(params);
|
renderStoragePanel(params);
|
||||||
|
this.elements.dialog.style.minWidth = '630px';
|
||||||
this.show();
|
this.show();
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ var setUploader = function(path) {
|
|||||||
path = decodeURI(path);
|
path = decodeURI(path);
|
||||||
|
|
||||||
var display_string = path,
|
var display_string = path,
|
||||||
mypath = '';
|
file_path = '';
|
||||||
|
|
||||||
// split path
|
// split path
|
||||||
var split_path = display_string.split('/');
|
var split_path = display_string.split('/');
|
||||||
@@ -203,29 +203,17 @@ var setUploader = function(path) {
|
|||||||
|
|
||||||
// set empty path if it is windows
|
// set empty path if it is windows
|
||||||
if (config.options.platform_type === "win32" && config.options.show_volumes) {
|
if (config.options.platform_type === "win32" && config.options.show_volumes) {
|
||||||
mypath = "";
|
file_path = "";
|
||||||
} else if (split_path.length === 0) {
|
} else if (split_path.length === 0) {
|
||||||
mypath = $('<b>/</b>');
|
file_path = '/';
|
||||||
} else {
|
} else {
|
||||||
mypath = $('<a class="breadcrumbs" href="#" data-path="/">/</a>');
|
file_path = '/';
|
||||||
}
|
}
|
||||||
$(mypath).appendTo($('.storage_dialog #uploader h1'));
|
|
||||||
|
|
||||||
Object.keys(split_path).forEach(function (i) {
|
Object.keys(split_path).forEach(function (i) {
|
||||||
if (i < split_path.length - 1) {
|
file_path += split_path[i] + '/';
|
||||||
mypath = $(
|
|
||||||
'<a class="breadcrumbs" href="#" data-path="' +
|
|
||||||
display_string.replace(split_path[i+1], '') +
|
|
||||||
'">' + split_path[i] + '/</a>'
|
|
||||||
);
|
|
||||||
$(mypath).appendTo($('.storage_dialog #uploader h1'));
|
|
||||||
} else {
|
|
||||||
mypath = $('<b>' + split_path[i] + '/</b>');
|
|
||||||
$(mypath).appendTo(
|
|
||||||
$('.storage_dialog #uploader h1')
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
$('.storage_dialog #uploader h1').html(file_path);
|
||||||
|
|
||||||
$('.currentpath').val(path);
|
$('.currentpath').val(path);
|
||||||
if ($('.storage_dialog #uploader h1 span').length === 0) {
|
if ($('.storage_dialog #uploader h1 span').length === 0) {
|
||||||
@@ -908,28 +896,6 @@ var getFolderInfo = function(path, file_type) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.fileinfo #contents li p').on('dblclick',function(e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
var $this = $(this);
|
|
||||||
var orig_value = decodeURI($this.find('span').attr('title')),
|
|
||||||
newvalue = orig_value.substring(0, orig_value.indexOf('.'));
|
|
||||||
|
|
||||||
if (newvalue === '') {
|
|
||||||
newvalue = orig_value;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this.find('input').toggle().val(newvalue).focus();
|
|
||||||
$this.find('span').toggle();
|
|
||||||
|
|
||||||
// Rename folder/file on pressing enter key
|
|
||||||
$('.file_manager').unbind().on('keyup', function(e) {
|
|
||||||
if (e.keyCode == 13) {
|
|
||||||
e.stopPropagation();
|
|
||||||
$this.find('input').trigger('blur');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Rename UI handling
|
// Rename UI handling
|
||||||
$('.fileinfo #contents li p').on('blur dblclick','input', function(e) {
|
$('.fileinfo #contents li p').on('blur dblclick','input', function(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@@ -1008,30 +974,6 @@ var getFolderInfo = function(path, file_type) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.fileinfo table#contents tr td p').on('dblclick', function(e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
var $this = $(this),
|
|
||||||
orig_value = decodeURI(
|
|
||||||
$this.find('span').attr('title')
|
|
||||||
);
|
|
||||||
|
|
||||||
var newvalue = orig_value.substring(0, orig_value.lastIndexOf('.'));
|
|
||||||
if (orig_value.lastIndexOf('/') == orig_value.length - 1 || newvalue === '') {
|
|
||||||
newvalue = orig_value;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this.find('input').toggle().val(newvalue).focus();
|
|
||||||
$this.find('span').toggle();
|
|
||||||
|
|
||||||
// Rename folder/file on pressing enter key
|
|
||||||
$('.file_manager').unbind().on('keyup', function(e) {
|
|
||||||
if (e.keyCode == 13) {
|
|
||||||
e.stopPropagation();
|
|
||||||
$this.find('input').trigger('blur');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.fileinfo table#contents tr td p').on(
|
$('.fileinfo table#contents tr td p').on(
|
||||||
'blur dblclick', 'input', function(e) {
|
'blur dblclick', 'input', function(e) {
|
||||||
var old_name = decodeURI($(this).siblings('span').attr('title')),
|
var old_name = decodeURI($(this).siblings('span').attr('title')),
|
||||||
@@ -1148,11 +1090,7 @@ var getFolderInfo = function(path, file_type) {
|
|||||||
'disabled'
|
'disabled'
|
||||||
);
|
);
|
||||||
// set selected folder name in breadcrums
|
// set selected folder name in breadcrums
|
||||||
$('.file_manager #uploader h1').hide();
|
|
||||||
$('.file_manager #uploader .show_selected_file').remove();
|
$('.file_manager #uploader .show_selected_file').remove();
|
||||||
$('<span class="show_selected_file">'+path+'</span>').appendTo(
|
|
||||||
'.file_manager #uploader .filemanager-path-group'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -1200,11 +1138,7 @@ var getFolderInfo = function(path, file_type) {
|
|||||||
'disabled'
|
'disabled'
|
||||||
);
|
);
|
||||||
// set selected folder name in breadcrums
|
// set selected folder name in breadcrums
|
||||||
$('.file_manager #uploader h1').hide();
|
|
||||||
$('.file_manager #uploader .show_selected_file').remove();
|
$('.file_manager #uploader .show_selected_file').remove();
|
||||||
$('<span class="show_selected_file">' + path + '</span>').appendTo(
|
|
||||||
'.file_manager #uploader .filemanager-path-group'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
config.options.dialog_type == 'create_file' &&
|
config.options.dialog_type == 'create_file' &&
|
||||||
|
|||||||
@@ -1121,16 +1121,13 @@ def load_file():
|
|||||||
if request.data:
|
if request.data:
|
||||||
file_data = json.loads(request.data.decode())
|
file_data = json.loads(request.data.decode())
|
||||||
|
|
||||||
|
file_path = unquote(file_data['file_name'])
|
||||||
# retrieve storage directory path
|
# retrieve storage directory path
|
||||||
storage_manager_path = get_storage_directory()
|
storage_manager_path = get_storage_directory()
|
||||||
if storage_manager_path is None:
|
if storage_manager_path:
|
||||||
storage_manager_path = ""
|
# generate full path of file
|
||||||
|
file_path = os.path.join(storage_manager_path, file_path.lstrip('/'))
|
||||||
|
|
||||||
# generate full path of file
|
|
||||||
file_path = os.path.join(
|
|
||||||
storage_manager_path,
|
|
||||||
unquote(file_data['file_name'].lstrip('/'))
|
|
||||||
)
|
|
||||||
file_data = None
|
file_data = None
|
||||||
|
|
||||||
# check if file type is text or binary
|
# check if file type is text or binary
|
||||||
|
|||||||
Reference in New Issue
Block a user