Assign indexes global vars to the window object

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2022-06-30 15:37:44 -03:00
parent bffe4a89c2
commit 4ea8a2fb34
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8
3 changed files with 19 additions and 28 deletions

View File

@ -59,36 +59,31 @@ window.centralColumnList = [];
* Array to hold 'Primary' index columns.
* @type {array}
*/
// eslint-disable-next-line no-unused-vars
var primaryIndexes = [];
window.primaryIndexes = [];
/**
* Array to hold 'Unique' index columns.
* @type {array}
*/
// eslint-disable-next-line no-unused-vars
var uniqueIndexes = [];
window.uniqueIndexes = [];
/**
* Array to hold 'Index' columns.
* @type {array}
*/
// eslint-disable-next-line no-unused-vars
var indexes = [];
window.indexes = [];
/**
* Array to hold 'Fulltext' columns.
* @type {array}
*/
// eslint-disable-next-line no-unused-vars
var fulltextIndexes = [];
window.fulltextIndexes = [];
/**
* Array to hold 'Spatial' columns.
* @type {array}
*/
// eslint-disable-next-line no-unused-vars
var spatialIndexes = [];
window.spatialIndexes = [];
/**
* Make sure that ajax requests will not be cached by appending a random variable to their parameters.

View File

@ -7,8 +7,6 @@
* @required js/functions.js
*/
/* global fulltextIndexes:writable, indexes:writable, primaryIndexes:writable, spatialIndexes:writable, uniqueIndexes:writable */ // js/functions.js
var Indexes = {};
/**
@ -23,19 +21,19 @@ Indexes.getIndexArray = function (indexChoice) {
switch (indexChoice.toLowerCase()) {
case 'primary':
sourceArray = primaryIndexes;
sourceArray = window.primaryIndexes;
break;
case 'unique':
sourceArray = uniqueIndexes;
sourceArray = window.uniqueIndexes;
break;
case 'index':
sourceArray = indexes;
sourceArray = window.indexes;
break;
case 'fulltext':
sourceArray = fulltextIndexes;
sourceArray = window.fulltextIndexes;
break;
case 'spatial':
sourceArray = spatialIndexes;
sourceArray = window.spatialIndexes;
break;
default:
return null;
@ -568,11 +566,11 @@ Indexes.off = () => function () {
*/
Indexes.on = () => function () {
// Re-initialize variables.
primaryIndexes = [];
uniqueIndexes = [];
indexes = [];
fulltextIndexes = [];
spatialIndexes = [];
window.primaryIndexes = [];
window.uniqueIndexes = [];
window.indexes = [];
window.fulltextIndexes = [];
window.spatialIndexes = [];
// for table creation form
var $engineSelector = $('.create_table_form select[name=tbl_storage_engine]');

View File

@ -7,8 +7,6 @@
* @required js/functions.js
*/
// eslint-disable-next-line no-unused-vars
/* global primaryIndexes:writable, indexes:writable, fulltextIndexes:writable, spatialIndexes:writable */ // js/functions.js
/* global sprintf */ // js/vendor/sprintf.js
/**
@ -57,10 +55,10 @@ window.AJAX.registerTeardown('table/structure.js', function () {
window.AJAX.registerOnload('table/structure.js', function () {
// Re-initialize variables.
primaryIndexes = [];
indexes = [];
fulltextIndexes = [];
spatialIndexes = [];
window.primaryIndexes = [];
window.indexes = [];
window.fulltextIndexes = [];
window.spatialIndexes = [];
/**
*Ajax action for submitting the "Column Change" and "Add Column" form