From 4ea8a2fb34382312417d9a16da5cc7c3b6bfbe67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Thu, 30 Jun 2022 15:37:44 -0300 Subject: Assign indexes global vars to the window object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MaurĂ­cio Meneghini Fauth --- js/src/functions.js | 15 +++++---------- js/src/indexes.js | 22 ++++++++++------------ js/src/table/structure.js | 10 ++++------ 3 files changed, 19 insertions(+), 28 deletions(-) diff --git a/js/src/functions.js b/js/src/functions.js index 669f4b8b18..1cb8758325 100644 --- a/js/src/functions.js +++ b/js/src/functions.js @@ -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. diff --git a/js/src/indexes.js b/js/src/indexes.js index 6befac9ae0..beeadaeb46 100644 --- a/js/src/indexes.js +++ b/js/src/indexes.js @@ -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]'); diff --git a/js/src/table/structure.js b/js/src/table/structure.js index 81e48c24be..526b5ec2e1 100644 --- a/js/src/table/structure.js +++ b/js/src/table/structure.js @@ -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 -- cgit v1.2.3