Skip to content

Commit 4ea8a2f

Browse files
committed
Assign indexes global vars to the window object
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
1 parent bffe4a8 commit 4ea8a2f

3 files changed

Lines changed: 19 additions & 28 deletions

File tree

js/src/functions.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,36 +59,31 @@ window.centralColumnList = [];
5959
* Array to hold 'Primary' index columns.
6060
* @type {array}
6161
*/
62-
// eslint-disable-next-line no-unused-vars
63-
var primaryIndexes = [];
62+
window.primaryIndexes = [];
6463

6564
/**
6665
* Array to hold 'Unique' index columns.
6766
* @type {array}
6867
*/
69-
// eslint-disable-next-line no-unused-vars
70-
var uniqueIndexes = [];
68+
window.uniqueIndexes = [];
7169

7270
/**
7371
* Array to hold 'Index' columns.
7472
* @type {array}
7573
*/
76-
// eslint-disable-next-line no-unused-vars
77-
var indexes = [];
74+
window.indexes = [];
7875

7976
/**
8077
* Array to hold 'Fulltext' columns.
8178
* @type {array}
8279
*/
83-
// eslint-disable-next-line no-unused-vars
84-
var fulltextIndexes = [];
80+
window.fulltextIndexes = [];
8581

8682
/**
8783
* Array to hold 'Spatial' columns.
8884
* @type {array}
8985
*/
90-
// eslint-disable-next-line no-unused-vars
91-
var spatialIndexes = [];
86+
window.spatialIndexes = [];
9287

9388
/**
9489
* Make sure that ajax requests will not be cached by appending a random variable to their parameters.

js/src/indexes.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* @required js/functions.js
88
*/
99

10-
/* global fulltextIndexes:writable, indexes:writable, primaryIndexes:writable, spatialIndexes:writable, uniqueIndexes:writable */ // js/functions.js
11-
1210
var Indexes = {};
1311

1412
/**
@@ -23,19 +21,19 @@ Indexes.getIndexArray = function (indexChoice) {
2321

2422
switch (indexChoice.toLowerCase()) {
2523
case 'primary':
26-
sourceArray = primaryIndexes;
24+
sourceArray = window.primaryIndexes;
2725
break;
2826
case 'unique':
29-
sourceArray = uniqueIndexes;
27+
sourceArray = window.uniqueIndexes;
3028
break;
3129
case 'index':
32-
sourceArray = indexes;
30+
sourceArray = window.indexes;
3331
break;
3432
case 'fulltext':
35-
sourceArray = fulltextIndexes;
33+
sourceArray = window.fulltextIndexes;
3634
break;
3735
case 'spatial':
38-
sourceArray = spatialIndexes;
36+
sourceArray = window.spatialIndexes;
3937
break;
4038
default:
4139
return null;
@@ -568,11 +566,11 @@ Indexes.off = () => function () {
568566
*/
569567
Indexes.on = () => function () {
570568
// Re-initialize variables.
571-
primaryIndexes = [];
572-
uniqueIndexes = [];
573-
indexes = [];
574-
fulltextIndexes = [];
575-
spatialIndexes = [];
569+
window.primaryIndexes = [];
570+
window.uniqueIndexes = [];
571+
window.indexes = [];
572+
window.fulltextIndexes = [];
573+
window.spatialIndexes = [];
576574

577575
// for table creation form
578576
var $engineSelector = $('.create_table_form select[name=tbl_storage_engine]');

js/src/table/structure.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* @required js/functions.js
88
*/
99

10-
// eslint-disable-next-line no-unused-vars
11-
/* global primaryIndexes:writable, indexes:writable, fulltextIndexes:writable, spatialIndexes:writable */ // js/functions.js
1210
/* global sprintf */ // js/vendor/sprintf.js
1311

1412
/**
@@ -57,10 +55,10 @@ window.AJAX.registerTeardown('table/structure.js', function () {
5755

5856
window.AJAX.registerOnload('table/structure.js', function () {
5957
// Re-initialize variables.
60-
primaryIndexes = [];
61-
indexes = [];
62-
fulltextIndexes = [];
63-
spatialIndexes = [];
58+
window.primaryIndexes = [];
59+
window.indexes = [];
60+
window.fulltextIndexes = [];
61+
window.spatialIndexes = [];
6462

6563
/**
6664
*Ajax action for submitting the "Column Change" and "Add Column" form

0 commit comments

Comments
 (0)