Resolved the issue when the user selects the folder 'Select' button is not getting enabled for 'Select folder' dialog.

refs #6536
This commit is contained in:
Nikhil Mohite
2021-07-06 19:00:08 +05:30
committed by Akshay Joshi
parent 5d4c073730
commit 669bdc7e38

View File

@@ -652,6 +652,20 @@ define([
return ret_ele; return ret_ele;
}; };
var enableSelect = function() {
// Enable select button if user select folder.
if (pgAdmin.FileUtils.data && pgAdmin.FileUtils.data.Capabilities.includes('select_folder')) {
$('.file_manager_ok').removeClass('disabled');
$('.file_manager_ok').attr('disabled', false);
}
};
var disableSelect = function() {
// Disable select button if user select file.
$('.file_manager_ok').addClass('disabled');
$('.file_manager_ok').attr('disabled', true);
};
/* /*
* Retrieves data for all items within the given folder and * Retrieves data for all items within the given folder and
* creates a list view. * creates a list view.
@@ -662,12 +676,7 @@ define([
file_type = ''; file_type = '';
} }
var capabilities = pgAdmin.FileUtils.data.Capabilities; var capabilities = pgAdmin.FileUtils.data.Capabilities;
enableSelect();
// Enable select button if user select folder.
if (pgAdmin.FileUtils.data.Capabilities.includes('select_folder')) {
$('.file_manager_ok').removeClass('disabled');
$('.file_manager_ok').attr('disabled', false);
}
// Update location for status, upload, & new folder functions. // Update location for status, upload, & new folder functions.
pgAdmin.FileUtils.setUploader(path); pgAdmin.FileUtils.setUploader(path);
@@ -1604,6 +1613,10 @@ define([
} }
} }
} else { } else {
if (has_capability(self.data_cap, 'select_folder')) {
disableSelect();
}
if ( if (
has_capability(self.data_cap, 'select_file') has_capability(self.data_cap, 'select_file')
) { ) {
@@ -1830,6 +1843,7 @@ define([
$('.storage_dialog #uploader .input-path').attr('title', path); $('.storage_dialog #uploader .input-path').attr('title', path);
$('.storage_dialog #uploader .input-path').attr('data-path', path); $('.storage_dialog #uploader .input-path').attr('data-path', path);
enableSelect();
// create new folder // create new folder
$('.create').off().on('click', function() { $('.create').off().on('click', function() {