Remove indexes column lists from Window object
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
75dbb2cfd2
commit
2cf3f49f35
@ -56,36 +56,6 @@ let sqlAutoCompleteDefaultTable = '';
|
||||
*/
|
||||
window.centralColumnList = [];
|
||||
|
||||
/**
|
||||
* Array to hold 'Primary' index columns.
|
||||
* @type {array}
|
||||
*/
|
||||
window.primaryIndexes = [];
|
||||
|
||||
/**
|
||||
* Array to hold 'Unique' index columns.
|
||||
* @type {array}
|
||||
*/
|
||||
window.uniqueIndexes = [];
|
||||
|
||||
/**
|
||||
* Array to hold 'Index' columns.
|
||||
* @type {array}
|
||||
*/
|
||||
window.indexes = [];
|
||||
|
||||
/**
|
||||
* Array to hold 'Fulltext' columns.
|
||||
* @type {array}
|
||||
*/
|
||||
window.fulltextIndexes = [];
|
||||
|
||||
/**
|
||||
* Array to hold 'Spatial' columns.
|
||||
* @type {array}
|
||||
*/
|
||||
window.spatialIndexes = [];
|
||||
|
||||
/**
|
||||
* Make sure that ajax requests will not be cached by appending a random variable to their parameters.
|
||||
* @return {function}
|
||||
|
||||
@ -14,6 +14,47 @@ import { ajaxRemoveMessage, ajaxShowMessage } from './ajax-message.js';
|
||||
*/
|
||||
const Indexes = {};
|
||||
|
||||
/**
|
||||
* Array to hold 'Primary' index columns.
|
||||
* @type {array}
|
||||
*/
|
||||
let primaryColumns = [];
|
||||
|
||||
/**
|
||||
* Array to hold 'Unique' index columns.
|
||||
* @type {array}
|
||||
*/
|
||||
let uniqueColumns = [];
|
||||
|
||||
/**
|
||||
* Array to hold 'Index' columns.
|
||||
* @type {array}
|
||||
*/
|
||||
let indexColumns = [];
|
||||
|
||||
/**
|
||||
* Array to hold 'Fulltext' columns.
|
||||
* @type {array}
|
||||
*/
|
||||
let fulltextColumns = [];
|
||||
|
||||
/**
|
||||
* Array to hold 'Spatial' columns.
|
||||
* @type {array}
|
||||
*/
|
||||
let spatialColumns = [];
|
||||
|
||||
/**
|
||||
* @return {void}
|
||||
*/
|
||||
Indexes.resetColumnLists = () => {
|
||||
primaryColumns = [];
|
||||
uniqueColumns = [];
|
||||
indexColumns = [];
|
||||
fulltextColumns = [];
|
||||
spatialColumns = [];
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the array of indexes based on the index choice
|
||||
*
|
||||
@ -22,23 +63,23 @@ const Indexes = {};
|
||||
* @return {null|object}
|
||||
*/
|
||||
Indexes.getIndexArray = function (indexChoice) {
|
||||
var sourceArray = null;
|
||||
let sourceArray = null;
|
||||
|
||||
switch (indexChoice.toLowerCase()) {
|
||||
case 'primary':
|
||||
sourceArray = window.primaryIndexes;
|
||||
sourceArray = primaryColumns;
|
||||
break;
|
||||
case 'unique':
|
||||
sourceArray = window.uniqueIndexes;
|
||||
sourceArray = uniqueColumns;
|
||||
break;
|
||||
case 'index':
|
||||
sourceArray = window.indexes;
|
||||
sourceArray = indexColumns;
|
||||
break;
|
||||
case 'fulltext':
|
||||
sourceArray = window.fulltextIndexes;
|
||||
sourceArray = fulltextColumns;
|
||||
break;
|
||||
case 'spatial':
|
||||
sourceArray = window.spatialIndexes;
|
||||
sourceArray = spatialColumns;
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
@ -570,12 +611,7 @@ Indexes.off = () => function () {
|
||||
* @return {function}
|
||||
*/
|
||||
Indexes.on = () => function () {
|
||||
// Re-initialize variables.
|
||||
window.primaryIndexes = [];
|
||||
window.uniqueIndexes = [];
|
||||
window.indexes = [];
|
||||
window.fulltextIndexes = [];
|
||||
window.spatialIndexes = [];
|
||||
Indexes.resetColumnLists();
|
||||
|
||||
// for table creation form
|
||||
var $engineSelector = $('.create_table_form select[name=tbl_storage_engine]');
|
||||
|
||||
@ -5,6 +5,7 @@ import { Navigation } from '../modules/navigation.js';
|
||||
import { CommonActions, CommonParams } from '../modules/common.js';
|
||||
import highlightSql from '../modules/sql-highlight.js';
|
||||
import { ajaxRemoveMessage, ajaxShowMessage } from '../modules/ajax-message.js';
|
||||
import { Indexes } from '../modules/indexes.js';
|
||||
|
||||
/**
|
||||
* @fileoverview functions used on the table structure page
|
||||
@ -58,11 +59,7 @@ AJAX.registerTeardown('table/structure.js', function () {
|
||||
});
|
||||
|
||||
AJAX.registerOnload('table/structure.js', function () {
|
||||
// Re-initialize variables.
|
||||
window.primaryIndexes = [];
|
||||
window.indexes = [];
|
||||
window.fulltextIndexes = [];
|
||||
window.spatialIndexes = [];
|
||||
Indexes.resetColumnLists();
|
||||
|
||||
/**
|
||||
*Ajax action for submitting the "Column Change" and "Add Column" form
|
||||
|
||||
Loading…
Reference in New Issue
Block a user