Visitar URL original
Assign centralColumnList global var to window object · phpmyadmin/phpmyadmin@bffe4a8 · GitHub
Skip to content

Commit bffe4a8

Browse files
committed
Assign centralColumnList global var to window object
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
1 parent 2341139 commit bffe4a8

2 files changed

Lines changed: 32 additions & 35 deletions

File tree

‎js/src/functions.js‎

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ let sqlAutoCompleteDefaultTable = '';
5353
* Array to hold the columns in central list per db.
5454
* @type {array}
5555
*/
56-
var centralColumnList = [];
56+
window.centralColumnList = [];
5757

5858
/**
5959
* Array to hold 'Primary' index columns.
@@ -2713,38 +2713,38 @@ Functions.autoPopulate = function (inputId, offset) {
27132713
var db = window.CommonParams.get('db');
27142714
var table = window.CommonParams.get('table');
27152715
var newInputId = inputId.substring(0, inputId.length - 1);
2716-
$('#' + newInputId + '1').val(centralColumnList[db + '_' + table][offset].col_name);
2717-
var colType = centralColumnList[db + '_' + table][offset].col_type.toUpperCase();
2716+
$('#' + newInputId + '1').val(window.centralColumnList[db + '_' + table][offset].col_name);
2717+
var colType = window.centralColumnList[db + '_' + table][offset].col_type.toUpperCase();
27182718
$('#' + newInputId + '2').val(colType);
27192719
var $input3 = $('#' + newInputId + '3');
2720-
$input3.val(centralColumnList[db + '_' + table][offset].col_length);
2720+
$input3.val(window.centralColumnList[db + '_' + table][offset].col_length);
27212721
if (colType === 'ENUM' || colType === 'SET') {
27222722
$input3.next().show();
27232723
} else {
27242724
$input3.next().hide();
27252725
}
2726-
var colDefault = centralColumnList[db + '_' + table][offset].col_default.toUpperCase();
2726+
var colDefault = window.centralColumnList[db + '_' + table][offset].col_default.toUpperCase();
27272727
var $input4 = $('#' + newInputId + '4');
27282728
if (colDefault !== '' && colDefault !== 'NULL' && colDefault !== 'CURRENT_TIMESTAMP' && colDefault !== 'CURRENT_TIMESTAMP()') {
27292729
$input4.val('USER_DEFINED');
27302730
$input4.next().next().show();
2731-
$input4.next().next().val(centralColumnList[db + '_' + table][offset].col_default);
2731+
$input4.next().next().val(window.centralColumnList[db + '_' + table][offset].col_default);
27322732
} else {
2733-
$input4.val(centralColumnList[db + '_' + table][offset].col_default);
2733+
$input4.val(window.centralColumnList[db + '_' + table][offset].col_default);
27342734
$input4.next().next().hide();
27352735
}
2736-
$('#' + newInputId + '5').val(centralColumnList[db + '_' + table][offset].col_collation);
2736+
$('#' + newInputId + '5').val(window.centralColumnList[db + '_' + table][offset].col_collation);
27372737
var $input6 = $('#' + newInputId + '6');
2738-
$input6.val(centralColumnList[db + '_' + table][offset].col_attribute);
2739-
if (centralColumnList[db + '_' + table][offset].col_extra === 'on update CURRENT_TIMESTAMP') {
2740-
$input6.val(centralColumnList[db + '_' + table][offset].col_extra);
2738+
$input6.val(window.centralColumnList[db + '_' + table][offset].col_attribute);
2739+
if (window.centralColumnList[db + '_' + table][offset].col_extra === 'on update CURRENT_TIMESTAMP') {
2740+
$input6.val(window.centralColumnList[db + '_' + table][offset].col_extra);
27412741
}
2742-
if (centralColumnList[db + '_' + table][offset].col_extra.toUpperCase() === 'AUTO_INCREMENT') {
2742+
if (window.centralColumnList[db + '_' + table][offset].col_extra.toUpperCase() === 'AUTO_INCREMENT') {
27432743
$('#' + newInputId + '9').prop('checked', true).trigger('change');
27442744
} else {
27452745
$('#' + newInputId + '9').prop('checked', false);
27462746
}
2747-
if (centralColumnList[db + '_' + table][offset].col_isNull !== '0') {
2747+
if (window.centralColumnList[db + '_' + table][offset].col_isNull !== '0') {
27482748
$('#' + newInputId + '7').prop('checked', true);
27492749
} else {
27502750
$('#' + newInputId + '7').prop('checked', false);
@@ -2914,33 +2914,33 @@ Functions.onloadEnumSetEditor = function () {
29142914
};
29152915
var colid = $(this).closest('td').find('input').attr('id');
29162916
var fields = '';
2917-
if (! (db + '_' + table in centralColumnList)) {
2918-
centralColumnList.push(db + '_' + table);
2917+
if (! (db + '_' + table in window.centralColumnList)) {
2918+
window.centralColumnList.push(db + '_' + table);
29192919
$.ajax({
29202920
type: 'POST',
29212921
url: href,
29222922
data: params,
29232923
success: function (data) {
2924-
centralColumnList[db + '_' + table] = data.message;
2924+
window.centralColumnList[db + '_' + table] = data.message;
29252925
},
29262926
async: false
29272927
});
29282928
}
29292929
var i = 0;
2930-
var listSize = centralColumnList[db + '_' + table].length;
2930+
var listSize = window.centralColumnList[db + '_' + table].length;
29312931
var min = (listSize <= maxRows) ? listSize : maxRows;
29322932
for (i = 0; i < min; i++) {
29332933
fields += '<tr><td><div><span class="fw-bold">' +
2934-
Functions.escapeHtml(centralColumnList[db + '_' + table][i].col_name) +
2935-
'</span><br><span class="color_gray">' + centralColumnList[db + '_' + table][i].col_type;
2934+
Functions.escapeHtml(window.centralColumnList[db + '_' + table][i].col_name) +
2935+
'</span><br><span class="color_gray">' + window.centralColumnList[db + '_' + table][i].col_type;
29362936

2937-
if (centralColumnList[db + '_' + table][i].col_attribute !== '') {
2938-
fields += '(' + Functions.escapeHtml(centralColumnList[db + '_' + table][i].col_attribute) + ') ';
2937+
if (window.centralColumnList[db + '_' + table][i].col_attribute !== '') {
2938+
fields += '(' + Functions.escapeHtml(window.centralColumnList[db + '_' + table][i].col_attribute) + ') ';
29392939
}
2940-
if (centralColumnList[db + '_' + table][i].col_length !== '') {
2941-
fields += '(' + Functions.escapeHtml(centralColumnList[db + '_' + table][i].col_length) + ') ';
2940+
if (window.centralColumnList[db + '_' + table][i].col_length !== '') {
2941+
fields += '(' + Functions.escapeHtml(window.centralColumnList[db + '_' + table][i].col_length) + ') ';
29422942
}
2943-
fields += Functions.escapeHtml(centralColumnList[db + '_' + table][i].col_extra) + '</span>' +
2943+
fields += Functions.escapeHtml(window.centralColumnList[db + '_' + table][i].col_extra) + '</span>' +
29442944
'</div></td>';
29452945
if (pick) {
29462946
fields += '<td><input class="btn btn-secondary pick w-100" type="submit" value="' +
@@ -2993,17 +2993,17 @@ Functions.onloadEnumSetEditor = function () {
29932993
min = (listSize <= maxRows + resultPointer) ? listSize : maxRows + resultPointer;
29942994
for (i = resultPointer; i < min; i++) {
29952995
fields += '<tr><td><div><span class="fw-bold">' +
2996-
centralColumnList[db + '_' + table][i].col_name +
2996+
window.centralColumnList[db + '_' + table][i].col_name +
29972997
'</span><br><span class="color_gray">' +
2998-
centralColumnList[db + '_' + table][i].col_type;
2998+
window.centralColumnList[db + '_' + table][i].col_type;
29992999

3000-
if (centralColumnList[db + '_' + table][i].col_attribute !== '') {
3001-
fields += '(' + centralColumnList[db + '_' + table][i].col_attribute + ') ';
3000+
if (window.centralColumnList[db + '_' + table][i].col_attribute !== '') {
3001+
fields += '(' + window.centralColumnList[db + '_' + table][i].col_attribute + ') ';
30023002
}
3003-
if (centralColumnList[db + '_' + table][i].col_length !== '') {
3004-
fields += '(' + centralColumnList[db + '_' + table][i].col_length + ') ';
3003+
if (window.centralColumnList[db + '_' + table][i].col_length !== '') {
3004+
fields += '(' + window.centralColumnList[db + '_' + table][i].col_length + ') ';
30053005
}
3006-
fields += centralColumnList[db + '_' + table][i].col_extra + '</span>' +
3006+
fields += window.centralColumnList[db + '_' + table][i].col_extra + '</span>' +
30073007
'</div></td>';
30083008
if (pick) {
30093009
fields += '<td><input class="btn btn-secondary pick w-100" type="submit" value="' +

‎js/src/normalization.js‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
* @requires jQuery
66
*/
77

8-
// eslint-disable-next-line no-unused-vars
9-
/* global centralColumnList:writable */ // js/functions.js
10-
118
/**
129
* AJAX scripts for normalization
1310
*
@@ -559,7 +556,7 @@ window.AJAX.registerOnload('normalization.js', function () {
559556
return false;
560557
});
561558
$('.tblFooters').on('click','#saveSplit', function () {
562-
centralColumnList = [];
559+
window.centralColumnList = [];
563560
if ($('#newCols #field_0_1').val() === '') {
564561
$('#newCols #field_0_1').trigger('focus');
565562
return false;

0 commit comments

Comments
 (0)