mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-23 23:13:38 -06:00
Ensure that folder rename should work properly in Storage Manager. Fixes #5943
This commit is contained in:
parent
17ce84dd0a
commit
3e2a1c4eca
@ -17,6 +17,7 @@ Housekeeping
|
||||
Bug fixes
|
||||
*********
|
||||
|
||||
| `Issue #5943 <https://redmine.postgresql.org/issues/5943>`_ - Ensure that folder rename should work properly in Storage Manager.
|
||||
| `Issue #5974 <https://redmine.postgresql.org/issues/5974>`_ - Fixed an issue where the debugger's custom tab title not applied when opened in the new browser tab.
|
||||
| `Issue #5978 <https://redmine.postgresql.org/issues/5978>`_ - Fixed an issue where dynamic tab title has not applied the first time for debugger panel.
|
||||
| `Issue #5983 <https://redmine.postgresql.org/issues/5983>`_ - Added the appropriate server icon based on the server type in the new connection dialog.
|
||||
|
@ -751,7 +751,7 @@ define([
|
||||
// if file/folder is protected do nothing
|
||||
if ($(this).find('.fa-lock').length)
|
||||
return;
|
||||
if ($(this).find('.fa-file-alt').length)
|
||||
if ($(this).find('.fa-file-alt').length || $(this).find('.tbl_folder_rename').length > 0)
|
||||
$(this).click();
|
||||
// If folder then first select and then double click to open folder/drive
|
||||
else if ($(this).find('.fa-folder-open').length || $(this).find('.fa-hdd').length) {
|
||||
@ -846,10 +846,17 @@ define([
|
||||
$this = $('.fileinfo').find(
|
||||
'table#contents tbody tr.selected td.tbl_file'
|
||||
);
|
||||
if($this.length == 0) {
|
||||
$this = $('.fileinfo').find(
|
||||
'table#contents tbody tr.selected td.tbl_folder'
|
||||
);
|
||||
// putting temporary class to distiguish between folder rename & double click.
|
||||
$this.addClass('tbl_folder_rename');
|
||||
}
|
||||
orig_value = decodeURI($this.find('span.less_text').html());
|
||||
newvalue = orig_value.substring(0, orig_value.lastIndexOf('.'));
|
||||
|
||||
if (orig_value.lastIndexOf('/') == orig_value.length - 1 || newvalue === '') {
|
||||
if (orig_value.lastIndexOf('/') == orig_value.length - 1 || (_.isEmpty(newvalue) || _.isUndefined(newvalue) || _.isNull(newvalue))) {
|
||||
newvalue = decodeURI(orig_value);
|
||||
}
|
||||
|
||||
@ -860,9 +867,7 @@ define([
|
||||
$('.file_manager').off().on('keyup', function(event) {
|
||||
if (event.keyCode == 13) {
|
||||
event.stopPropagation();
|
||||
$('.fileinfo table#contents tr.selected td.tbl_file').find(
|
||||
'fm_file_rename'
|
||||
).trigger('blur');
|
||||
$this.find('fm_file_rename').trigger('blur');
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -924,9 +929,14 @@ define([
|
||||
$(this).val()
|
||||
) + (last !== '' ? '.' + last : '');
|
||||
|
||||
if (newvalue !== new_name) {
|
||||
|
||||
$(this).toggle();
|
||||
$(this).siblings('span').toggle().html(full_name);
|
||||
|
||||
//check if user is trying to rename folder
|
||||
let isFolder = $(this).closest('.tbl_folder').length > 0;
|
||||
|
||||
new_name = decodeURI($(this).val());
|
||||
file_path = decodeURI($(this).parent().parent().find(
|
||||
'span'
|
||||
@ -935,11 +945,22 @@ define([
|
||||
'Filename': old_name,
|
||||
'Path': file_path,
|
||||
'NewFilename': new_name,
|
||||
'isFolder': isFolder,
|
||||
};
|
||||
|
||||
if (newvalue !== new_name) {
|
||||
renameItem(file_data);
|
||||
getFolderInfo($('.currentpath').val());
|
||||
let path = $('.currentpath').val();
|
||||
if(isFolder == true) {
|
||||
// if its folder rename, remove the temporary added class
|
||||
$(this).closest('.tbl_folder').removeClass('tbl_folder_rename');
|
||||
if(path.includes('\\')) {
|
||||
path = $('.currentpath').val().split('\\').slice(0, -2).join('\\')+'\\';
|
||||
}
|
||||
else {
|
||||
path = $('.currentpath').val().split('/').slice(0, -2).join('/')+'/';
|
||||
}
|
||||
}
|
||||
getFolderInfo(path);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -966,20 +987,36 @@ define([
|
||||
var full_name = decodeURI($(this).val()) + (
|
||||
last !== '' ? '.' + last : ''
|
||||
);
|
||||
|
||||
if (new_value !== new_name) {
|
||||
|
||||
$(this).toggle();
|
||||
$(this).siblings('span').toggle().html(full_name);
|
||||
|
||||
let isFolder = $(this).closest('.tbl_folder').length > 0;
|
||||
|
||||
var new_name = decodeURI($(this).val()),
|
||||
file_path = decodeURI($(this).parent().parent().attr('title')),
|
||||
file_data = {
|
||||
'Filename': old_name,
|
||||
'Path': file_path,
|
||||
'NewFilename': new_name,
|
||||
'isFolder': isFolder,
|
||||
};
|
||||
|
||||
if (new_value !== new_name) {
|
||||
renameItem(file_data);
|
||||
getFolderInfo($('.currentpath').val());
|
||||
let path = $('.currentpath').val();
|
||||
if(isFolder == true) {
|
||||
// if its folder rename, remove the temporary added class
|
||||
$(this).closest('.tbl_folder').removeClass('tbl_folder_rename');
|
||||
if(path.includes('\\')) {
|
||||
path = $('.currentpath').val().split('\\').slice(0, -2).join('\\')+'\\';
|
||||
}
|
||||
else {
|
||||
path = $('.currentpath').val().split('/').slice(0, -2).join('/')+'/';
|
||||
}
|
||||
}
|
||||
getFolderInfo(path);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -1035,15 +1072,12 @@ define([
|
||||
|
||||
$('.file_manager_ok').removeClass('disabled');
|
||||
$('.file_manager_ok').attr('disabled', false);
|
||||
$('.file_manager button.delete').removeAttr(
|
||||
$('.file_manager button.delete, .file_manager button.rename').removeAttr(
|
||||
'disabled', 'disabled'
|
||||
);
|
||||
$('.file_manager button.download').attr(
|
||||
'disabled', 'disabled'
|
||||
);
|
||||
$('.file_manager button.rename').attr(
|
||||
'disabled', 'disabled'
|
||||
);
|
||||
// set selected folder name in breadcrums
|
||||
$('.file_manager #uploader .input-path').hide();
|
||||
$('.file_manager #uploader .show_selected_file').remove();
|
||||
@ -1086,8 +1120,7 @@ define([
|
||||
$('.file_manager_ok').removeClass('disabled');
|
||||
$('.file_manager_ok').attr('disabled', false);
|
||||
$('.file_manager button.download').attr('disabled', 'disabled');
|
||||
$('.file_manager button.rename').attr('disabled', 'disabled');
|
||||
$('.file_manager button.delete').removeAttr('disabled');
|
||||
$('.file_manager button.delete, .file_manager button.rename').removeAttr('disabled');
|
||||
|
||||
// set selected folder name in breadcrums
|
||||
$('.file_manager #uploader .input-path').hide();
|
||||
|
Loading…
Reference in New Issue
Block a user