mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-10 08:04:36 -06:00
Fixed code smell 'Variables should not be shadowed'.
This commit is contained in:
parent
916182f80f
commit
290cf8271b
@ -301,10 +301,10 @@ define([
|
|||||||
var isDeleted = false,
|
var isDeleted = false,
|
||||||
lg = pgAdmin.FileUtils.lg;
|
lg = pgAdmin.FileUtils.lg;
|
||||||
|
|
||||||
var doDelete = function(data) {
|
var doDelete = function(sel_data) {
|
||||||
var post_data = {
|
var post_data = {
|
||||||
'mode': 'delete',
|
'mode': 'delete',
|
||||||
'path': data.Path,
|
'path': sel_data.Path,
|
||||||
};
|
};
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -870,7 +870,7 @@ define([
|
|||||||
var old_name = decodeURI($(this).siblings('span').attr('title'));
|
var old_name = decodeURI($(this).siblings('span').attr('title'));
|
||||||
newvalue = old_name.substring(0, old_name.indexOf('.'));
|
newvalue = old_name.substring(0, old_name.indexOf('.'));
|
||||||
var last = getFileExtension(old_name),
|
var last = getFileExtension(old_name),
|
||||||
data, new_name, path, full_name;
|
file_data, new_name, file_path, full_name;
|
||||||
|
|
||||||
if (old_name.indexOf('.') == 0) {
|
if (old_name.indexOf('.') == 0) {
|
||||||
last = '';
|
last = '';
|
||||||
@ -890,17 +890,17 @@ define([
|
|||||||
$(this).siblings('span').toggle().html(full_name);
|
$(this).siblings('span').toggle().html(full_name);
|
||||||
|
|
||||||
new_name = decodeURI($(this).val());
|
new_name = decodeURI($(this).val());
|
||||||
path = decodeURI($(this).parent().parent().find(
|
file_path = decodeURI($(this).parent().parent().find(
|
||||||
'span'
|
'span'
|
||||||
).attr('data-alt'));
|
).attr('data-alt'));
|
||||||
data = {
|
file_data = {
|
||||||
'Filename': old_name,
|
'Filename': old_name,
|
||||||
'Path': path,
|
'Path': file_path,
|
||||||
'NewFilename': new_name,
|
'NewFilename': new_name,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (newvalue !== new_name) {
|
if (newvalue !== new_name) {
|
||||||
renameItem(data);
|
renameItem(file_data);
|
||||||
var parent = $('.currentpath').val();
|
var parent = $('.currentpath').val();
|
||||||
getFolderInfo(parent);
|
getFolderInfo(parent);
|
||||||
}
|
}
|
||||||
@ -923,17 +923,17 @@ define([
|
|||||||
$(this).siblings('span').toggle().html(full_name);
|
$(this).siblings('span').toggle().html(full_name);
|
||||||
|
|
||||||
new_name = decodeURI($(this).val());
|
new_name = decodeURI($(this).val());
|
||||||
path = decodeURI($(this).parent().parent().find(
|
file_path = decodeURI($(this).parent().parent().find(
|
||||||
'span'
|
'span'
|
||||||
).attr('data-alt'));
|
).attr('data-alt'));
|
||||||
data = {
|
file_data = {
|
||||||
'Filename': old_name,
|
'Filename': old_name,
|
||||||
'Path': path,
|
'Path': file_path,
|
||||||
'NewFilename': new_name,
|
'NewFilename': new_name,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (newvalue !== new_name) {
|
if (newvalue !== new_name) {
|
||||||
renameItem(data);
|
renameItem(file_data);
|
||||||
getFolderInfo($('.currentpath').val());
|
getFolderInfo($('.currentpath').val());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -946,14 +946,14 @@ define([
|
|||||||
'blur dblclick', 'input',
|
'blur dblclick', 'input',
|
||||||
function(e) {
|
function(e) {
|
||||||
var old_name = decodeURI($(this).siblings('span').attr('title')),
|
var old_name = decodeURI($(this).siblings('span').attr('title')),
|
||||||
newvalue = old_name.substring(0, old_name.indexOf('.')),
|
new_value = old_name.substring(0, old_name.indexOf('.')),
|
||||||
last = getFileExtension(old_name);
|
last = getFileExtension(old_name);
|
||||||
if (old_name.indexOf('.') == 0) {
|
if (old_name.indexOf('.') == 0) {
|
||||||
last = '';
|
last = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newvalue == '') {
|
if (new_value == '') {
|
||||||
newvalue = old_name;
|
new_value = old_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.type == 'focusout') {
|
if (e.type == 'focusout') {
|
||||||
@ -965,16 +965,16 @@ define([
|
|||||||
$(this).siblings('span').toggle().html(full_name);
|
$(this).siblings('span').toggle().html(full_name);
|
||||||
|
|
||||||
var new_name = decodeURI($(this).val()),
|
var new_name = decodeURI($(this).val()),
|
||||||
path = decodeURI($(this).parent().parent().attr('title')),
|
file_path = decodeURI($(this).parent().parent().attr('title')),
|
||||||
data = {
|
file_data = {
|
||||||
'Filename': old_name,
|
'Filename': old_name,
|
||||||
'Path': path,
|
'Path': file_path,
|
||||||
'NewFilename': new_name,
|
'NewFilename': new_name,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (newvalue !== new_name) {
|
if (new_value !== new_name) {
|
||||||
renameItem(data);
|
renameItem(file_data);
|
||||||
var parent = path.split('/').reverse().slice(2).reverse().join('/') + '/';
|
var parent = file_path.split('/').reverse().slice(2).reverse().join('/') + '/';
|
||||||
getFolderInfo(parent);
|
getFolderInfo(parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -996,18 +996,18 @@ define([
|
|||||||
// Enable/Disable level up button
|
// Enable/Disable level up button
|
||||||
enab_dis_level_up();
|
enab_dis_level_up();
|
||||||
|
|
||||||
var path = decodeURI($(this).find('span').attr('data-alt'));
|
var file_path = decodeURI($(this).find('span').attr('data-alt'));
|
||||||
|
|
||||||
if (path.lastIndexOf('/') == path.length - 1 || path.lastIndexOf('\\') == path.length - 1) {
|
if (file_path.lastIndexOf('/') == file_path.length - 1 || file_path.lastIndexOf('\\') == file_path.length - 1) {
|
||||||
$('.file_manager_ok').addClass('disabled');
|
$('.file_manager_ok').addClass('disabled');
|
||||||
$('.file_manager_ok').attr('disabled', true);
|
$('.file_manager_ok').attr('disabled', true);
|
||||||
$('.file_manager button.delete, .file_manager button.rename').attr('disabled', 'disabled');
|
$('.file_manager button.delete, .file_manager button.rename').attr('disabled', 'disabled');
|
||||||
$('.file_manager button.download').attr('disabled', 'disabled');
|
$('.file_manager button.download').attr('disabled', 'disabled');
|
||||||
|
|
||||||
getFolderInfo(path);
|
getFolderInfo(file_path);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var is_valid_file = getFileInfo(path);
|
var is_valid_file = getFileInfo(file_path);
|
||||||
if (is_valid_file && check_file_capability(e, data_cap, 'grid')) {
|
if (is_valid_file && check_file_capability(e, data_cap, 'grid')) {
|
||||||
$('.file_manager_ok').trigger('click');
|
$('.file_manager_ok').trigger('click');
|
||||||
}
|
}
|
||||||
@ -1016,12 +1016,12 @@ define([
|
|||||||
|
|
||||||
$('.fileinfo').find('#contents li').on('click', function(e) {
|
$('.fileinfo').find('#contents li').on('click', function(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
var path = decodeURI($(this).find('.clip span').attr('data-alt')),
|
var file_path = decodeURI($(this).find('.clip span').attr('data-alt')),
|
||||||
is_protected = $(this).find(
|
is_protected = $(this).find(
|
||||||
'.clip span.fm_lock_icon'
|
'.clip span.fm_lock_icon'
|
||||||
).attr('data-protected');
|
).attr('data-protected');
|
||||||
|
|
||||||
if (path.lastIndexOf('/') == path.length - 1 || path.lastIndexOf('\\') == path.length - 1) {
|
if (file_path.lastIndexOf('/') == file_path.length - 1 || file_path.lastIndexOf('\\') == file_path.length - 1) {
|
||||||
if (
|
if (
|
||||||
has_capability(data_cap, 'select_folder') &&
|
has_capability(data_cap, 'select_folder') &&
|
||||||
is_protected == undefined
|
is_protected == undefined
|
||||||
@ -1040,11 +1040,11 @@ define([
|
|||||||
// set selected folder name in breadcrums
|
// set selected folder name in breadcrums
|
||||||
$('.file_manager #uploader .input-path').hide();
|
$('.file_manager #uploader .input-path').hide();
|
||||||
$('.file_manager #uploader .show_selected_file').remove();
|
$('.file_manager #uploader .show_selected_file').remove();
|
||||||
$('<span class="show_selected_file">' + path + '</span>').appendTo(
|
$('<span class="show_selected_file">' + file_path + '</span>').appendTo(
|
||||||
'.file_manager #uploader .filemanager-path-group'
|
'.file_manager #uploader .filemanager-path-group'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
pgAdmin.FileUtils.setUploader(path);
|
pgAdmin.FileUtils.setUploader(file_path);
|
||||||
} else {
|
} else {
|
||||||
if (
|
if (
|
||||||
has_capability(data_cap, 'select_file') &&
|
has_capability(data_cap, 'select_file') &&
|
||||||
@ -1061,18 +1061,18 @@ define([
|
|||||||
$('.file_manager #uploader .show_selected_file').remove();
|
$('.file_manager #uploader .show_selected_file').remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
getFileInfo(path);
|
getFileInfo(file_path);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$('.fileinfo table#contents tbody tr').on('click', function(e) {
|
$('.fileinfo table#contents tbody tr').on('click', function(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
var path = decodeURI($('td:first-child', this).attr('title')),
|
var file_path = decodeURI($('td:first-child', this).attr('title')),
|
||||||
is_protected = $('td:first-child', this).find(
|
is_protected = $('td:first-child', this).find(
|
||||||
'i.tbl_lock_icon'
|
'i.tbl_lock_icon'
|
||||||
).attr('data-protected');
|
).attr('data-protected');
|
||||||
|
|
||||||
if (path.lastIndexOf('/') == path.length - 1 || path.lastIndexOf('\\') == path.length - 1) {
|
if (file_path.lastIndexOf('/') == file_path.length - 1 || file_path.lastIndexOf('\\') == file_path.length - 1) {
|
||||||
if (has_capability(data_cap, 'select_folder') && is_protected == undefined) {
|
if (has_capability(data_cap, 'select_folder') && is_protected == undefined) {
|
||||||
$(this).parent().find('tr.selected').removeClass('selected');
|
$(this).parent().find('tr.selected').removeClass('selected');
|
||||||
$('td:first-child', this).parent().addClass('selected');
|
$('td:first-child', this).parent().addClass('selected');
|
||||||
@ -1084,11 +1084,11 @@ define([
|
|||||||
// set selected folder name in breadcrums
|
// set selected folder name in breadcrums
|
||||||
$('.file_manager #uploader .input-path').hide();
|
$('.file_manager #uploader .input-path').hide();
|
||||||
$('.file_manager #uploader .show_selected_file').remove();
|
$('.file_manager #uploader .show_selected_file').remove();
|
||||||
$('<span class="show_selected_file">' + path + '</span>').appendTo(
|
$('<span class="show_selected_file">' + file_path + '</span>').appendTo(
|
||||||
'.file_manager #uploader .filemanager-path-group'
|
'.file_manager #uploader .filemanager-path-group'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
pgAdmin.FileUtils.setUploader(path);
|
pgAdmin.FileUtils.setUploader(file_path);
|
||||||
} else {
|
} else {
|
||||||
if (has_capability(data_cap, 'select_file') && is_protected == undefined) {
|
if (has_capability(data_cap, 'select_file') && is_protected == undefined) {
|
||||||
$(this).parent().find('tr.selected').removeClass('selected');
|
$(this).parent().find('tr.selected').removeClass('selected');
|
||||||
@ -1100,7 +1100,7 @@ define([
|
|||||||
$('.file_manager #uploader .show_selected_file').remove();
|
$('.file_manager #uploader .show_selected_file').remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
getFileInfo(path);
|
getFileInfo(file_path);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1108,16 +1108,16 @@ define([
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
// Enable/Disable level up button
|
// Enable/Disable level up button
|
||||||
enab_dis_level_up();
|
enab_dis_level_up();
|
||||||
var path = $('td:first-child', this).attr('title');
|
var file_path = $('td:first-child', this).attr('title');
|
||||||
|
|
||||||
if (path.lastIndexOf('/') == path.length - 1 || path.lastIndexOf('\\') == path.length - 1) {
|
if (file_path.lastIndexOf('/') == file_path.length - 1 || file_path.lastIndexOf('\\') == file_path.length - 1) {
|
||||||
$('.file_manager_ok').addClass('disabled');
|
$('.file_manager_ok').addClass('disabled');
|
||||||
$('.file_manager_ok').attr('disabled', true);
|
$('.file_manager_ok').attr('disabled', true);
|
||||||
$('.file_manager button.download').attr('disabled', 'disabled');
|
$('.file_manager button.download').attr('disabled', 'disabled');
|
||||||
$('.file_manager button.delete, .file_manager button.rename').attr('disabled', 'disabled');
|
$('.file_manager button.delete, .file_manager button.rename').attr('disabled', 'disabled');
|
||||||
getFolderInfo(path);
|
getFolderInfo(file_path);
|
||||||
} else {
|
} else {
|
||||||
var is_valid_file = getFileInfo(path);
|
var is_valid_file = getFileInfo(file_path);
|
||||||
if (
|
if (
|
||||||
is_valid_file && check_file_capability(e, data_cap, 'table')
|
is_valid_file && check_file_capability(e, data_cap, 'table')
|
||||||
) {
|
) {
|
||||||
|
Loading…
Reference in New Issue
Block a user