Remove Indexes object from the Window global object
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
b7a710e83f
commit
49865fe647
@ -3,10 +3,10 @@ import { AJAX } from './ajax.js';
|
||||
import { Navigation } from './navigation.js';
|
||||
import { CommonActions, CommonParams } from './common.js';
|
||||
import { mysqlDocKeyword, mysqlDocBuiltin } from './modules/doc-links.js';
|
||||
import { Indexes } from './indexes.js';
|
||||
|
||||
/* global ChartType, ColumnType, DataTable, JQPlotChartFactory */ // js/chart.js
|
||||
/* global DatabaseStructure */ // js/database/structure.js
|
||||
/* global Indexes */ // js/indexes.js
|
||||
/* global firstDayOfCalendar, maxInputVars, mysqlDocTemplate, themeImagePath */ // templates/javascript/variables.twig
|
||||
|
||||
/**
|
||||
|
||||
@ -10,9 +10,7 @@ import { CommonActions, CommonParams } from './common.js';
|
||||
*
|
||||
* @requires jQueryUI
|
||||
*/
|
||||
|
||||
var Indexes = {};
|
||||
window.Indexes = Indexes;
|
||||
const Indexes = {};
|
||||
|
||||
/**
|
||||
* Returns the array of indexes based on the index choice
|
||||
@ -803,3 +801,5 @@ Indexes.on = () => function () {
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
export { Indexes };
|
||||
|
||||
@ -5,8 +5,7 @@ import { KeyHandlerEvents } from './keyhandler.js';
|
||||
import { Navigation } from './navigation.js';
|
||||
import { PageSettings } from './page_settings.js';
|
||||
import { crossFramingProtection } from './cross_framing_protection.js';
|
||||
|
||||
/* global Indexes */
|
||||
import { Indexes } from './indexes.js';
|
||||
|
||||
AJAX.registerOnload('main.js', () => AJAX.removeSubmitEvents());
|
||||
$(AJAX.loadEventHandler());
|
||||
@ -39,8 +38,8 @@ $(Functions.breadcrumbScrollToTop());
|
||||
|
||||
$(Navigation.onload());
|
||||
|
||||
AJAX.registerTeardown('indexes.js', Indexes.off());
|
||||
AJAX.registerOnload('indexes.js', Indexes.on());
|
||||
AJAX.registerTeardown('main.js', Indexes.off());
|
||||
AJAX.registerOnload('main.js', Indexes.on());
|
||||
|
||||
$(() => Functions.checkNumberOfFields());
|
||||
|
||||
|
||||
@ -77,7 +77,6 @@ class SqlController extends AbstractController
|
||||
$this->addScriptFiles([
|
||||
'vendor/jquery/jquery.uitablefilter.js',
|
||||
'table/change.js',
|
||||
'indexes.js',
|
||||
'gis_data_editor.js',
|
||||
'multi_column_sort.js',
|
||||
]);
|
||||
|
||||
@ -188,7 +188,7 @@ class AddFieldController extends AbstractController
|
||||
|
||||
$GLOBALS['active_page'] = Url::getFromRoute('/table/structure');
|
||||
|
||||
$this->addScriptFiles(['vendor/jquery/jquery.uitablefilter.js', 'indexes.js']);
|
||||
$this->addScriptFiles(['vendor/jquery/jquery.uitablefilter.js']);
|
||||
|
||||
$this->checkParameters(['server', 'db', 'table', 'num_fields']);
|
||||
|
||||
|
||||
@ -153,7 +153,7 @@ class CreateController extends AbstractController
|
||||
// Do not display the table in the header since it hasn't been created yet
|
||||
$this->response->getHeader()->getMenu()->setTable('');
|
||||
|
||||
$this->addScriptFiles(['vendor/jquery/jquery.uitablefilter.js', 'indexes.js']);
|
||||
$this->addScriptFiles(['vendor/jquery/jquery.uitablefilter.js']);
|
||||
|
||||
$this->checkParameters(['server', 'db']);
|
||||
|
||||
|
||||
@ -91,8 +91,6 @@ final class IndexRenameController extends AbstractController
|
||||
$formParams['old_index'] = $_POST['index'];
|
||||
}
|
||||
|
||||
$this->addScriptFiles(['indexes.js']);
|
||||
|
||||
$this->render('table/index_rename_form', [
|
||||
'index' => $index,
|
||||
'form_params' => $formParams,
|
||||
|
||||
@ -139,8 +139,6 @@ class IndexesController extends AbstractController
|
||||
$form_params['old_index'] = $_POST['index'];
|
||||
}
|
||||
|
||||
$this->addScriptFiles(['indexes.js']);
|
||||
|
||||
$this->render('table/index_form', [
|
||||
'fields' => $fields,
|
||||
'index' => $index,
|
||||
|
||||
@ -93,7 +93,7 @@ final class RelationController extends AbstractController
|
||||
return;
|
||||
}
|
||||
|
||||
$this->addScriptFiles(['table/relation.js', 'indexes.js']);
|
||||
$this->addScriptFiles(['table/relation.js']);
|
||||
|
||||
// Set the database
|
||||
$this->dbi->selectDb($GLOBALS['db']);
|
||||
|
||||
@ -83,7 +83,7 @@ final class ReplaceController extends AbstractController
|
||||
|
||||
$this->dbi->selectDb($GLOBALS['db']);
|
||||
|
||||
$this->addScriptFiles(['makegrid.js', 'sql.js', 'indexes.js', 'gis_data_editor.js']);
|
||||
$this->addScriptFiles(['makegrid.js', 'sql.js', 'gis_data_editor.js']);
|
||||
|
||||
$insertRows = $_POST['insert_rows'] ?? null;
|
||||
if (is_numeric($insertRows) && $insertRows != $GLOBALS['cfg']['InsertRows']) {
|
||||
|
||||
@ -90,7 +90,7 @@ final class ChangeController extends AbstractController
|
||||
$checkUserPrivileges = new CheckUserPrivileges($this->dbi);
|
||||
$checkUserPrivileges->getPrivileges();
|
||||
|
||||
$this->addScriptFiles(['vendor/jquery/jquery.uitablefilter.js', 'indexes.js']);
|
||||
$this->addScriptFiles(['vendor/jquery/jquery.uitablefilter.js']);
|
||||
|
||||
$this->checkParameters(['server', 'db', 'table', 'num_fields']);
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ final class PartitioningController extends AbstractController
|
||||
$this->response->addHTML($pageSettings->getErrorHTML());
|
||||
$this->response->addHTML($pageSettings->getHTML());
|
||||
|
||||
$this->addScriptFiles(['table/structure.js', 'indexes.js']);
|
||||
$this->addScriptFiles(['table/structure.js']);
|
||||
|
||||
$partitionDetails = null;
|
||||
if (! isset($_POST['partition_by'])) {
|
||||
|
||||
@ -121,7 +121,7 @@ class StructureController extends AbstractController
|
||||
$checkUserPrivileges = new CheckUserPrivileges($this->dbi);
|
||||
$checkUserPrivileges->getPrivileges();
|
||||
|
||||
$this->addScriptFiles(['table/structure.js', 'indexes.js']);
|
||||
$this->addScriptFiles(['table/structure.js']);
|
||||
|
||||
$relationParameters = $this->relation->getRelationParameters();
|
||||
|
||||
|
||||
@ -142,7 +142,6 @@ class Header
|
||||
$this->scripts->addFile('shared.js');
|
||||
$this->scripts->addFile('menu_resizer.js');
|
||||
$this->scripts->addFile('config.js');
|
||||
$this->scripts->addFile('indexes.js');
|
||||
$this->scripts->addFile('main.js');
|
||||
|
||||
$this->scripts->addCode($this->getJsParamsCode());
|
||||
|
||||
@ -264,7 +264,6 @@ class HeaderTest extends AbstractTestCase
|
||||
['name' => 'shared.js', 'fire' => 0],
|
||||
['name' => 'menu_resizer.js', 'fire' => 1],
|
||||
['name' => 'config.js', 'fire' => 1],
|
||||
['name' => 'indexes.js', 'fire' => 1],
|
||||
['name' => 'main.js', 'fire' => 1],
|
||||
];
|
||||
$this->assertSame($expected, $scripts->getFiles());
|
||||
|
||||
@ -40,7 +40,6 @@ module.exports = [
|
||||
'gis_data_editor': './js/src/gis_data_editor.js',
|
||||
'home': './js/src/home.js',
|
||||
'import': './js/src/import.js',
|
||||
'indexes': './js/src/indexes.js',
|
||||
'jqplot/plugins/jqplot.byteFormatter': './js/src/jqplot/plugins/jqplot.byteFormatter.js',
|
||||
'jquery.sortable-table': './js/src/jquery.sortable-table.js',
|
||||
'main': './js/src/main.js',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user