Replace var with let or const in TypeScript files
Most of the changes were done by PhpStorm. Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
This commit is contained in:
parent
dbb116703b
commit
0d843e68fe
@ -11,8 +11,8 @@ window.CodeMirror.sqlLint = function (text, updateLinting, options, cm) {
|
||||
}
|
||||
|
||||
function handleResponse (response) {
|
||||
var found = [];
|
||||
for (var idx in response) {
|
||||
const found = [];
|
||||
for (let idx in response) {
|
||||
found.push({
|
||||
// eslint-disable-next-line new-cap
|
||||
from: window.CodeMirror.Pos(
|
||||
|
||||
@ -53,7 +53,7 @@ AJAX.registerOnload('database/central_columns.js', function () {
|
||||
|
||||
$('#tableslistcontainer').find('button[name="delete_central_columns"]').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
var multiDeleteColumns = $('.checkall:checkbox:checked').serialize();
|
||||
const multiDeleteColumns = $('.checkall:checkbox:checked').serialize();
|
||||
if (multiDeleteColumns === '') {
|
||||
ajaxShowMessage(window.Messages.strRadioUnchecked);
|
||||
|
||||
@ -67,15 +67,15 @@ AJAX.registerOnload('database/central_columns.js', function () {
|
||||
|
||||
$('#tableslistcontainer').find('button[name="edit_central_columns"]').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
var editColumnList = $('.checkall:checkbox:checked').serialize();
|
||||
const editColumnList = $('.checkall:checkbox:checked').serialize();
|
||||
if (editColumnList === '') {
|
||||
ajaxShowMessage(window.Messages.strRadioUnchecked);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var editColumnData = editColumnList + '' + argsep + 'edit_central_columns_page=true' + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'db=' + encodeURIComponent(CommonParams.get('db')) + argsep + 'server=' + CommonParams.get('server');
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
const editColumnData = editColumnList + '' + argsep + 'edit_central_columns_page=true' + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'db=' + encodeURIComponent(CommonParams.get('db')) + argsep + 'server=' + CommonParams.get('server');
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $(this);
|
||||
$.post('index.php?route=/database/central-columns', editColumnData, AJAX.responseHandler);
|
||||
@ -84,8 +84,8 @@ AJAX.registerOnload('database/central_columns.js', function () {
|
||||
$('#multi_edit_central_columns').on('submit', function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var multiColumnEditData = $('#multi_edit_central_columns').serialize() + argsep + 'multi_edit_central_column_save=true' + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'db=' + encodeURIComponent(CommonParams.get('db')) + argsep + 'server=' + CommonParams.get('server');
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
const multiColumnEditData = $('#multi_edit_central_columns').serialize() + argsep + 'multi_edit_central_column_save=true' + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'db=' + encodeURIComponent(CommonParams.get('db')) + argsep + 'server=' + CommonParams.get('server');
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $(this);
|
||||
$.post('index.php?route=/database/central-columns', multiColumnEditData, AJAX.responseHandler);
|
||||
@ -107,19 +107,19 @@ AJAX.registerOnload('database/central_columns.js', function () {
|
||||
window.scrollTo(0, 0);
|
||||
$(document).on('keyup', '.filter_rows', function () {
|
||||
// get the column names
|
||||
var cols = $('th.column_heading').map(function () {
|
||||
const cols = $('th.column_heading').map(function () {
|
||||
return $(this).text().trim();
|
||||
}).get();
|
||||
$.uiTableFilter($('#table_columns'), $(this).val(), cols, null, 'td span');
|
||||
});
|
||||
|
||||
$('.edit').on('click', function () {
|
||||
var rownum = $(this).parent().data('rownum');
|
||||
const rownum = $(this).parent().data('rownum');
|
||||
$('#save_' + rownum).show();
|
||||
$(this).hide();
|
||||
$('#f_' + rownum + ' td span').hide();
|
||||
$('#f_' + rownum + ' input, #f_' + rownum + ' select, #f_' + rownum + ' .open_enum_editor').show();
|
||||
var attributeVal = $('#f_' + rownum + ' td[name=col_attribute] span').html();
|
||||
const attributeVal = $('#f_' + rownum + ' td[name=col_attribute] span').html();
|
||||
$('#f_' + rownum + ' select[name=field_attribute\\[' + rownum + '\\] ] option[value="' + attributeVal + '"]').attr('selected', 'selected');
|
||||
if ($('#f_' + rownum + ' .default_type').val() === 'USER_DEFINED') {
|
||||
$('#f_' + rownum + ' .default_type').siblings('.default_value').show();
|
||||
@ -131,10 +131,10 @@ AJAX.registerOnload('database/central_columns.js', function () {
|
||||
$('.del_row').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var $td = $(this);
|
||||
var question = window.Messages.strDeleteCentralColumnWarning;
|
||||
const $td = $(this);
|
||||
const question = window.Messages.strDeleteCentralColumnWarning;
|
||||
$td.confirm(question, null, function () {
|
||||
var rownum = $td.data('rownum');
|
||||
const rownum = $td.data('rownum');
|
||||
$('#del_col_name').val('selected_fld%5B%5D=' + $('#checkbox_row_' + rownum).val());
|
||||
$('#del_form').trigger('submit');
|
||||
});
|
||||
@ -143,7 +143,7 @@ AJAX.registerOnload('database/central_columns.js', function () {
|
||||
$('.edit_cancel_form').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var rownum = $(this).data('rownum');
|
||||
const rownum = $(this).data('rownum');
|
||||
$('#save_' + rownum).hide();
|
||||
$('#edit_' + rownum).show();
|
||||
$('#f_' + rownum + ' td span').show();
|
||||
@ -154,7 +154,7 @@ AJAX.registerOnload('database/central_columns.js', function () {
|
||||
$('.edit_save_form').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var rownum = $(this).data('rownum');
|
||||
const rownum = $(this).data('rownum');
|
||||
$('#f_' + rownum + ' td').each(function () {
|
||||
if ($(this).attr('name') !== 'undefined') {
|
||||
$(this).find(':input[type!="hidden"],select').first()
|
||||
@ -168,7 +168,7 @@ AJAX.registerOnload('database/central_columns.js', function () {
|
||||
$('#f_' + rownum + ' .default_value').attr('name', 'col_default_val');
|
||||
}
|
||||
|
||||
var datastring = $('#f_' + rownum + ' :input').serialize();
|
||||
const datastring = $('#f_' + rownum + ' :input').serialize();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'index.php?route=/database/central-columns',
|
||||
@ -212,14 +212,14 @@ AJAX.registerOnload('database/central_columns.js', function () {
|
||||
});
|
||||
|
||||
$('#table-select').on('change', function () {
|
||||
var selectValue = $(this).val();
|
||||
var defaultColumnSelect = $('#column-select').find('option').first();
|
||||
var href = 'index.php?route=/database/central-columns/populate';
|
||||
var params = {
|
||||
const selectValue = $(this).val();
|
||||
const defaultColumnSelect = $('#column-select').find('option').first();
|
||||
const href = 'index.php?route=/database/central-columns/populate';
|
||||
const params = {
|
||||
'ajax_request': true,
|
||||
'server': CommonParams.get('server'),
|
||||
'db': CommonParams.get('db'),
|
||||
'selectedTable': selectValue
|
||||
'selectedTable': selectValue,
|
||||
};
|
||||
$('#column-select').html('<option value="">' + window.Messages.strLoading + '</option>');
|
||||
if (selectValue !== '') {
|
||||
@ -231,7 +231,7 @@ AJAX.registerOnload('database/central_columns.js', function () {
|
||||
});
|
||||
|
||||
$('#add_column').on('submit', function (e) {
|
||||
var selectvalue = $('#column-select').val();
|
||||
const selectvalue = $('#column-select').val();
|
||||
if (selectvalue === '') {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
@ -240,7 +240,7 @@ AJAX.registerOnload('database/central_columns.js', function () {
|
||||
|
||||
$('#add_col_div').find('>a').on('click', function () {
|
||||
$('#add_new').slideToggle('slow');
|
||||
var $addColDivLinkSpan = $('#add_col_div').find('>a span');
|
||||
const $addColDivLinkSpan = $('#add_col_div').find('>a span');
|
||||
if ($addColDivLinkSpan.html() === '+') {
|
||||
$addColDivLinkSpan.html('-');
|
||||
} else {
|
||||
|
||||
@ -30,7 +30,7 @@ const DatabaseEvents = {
|
||||
* @var $elm a jQuery object containing the reference
|
||||
* to an element that is being validated
|
||||
*/
|
||||
var $elm = null;
|
||||
let $elm = null;
|
||||
// Common validation. At the very least the name
|
||||
// and the definition must be provided for an item
|
||||
$elm = $('table.rte_table').last().find('input[name=item_name]');
|
||||
@ -60,21 +60,21 @@ const DatabaseEvents = {
|
||||
},
|
||||
|
||||
exportDialog: function ($this) {
|
||||
var $msg = ajaxShowMessage();
|
||||
const $msg = ajaxShowMessage();
|
||||
if ($this.attr('id') === 'bulkActionExportButton') {
|
||||
var combined = {
|
||||
const combined = {
|
||||
success: true,
|
||||
title: window.Messages.strExport,
|
||||
message: '',
|
||||
error: ''
|
||||
error: '',
|
||||
};
|
||||
// export anchors of all selected rows
|
||||
var exportAnchors = $('input.checkall:checked').parents('tr').find('.export_anchor');
|
||||
var count = exportAnchors.length;
|
||||
var returnCount = 0;
|
||||
var p: any = $.when();
|
||||
const exportAnchors = $('input.checkall:checked').parents('tr').find('.export_anchor');
|
||||
const count = exportAnchors.length;
|
||||
let returnCount = 0;
|
||||
let p: any = $.when();
|
||||
exportAnchors.each(function () {
|
||||
var h = $(this).attr('href');
|
||||
const h = $(this).attr('href');
|
||||
p = p.then(function () {
|
||||
return $.get(h, { 'ajax_request': true }, function (data) {
|
||||
returnCount++;
|
||||
@ -126,13 +126,13 @@ const DatabaseEvents = {
|
||||
}
|
||||
},
|
||||
editorDialog: function (isNew, $this) {
|
||||
var that = this;
|
||||
const that = this;
|
||||
/**
|
||||
* @var $edit_row jQuery object containing the reference to
|
||||
* the row of the the item being edited
|
||||
* from the list of items
|
||||
*/
|
||||
var $editRow = null;
|
||||
let $editRow = null;
|
||||
if ($this.hasClass('edit_anchor')) {
|
||||
// Remember the row of the item being edited for later,
|
||||
// so that if the edit is successful, we can replace the
|
||||
@ -144,7 +144,7 @@ const DatabaseEvents = {
|
||||
* @var $msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user
|
||||
*/
|
||||
var $msg = ajaxShowMessage();
|
||||
let $msg = ajaxShowMessage();
|
||||
$.get($this.attr('href'), { 'ajax_request': true }, function (data) {
|
||||
if (data.success !== true) {
|
||||
ajaxShowMessage(data.error, false);
|
||||
@ -169,12 +169,12 @@ const DatabaseEvents = {
|
||||
/**
|
||||
* @var data Form data to be sent in the AJAX request
|
||||
*/
|
||||
var data = $('form.rte_form').last().serialize();
|
||||
const data = $('form.rte_form').last().serialize();
|
||||
$msg = ajaxShowMessage(
|
||||
window.Messages.strProcessingRequest
|
||||
);
|
||||
|
||||
var url = $('form.rte_form').last().attr('action');
|
||||
const url = $('form.rte_form').last().attr('action');
|
||||
$.post(url, data, function (data) {
|
||||
if (data.success !== true) {
|
||||
ajaxShowMessage(data.error, false);
|
||||
@ -205,12 +205,12 @@ const DatabaseEvents = {
|
||||
* to find the correct location where
|
||||
* to insert a new row.
|
||||
*/
|
||||
var text = '';
|
||||
let text = '';
|
||||
/**
|
||||
* @var inserted Whether a new item has been
|
||||
* inserted in the list or not
|
||||
*/
|
||||
var inserted = false;
|
||||
let inserted = false;
|
||||
$('table.data').find('tr').each(function () {
|
||||
text = $(this)
|
||||
.children('td')
|
||||
@ -258,12 +258,12 @@ const DatabaseEvents = {
|
||||
/**
|
||||
* @var ct Count of processed rows
|
||||
*/
|
||||
var ct = 0;
|
||||
let ct = 0;
|
||||
/**
|
||||
* @var rowclass Class to be attached to the row
|
||||
* that is being processed
|
||||
*/
|
||||
var rowclass = '';
|
||||
let rowclass = '';
|
||||
$('table.data').find('tr').has('td').each(function () {
|
||||
rowclass = (ct % 2 === 0) ? 'odd' : 'even';
|
||||
$(this).removeClass().addClass(rowclass);
|
||||
@ -319,8 +319,8 @@ const DatabaseEvents = {
|
||||
* @var elm jQuery object containing the reference to
|
||||
* the Definition textarea.
|
||||
*/
|
||||
var $elm = $('textarea[name=item_definition]').last();
|
||||
var linterOptions = {
|
||||
const $elm = $('textarea[name=item_definition]').last();
|
||||
const linterOptions = {
|
||||
editorType: 'event',
|
||||
};
|
||||
that.syntaxHiglighter = getSqlEditor($elm, {}, 'vertical', linterOptions);
|
||||
@ -342,12 +342,12 @@ const DatabaseEvents = {
|
||||
/**
|
||||
* @var $curr_row Object containing reference to the current row
|
||||
*/
|
||||
var $currRow = $this.parents('tr');
|
||||
const $currRow = $this.parents('tr');
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = $('<div></div>').text(
|
||||
$currRow.children('td').children('.drop_sql').html()
|
||||
const question = $('<div></div>').text(
|
||||
$currRow.children('td').children('.drop_sql').html(),
|
||||
);
|
||||
// We ask for confirmation first here, before submitting the ajax request
|
||||
$this.confirm(question, $this.attr('href'), function (url) {
|
||||
@ -355,8 +355,8 @@ const DatabaseEvents = {
|
||||
* @var msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user
|
||||
*/
|
||||
var $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var params = getJsConfirmCommonParam(this, $this.getPostData());
|
||||
const $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
const params = getJsConfirmCommonParam(this, $this.getPostData());
|
||||
$.post(url, params, function (data) {
|
||||
if (data.success !== true) {
|
||||
ajaxShowMessage(data.error, false);
|
||||
@ -368,7 +368,7 @@ const DatabaseEvents = {
|
||||
* @var $table Object containing reference
|
||||
* to the main list of elements
|
||||
*/
|
||||
var $table = $currRow.parent();
|
||||
const $table = $currRow.parent();
|
||||
// Check how many rows will be left after we remove
|
||||
// the one that the user has requested us to remove
|
||||
if ($table.find('tr').length === 3) {
|
||||
@ -390,12 +390,12 @@ const DatabaseEvents = {
|
||||
/**
|
||||
* @var ct Count of processed rows
|
||||
*/
|
||||
var ct = 0;
|
||||
let ct = 0;
|
||||
/**
|
||||
* @var rowclass Class to be attached to the row
|
||||
* that is being processed
|
||||
*/
|
||||
var rowclass = '';
|
||||
let rowclass = '';
|
||||
$table.find('tr').has('td').each(function () {
|
||||
rowclass = (ct % 2 === 1) ? 'odd' : 'even';
|
||||
$(this).removeClass().addClass(rowclass);
|
||||
@ -420,21 +420,21 @@ const DatabaseEvents = {
|
||||
* @var msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user
|
||||
*/
|
||||
var $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
const $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
|
||||
// drop anchors of all selected rows
|
||||
var dropAnchors = $('input.checkall:checked').parents('tr').find('.drop_anchor');
|
||||
var success = true;
|
||||
var count = dropAnchors.length;
|
||||
var returnCount = 0;
|
||||
const dropAnchors = $('input.checkall:checked').parents('tr').find('.drop_anchor');
|
||||
let success = true;
|
||||
const count = dropAnchors.length;
|
||||
let returnCount = 0;
|
||||
|
||||
dropAnchors.each(function () {
|
||||
var $anchor = $(this);
|
||||
const $anchor = $(this);
|
||||
/**
|
||||
* @var $curr_row Object containing reference to the current row
|
||||
*/
|
||||
var $currRow = $anchor.parents('tr');
|
||||
var params = getJsConfirmCommonParam(this, $anchor.getPostData());
|
||||
const $currRow = $anchor.parents('tr');
|
||||
const params = getJsConfirmCommonParam(this, $anchor.getPostData());
|
||||
$.post($anchor.attr('href'), params, function (data) {
|
||||
returnCount++;
|
||||
if (data.success !== true) {
|
||||
@ -451,7 +451,7 @@ const DatabaseEvents = {
|
||||
* @var $table Object containing reference
|
||||
* to the main list of elements
|
||||
*/
|
||||
var $table = $currRow.parent();
|
||||
const $table = $currRow.parent();
|
||||
// Check how many rows will be left after we remove
|
||||
// the one that the user has requested us to remove
|
||||
if ($table.find('tr').length === 3) {
|
||||
@ -471,12 +471,12 @@ const DatabaseEvents = {
|
||||
/**
|
||||
* @var ct Count of processed rows
|
||||
*/
|
||||
var ct = 0;
|
||||
let ct = 0;
|
||||
/**
|
||||
* @var rowclass Class to be attached to the row
|
||||
* that is being processed
|
||||
*/
|
||||
var rowclass = '';
|
||||
let rowclass = '';
|
||||
$table.find('tr').has('td').each(function () {
|
||||
rowclass = (ct % 2 === 1) ? 'odd' : 'even';
|
||||
$(this).removeClass().addClass(rowclass);
|
||||
@ -510,7 +510,7 @@ const DatabaseEvents = {
|
||||
* @var elm a jQuery object containing the reference
|
||||
* to an element that is being validated
|
||||
*/
|
||||
var $elm = null;
|
||||
let $elm = null;
|
||||
const eventsEditorModal = $('#eventsEditorModal');
|
||||
if (eventsEditorModal.find('select[name=item_type]').find(':selected').val() === 'RECURRING') {
|
||||
// The interval field must not be empty for recurring events
|
||||
|
||||
@ -41,11 +41,11 @@ AJAX.registerTeardown('database/multi_table_query.js', function () {
|
||||
});
|
||||
|
||||
AJAX.registerOnload('database/multi_table_query.js', function () {
|
||||
var editor = getSqlEditor($('#MultiSqlquery'), {}, 'vertical');
|
||||
const editor = getSqlEditor($('#MultiSqlquery'), {}, 'vertical');
|
||||
$('.CodeMirror-line').css('text-align', 'left');
|
||||
editor.setSize(-1, -1);
|
||||
|
||||
var columnCount = 3;
|
||||
let columnCount = 3;
|
||||
addNewColumnCallbacks();
|
||||
|
||||
function opsWithMultipleArgs (): string[] {
|
||||
@ -57,13 +57,13 @@ AJAX.registerOnload('database/multi_table_query.js', function () {
|
||||
}
|
||||
|
||||
$('#update_query_button').on('click', function () {
|
||||
var columns = [];
|
||||
var tableAliases = {};
|
||||
const columns = [];
|
||||
const tableAliases = {};
|
||||
$('.tableNameSelect').each(function () {
|
||||
var $show = $(this).siblings('.show_col').first();
|
||||
const $show = $(this).siblings('.show_col').first();
|
||||
if ($(this).val() !== '' && $show.prop('checked')) {
|
||||
var tableAlias = $(this).siblings('.table_alias').first().val();
|
||||
var columnAlias = $(this).siblings('.col_alias').first().val();
|
||||
const tableAlias = $(this).siblings('.table_alias').first().val();
|
||||
const columnAlias = $(this).siblings('.col_alias').first().val();
|
||||
|
||||
if (tableAlias !== '') {
|
||||
columns.push([tableAlias, $(this).siblings('.columnNameSelect').first().val()]);
|
||||
@ -89,7 +89,7 @@ AJAX.registerOnload('database/multi_table_query.js', function () {
|
||||
return;
|
||||
}
|
||||
|
||||
var foreignKeys;
|
||||
let foreignKeys;
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
async: false,
|
||||
@ -106,7 +106,7 @@ AJAX.registerOnload('database/multi_table_query.js', function () {
|
||||
}
|
||||
});
|
||||
|
||||
var query = 'SELECT ' + '`' + escapeBacktick(columns[0][0]) + '`.';
|
||||
let query = 'SELECT ' + '`' + escapeBacktick(columns[0][0]) + '`.';
|
||||
if (columns[0][1] === '*') {
|
||||
query += '*';
|
||||
} else {
|
||||
@ -117,7 +117,7 @@ AJAX.registerOnload('database/multi_table_query.js', function () {
|
||||
query += ' AS `' + escapeBacktick(columns[0][2]) + '`';
|
||||
}
|
||||
|
||||
for (var i = 1; i < columns.length; i++) {
|
||||
for (let i = 1; i < columns.length; i++) {
|
||||
query += ', `' + escapeBacktick(columns[i][0]) + '`.';
|
||||
if (columns[i][1] === '*') {
|
||||
query += '*';
|
||||
@ -134,7 +134,7 @@ AJAX.registerOnload('database/multi_table_query.js', function () {
|
||||
|
||||
query += window.generateFromBlock(tableAliases, foreignKeys);
|
||||
|
||||
var $criteriaColCount = $('.criteria_col:checked').length;
|
||||
const $criteriaColCount = $('.criteria_col:checked').length;
|
||||
if ($criteriaColCount > 0) {
|
||||
query += '\nWHERE ';
|
||||
query += window.generateWhereBlock();
|
||||
@ -145,7 +145,7 @@ AJAX.registerOnload('database/multi_table_query.js', function () {
|
||||
});
|
||||
|
||||
$('#submit_query').on('click', function () {
|
||||
var query = editor.getDoc().getValue();
|
||||
const query = editor.getDoc().getValue();
|
||||
// Verifying that the query is not empty
|
||||
if (query === '') {
|
||||
ajaxShowMessage(window.Messages.strEmptyQuery, false, 'error');
|
||||
@ -153,19 +153,19 @@ AJAX.registerOnload('database/multi_table_query.js', function () {
|
||||
return;
|
||||
}
|
||||
|
||||
var data = {
|
||||
const data = {
|
||||
'db': $('#db_name').val(),
|
||||
'sql_query': query,
|
||||
'ajax_request': '1',
|
||||
'server': CommonParams.get('server'),
|
||||
'token': CommonParams.get('token')
|
||||
'token': CommonParams.get('token'),
|
||||
};
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'index.php?route=/database/multi-table-query/query',
|
||||
data: data,
|
||||
success: function (data) {
|
||||
var $resultsDom = $(data.message);
|
||||
const $resultsDom = $(data.message);
|
||||
$resultsDom.find('.ajax:not(.pageselector)').each(function () {
|
||||
$(this).on('click', function (event) {
|
||||
event.preventDefault();
|
||||
@ -200,7 +200,7 @@ AJAX.registerOnload('database/multi_table_query.js', function () {
|
||||
|
||||
$('#add_column_button').on('click', function () {
|
||||
columnCount++;
|
||||
var $newColumnDom = $('<div class="col"></div>').html($('#new_column_layout').html());
|
||||
const $newColumnDom = $('<div class="col"></div>').html($('#new_column_layout').html());
|
||||
$newColumnDom.find('.jsCriteriaButton').first().attr('data-bs-target', '#criteriaOptionsExtra' + columnCount.toString());
|
||||
$newColumnDom.find('.jsCriteriaButton').first().attr('aria-controls', 'criteriaOptionsExtra' + columnCount.toString());
|
||||
$newColumnDom.find('.jsCriteriaOptions').first().attr('id', 'criteriaOptionsExtra' + columnCount.toString());
|
||||
@ -312,11 +312,11 @@ AJAX.registerOnload('database/multi_table_query.js', function () {
|
||||
$('.jsCriteriaButton').each(function () {
|
||||
$(this).on('click', function (event, from) {
|
||||
if (from === null) {
|
||||
var $checkbox = $(this).siblings('.criteria_col').first();
|
||||
const $checkbox = $(this).siblings('.criteria_col').first();
|
||||
$checkbox.prop('checked', ! $checkbox.prop('checked'));
|
||||
}
|
||||
|
||||
var $criteriaColCount = $('.criteria_col:checked').length;
|
||||
const $criteriaColCount = $('.criteria_col:checked').length;
|
||||
if ($criteriaColCount > 1) {
|
||||
$(this).siblings('.jsCriteriaOptions').first().find('.logical_operator').first().css('display', 'table-row');
|
||||
}
|
||||
@ -325,7 +325,7 @@ AJAX.registerOnload('database/multi_table_query.js', function () {
|
||||
|
||||
$('.criteria_col').each(function () {
|
||||
$(this).on('change', function () {
|
||||
var $anchor = $(this).siblings('.jsCriteriaButton').first();
|
||||
const $anchor = $(this).siblings('.jsCriteriaButton').first();
|
||||
if (
|
||||
($(this).is(':checked') && ! $anchor.hasClass('collapsed'))
|
||||
|| (! $(this).is(':checked') && $anchor.hasClass('collapsed'))
|
||||
@ -341,8 +341,8 @@ AJAX.registerOnload('database/multi_table_query.js', function () {
|
||||
|
||||
$('.criteria_rhs').each(function () {
|
||||
$(this).on('change', function () {
|
||||
var $rhsCol = $(this).parent().parent().siblings('.rhs_table').first();
|
||||
var $rhsText = $(this).parent().parent().siblings('.rhs_text').first();
|
||||
const $rhsCol = $(this).parent().parent().siblings('.rhs_table').first();
|
||||
const $rhsText = $(this).parent().parent().siblings('.rhs_text').first();
|
||||
if ($(this).val() === 'text') {
|
||||
$rhsCol.css('display', 'none');
|
||||
$rhsText.css('display', 'table-row');
|
||||
|
||||
@ -48,8 +48,8 @@ AJAX.registerOnload('database/operations.js', function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
var oldDbName = CommonParams.get('db');
|
||||
var newDbName = $('#new_db_name').val();
|
||||
const oldDbName = CommonParams.get('db');
|
||||
const newDbName = $('#new_db_name').val();
|
||||
|
||||
if (newDbName === oldDbName) {
|
||||
ajaxShowMessage(window.Messages.strDatabaseRenameToSameName, false, 'error');
|
||||
@ -57,9 +57,9 @@ AJAX.registerOnload('database/operations.js', function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
var $form = $(this);
|
||||
const $form = $(this);
|
||||
|
||||
var question = escapeHtml('CREATE DATABASE ' + newDbName + ' / DROP DATABASE ' + oldDbName);
|
||||
const question = escapeHtml('CREATE DATABASE ' + newDbName + ' / DROP DATABASE ' + oldDbName);
|
||||
|
||||
prepareForAjaxRequest($form);
|
||||
|
||||
@ -73,7 +73,7 @@ AJAX.registerOnload('database/operations.js', function () {
|
||||
$('#pma_navigation_tree')
|
||||
.find('a:not(\'.expander\')')
|
||||
.each(function () {
|
||||
var $thisAnchor = $(this);
|
||||
const $thisAnchor = $(this);
|
||||
if ($thisAnchor.text() === data.newname) {
|
||||
// simulate a click on the new db name
|
||||
// in navigation
|
||||
@ -101,7 +101,7 @@ AJAX.registerOnload('database/operations.js', function () {
|
||||
}
|
||||
|
||||
ajaxShowMessage(window.Messages.strCopyingDatabase, false);
|
||||
var $form = $(this);
|
||||
const $form = $(this);
|
||||
prepareForAjaxRequest($form);
|
||||
$.post($form.attr('action'), $form.serialize(), function (data) {
|
||||
// use messages that stay on screen
|
||||
@ -138,7 +138,7 @@ AJAX.registerOnload('database/operations.js', function () {
|
||||
*/
|
||||
$(document).on('submit', '#change_db_charset_form.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var $form = $(this);
|
||||
const $form = $(this);
|
||||
prepareForAjaxRequest($form);
|
||||
ajaxShowMessage(window.Messages.strChangingCharset);
|
||||
$.post($form.attr('action'), $form.serialize(), function (data) {
|
||||
@ -155,17 +155,17 @@ AJAX.registerOnload('database/operations.js', function () {
|
||||
*/
|
||||
$(document).on('click', '#drop_db_anchor.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var $link = $(this);
|
||||
const $link = $(this);
|
||||
/**
|
||||
* @var {string} question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = window.Messages.strDropDatabaseStrongWarning + ' ';
|
||||
let question = window.Messages.strDropDatabaseStrongWarning + ' ';
|
||||
question += window.sprintf(
|
||||
window.Messages.strDoYouReally,
|
||||
'DROP DATABASE `' + escapeHtml(CommonParams.get('db') + '`')
|
||||
);
|
||||
|
||||
var params = getJsConfirmCommonParam(this, $link.getPostData());
|
||||
const params = getJsConfirmCommonParam(this, $link.getPostData());
|
||||
|
||||
$(this).confirm(question, $(this).attr('href'), function (url) {
|
||||
ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
|
||||
@ -129,11 +129,11 @@ function generateCondition (criteriaDiv, table) {
|
||||
}
|
||||
|
||||
function generateWhereBlock () {
|
||||
var count = 0;
|
||||
var query = '';
|
||||
let count = 0;
|
||||
let query = '';
|
||||
$('.tableNameSelect').each(function () {
|
||||
var criteriaDiv = $(this).siblings('.jsCriteriaOptions').first();
|
||||
var useCriteria = $(this).siblings('.criteria_col').first();
|
||||
const criteriaDiv = $(this).siblings('.jsCriteriaOptions').first();
|
||||
const useCriteria = $(this).siblings('.criteria_col').first();
|
||||
if ($(this).val() !== '' && useCriteria.prop('checked')) {
|
||||
if (count > 0) {
|
||||
criteriaDiv.find('input.logical_op').each(function () {
|
||||
@ -152,7 +152,7 @@ function generateWhereBlock () {
|
||||
}
|
||||
|
||||
function generateJoin (newTable, tableAliases, fk) {
|
||||
var query = '';
|
||||
let query = '';
|
||||
query += ' \n\tLEFT JOIN ' + '`' + escapeBacktick(newTable) + '`';
|
||||
if (tableAliases[fk.TABLE_NAME][0] !== '') {
|
||||
query += ' AS `' + escapeBacktick(tableAliases[newTable][0]) + '`';
|
||||
@ -174,15 +174,15 @@ function generateJoin (newTable, tableAliases, fk) {
|
||||
}
|
||||
|
||||
function existReference (table, fk, usedTables) {
|
||||
var isReferredBy = fk.TABLE_NAME === table && usedTables.includes(fk.REFERENCED_TABLE_NAME);
|
||||
var isReferencedBy = fk.REFERENCED_TABLE_NAME === table && usedTables.includes(fk.TABLE_NAME);
|
||||
const isReferredBy = fk.TABLE_NAME === table && usedTables.includes(fk.REFERENCED_TABLE_NAME);
|
||||
const isReferencedBy = fk.REFERENCED_TABLE_NAME === table && usedTables.includes(fk.TABLE_NAME);
|
||||
|
||||
return isReferredBy || isReferencedBy;
|
||||
}
|
||||
|
||||
function tryJoinTable (table, tableAliases, usedTables, foreignKeys) {
|
||||
for (var i = 0; i < foreignKeys.length; i++) {
|
||||
var fk = foreignKeys[i];
|
||||
for (let i = 0; i < foreignKeys.length; i++) {
|
||||
const fk = foreignKeys[i];
|
||||
if (existReference(table, fk, usedTables)) {
|
||||
return generateJoin(table, tableAliases, fk);
|
||||
}
|
||||
@ -192,7 +192,7 @@ function tryJoinTable (table, tableAliases, usedTables, foreignKeys) {
|
||||
}
|
||||
|
||||
function appendTable (table, tableAliases, usedTables, foreignKeys) {
|
||||
var query = tryJoinTable(table, tableAliases, usedTables, foreignKeys);
|
||||
let query = tryJoinTable(table, tableAliases, usedTables, foreignKeys);
|
||||
if (query === '') {
|
||||
if (usedTables.length > 0) {
|
||||
query += '\n\t, ';
|
||||
@ -210,9 +210,9 @@ function appendTable (table, tableAliases, usedTables, foreignKeys) {
|
||||
}
|
||||
|
||||
function generateFromBlock (tableAliases, foreignKeys) {
|
||||
var usedTables = [];
|
||||
var query = '';
|
||||
for (var table in tableAliases) {
|
||||
const usedTables = [];
|
||||
let query = '';
|
||||
for (let table in tableAliases) {
|
||||
if (tableAliases.hasOwnProperty(table)) {
|
||||
query += appendTable(table, tableAliases, usedTables, foreignKeys);
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ const DatabaseRoutines = {
|
||||
* @var $elm a jQuery object containing the reference
|
||||
* to an element that is being validated
|
||||
*/
|
||||
var $elm = null;
|
||||
let $elm = null;
|
||||
// Common validation. At the very least the name
|
||||
// and the definition must be provided for an item
|
||||
$elm = $('table.rte_table').last().find('input[name=item_name]');
|
||||
@ -70,27 +70,27 @@ const DatabaseRoutines = {
|
||||
},
|
||||
|
||||
exportDialog: function ($this) {
|
||||
var $msg = ajaxShowMessage();
|
||||
const $msg = ajaxShowMessage();
|
||||
if ($this.attr('id') === 'bulkActionExportButton') {
|
||||
var combined = {
|
||||
const combined = {
|
||||
success: true,
|
||||
title: window.Messages.strExport,
|
||||
message: '',
|
||||
error: ''
|
||||
error: '',
|
||||
};
|
||||
// export anchors of all selected rows
|
||||
var exportAnchors = $('input.checkall:checked').parents('tr').find('.export_anchor');
|
||||
var count = exportAnchors.length;
|
||||
var returnCount = 0;
|
||||
const exportAnchors = $('input.checkall:checked').parents('tr').find('.export_anchor');
|
||||
const count = exportAnchors.length;
|
||||
let returnCount = 0;
|
||||
|
||||
// No routine is exportable (due to privilege issues)
|
||||
if (count === 0) {
|
||||
ajaxShowMessage(window.Messages.NoExportable);
|
||||
}
|
||||
|
||||
var p: any = $.when();
|
||||
let p: any = $.when();
|
||||
exportAnchors.each(function () {
|
||||
var h = $(this).attr('href');
|
||||
const h = $(this).attr('href');
|
||||
p = p.then(function () {
|
||||
return $.get(h, { 'ajax_request': true }, function (data) {
|
||||
returnCount++;
|
||||
@ -142,13 +142,13 @@ const DatabaseRoutines = {
|
||||
}
|
||||
},
|
||||
editorDialog: function (isNew, $this) {
|
||||
var that = this;
|
||||
const that = this;
|
||||
/**
|
||||
* @var $edit_row jQuery object containing the reference to
|
||||
* the row of the the item being edited
|
||||
* from the list of items
|
||||
*/
|
||||
var $editRow = null;
|
||||
let $editRow = null;
|
||||
if ($this.hasClass('edit_anchor')) {
|
||||
// Remember the row of the item being edited for later,
|
||||
// so that if the edit is successful, we can replace the
|
||||
@ -160,7 +160,7 @@ const DatabaseRoutines = {
|
||||
* @var $msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user
|
||||
*/
|
||||
var $msg = ajaxShowMessage();
|
||||
let $msg = ajaxShowMessage();
|
||||
$.get($this.attr('href'), { 'ajax_request': true }, function (data) {
|
||||
if (data.success !== true) {
|
||||
ajaxShowMessage(data.error, false);
|
||||
@ -188,12 +188,12 @@ const DatabaseRoutines = {
|
||||
/**
|
||||
* @var data Form data to be sent in the AJAX request
|
||||
*/
|
||||
var data = $('form.rte_form').last().serialize();
|
||||
const data = $('form.rte_form').last().serialize();
|
||||
$msg = ajaxShowMessage(
|
||||
window.Messages.strProcessingRequest
|
||||
);
|
||||
|
||||
var url = $('form.rte_form').last().attr('action');
|
||||
const url = $('form.rte_form').last().attr('action');
|
||||
$.post(url, data, function (data) {
|
||||
if (data.success !== true) {
|
||||
ajaxShowMessage(data.error, false);
|
||||
@ -206,7 +206,7 @@ const DatabaseRoutines = {
|
||||
slidingMessage(data.message);
|
||||
bootstrap.Modal.getOrCreateInstance('#routinesEditorModal').hide();
|
||||
|
||||
var tableId = '#' + data.tableType + 'Table';
|
||||
const tableId = '#' + data.tableType + 'Table';
|
||||
// If we are in 'edit' mode, we must
|
||||
// remove the reference to the old row.
|
||||
if (isEditMode && $editRow !== null) {
|
||||
@ -226,12 +226,12 @@ const DatabaseRoutines = {
|
||||
* to find the correct location where
|
||||
* to insert a new row.
|
||||
*/
|
||||
var text = '';
|
||||
let text = '';
|
||||
/**
|
||||
* @var inserted Whether a new item has been
|
||||
* inserted in the list or not
|
||||
*/
|
||||
var inserted = false;
|
||||
let inserted = false;
|
||||
$(tableId + '.data').find('tr').each(function () {
|
||||
text = $(this)
|
||||
.children('td')
|
||||
@ -279,12 +279,12 @@ const DatabaseRoutines = {
|
||||
/**
|
||||
* @var ct Count of processed rows
|
||||
*/
|
||||
var ct = 0;
|
||||
let ct = 0;
|
||||
/**
|
||||
* @var rowclass Class to be attached to the row
|
||||
* that is being processed
|
||||
*/
|
||||
var rowclass = '';
|
||||
let rowclass = '';
|
||||
$(tableId + '.data').find('tr').has('td').each(function () {
|
||||
rowclass = (ct % 2 === 0) ? 'odd' : 'even';
|
||||
$(this).removeClass('odd even').addClass(rowclass);
|
||||
@ -339,8 +339,8 @@ const DatabaseRoutines = {
|
||||
* @var elm jQuery object containing the reference to
|
||||
* the Definition textarea.
|
||||
*/
|
||||
var $elm = $('textarea[name=item_definition]').last();
|
||||
var linterOptions = {
|
||||
const $elm = $('textarea[name=item_definition]').last();
|
||||
const linterOptions = {
|
||||
editorType: 'routine',
|
||||
};
|
||||
that.syntaxHiglighter = getSqlEditor($elm, {}, 'vertical', linterOptions);
|
||||
@ -365,12 +365,12 @@ const DatabaseRoutines = {
|
||||
/**
|
||||
* @var $curr_row Object containing reference to the current row
|
||||
*/
|
||||
var $currRow = $this.parents('tr');
|
||||
const $currRow = $this.parents('tr');
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = $('<div></div>').text(
|
||||
$currRow.children('td').children('.drop_sql').html()
|
||||
const question = $('<div></div>').text(
|
||||
$currRow.children('td').children('.drop_sql').html(),
|
||||
);
|
||||
// We ask for confirmation first here, before submitting the ajax request
|
||||
$this.confirm(question, $this.attr('href'), function (url) {
|
||||
@ -378,8 +378,8 @@ const DatabaseRoutines = {
|
||||
* @var msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user
|
||||
*/
|
||||
var $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var params = getJsConfirmCommonParam(this, $this.getPostData());
|
||||
const $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
const params = getJsConfirmCommonParam(this, $this.getPostData());
|
||||
$.post(url, params, function (data) {
|
||||
if (data.success !== true) {
|
||||
ajaxShowMessage(data.error, false);
|
||||
@ -391,7 +391,7 @@ const DatabaseRoutines = {
|
||||
* @var $table Object containing reference
|
||||
* to the main list of elements
|
||||
*/
|
||||
var $table = $currRow.parent().parent();
|
||||
const $table = $currRow.parent().parent();
|
||||
// Check how many rows will be left after we remove
|
||||
// the one that the user has requested us to remove
|
||||
if ($table.find('tr').length === 3) {
|
||||
@ -413,12 +413,12 @@ const DatabaseRoutines = {
|
||||
/**
|
||||
* @var ct Count of processed rows
|
||||
*/
|
||||
var ct = 0;
|
||||
let ct = 0;
|
||||
/**
|
||||
* @var rowclass Class to be attached to the row
|
||||
* that is being processed
|
||||
*/
|
||||
var rowclass = '';
|
||||
let rowclass = '';
|
||||
$table.find('tr').has('td').each(function () {
|
||||
rowclass = (ct % 2 === 1) ? 'odd' : 'even';
|
||||
$(this).removeClass('odd even').addClass(rowclass);
|
||||
@ -443,21 +443,21 @@ const DatabaseRoutines = {
|
||||
* @var msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user
|
||||
*/
|
||||
var $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
const $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
|
||||
// drop anchors of all selected rows
|
||||
var dropAnchors = $('input.checkall:checked').parents('tr').find('.drop_anchor');
|
||||
var success = true;
|
||||
var count = dropAnchors.length;
|
||||
var returnCount = 0;
|
||||
const dropAnchors = $('input.checkall:checked').parents('tr').find('.drop_anchor');
|
||||
let success = true;
|
||||
const count = dropAnchors.length;
|
||||
let returnCount = 0;
|
||||
|
||||
dropAnchors.each(function () {
|
||||
var $anchor = $(this);
|
||||
const $anchor = $(this);
|
||||
/**
|
||||
* @var $curr_row Object containing reference to the current row
|
||||
*/
|
||||
var $currRow = $anchor.parents('tr');
|
||||
var params = getJsConfirmCommonParam(this, $anchor.getPostData());
|
||||
const $currRow = $anchor.parents('tr');
|
||||
const params = getJsConfirmCommonParam(this, $anchor.getPostData());
|
||||
$.post($anchor.attr('href'), params, function (data) {
|
||||
returnCount++;
|
||||
if (data.success !== true) {
|
||||
@ -474,7 +474,7 @@ const DatabaseRoutines = {
|
||||
* @var $table Object containing reference
|
||||
* to the main list of elements
|
||||
*/
|
||||
var $table = $currRow.parent().parent();
|
||||
const $table = $currRow.parent().parent();
|
||||
// Check how many rows will be left after we remove
|
||||
// the one that the user has requested us to remove
|
||||
if ($table.find('tr').length === 3) {
|
||||
@ -494,12 +494,12 @@ const DatabaseRoutines = {
|
||||
/**
|
||||
* @var ct Count of processed rows
|
||||
*/
|
||||
var ct = 0;
|
||||
let ct = 0;
|
||||
/**
|
||||
* @var rowclass Class to be attached to the row
|
||||
* that is being processed
|
||||
*/
|
||||
var rowclass = '';
|
||||
let rowclass = '';
|
||||
$table.find('tr').has('td').each(function () {
|
||||
rowclass = (ct % 2 === 1) ? 'odd' : 'even';
|
||||
$(this).removeClass('odd even').addClass(rowclass);
|
||||
@ -532,7 +532,7 @@ const DatabaseRoutines = {
|
||||
postDialogShow: function (data) {
|
||||
// Cache the template for a parameter table row
|
||||
DatabaseRoutines.paramTemplate = data.paramTemplate;
|
||||
var that = this;
|
||||
const that = this;
|
||||
// Make adjustments in the dialog to make it AJAX compatible
|
||||
$('td.routine_param_remove').show();
|
||||
// Enable/disable the 'options' dropdowns for parameters as necessary
|
||||
@ -572,14 +572,14 @@ const DatabaseRoutines = {
|
||||
* @var index Counter used for reindexing the input
|
||||
* fields in the routine parameters table
|
||||
*/
|
||||
var index = 0;
|
||||
let index = 0;
|
||||
$('table.routine_params_table tbody').find('tr').each(function () {
|
||||
$(this).find(':input').each(function () {
|
||||
/**
|
||||
* @var inputname The value of the name attribute of
|
||||
* the input field being reindexed
|
||||
*/
|
||||
var inputname = $(this).attr('name');
|
||||
const inputname = $(this).attr('name');
|
||||
if (inputname.startsWith('item_param_dir')) {
|
||||
$(this).attr('name', inputname.substring(0, 14) + '[' + index + ']');
|
||||
} else if (inputname.startsWith('item_param_name')) {
|
||||
@ -608,12 +608,12 @@ const DatabaseRoutines = {
|
||||
/**
|
||||
* @var isSuccess Stores the outcome of the validation
|
||||
*/
|
||||
var isSuccess = true;
|
||||
let isSuccess = true;
|
||||
/**
|
||||
* @var inputname The value of the "name" attribute for
|
||||
* the field that is being processed
|
||||
*/
|
||||
var inputname = '';
|
||||
let inputname = '';
|
||||
|
||||
const routinesEditorModal = $('#routinesEditorModal');
|
||||
routinesEditorModal.find('table.routine_params_table').last().find('tr').each(function () {
|
||||
@ -646,8 +646,8 @@ const DatabaseRoutines = {
|
||||
|
||||
routinesEditorModal.find('table.routine_params_table').last().find('tr').each(function () {
|
||||
// SET, ENUM, VARCHAR and VARBINARY fields must have length/values
|
||||
var $inputtyp = $(this).find('select[name^=item_param_type]');
|
||||
var $inputlen = $(this).find('input[name^=item_param_length]');
|
||||
const $inputtyp = $(this).find('select[name^=item_param_type]');
|
||||
const $inputlen = $(this).find('input[name^=item_param_length]');
|
||||
if ($inputtyp.length && $inputlen.length) {
|
||||
if (($inputtyp.val() === 'ENUM' || $inputtyp.val() === 'SET' || ($inputtyp.val() as string).startsWith('VAR')) &&
|
||||
$inputlen.val() === ''
|
||||
@ -669,8 +669,8 @@ const DatabaseRoutines = {
|
||||
if (routinesEditorModal.find('select[name=item_type]').find(':selected').val() === 'FUNCTION') {
|
||||
// The length/values of return variable for functions must
|
||||
// be set, if the type is SET, ENUM, VARCHAR or VARBINARY.
|
||||
var $returntyp = routinesEditorModal.find('select[name=item_returntype]');
|
||||
var $returnlen = routinesEditorModal.find('input[name=item_returnlength]');
|
||||
const $returntyp = routinesEditorModal.find('select[name=item_returntype]');
|
||||
const $returnlen = routinesEditorModal.find('input[name=item_returnlength]');
|
||||
if (($returntyp.val() === 'ENUM' || $returntyp.val() === 'SET' || ($returntyp.val() as string).startsWith('VAR')) &&
|
||||
$returnlen.val() === ''
|
||||
) {
|
||||
@ -716,13 +716,13 @@ const DatabaseRoutines = {
|
||||
* to an element to be displayed when no
|
||||
* options are available
|
||||
*/
|
||||
var $noOpts = $text.parent().parent().find('.no_opts');
|
||||
const $noOpts = $text.parent().parent().find('.no_opts');
|
||||
/**
|
||||
* @var no_len a jQuery object containing the reference
|
||||
* to an element to be displayed when no
|
||||
* "length/values" field is available
|
||||
*/
|
||||
var $noLen = $len.parent().parent().find('.no_len');
|
||||
const $noLen = $len.parent().parent().find('.no_len');
|
||||
|
||||
// Process for parameter options
|
||||
switch ($type.val()) {
|
||||
@ -790,8 +790,8 @@ const DatabaseRoutines = {
|
||||
* @var msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user
|
||||
*/
|
||||
var $msg = ajaxShowMessage();
|
||||
var params = getJsConfirmCommonParam($this[0], $this.getPostData());
|
||||
let $msg = ajaxShowMessage();
|
||||
const params = getJsConfirmCommonParam($this[0], $this.getPostData());
|
||||
$.post($this.attr('href'), params, function (data) {
|
||||
if (data.success !== true) {
|
||||
ajaxShowMessage(data.error, false);
|
||||
@ -817,7 +817,7 @@ const DatabaseRoutines = {
|
||||
/**
|
||||
* @var data Form data to be sent in the AJAX request
|
||||
*/
|
||||
var data = $('form.rte_form').last().serialize();
|
||||
const data = $('form.rte_form').last().serialize();
|
||||
$msg = ajaxShowMessage(
|
||||
window.Messages.strProcessingRequest
|
||||
);
|
||||
@ -870,12 +870,12 @@ const DatabaseRoutines = {
|
||||
/**
|
||||
* @var data Form data to be sent in the AJAX request
|
||||
*/
|
||||
var data = $(this).serialize();
|
||||
const data = $(this).serialize();
|
||||
$msg = ajaxShowMessage(
|
||||
window.Messages.strProcessingRequest
|
||||
);
|
||||
|
||||
var url = $(this).attr('action');
|
||||
const url = $(this).attr('action');
|
||||
$.post(url, data, function (data) {
|
||||
if (data.success !== true) {
|
||||
ajaxShowMessage(data.error, false);
|
||||
|
||||
@ -36,7 +36,7 @@ AJAX.registerTeardown('database/search.js', function () {
|
||||
|
||||
AJAX.registerOnload('database/search.js', function () {
|
||||
/** Hide the table link in the initial search result */
|
||||
var icon = getImageTag('s_tbl', '', { 'id': 'table-image' }).toString();
|
||||
const icon = getImageTag('s_tbl', '', { 'id': 'table-image' }).toString();
|
||||
$('#table-info').prepend(icon).hide();
|
||||
|
||||
/** Hide the browse and deleted results in the new search criteria */
|
||||
@ -61,7 +61,7 @@ AJAX.registerOnload('database/search.js', function () {
|
||||
$('#togglesearchresultlink')
|
||||
.html(window.Messages.strHideSearchResults)
|
||||
.on('click', function () {
|
||||
var $link = $(this);
|
||||
const $link = $(this);
|
||||
$('#searchresults').slideToggle();
|
||||
if ($link.text() === window.Messages.strHideSearchResults) {
|
||||
$link.text(window.Messages.strShowSearchResults);
|
||||
@ -87,7 +87,7 @@ AJAX.registerOnload('database/search.js', function () {
|
||||
$('#togglequerybox')
|
||||
.hide()
|
||||
.on('click', function () {
|
||||
var $link = $(this);
|
||||
const $link = $(this);
|
||||
$('#sqlqueryform').slideToggle('medium');
|
||||
if ($link.text() === window.Messages.strHideQueryBox) {
|
||||
$link.text(window.Messages.strShowQueryBox);
|
||||
@ -108,7 +108,7 @@ AJAX.registerOnload('database/search.js', function () {
|
||||
$('#togglesearchformlink')
|
||||
.html(window.Messages.strShowSearchCriteria)
|
||||
.on('click', function () {
|
||||
var $link = $(this);
|
||||
const $link = $(this);
|
||||
$('#db_search_form').slideToggle();
|
||||
if ($link.text() === window.Messages.strHideSearchCriteria) {
|
||||
$link.text(window.Messages.strShowSearchCriteria);
|
||||
@ -126,20 +126,20 @@ AJAX.registerOnload('database/search.js', function () {
|
||||
$(document).on('click', '.browse_results', function (e) {
|
||||
e.preventDefault();
|
||||
/** Hides the results shown by the delete criteria */
|
||||
var $msg = ajaxShowMessage(window.Messages.strBrowsing, false);
|
||||
const $msg = ajaxShowMessage(window.Messages.strBrowsing, false);
|
||||
$('#sqlqueryform').hide();
|
||||
$('#togglequerybox').hide();
|
||||
/** Load the browse results to the page */
|
||||
$('#table-info').show();
|
||||
var tableName = $(this).data('table-name');
|
||||
const tableName = $(this).data('table-name');
|
||||
$('#table-link').attr({ 'href': $(this).data('href') }).text(tableName);
|
||||
|
||||
var url = $(this).data('href') + '#searchresults';
|
||||
var browseSql = $(this).data('browse-sql');
|
||||
var params = {
|
||||
const url = $(this).data('href') + '#searchresults';
|
||||
const browseSql = $(this).data('browse-sql');
|
||||
const params = {
|
||||
'ajax_request': true,
|
||||
'is_js_confirmed': true,
|
||||
'sql_query': browseSql
|
||||
'sql_query': browseSql,
|
||||
};
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success) {
|
||||
@ -171,20 +171,20 @@ AJAX.registerOnload('database/search.js', function () {
|
||||
$('#sqlqueryform').hide();
|
||||
$('#togglequerybox').hide();
|
||||
/** Conformation message for deletion */
|
||||
var msg = window.sprintf(
|
||||
const msg = window.sprintf(
|
||||
window.Messages.strConfirmDeleteResults,
|
||||
$(this).data('table-name')
|
||||
$(this).data('table-name'),
|
||||
);
|
||||
if (confirm(msg)) {
|
||||
var $msg = ajaxShowMessage(window.Messages.strDeleting, false);
|
||||
const $msg = ajaxShowMessage(window.Messages.strDeleting, false);
|
||||
/** Load the deleted option to the page*/
|
||||
$('#sqlqueryform').html('');
|
||||
var params = {
|
||||
const params = {
|
||||
'ajax_request': true,
|
||||
'is_js_confirmed': true,
|
||||
'sql_query': $(this).data('delete-sql')
|
||||
'sql_query': $(this).data('delete-sql'),
|
||||
};
|
||||
var url = $(this).data('href');
|
||||
const url = $(this).data('href');
|
||||
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data === 'undefined' || ! data.success) {
|
||||
@ -222,13 +222,13 @@ AJAX.registerOnload('database/search.js', function () {
|
||||
return;
|
||||
}
|
||||
|
||||
var $msgbox = ajaxShowMessage(window.Messages.strSearching, false);
|
||||
const $msgbox = ajaxShowMessage(window.Messages.strSearching, false);
|
||||
// jQuery object to reuse
|
||||
var $form = $(this);
|
||||
const $form = $(this);
|
||||
|
||||
prepareForAjaxRequest($form);
|
||||
|
||||
var url = $form.serialize() + CommonParams.get('arg_separator') + 'submit_search=' + $('#buttonGo').val();
|
||||
const url = $form.serialize() + CommonParams.get('arg_separator') + 'submit_search=' + $('#buttonGo').val();
|
||||
$.post($form.attr('action'), url, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
// found results
|
||||
|
||||
@ -43,7 +43,7 @@ AJAX.registerTeardown('database/structure.js', function () {
|
||||
* @param {object} $target Target for appending the real count value.
|
||||
*/
|
||||
function fetchRealRowCount ($target) {
|
||||
var $throbber = $('#pma_navigation').find('.throbber')
|
||||
const $throbber = $('#pma_navigation').find('.throbber')
|
||||
.first()
|
||||
.clone()
|
||||
.css({ visibility: 'visible', display: 'inline-block' })
|
||||
@ -96,8 +96,8 @@ AJAX.registerOnload('database/structure.js', function () {
|
||||
* Event handler on select of "Make consistent with central list"
|
||||
*/
|
||||
$('select[name=submit_mult]').on('change', function (event) {
|
||||
var url = 'index.php?route=/database/structure';
|
||||
var action = $(this).val();
|
||||
let url = 'index.php?route=/database/structure';
|
||||
const action = $(this).val();
|
||||
|
||||
if (action === 'make_consistent_with_central_list') {
|
||||
event.preventDefault();
|
||||
@ -136,8 +136,8 @@ AJAX.registerOnload('database/structure.js', function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
var formData = $('#tablesForm').serialize();
|
||||
var modalTitle = '';
|
||||
const formData = $('#tablesForm').serialize();
|
||||
let modalTitle = '';
|
||||
if (action === 'copy_tbl') {
|
||||
url = 'index.php?route=/database/structure/copy-form';
|
||||
modalTitle = window.Messages.strCopyTablesTo;
|
||||
@ -203,9 +203,9 @@ AJAX.registerOnload('database/structure.js', function () {
|
||||
return;
|
||||
}
|
||||
|
||||
var $form = $(this).parents('form');
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var data = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
|
||||
const $form = $(this).parents('form');
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
const data = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
|
||||
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $form;
|
||||
@ -222,30 +222,30 @@ AJAX.registerOnload('database/structure.js', function () {
|
||||
/**
|
||||
* @var $this_anchor Object referring to the anchor clicked
|
||||
*/
|
||||
var $thisAnchor = $(this);
|
||||
const $thisAnchor = $(this);
|
||||
|
||||
// extract current table name and build the question string
|
||||
/**
|
||||
* @var curr_table_name String containing the name of the table to be truncated
|
||||
*/
|
||||
var currTableName = $thisAnchor.parents('tr').children('th').children('a').text();
|
||||
const currTableName = $thisAnchor.parents('tr').children('th').children('a').text();
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = window.Messages.strTruncateTableStrongWarning + ' ' +
|
||||
const question = window.Messages.strTruncateTableStrongWarning + ' ' +
|
||||
window.sprintf(window.Messages.strDoYouReally, 'TRUNCATE `' + escapeHtml(currTableName) + '`') +
|
||||
getForeignKeyCheckboxLoader();
|
||||
|
||||
$thisAnchor.confirm(question, $thisAnchor.attr('href'), function (url) {
|
||||
ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
|
||||
var params = getJsConfirmCommonParam(this, $thisAnchor.getPostData());
|
||||
const params = getJsConfirmCommonParam(this, $thisAnchor.getPostData());
|
||||
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
ajaxShowMessage(data.message);
|
||||
// Adjust table statistics
|
||||
var $tr = $thisAnchor.closest('tr');
|
||||
const $tr = $thisAnchor.closest('tr');
|
||||
$tr.find('.tbl_rows').text('0');
|
||||
$tr.find('.tbl_size, .tbl_overhead').text('-');
|
||||
adjustTotals();
|
||||
@ -262,25 +262,25 @@ AJAX.registerOnload('database/structure.js', function () {
|
||||
$(document).on('click', 'a.drop_table_anchor.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var $thisAnchor = $(this);
|
||||
const $thisAnchor = $(this);
|
||||
|
||||
// extract current table name and build the question string
|
||||
/**
|
||||
* @var $curr_row Object containing reference to the current row
|
||||
*/
|
||||
var $currRow = $thisAnchor.parents('tr');
|
||||
const $currRow = $thisAnchor.parents('tr');
|
||||
/**
|
||||
* @var curr_table_name String containing the name of the table to be truncated
|
||||
*/
|
||||
var currTableName = $currRow.children('th').children('a').text();
|
||||
const currTableName = $currRow.children('th').children('a').text();
|
||||
/**
|
||||
* @var is_view Boolean telling if we have a view
|
||||
*/
|
||||
var isView = $currRow.hasClass('is_view') || $thisAnchor.hasClass('view');
|
||||
const isView = $currRow.hasClass('is_view') || $thisAnchor.hasClass('view');
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question;
|
||||
let question;
|
||||
if (! isView) {
|
||||
question = window.Messages.strDropTableStrongWarning + ' ' +
|
||||
window.sprintf(window.Messages.strDoYouReally, 'DROP TABLE `' + escapeHtml(currTableName) + '`');
|
||||
@ -292,9 +292,9 @@ AJAX.registerOnload('database/structure.js', function () {
|
||||
question += getForeignKeyCheckboxLoader();
|
||||
|
||||
$thisAnchor.confirm(question, $thisAnchor.attr('href'), function (url) {
|
||||
var $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
const $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
|
||||
var params = getJsConfirmCommonParam(this, $thisAnchor.getPostData());
|
||||
const params = getJsConfirmCommonParam(this, $thisAnchor.getPostData());
|
||||
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
|
||||
@ -1,23 +1,23 @@
|
||||
import { ajaxShowMessage } from '../modules/ajax-message.ts';
|
||||
|
||||
var designerTables = [
|
||||
const designerTables = [
|
||||
{
|
||||
name: 'pdf_pages',
|
||||
key: 'pgNr',
|
||||
autoIncrement: true
|
||||
autoIncrement: true,
|
||||
},
|
||||
{
|
||||
name: 'table_coords',
|
||||
key: 'id',
|
||||
autoIncrement: true
|
||||
}
|
||||
autoIncrement: true,
|
||||
},
|
||||
];
|
||||
|
||||
var DesignerOfflineDB = (function () {
|
||||
const DesignerOfflineDB = (function () {
|
||||
/**
|
||||
* @type {IDBDatabase|null}
|
||||
*/
|
||||
var datastore = null;
|
||||
let datastore = null;
|
||||
|
||||
/**
|
||||
* @param {string} table
|
||||
@ -32,8 +32,8 @@ var DesignerOfflineDB = (function () {
|
||||
* @return {IDBObjectStore}
|
||||
*/
|
||||
const getObjectStore = function (table) {
|
||||
var transaction = designerDB.getTransaction(table);
|
||||
var objStore = transaction.objectStore(table);
|
||||
const transaction = designerDB.getTransaction(table);
|
||||
const objStore = transaction.objectStore(table);
|
||||
|
||||
return objStore;
|
||||
};
|
||||
@ -44,9 +44,9 @@ var DesignerOfflineDB = (function () {
|
||||
* @return {IDBObjectStore}
|
||||
*/
|
||||
const getCursorRequest = function (transaction, table) {
|
||||
var objStore = transaction.objectStore(table);
|
||||
var keyRange = IDBKeyRange.lowerBound(0);
|
||||
var cursorRequest = objStore.openCursor(keyRange);
|
||||
const objStore = transaction.objectStore(table);
|
||||
const keyRange = IDBKeyRange.lowerBound(0);
|
||||
const cursorRequest = objStore.openCursor(keyRange);
|
||||
|
||||
return cursorRequest;
|
||||
};
|
||||
@ -55,14 +55,14 @@ var DesignerOfflineDB = (function () {
|
||||
* @param {Function} callback
|
||||
*/
|
||||
const open = function (callback): void {
|
||||
var version = 1;
|
||||
var request = window.indexedDB.open('pma_designer', version);
|
||||
const version = 1;
|
||||
const request = window.indexedDB.open('pma_designer', version);
|
||||
|
||||
request.onupgradeneeded = function (e) {
|
||||
var db = (e.target as IDBRequest).result;
|
||||
const db = (e.target as IDBRequest).result;
|
||||
(e.target as IDBRequest).transaction.onerror = designerDB.onerror;
|
||||
|
||||
var t;
|
||||
let t;
|
||||
for (t in designerTables) {
|
||||
if (db.objectStoreNames.contains(designerTables[t].name)) {
|
||||
db.deleteObjectStore(designerTables[t].name);
|
||||
@ -72,7 +72,7 @@ var DesignerOfflineDB = (function () {
|
||||
for (t in designerTables) {
|
||||
db.createObjectStore(designerTables[t].name, {
|
||||
keyPath: designerTables[t].key,
|
||||
autoIncrement: designerTables[t].autoIncrement
|
||||
autoIncrement: designerTables[t].autoIncrement,
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -101,8 +101,8 @@ var DesignerOfflineDB = (function () {
|
||||
return;
|
||||
}
|
||||
|
||||
var objStore = designerDB.getObjectStore(table);
|
||||
var cursorRequest = objStore.get(parseInt(id));
|
||||
const objStore = designerDB.getObjectStore(table);
|
||||
const cursorRequest = objStore.get(parseInt(id));
|
||||
|
||||
cursorRequest.onsuccess = function (e) {
|
||||
callback(e.target.result);
|
||||
@ -122,16 +122,16 @@ var DesignerOfflineDB = (function () {
|
||||
return;
|
||||
}
|
||||
|
||||
var transaction = designerDB.getTransaction(table);
|
||||
var cursorRequest = designerDB.getCursorRequest(transaction, table);
|
||||
var results = [];
|
||||
const transaction = designerDB.getTransaction(table);
|
||||
const cursorRequest = designerDB.getCursorRequest(transaction, table);
|
||||
const results = [];
|
||||
|
||||
transaction.oncomplete = function () {
|
||||
callback(results);
|
||||
};
|
||||
|
||||
cursorRequest.onsuccess = function (e) {
|
||||
var result = e.target.result;
|
||||
const result = e.target.result;
|
||||
if (Boolean(result) === false) {
|
||||
return;
|
||||
}
|
||||
@ -154,16 +154,16 @@ var DesignerOfflineDB = (function () {
|
||||
return;
|
||||
}
|
||||
|
||||
var transaction = designerDB.getTransaction(table);
|
||||
var cursorRequest = designerDB.getCursorRequest(transaction, table);
|
||||
var firstResult = null;
|
||||
const transaction = designerDB.getTransaction(table);
|
||||
const cursorRequest = designerDB.getCursorRequest(transaction, table);
|
||||
let firstResult = null;
|
||||
|
||||
transaction.oncomplete = function () {
|
||||
callback(firstResult);
|
||||
};
|
||||
|
||||
cursorRequest.onsuccess = function (e) {
|
||||
var result = e.target.result;
|
||||
const result = e.target.result;
|
||||
if (Boolean(result) === false) {
|
||||
return;
|
||||
}
|
||||
@ -186,8 +186,8 @@ var DesignerOfflineDB = (function () {
|
||||
return;
|
||||
}
|
||||
|
||||
var objStore = designerDB.getObjectStore(table);
|
||||
var request = objStore.put(obj);
|
||||
const objStore = designerDB.getObjectStore(table);
|
||||
const request = objStore.put(obj);
|
||||
|
||||
request.onsuccess = function (e) {
|
||||
if (typeof callback === 'function') {
|
||||
@ -210,8 +210,8 @@ var DesignerOfflineDB = (function () {
|
||||
return;
|
||||
}
|
||||
|
||||
var objStore = designerDB.getObjectStore(table);
|
||||
var request = objStore.delete(parseInt(id));
|
||||
const objStore = designerDB.getObjectStore(table);
|
||||
const request = objStore.delete(parseInt(id));
|
||||
|
||||
request.onsuccess = function () {
|
||||
if (typeof callback === 'function') {
|
||||
@ -230,7 +230,7 @@ var DesignerOfflineDB = (function () {
|
||||
console.log(e);
|
||||
};
|
||||
|
||||
var designerDB = {
|
||||
const designerDB = {
|
||||
getTransaction: getTransaction,
|
||||
getObjectStore: getObjectStore,
|
||||
getCursorRequest: getCursorRequest,
|
||||
|
||||
@ -9,8 +9,7 @@ import { DesignerConfig } from './config.ts';
|
||||
* @requires jQuery
|
||||
* @requires move.js
|
||||
*/
|
||||
|
||||
var gIndex;
|
||||
let gIndex;
|
||||
|
||||
/**
|
||||
* To display details of objects(where,rename,Having,aggregate,groupby,orderby,having)
|
||||
@ -19,8 +18,8 @@ var gIndex;
|
||||
* @return {string}
|
||||
*/
|
||||
const detail = function (index) {
|
||||
var type = DesignerHistory.historyArray[index].getType();
|
||||
var str;
|
||||
const type = DesignerHistory.historyArray[index].getType();
|
||||
let str;
|
||||
if (type === 'Where') {
|
||||
str = 'Where ' + DesignerHistory.historyArray[index].getColumnName() + DesignerHistory.historyArray[index].getObj().getRelationOperator() + DesignerHistory.historyArray[index].getObj().getQuery();
|
||||
} else if (type === 'Rename') {
|
||||
@ -55,12 +54,12 @@ const detail = function (index) {
|
||||
* @return {string}
|
||||
*/
|
||||
const display = function (init, finit) {
|
||||
var str;
|
||||
var i;
|
||||
var j;
|
||||
var k;
|
||||
var sto;
|
||||
var temp;
|
||||
let str;
|
||||
let i;
|
||||
let j;
|
||||
let k;
|
||||
let sto;
|
||||
let temp;
|
||||
// this part sorts the history array based on table name,this is needed for clubbing all object of same name together.
|
||||
for (i = init; i < finit; i++) {
|
||||
sto = DesignerHistory.historyArray[i];
|
||||
@ -79,7 +78,7 @@ const display = function (init, finit) {
|
||||
|
||||
// this part generates HTML code for history tab.adds delete,edit,and/or and detail features with objects.
|
||||
str = ''; // string to store Html code for history tab
|
||||
var historyArrayLength = DesignerHistory.historyArray.length;
|
||||
const historyArrayLength = DesignerHistory.historyArray.length;
|
||||
for (i = 0; i < historyArrayLength; i++) {
|
||||
temp = DesignerHistory.historyArray[i].getTab(); // + '.' + DesignerHistory.historyArray[i].getObjNo(); for Self JOIN
|
||||
str += '<h3 class="tiger"><a href="#">' + temp + '</a></h3>';
|
||||
@ -97,12 +96,12 @@ const display = function (init, finit) {
|
||||
'<td width="175" style="padding-left: 5px">' + $('<div/>').text(DesignerHistory.historyArray[i].getColumnName()).html() + '<td>';
|
||||
|
||||
if (DesignerHistory.historyArray[i].getType() === 'GroupBy' || DesignerHistory.historyArray[i].getType() === 'OrderBy') {
|
||||
var detailDescGroupBy = $('<div/>').text(DesignerHistory.detail(i)).html();
|
||||
const detailDescGroupBy = $('<div/>').text(DesignerHistory.detail(i)).html();
|
||||
str += '<td class="text-center">' + getImageTag('s_info', DesignerHistory.detail(i)) + '</td>' +
|
||||
'<td title="' + detailDescGroupBy + '">' + DesignerHistory.historyArray[i].getType() + '</td>' +
|
||||
'<td onclick=DesignerHistory.historyDelete(' + i + ')>' + getImageTag('b_drop', window.Messages.strDelete) + '</td>';
|
||||
} else {
|
||||
var detailDesc = $('<div/>').text(DesignerHistory.detail(i)).html();
|
||||
const detailDesc = $('<div/>').text(DesignerHistory.detail(i)).html();
|
||||
str += '<td class="text-center">' + getImageTag('s_info', DesignerHistory.detail(i)) + '</td>' +
|
||||
'<td title="' + detailDesc + '">' + DesignerHistory.historyArray[i].getType() + '</td>' +
|
||||
'<td onclick=DesignerHistory.historyEdit(' + i + ')>' + getImageTag('b_edit', window.Messages.strEdit) + '</td>' +
|
||||
@ -138,7 +137,7 @@ const andOr = function (index): void {
|
||||
DesignerHistory.historyArray[index].setAndOr(1);
|
||||
}
|
||||
|
||||
var existingDiv = document.getElementById('ab');
|
||||
const existingDiv = document.getElementById('ab');
|
||||
existingDiv.innerHTML = DesignerHistory.display(0, 0);
|
||||
$('#ab').accordion('refresh');
|
||||
};
|
||||
@ -149,8 +148,8 @@ const andOr = function (index): void {
|
||||
* @param {number} index of DesignerHistory.historyArray[] which is to be deleted
|
||||
*/
|
||||
const historyDelete = function (index): void {
|
||||
var fromArrayLength = window.fromArray.length;
|
||||
for (var k = 0; k < fromArrayLength; k++) {
|
||||
const fromArrayLength = window.fromArray.length;
|
||||
for (let k = 0; k < fromArrayLength; k++) {
|
||||
if (window.fromArray[k] === DesignerHistory.historyArray[index].getTab()) {
|
||||
window.fromArray.splice(k, 1);
|
||||
break;
|
||||
@ -158,7 +157,7 @@ const historyDelete = function (index): void {
|
||||
}
|
||||
|
||||
DesignerHistory.historyArray.splice(index, 1);
|
||||
var existingDiv = document.getElementById('ab');
|
||||
const existingDiv = document.getElementById('ab');
|
||||
existingDiv.innerHTML = DesignerHistory.display(0, 0);
|
||||
$('#ab').accordion('refresh');
|
||||
};
|
||||
@ -167,7 +166,7 @@ const historyDelete = function (index): void {
|
||||
* @param {string} elementId
|
||||
*/
|
||||
const changeStyle = function (elementId): void {
|
||||
var element = document.getElementById(elementId);
|
||||
const element = document.getElementById(elementId);
|
||||
element.style.left = '530px';
|
||||
element.style.top = '130px';
|
||||
element.style.position = 'absolute';
|
||||
@ -183,7 +182,7 @@ const changeStyle = function (elementId): void {
|
||||
*/
|
||||
const historyEdit = function (index): void {
|
||||
gIndex = index;
|
||||
var type = DesignerHistory.historyArray[index].getType();
|
||||
const type = DesignerHistory.historyArray[index].getType();
|
||||
if (type === 'Where') {
|
||||
(document.getElementById('eQuery') as HTMLTextAreaElement).value = DesignerHistory.historyArray[index].getObj().getQuery();
|
||||
(document.getElementById('erel_opt') as HTMLSelectElement).value = DesignerHistory.historyArray[index].getObj().getRelationOperator();
|
||||
@ -240,7 +239,7 @@ const edit = function (type): void {
|
||||
document.getElementById('query_having').style.visibility = 'hidden';
|
||||
}
|
||||
|
||||
var existingDiv = document.getElementById('ab');
|
||||
const existingDiv = document.getElementById('ab');
|
||||
existingDiv.innerHTML = DesignerHistory.display(0, 0);
|
||||
$('#ab').accordion('refresh');
|
||||
};
|
||||
@ -256,12 +255,12 @@ const edit = function (type): void {
|
||||
*
|
||||
*/
|
||||
const HistoryObj = function (nColumnName, nObj, nTab, nObjNo, nType) {
|
||||
var andOr;
|
||||
var obj;
|
||||
var tab;
|
||||
var columnName;
|
||||
var objNo;
|
||||
var type;
|
||||
let andOr;
|
||||
let obj;
|
||||
let tab;
|
||||
let columnName;
|
||||
let objNo;
|
||||
let type;
|
||||
this.setColumnName = function (nColumnName) {
|
||||
columnName = nColumnName;
|
||||
};
|
||||
@ -331,8 +330,8 @@ const HistoryObj = function (nColumnName, nObj, nTab, nObjNo, nType) {
|
||||
*/
|
||||
|
||||
const Where = function (nRelationOperator, nQuery) {
|
||||
var relationOperator;
|
||||
var query;
|
||||
let relationOperator;
|
||||
let query;
|
||||
this.setRelationOperator = function (nRelationOperator) {
|
||||
relationOperator = nRelationOperator;
|
||||
};
|
||||
@ -359,7 +358,7 @@ const Where = function (nRelationOperator, nQuery) {
|
||||
* @param nOrder order, ASC or DESC
|
||||
*/
|
||||
const OrderBy = function (nOrder) {
|
||||
var order;
|
||||
let order;
|
||||
this.setOrder = function (nOrder) {
|
||||
order = nOrder;
|
||||
};
|
||||
@ -379,9 +378,9 @@ const OrderBy = function (nOrder) {
|
||||
* @param nOperator operator
|
||||
*/
|
||||
const Having = function (nRelationOperator, nQuery, nOperator) {
|
||||
var relationOperator;
|
||||
var query;
|
||||
var operator;
|
||||
let relationOperator;
|
||||
let query;
|
||||
let operator;
|
||||
this.setOperator = function (nOperator) {
|
||||
operator = nOperator;
|
||||
};
|
||||
@ -418,7 +417,7 @@ const Having = function (nRelationOperator, nQuery, nOperator) {
|
||||
*
|
||||
*/
|
||||
const Rename = function (nRenameTo) {
|
||||
var renameTo;
|
||||
let renameTo;
|
||||
this.setRenameTo = function (nRenameTo) {
|
||||
renameTo = nRenameTo;
|
||||
};
|
||||
@ -437,7 +436,7 @@ const Rename = function (nRenameTo) {
|
||||
*
|
||||
*/
|
||||
const Aggregate = function (nOperator) {
|
||||
var operator;
|
||||
let operator;
|
||||
this.setOperator = function (nOperator) {
|
||||
operator = nOperator;
|
||||
};
|
||||
@ -457,11 +456,11 @@ const Aggregate = function (nOperator) {
|
||||
*/
|
||||
|
||||
const unique = function (arrayName) {
|
||||
var newArray = [];
|
||||
const newArray = [];
|
||||
uniquetop:
|
||||
for (var i = 0; i < arrayName.length; i++) {
|
||||
var newArrayLength = newArray.length;
|
||||
for (var j = 0; j < newArrayLength; j++) {
|
||||
for (let i = 0; i < arrayName.length; i++) {
|
||||
const newArrayLength = newArray.length;
|
||||
for (let j = 0; j < newArrayLength; j++) {
|
||||
if (newArray[j] === arrayName[i]) {
|
||||
continue uniquetop;
|
||||
}
|
||||
@ -482,8 +481,8 @@ const unique = function (arrayName) {
|
||||
*/
|
||||
|
||||
const found = function (arrayName, value) {
|
||||
var arrayNameLength = arrayName.length;
|
||||
for (var i = 0; i < arrayNameLength; i++) {
|
||||
const arrayNameLength = arrayName.length;
|
||||
for (let i = 0; i < arrayNameLength; i++) {
|
||||
if (arrayName[i] === value) {
|
||||
return 1;
|
||||
}
|
||||
@ -501,8 +500,8 @@ const found = function (arrayName, value) {
|
||||
* @return {obj[]}
|
||||
*/
|
||||
const addArray = function (add, arr) {
|
||||
var addLength = add.length;
|
||||
for (var i = 0; i < addLength; i++) {
|
||||
const addLength = add.length;
|
||||
for (let i = 0; i < addLength; i++) {
|
||||
arr.push(add[i]);
|
||||
}
|
||||
|
||||
@ -519,10 +518,10 @@ const addArray = function (add, arr) {
|
||||
*
|
||||
*/
|
||||
const removeArray = function (rem, arr) {
|
||||
var remLength = rem.length;
|
||||
for (var i = 0; i < remLength; i++) {
|
||||
var arrLength = arr.length;
|
||||
for (var j = 0; j < arrLength; j++) {
|
||||
const remLength = rem.length;
|
||||
for (let i = 0; i < remLength; i++) {
|
||||
const arrLength = arr.length;
|
||||
for (let j = 0; j < arrLength; j++) {
|
||||
if (rem[i] === arr[j]) {
|
||||
arr.splice(j, 1);
|
||||
}
|
||||
@ -537,9 +536,9 @@ const removeArray = function (rem, arr) {
|
||||
* @return {string}
|
||||
*/
|
||||
const queryGroupBy = function () {
|
||||
var i;
|
||||
var str = '';
|
||||
var historyArrayLength = DesignerHistory.historyArray.length;
|
||||
let i;
|
||||
let str = '';
|
||||
const historyArrayLength = DesignerHistory.historyArray.length;
|
||||
for (i = 0; i < historyArrayLength; i++) {
|
||||
if (DesignerHistory.historyArray[i].getType() === 'GroupBy') {
|
||||
str += '`' + DesignerHistory.historyArray[i].getColumnName() + '`, ';
|
||||
@ -556,9 +555,9 @@ const queryGroupBy = function () {
|
||||
* @return {string}
|
||||
*/
|
||||
const queryHaving = function () {
|
||||
var i;
|
||||
var and = '(';
|
||||
var historyArrayLength = DesignerHistory.historyArray.length;
|
||||
let i;
|
||||
let and = '(';
|
||||
const historyArrayLength = DesignerHistory.historyArray.length;
|
||||
for (i = 0; i < historyArrayLength; i++) {
|
||||
if (DesignerHistory.historyArray[i].getType() === 'Having') {
|
||||
if (DesignerHistory.historyArray[i].getObj().getOperator() !== 'None') {
|
||||
@ -584,9 +583,9 @@ const queryHaving = function () {
|
||||
* @return {string}
|
||||
*/
|
||||
const queryOrderBy = function () {
|
||||
var i;
|
||||
var str = '';
|
||||
var historyArrayLength = DesignerHistory.historyArray.length;
|
||||
let i;
|
||||
let str = '';
|
||||
const historyArrayLength = DesignerHistory.historyArray.length;
|
||||
for (i = 0; i < historyArrayLength; i++) {
|
||||
if (DesignerHistory.historyArray[i].getType() === 'OrderBy') {
|
||||
str += '`' + DesignerHistory.historyArray[i].getColumnName() + '` ' +
|
||||
@ -604,10 +603,10 @@ const queryOrderBy = function () {
|
||||
* @return {string}
|
||||
*/
|
||||
const queryWhere = function () {
|
||||
var i;
|
||||
var and = '(';
|
||||
var or = '(';
|
||||
var historyArrayLength = DesignerHistory.historyArray.length;
|
||||
let i;
|
||||
let and = '(';
|
||||
let or = '(';
|
||||
const historyArrayLength = DesignerHistory.historyArray.length;
|
||||
for (i = 0; i < historyArrayLength; i++) {
|
||||
if (DesignerHistory.historyArray[i].getType() === 'Where') {
|
||||
if (DesignerHistory.historyArray[i].getAndOr() === 0) {
|
||||
@ -640,10 +639,10 @@ const queryWhere = function () {
|
||||
};
|
||||
|
||||
const checkAggregate = function (idThis) {
|
||||
var i;
|
||||
var historyArrayLength = DesignerHistory.historyArray.length;
|
||||
let i;
|
||||
const historyArrayLength = DesignerHistory.historyArray.length;
|
||||
for (i = 0; i < historyArrayLength; i++) {
|
||||
var temp = '`' + DesignerHistory.historyArray[i].getTab() + '`.`' + DesignerHistory.historyArray[i].getColumnName() + '`';
|
||||
const temp = '`' + DesignerHistory.historyArray[i].getTab() + '`.`' + DesignerHistory.historyArray[i].getColumnName() + '`';
|
||||
if (temp === idThis && DesignerHistory.historyArray[i].getType() === 'Aggregate') {
|
||||
return DesignerHistory.historyArray[i].getObj().getOperator() + '(' + idThis + ')';
|
||||
}
|
||||
@ -653,10 +652,10 @@ const checkAggregate = function (idThis) {
|
||||
};
|
||||
|
||||
const checkRename = function (idThis) {
|
||||
var i;
|
||||
var historyArrayLength = DesignerHistory.historyArray.length;
|
||||
let i;
|
||||
const historyArrayLength = DesignerHistory.historyArray.length;
|
||||
for (i = 0; i < historyArrayLength; i++) {
|
||||
var temp = '`' + DesignerHistory.historyArray[i].getTab() + '`.`' + DesignerHistory.historyArray[i].getColumnName() + '`';
|
||||
const temp = '`' + DesignerHistory.historyArray[i].getTab() + '`.`' + DesignerHistory.historyArray[i].getColumnName() + '`';
|
||||
if (temp === idThis && DesignerHistory.historyArray[i].getType() === 'Rename') {
|
||||
return ' AS `' + DesignerHistory.historyArray[i].getObj().getRenameTo() + '`';
|
||||
}
|
||||
@ -672,27 +671,27 @@ const checkRename = function (idThis) {
|
||||
* @return {string}
|
||||
*/
|
||||
const queryFrom = function () {
|
||||
var i;
|
||||
var tabLeft = [];
|
||||
var tabUsed = [];
|
||||
var tTabLeft = [];
|
||||
var temp;
|
||||
var query = '';
|
||||
var quer = '';
|
||||
var parts = [];
|
||||
var tArray = [];
|
||||
let i;
|
||||
let tabLeft = [];
|
||||
let tabUsed = [];
|
||||
let tTabLeft = [];
|
||||
let temp;
|
||||
let query = '';
|
||||
let quer = '';
|
||||
let parts = [];
|
||||
let tArray = [];
|
||||
tArray = window.fromArray;
|
||||
var K: any = 0;
|
||||
var k;
|
||||
var key;
|
||||
var key2;
|
||||
var key3;
|
||||
var parts1;
|
||||
let K: any = 0;
|
||||
let k;
|
||||
let key;
|
||||
let key2;
|
||||
let key3;
|
||||
let parts1;
|
||||
|
||||
// the constraints that have been used in the LEFT JOIN
|
||||
var constraintsAdded = [];
|
||||
const constraintsAdded = [];
|
||||
|
||||
var historyArrayLength = DesignerHistory.historyArray.length;
|
||||
const historyArrayLength = DesignerHistory.historyArray.length;
|
||||
for (i = 0; i < historyArrayLength; i++) {
|
||||
window.fromArray.push(DesignerHistory.historyArray[i].getTab());
|
||||
}
|
||||
@ -793,11 +792,11 @@ const queryFrom = function () {
|
||||
* @uses DesignerHistory.queryOrderBy()
|
||||
*/
|
||||
const buildQuery = function () {
|
||||
var qSelect = 'SELECT ';
|
||||
var temp;
|
||||
var selectFieldLength = DesignerHistory.selectField.length;
|
||||
let qSelect = 'SELECT ';
|
||||
let temp;
|
||||
const selectFieldLength = DesignerHistory.selectField.length;
|
||||
if (selectFieldLength > 0) {
|
||||
for (var i = 0; i < selectFieldLength; i++) {
|
||||
for (let i = 0; i < selectFieldLength; i++) {
|
||||
temp = DesignerHistory.checkAggregate(DesignerHistory.selectField[i]);
|
||||
if (temp !== '') {
|
||||
qSelect += temp;
|
||||
@ -816,29 +815,29 @@ const buildQuery = function () {
|
||||
|
||||
qSelect += '\nFROM ' + DesignerHistory.queryFrom();
|
||||
|
||||
var qWhere = DesignerHistory.queryWhere();
|
||||
const qWhere = DesignerHistory.queryWhere();
|
||||
if (qWhere !== '') {
|
||||
qSelect += '\nWHERE ' + qWhere;
|
||||
}
|
||||
|
||||
var qGroupBy = DesignerHistory.queryGroupBy();
|
||||
const qGroupBy = DesignerHistory.queryGroupBy();
|
||||
if (qGroupBy !== '') {
|
||||
qSelect += '\nGROUP BY ' + qGroupBy;
|
||||
}
|
||||
|
||||
var qHaving = DesignerHistory.queryHaving();
|
||||
const qHaving = DesignerHistory.queryHaving();
|
||||
if (qHaving !== '') {
|
||||
qSelect += '\nHAVING ' + qHaving;
|
||||
}
|
||||
|
||||
var qOrderBy = DesignerHistory.queryOrderBy();
|
||||
const qOrderBy = DesignerHistory.queryOrderBy();
|
||||
if (qOrderBy !== '') {
|
||||
qSelect += '\nORDER BY ' + qOrderBy;
|
||||
}
|
||||
|
||||
$('#buildQuerySubmitButton').on('click', function () {
|
||||
if (DesignerHistory.vqbEditor) {
|
||||
var $elm = $('#buildQueryModal').find('textarea');
|
||||
const $elm = $('#buildQueryModal').find('textarea');
|
||||
DesignerHistory.vqbEditor.save();
|
||||
$elm.val(DesignerHistory.vqbEditor.getValue());
|
||||
}
|
||||
@ -854,7 +853,7 @@ const buildQuery = function () {
|
||||
* @var $elm jQuery object containing the reference
|
||||
* to the query textarea.
|
||||
*/
|
||||
var $elm = $('#buildQueryModal').find('textarea');
|
||||
const $elm = $('#buildQueryModal').find('textarea');
|
||||
if (! DesignerHistory.vqbEditor) {
|
||||
DesignerHistory.vqbEditor = getSqlEditor($elm);
|
||||
}
|
||||
|
||||
@ -46,9 +46,9 @@ AJAX.registerTeardown('designer/init.js', function () {
|
||||
});
|
||||
|
||||
AJAX.registerOnload('designer/init.js', function () {
|
||||
var $content = $('#page_content');
|
||||
var $img = $('#toggleFullscreen').find('img');
|
||||
var $span = $img.siblings('span');
|
||||
const $content = $('#page_content');
|
||||
const $img = $('#toggleFullscreen').find('img');
|
||||
const $span = $img.siblings('span');
|
||||
|
||||
$content.css({ 'margin-left': '3px' });
|
||||
$(document).on('fullscreenchange', function () {
|
||||
@ -65,7 +65,7 @@ AJAX.registerOnload('designer/init.js', function () {
|
||||
// Saving the fullscreen state in config when
|
||||
// designer exists fullscreen mode via ESC key
|
||||
|
||||
var valueSent = 'off';
|
||||
const valueSent = 'off';
|
||||
DesignerMove.saveValueInConfig('full_screen', valueSent);
|
||||
}
|
||||
});
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
var DesignerObjects = {
|
||||
const DesignerObjects = {
|
||||
PdfPage: function (dbName, pageDescr, tblCords) {
|
||||
// no dot set the auto increment before put() in the database
|
||||
// issue #12900
|
||||
@ -17,7 +17,7 @@ var DesignerObjects = {
|
||||
this.pdfPgNr = pdfPgNr;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export { DesignerObjects };
|
||||
|
||||
@ -20,8 +20,8 @@ function showTablesInLandingPage (db) {
|
||||
function saveToNewPage (db, pageName, tablePositions, callback) {
|
||||
DesignerPage.createNewPage(db, pageName, function (page) {
|
||||
if (page) {
|
||||
var tblCords = [];
|
||||
var saveCallback = function (id) {
|
||||
const tblCords = [];
|
||||
const saveCallback = function (id) {
|
||||
tblCords.push(id);
|
||||
if (tablePositions.length === tblCords.length) {
|
||||
page.tblCords = tblCords;
|
||||
@ -29,7 +29,7 @@ function saveToNewPage (db, pageName, tablePositions, callback) {
|
||||
}
|
||||
};
|
||||
|
||||
for (var pos = 0; pos < tablePositions.length; pos++) {
|
||||
for (let pos = 0; pos < tablePositions.length; pos++) {
|
||||
tablePositions[pos].pdfPgNr = page.pgNr;
|
||||
DesignerPage.saveTablePositions(tablePositions[pos], saveCallback);
|
||||
}
|
||||
@ -53,7 +53,7 @@ function saveToSelectedPage (db, pageId, pageName, tablePositions, callback) {
|
||||
}
|
||||
|
||||
function createNewPage (db, pageName, callback) {
|
||||
var newPage = new DesignerObjects.PdfPage(db, pageName, []);
|
||||
const newPage = new DesignerObjects.PdfPage(db, pageName, []);
|
||||
DesignerOfflineDB.addObject('pdf_pages', newPage, function (pgNr) {
|
||||
newPage.pgNr = pgNr;
|
||||
if (typeof callback !== 'undefined') {
|
||||
@ -68,9 +68,9 @@ function saveTablePositions (positions, callback) {
|
||||
|
||||
function createPageList (db, callback) {
|
||||
DesignerOfflineDB.loadAllObjects('pdf_pages', function (pages) {
|
||||
var html = '';
|
||||
for (var p = 0; p < pages.length; p++) {
|
||||
var page = pages[p];
|
||||
let html = '';
|
||||
for (let p = 0; p < pages.length; p++) {
|
||||
const page = pages[p];
|
||||
if (page.dbName === db) {
|
||||
html += '<option value="' + page.pgNr + '">';
|
||||
html += escapeHtml(page.pageDescr) + '</option>';
|
||||
@ -86,7 +86,7 @@ function createPageList (db, callback) {
|
||||
function deletePage (pageId, callback = undefined) {
|
||||
DesignerOfflineDB.loadObject('pdf_pages', pageId, function (page) {
|
||||
if (page) {
|
||||
for (var i = 0; i < page.tblCords.length; i++) {
|
||||
for (let i = 0; i < page.tblCords.length; i++) {
|
||||
DesignerOfflineDB.deleteObject('table_coords', page.tblCords[i]);
|
||||
}
|
||||
|
||||
@ -97,9 +97,9 @@ function deletePage (pageId, callback = undefined) {
|
||||
|
||||
function loadFirstPage (db, callback) {
|
||||
DesignerOfflineDB.loadAllObjects('pdf_pages', function (pages) {
|
||||
var firstPage = null;
|
||||
for (var i = 0; i < pages.length; i++) {
|
||||
var page = pages[i];
|
||||
let firstPage = null;
|
||||
for (let i = 0; i < pages.length; i++) {
|
||||
const page = pages[i];
|
||||
if (page.dbName === db) {
|
||||
// give preference to a page having same name as the db
|
||||
if (page.pageDescr === db) {
|
||||
@ -119,12 +119,12 @@ function loadFirstPage (db, callback) {
|
||||
}
|
||||
|
||||
function showNewPageTables (check) {
|
||||
var allTables = ($('#id_scroll_tab').find('td input:checkbox') as JQuery<HTMLInputElement>);
|
||||
const allTables = ($('#id_scroll_tab').find('td input:checkbox') as JQuery<HTMLInputElement>);
|
||||
allTables.prop('checked', check);
|
||||
for (var tab = 0; tab < allTables.length; tab++) {
|
||||
var input = allTables[tab];
|
||||
for (let tab = 0; tab < allTables.length; tab++) {
|
||||
const input = allTables[tab];
|
||||
if (input.value) {
|
||||
var element = document.getElementById(input.value);
|
||||
const element = document.getElementById(input.value);
|
||||
element.style.top = DesignerPage.getRandom(550, 20) + 'px';
|
||||
element.style.left = DesignerPage.getRandom(700, 20) + 'px';
|
||||
DesignerMove.visibleTab(input, input.value);
|
||||
@ -140,10 +140,10 @@ function loadHtmlForPage (pageId) {
|
||||
DesignerPage.showNewPageTables(true);
|
||||
DesignerPage.loadPageObjects(pageId, function (page, tblCords) {
|
||||
$('#name-panel').find('#page_name').text(page.pageDescr);
|
||||
var tableMissing = false;
|
||||
for (var t = 0; t < tblCords.length; t++) {
|
||||
var tbId = DesignerConfig.db + '.' + tblCords[t].tableName;
|
||||
var table = document.getElementById(tbId);
|
||||
let tableMissing = false;
|
||||
for (let t = 0; t < tblCords.length; t++) {
|
||||
const tbId = DesignerConfig.db + '.' + tblCords[t].tableName;
|
||||
const table = document.getElementById(tbId);
|
||||
if (table === null) {
|
||||
tableMissing = true;
|
||||
continue;
|
||||
@ -152,7 +152,7 @@ function loadHtmlForPage (pageId) {
|
||||
table.style.top = tblCords[t].y + 'px';
|
||||
table.style.left = tblCords[t].x + 'px';
|
||||
|
||||
var checkbox = (document.getElementById('check_vis_' + tbId) as HTMLInputElement);
|
||||
const checkbox = (document.getElementById('check_vis_' + tbId) as HTMLInputElement);
|
||||
checkbox.checked = true;
|
||||
DesignerMove.visibleTab(checkbox, checkbox.value);
|
||||
}
|
||||
@ -169,9 +169,9 @@ function loadHtmlForPage (pageId) {
|
||||
|
||||
function loadPageObjects (pageId, callback) {
|
||||
DesignerOfflineDB.loadObject('pdf_pages', pageId, function (page) {
|
||||
var tblCords = [];
|
||||
var count = page.tblCords.length;
|
||||
for (var i = 0; i < count; i++) {
|
||||
const tblCords = [];
|
||||
const count = page.tblCords.length;
|
||||
for (let i = 0; i < count; i++) {
|
||||
DesignerOfflineDB.loadObject('table_coords', page.tblCords[i], function (tblCord) {
|
||||
tblCords.push(tblCord);
|
||||
if (tblCords.length === count) {
|
||||
@ -185,7 +185,7 @@ function loadPageObjects (pageId, callback) {
|
||||
}
|
||||
|
||||
function getRandom (max, min) {
|
||||
var val = Math.random() * (max - min) + min;
|
||||
const val = Math.random() * (max - min) + min;
|
||||
|
||||
return Math.floor(val);
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ import { escapeHtml } from './modules/functions/escape.ts';
|
||||
* Class to handle PMA Drag and Drop Import
|
||||
* feature
|
||||
*/
|
||||
var DragDropImport = {
|
||||
const DragDropImport = {
|
||||
/**
|
||||
* @var {number}, count of total uploads in this view
|
||||
*/
|
||||
@ -42,8 +42,8 @@ var DragDropImport = {
|
||||
* @return {string}, extension for valid extension, '' otherwise
|
||||
*/
|
||||
getExtension: function (file) {
|
||||
var arr = file.split('.');
|
||||
var ext = arr[arr.length - 1];
|
||||
const arr = file.split('.');
|
||||
let ext = arr[arr.length - 1];
|
||||
|
||||
// check if compressed
|
||||
if ($.inArray(ext.toLowerCase(),
|
||||
@ -76,15 +76,15 @@ var DragDropImport = {
|
||||
* @param {string} hash hash of the current file upload
|
||||
*/
|
||||
sendFileToServer: function (formData, hash): void {
|
||||
var jqXHR = $.ajax({
|
||||
const jqXHR = $.ajax({
|
||||
xhr: function () {
|
||||
var xhrobj = $.ajaxSettings.xhr();
|
||||
const xhrobj = $.ajaxSettings.xhr();
|
||||
if (xhrobj.upload) {
|
||||
xhrobj.upload.addEventListener('progress', function (event) {
|
||||
var percent = 0;
|
||||
let percent = 0;
|
||||
// @ts-ignore
|
||||
var position = event.loaded || event.position;
|
||||
var total = event.total;
|
||||
const position = event.loaded || event.position;
|
||||
const total = event.total;
|
||||
if (event.lengthComputable) {
|
||||
percent = Math.ceil(position / total * 100);
|
||||
}
|
||||
@ -107,10 +107,10 @@ var DragDropImport = {
|
||||
if (! data.success) {
|
||||
DragDropImport.importStatus[DragDropImport.importStatus.length] = {
|
||||
hash: hash,
|
||||
message: data.error
|
||||
message: data.error,
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
// -- provide link to cancel the upload
|
||||
@ -130,12 +130,12 @@ var DragDropImport = {
|
||||
} else if ($(this).children('span').html() ===
|
||||
window.Messages.dropImportMessageFailed) {
|
||||
// -- view information
|
||||
var $this = $(this);
|
||||
const $this = $(this);
|
||||
$.each(DragDropImport.importStatus,
|
||||
function (key, value) {
|
||||
if (value.hash === hash) {
|
||||
$('.pma_drop_result:visible').remove();
|
||||
var filename = $this.parent('span').attr('data-filename');
|
||||
const filename = $this.parent('span').attr('data-filename');
|
||||
$('body').append('<div class="pma_drop_result"><h2>' +
|
||||
window.Messages.dropImportImportResultHeader + ' - ' +
|
||||
escapeHtml(filename) + '<span class="close">x</span></h2>' + value.message + '</div>');
|
||||
@ -180,7 +180,7 @@ var DragDropImport = {
|
||||
* @return {void}
|
||||
*/
|
||||
markInternalDrag: function (event) {
|
||||
var dataTransfer = event.originalEvent && event.originalEvent.dataTransfer;
|
||||
const dataTransfer = event.originalEvent && event.originalEvent.dataTransfer;
|
||||
|
||||
// OS file drags do not trigger dragstart on current document.
|
||||
// If we can already detect real file payload here, do not mark internal.
|
||||
@ -206,8 +206,8 @@ var DragDropImport = {
|
||||
* @return {boolean}
|
||||
*/
|
||||
hasFiles: function (event) {
|
||||
var dataTransfer = event.originalEvent.dataTransfer;
|
||||
var types = dataTransfer.types;
|
||||
const dataTransfer = event.originalEvent.dataTransfer;
|
||||
const types = dataTransfer.types;
|
||||
|
||||
// Chrome/Edge may expose browser-internal drags as 'Files'.
|
||||
if (DragDropImport.internalDomDrag) {
|
||||
@ -280,7 +280,7 @@ var DragDropImport = {
|
||||
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
var $dropHandler = $('.pma_drop_handler');
|
||||
const $dropHandler = $('.pma_drop_handler');
|
||||
$dropHandler.clearQueue().stop();
|
||||
$dropHandler.fadeOut();
|
||||
$dropHandler.html(window.Messages.dropImportDropFiles);
|
||||
@ -296,7 +296,7 @@ var DragDropImport = {
|
||||
$('.pma_sql_import_status div li[data-hash="' + hash + '"]')
|
||||
.children('progress').hide();
|
||||
|
||||
var icon = 'icon ic_s_success';
|
||||
let icon = 'icon ic_s_success';
|
||||
// -- provide link to view upload status
|
||||
if (! aborted) {
|
||||
if (status) {
|
||||
@ -343,8 +343,8 @@ var DragDropImport = {
|
||||
return;
|
||||
}
|
||||
|
||||
var dbname = CommonParams.get('db');
|
||||
var server = CommonParams.get('server');
|
||||
const dbname = CommonParams.get('db');
|
||||
const server = CommonParams.get('server');
|
||||
|
||||
if (!DragDropImport.hasFiles(event)) {
|
||||
DragDropImport.clearInternalDrag();
|
||||
@ -357,7 +357,7 @@ var DragDropImport = {
|
||||
|
||||
// if no database is selected -- no
|
||||
if (dbname !== '') {
|
||||
var files = event.originalEvent.dataTransfer.files;
|
||||
const files = event.originalEvent.dataTransfer.files;
|
||||
if (! files || files.length === 0) {
|
||||
// No files actually transferred
|
||||
$('.pma_drop_handler').fadeOut();
|
||||
@ -368,11 +368,11 @@ var DragDropImport = {
|
||||
}
|
||||
|
||||
$('.pma_sql_import_status').slideDown();
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var ext = (DragDropImport.getExtension(files[i].name));
|
||||
var hash = AJAX.hash(++DragDropImport.uploadCount);
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const ext = (DragDropImport.getExtension(files[i].name));
|
||||
const hash = AJAX.hash(++DragDropImport.uploadCount);
|
||||
|
||||
var $sqlImportStatusDiv = $('.pma_sql_import_status div');
|
||||
const $sqlImportStatusDiv = $('.pma_sql_import_status div');
|
||||
$sqlImportStatusDiv.append('<li data-hash="' + hash + '">' +
|
||||
((ext !== '') ? '' : '<img src="./themes/dot.gif" title="invalid format" class="icon ic_s_notice"> ') +
|
||||
escapeHtml(files[i].name) + '<span class="filesize" data-filename="' +
|
||||
@ -381,7 +381,7 @@ var DragDropImport = {
|
||||
|
||||
// scroll the UI to bottom
|
||||
$sqlImportStatusDiv.scrollTop(
|
||||
$sqlImportStatusDiv.scrollTop() + 50
|
||||
$sqlImportStatusDiv.scrollTop() + 50,
|
||||
); // 50 hardcoded for now
|
||||
|
||||
if (ext !== '') {
|
||||
@ -393,7 +393,7 @@ var DragDropImport = {
|
||||
.append('<br><progress max="100" value="2"></progress>');
|
||||
|
||||
// uploading
|
||||
var fd = new FormData();
|
||||
const fd = new FormData();
|
||||
fd.append('import_file', files[i]);
|
||||
fd.append('noplugin', Math.random().toString(36).substring(2, 12));
|
||||
fd.append('db', dbname);
|
||||
@ -423,7 +423,7 @@ var DragDropImport = {
|
||||
$('.pma_drop_handler').fadeOut();
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -15,7 +15,7 @@ declare global {
|
||||
* general function, usually for data manipulation pages
|
||||
*
|
||||
*/
|
||||
var ErrorReport = {
|
||||
const ErrorReport = {
|
||||
/**
|
||||
* @var {object}, stores the last exception info
|
||||
*/
|
||||
@ -44,10 +44,10 @@ var ErrorReport = {
|
||||
if (data.report_setting === 'ask') {
|
||||
ErrorReport.showErrorNotification();
|
||||
} else if (data.report_setting === 'always') {
|
||||
var reportData = ErrorReport.getReportData(exception);
|
||||
var postData = $.extend(reportData, {
|
||||
const reportData = ErrorReport.getReportData(exception);
|
||||
const postData = $.extend(reportData, {
|
||||
'send_error_report': true,
|
||||
'automatic': true
|
||||
'automatic': true,
|
||||
});
|
||||
$.post('index.php?route=/error-report', postData, function (data) {
|
||||
if (data.success === false) {
|
||||
@ -75,7 +75,7 @@ var ErrorReport = {
|
||||
'ajax_request': true,
|
||||
'server': CommonParams.get('server'),
|
||||
'get_settings': true,
|
||||
'exception_type': 'js'
|
||||
'exception_type': 'js',
|
||||
}, function (data) {
|
||||
ErrorReport.errorReportData = data;
|
||||
ErrorReport.errorDataHandler(data, exception);
|
||||
@ -96,7 +96,7 @@ var ErrorReport = {
|
||||
const postData = $.extend(reportData, {
|
||||
'send_error_report': true,
|
||||
'description': $('#errorReportDescription').val(),
|
||||
'always_send': ($('#errorReportAlwaysSendCheckbox') as JQuery<HTMLInputElement>)[0].checked
|
||||
'always_send': ($('#errorReportAlwaysSendCheckbox') as JQuery<HTMLInputElement>)[0].checked,
|
||||
});
|
||||
$.post('index.php?route=/error-report', postData, function (data) {
|
||||
if (data.success === false) {
|
||||
@ -131,25 +131,25 @@ var ErrorReport = {
|
||||
* Shows the small notification that asks for user permission
|
||||
*/
|
||||
showErrorNotification: function (): void {
|
||||
var key = Math.random().toString(36).substring(2, 12);
|
||||
let key = Math.random().toString(36).substring(2, 12);
|
||||
while (key in ErrorReport.keyDict) {
|
||||
key = Math.random().toString(36).substring(2, 12);
|
||||
}
|
||||
|
||||
ErrorReport.keyDict[key] = 1;
|
||||
|
||||
var $div = $(
|
||||
'<div class="alert alert-danger" role="alert" id="error_notification_' + key + '"></div>'
|
||||
const $div = $(
|
||||
'<div class="alert alert-danger" role="alert" id="error_notification_' + key + '"></div>',
|
||||
).append(
|
||||
getImageTag('s_error') + window.Messages.strErrorOccurred
|
||||
getImageTag('s_error') + window.Messages.strErrorOccurred,
|
||||
);
|
||||
|
||||
var $buttons = $('<div class="float-end"></div>');
|
||||
var buttonHtml = '<button class="btn btn-primary" id="show_error_report_' + key + '">';
|
||||
const $buttons = $('<div class="float-end"></div>');
|
||||
let buttonHtml = '<button class="btn btn-primary" id="show_error_report_' + key + '">';
|
||||
buttonHtml += window.Messages.strShowReportDetails;
|
||||
buttonHtml += '</button>';
|
||||
|
||||
var settingsUrl = 'index.php?route=/preferences/features&server=' + CommonParams.get('server');
|
||||
const settingsUrl = 'index.php?route=/preferences/features&server=' + CommonParams.get('server');
|
||||
buttonHtml += '<a class="ajax" href="' + settingsUrl + '">';
|
||||
buttonHtml += getImageTag('s_cog', window.Messages.strChangeReportSettings);
|
||||
buttonHtml += '</a>';
|
||||
@ -192,8 +192,8 @@ var ErrorReport = {
|
||||
return '';
|
||||
}
|
||||
|
||||
var reg = /([a-zA-Z]+):/;
|
||||
var regexResult = reg.exec(exception.message);
|
||||
const reg = /([a-zA-Z]+):/;
|
||||
const regexResult = reg.exec(exception.message);
|
||||
if (regexResult && regexResult.length === 2) {
|
||||
return regexResult[1];
|
||||
}
|
||||
@ -216,10 +216,10 @@ var ErrorReport = {
|
||||
*/
|
||||
getReportData: function (exception) {
|
||||
if (exception && exception.stack && exception.stack.length) {
|
||||
for (var i = 0; i < exception.stack.length; i++) {
|
||||
var stack = exception.stack[i];
|
||||
for (let i = 0; i < exception.stack.length; i++) {
|
||||
const stack = exception.stack[i];
|
||||
if (stack.context && stack.context.length) {
|
||||
for (var j = 0; j < stack.context.length; j++) {
|
||||
for (let j = 0; j < stack.context.length; j++) {
|
||||
if (stack.context[j].length > 80) {
|
||||
stack.context[j] = stack.context[j].substring(-1, 75) + '//...';
|
||||
}
|
||||
@ -228,18 +228,25 @@ var ErrorReport = {
|
||||
}
|
||||
}
|
||||
|
||||
var reportData: { exception: any; server: any; ajax_request: boolean; exception_type: string; url: string, scripts?: any[] } = {
|
||||
const reportData: {
|
||||
exception: any;
|
||||
server: any;
|
||||
ajax_request: boolean;
|
||||
exception_type: string;
|
||||
url: string,
|
||||
scripts?: any[]
|
||||
} = {
|
||||
'server': CommonParams.get('server'),
|
||||
'ajax_request': true,
|
||||
'exception': exception,
|
||||
'url': window.location.href,
|
||||
'exception_type': 'js'
|
||||
'exception_type': 'js',
|
||||
};
|
||||
if (AJAX.scriptHandler.scripts.length > 0) {
|
||||
reportData.scripts = AJAX.scriptHandler.scripts.map(
|
||||
function (script) {
|
||||
return script;
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@ -254,7 +261,7 @@ var ErrorReport = {
|
||||
*/
|
||||
wrapFunction: function (func) {
|
||||
if (! func.wrapped) {
|
||||
var newFunc = function () {
|
||||
const newFunc = function () {
|
||||
try {
|
||||
return func.apply(this, arguments);
|
||||
} catch (x) {
|
||||
@ -278,9 +285,9 @@ var ErrorReport = {
|
||||
* Automatically wraps the callback in AJAX.registerOnload
|
||||
*/
|
||||
wrapAjaxOnloadCallback: function (): void {
|
||||
var oldOnload = AJAX.registerOnload;
|
||||
const oldOnload = AJAX.registerOnload;
|
||||
AJAX.registerOnload = function (file, func) {
|
||||
var wrappedFunction = ErrorReport.wrapFunction(func);
|
||||
const wrappedFunction = ErrorReport.wrapFunction(func);
|
||||
oldOnload.call(this, file, wrappedFunction);
|
||||
};
|
||||
},
|
||||
@ -288,9 +295,9 @@ var ErrorReport = {
|
||||
* Automatically wraps the callback in $.fn.on
|
||||
*/
|
||||
wrapJqueryOnCallback: function (): void {
|
||||
var oldOn = $.fn.on;
|
||||
const oldOn = $.fn.on;
|
||||
$.fn.on = function () {
|
||||
for (var i = 1; i <= 3; i++) {
|
||||
for (let i = 1; i <= 3; i++) {
|
||||
if (typeof (arguments[i]) === 'function') {
|
||||
arguments[i] = ErrorReport.wrapFunction(arguments[i]);
|
||||
break;
|
||||
@ -306,7 +313,7 @@ var ErrorReport = {
|
||||
setUpErrorReporting: function (): void {
|
||||
ErrorReport.wrapAjaxOnloadCallback();
|
||||
ErrorReport.wrapJqueryOnCallback();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
AJAX.registerOnload('error_report.js', function () {
|
||||
|
||||
@ -36,8 +36,8 @@ function enableDumpSomeRowsSubOptions () {
|
||||
* @return {object} template data
|
||||
*/
|
||||
function getTemplateData () {
|
||||
var $form = $('form[name="dump"]');
|
||||
var excludeList = [
|
||||
const $form = $('form[name="dump"]');
|
||||
const excludeList = [
|
||||
'token',
|
||||
'server',
|
||||
'db',
|
||||
@ -46,10 +46,10 @@ function getTemplateData () {
|
||||
'export_type',
|
||||
'export_method',
|
||||
'sql_query',
|
||||
'template_id'
|
||||
'template_id',
|
||||
];
|
||||
var obj = {};
|
||||
var arr = $form.serializeArray();
|
||||
const obj = {};
|
||||
const arr = $form.serializeArray();
|
||||
$.each(arr, function () {
|
||||
if ($.inArray(this.name, excludeList) < 0) {
|
||||
if (obj[this.name] !== undefined) {
|
||||
@ -88,16 +88,16 @@ function getTemplateData () {
|
||||
* @param name name of the template
|
||||
*/
|
||||
function createTemplate (name) {
|
||||
var templateData = Export.getTemplateData();
|
||||
const templateData = Export.getTemplateData();
|
||||
|
||||
var params = {
|
||||
const params = {
|
||||
'ajax_request': true,
|
||||
'server': CommonParams.get('server'),
|
||||
'db': CommonParams.get('db'),
|
||||
'table': CommonParams.get('table'),
|
||||
'exportType': $('input[name="export_type"]').val(),
|
||||
'templateName': name,
|
||||
'templateData': JSON.stringify(templateData)
|
||||
'templateData': JSON.stringify(templateData),
|
||||
};
|
||||
|
||||
ajaxShowMessage();
|
||||
@ -124,7 +124,7 @@ function createTemplate (name) {
|
||||
* @param id ID of the template to load
|
||||
*/
|
||||
function loadTemplate (id) {
|
||||
var params = {
|
||||
const params = {
|
||||
'ajax_request': true,
|
||||
'server': CommonParams.get('server'),
|
||||
'db': CommonParams.get('db'),
|
||||
@ -136,16 +136,16 @@ function loadTemplate (id) {
|
||||
ajaxShowMessage();
|
||||
$.post('index.php?route=/export/template/load', params, function (response) {
|
||||
if (response.success === true) {
|
||||
var $form = $('form[name="dump"]');
|
||||
var options = JSON.parse(response.data);
|
||||
const $form = $('form[name="dump"]');
|
||||
const options = JSON.parse(response.data);
|
||||
$.each(options, function (key, value) {
|
||||
if (typeof key === 'symbol') {
|
||||
// Continue to next iteration.
|
||||
return true;
|
||||
}
|
||||
|
||||
var localValue = value;
|
||||
var $element = $form.find('[name="' + key + '"]');
|
||||
let localValue = value;
|
||||
const $element = $form.find('[name="' + key + '"]');
|
||||
if ($element.length) {
|
||||
if (($element.is('input') && $element.attr('type') === 'checkbox') && localValue === null) {
|
||||
$element.prop('checked', false);
|
||||
@ -179,16 +179,16 @@ function loadTemplate (id) {
|
||||
* @param id ID of the template to update
|
||||
*/
|
||||
function updateTemplate (id) {
|
||||
var templateData = Export.getTemplateData();
|
||||
const templateData = Export.getTemplateData();
|
||||
|
||||
var params = {
|
||||
const params = {
|
||||
'ajax_request': true,
|
||||
'server': CommonParams.get('server'),
|
||||
'db': CommonParams.get('db'),
|
||||
'table': CommonParams.get('table'),
|
||||
'exportType': $('input[name="export_type"]').val(),
|
||||
'templateId': id,
|
||||
'templateData': JSON.stringify(templateData)
|
||||
'templateData': JSON.stringify(templateData),
|
||||
};
|
||||
|
||||
ajaxShowMessage();
|
||||
@ -207,7 +207,7 @@ function updateTemplate (id) {
|
||||
* @param id ID of the template to delete
|
||||
*/
|
||||
function deleteTemplate (id) {
|
||||
var params = {
|
||||
const params = {
|
||||
'ajax_request': true,
|
||||
'server': CommonParams.get('server'),
|
||||
'db': CommonParams.get('db'),
|
||||
@ -257,7 +257,7 @@ AJAX.registerTeardown('export.js', function () {
|
||||
AJAX.registerOnload('export.js', function () {
|
||||
$('#showsqlquery').on('click', function () {
|
||||
// Creating a dialog box similar to preview sql container to show sql query
|
||||
var modal = $('#showSqlQueryModal');
|
||||
const modal = $('#showSqlQueryModal');
|
||||
modal.modal('show');
|
||||
modal.on('shown.bs.modal', function () {
|
||||
$('#showSqlQueryModalLabel').first().html(window.Messages.strQuery);
|
||||
@ -271,7 +271,7 @@ AJAX.registerOnload('export.js', function () {
|
||||
// create a new template
|
||||
$('input[name="createTemplate"]').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
var name = ($('input[name="templateName"]').val() as string);
|
||||
const name = ($('input[name="templateName"]').val() as string);
|
||||
if (name.length) {
|
||||
Export.createTemplate(name);
|
||||
}
|
||||
@ -280,7 +280,7 @@ AJAX.registerOnload('export.js', function () {
|
||||
// load an existing template
|
||||
$('select[name="template"]').on('change', function (e) {
|
||||
e.preventDefault();
|
||||
var id = ($(this).val() as string);
|
||||
const id = ($(this).val() as string);
|
||||
if (id.length) {
|
||||
Export.loadTemplate(id);
|
||||
}
|
||||
@ -289,7 +289,7 @@ AJAX.registerOnload('export.js', function () {
|
||||
// update an existing template with new criteria
|
||||
$('input[name="updateTemplate"]').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
var id = ($('select[name="template"]').val() as string);
|
||||
const id = ($('select[name="template"]').val() as string);
|
||||
if (id.length) {
|
||||
Export.updateTemplate(id);
|
||||
}
|
||||
@ -298,7 +298,7 @@ AJAX.registerOnload('export.js', function () {
|
||||
// delete an existing template
|
||||
$('input[name="deleteTemplate"]').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
var id = ($('select[name="template"]').val() as string);
|
||||
const id = ($('select[name="template"]').val() as string);
|
||||
if (id.length) {
|
||||
Export.deleteTemplate(id);
|
||||
}
|
||||
@ -310,7 +310,7 @@ AJAX.registerOnload('export.js', function () {
|
||||
*/
|
||||
$('#plugins').on('change', function () {
|
||||
$('#format_specific_opts').find('div.format_specific_options').addClass('d-none');
|
||||
var selectedPluginName = $('#plugins').find('option:selected').val();
|
||||
const selectedPluginName = $('#plugins').find('option:selected').val();
|
||||
$('#' + selectedPluginName + '_options').removeClass('d-none');
|
||||
});
|
||||
|
||||
@ -318,8 +318,8 @@ AJAX.registerOnload('export.js', function () {
|
||||
* Toggles the enabling and disabling of the SQL plugin's comment options that apply only when exporting structure
|
||||
*/
|
||||
$('input[type=\'radio\'][name=\'sql_structure_or_data\']').on('change', function () {
|
||||
var commentsArePresent = $('#checkbox_sql_include_comments').prop('checked');
|
||||
var show = $('input[type=\'radio\'][name=\'sql_structure_or_data\']:checked').val();
|
||||
const commentsArePresent = $('#checkbox_sql_include_comments').prop('checked');
|
||||
const show = $('input[type=\'radio\'][name=\'sql_structure_or_data\']:checked').val();
|
||||
if (show === 'data') {
|
||||
// disable the SQL comment options
|
||||
if (commentsArePresent) {
|
||||
@ -347,7 +347,7 @@ AJAX.registerOnload('export.js', function () {
|
||||
|
||||
// When MS Excel is selected as the Format automatically Switch to Character Set as windows-1252
|
||||
$('#plugins').on('change', function () {
|
||||
var selectedPluginName = $('#plugins').find('option:selected').val();
|
||||
const selectedPluginName = $('#plugins').find('option:selected').val();
|
||||
if (selectedPluginName === 'excel') {
|
||||
$('#select_charset').val('windows-1252');
|
||||
} else {
|
||||
@ -374,9 +374,9 @@ function setupTableStructureOrData () {
|
||||
return;
|
||||
}
|
||||
|
||||
var pluginName = $('#plugins').find('option:selected').val();
|
||||
var formElemName = pluginName + '_structure_or_data';
|
||||
var forceStructureOrData = ! ($('input[name=\'' + formElemName + '_default\']').length);
|
||||
const pluginName = $('#plugins').find('option:selected').val();
|
||||
const formElemName = pluginName + '_structure_or_data';
|
||||
const forceStructureOrData = !($('input[name=\'' + formElemName + '_default\']').length);
|
||||
|
||||
if (forceStructureOrData === true) {
|
||||
$('input[name="structure_or_data_forced"]').val(1);
|
||||
@ -391,7 +391,7 @@ function setupTableStructureOrData () {
|
||||
|
||||
$('.export_structure, .export_data').fadeTo('fast', 1);
|
||||
|
||||
var structureOrData = $('input[name="' + formElemName + '_default"]').val();
|
||||
const structureOrData = $('input[name="' + formElemName + '_default"]').val();
|
||||
|
||||
if (structureOrData === 'structure') {
|
||||
$('.export_data input[type="checkbox"]')
|
||||
@ -430,11 +430,11 @@ function setupTableStructureOrData () {
|
||||
* options
|
||||
*/
|
||||
function toggleStructureDataOpts () {
|
||||
var pluginName = $('select#plugins').val();
|
||||
var radioFormName = pluginName + '_structure_or_data';
|
||||
var dataDiv = '#' + pluginName + '_data';
|
||||
var structureDiv = '#' + pluginName + '_structure';
|
||||
var show = $('input[type=\'radio\'][name=\'' + radioFormName + '\']:checked').val();
|
||||
const pluginName = $('select#plugins').val();
|
||||
const radioFormName = pluginName + '_structure_or_data';
|
||||
const dataDiv = '#' + pluginName + '_data';
|
||||
const structureDiv = '#' + pluginName + '_structure';
|
||||
const show = $('input[type=\'radio\'][name=\'' + radioFormName + '\']:checked').val();
|
||||
// Show the #rows if 'show' is not structure
|
||||
$('#rows').toggle(show !== 'structure');
|
||||
if (show === 'data') {
|
||||
@ -454,7 +454,7 @@ function toggleStructureDataOpts () {
|
||||
* Toggles the disabling of the "save to file" options
|
||||
*/
|
||||
function toggleSaveToFile () {
|
||||
var $ulSaveAsfile = $('#ul_save_asfile');
|
||||
const $ulSaveAsfile = $('#ul_save_asfile');
|
||||
if (! $('#radio_dump_asfile').prop('checked')) {
|
||||
$ulSaveAsfile.find('> li').fadeTo('fast', 0.4);
|
||||
$ulSaveAsfile.find('> li > input').prop('disabled', true);
|
||||
@ -476,7 +476,7 @@ AJAX.registerOnload('export.js', function () {
|
||||
*/
|
||||
function toggleSqlIncludeComments () {
|
||||
$('#checkbox_sql_include_comments').on('change', function () {
|
||||
var $ulIncludeComments = $('#ul_include_comments');
|
||||
const $ulIncludeComments = $('#ul_include_comments');
|
||||
if (! $('#checkbox_sql_include_comments').prop('checked')) {
|
||||
$ulIncludeComments.find('> li').fadeTo('fast', 0.4);
|
||||
$ulIncludeComments.find('> li > input').prop('disabled', true);
|
||||
@ -493,11 +493,11 @@ function toggleSqlIncludeComments () {
|
||||
}
|
||||
|
||||
function checkTableSelectAll () {
|
||||
var total = $('input[name="table_select[]"]').length;
|
||||
var strChecked = $('input[name="table_structure[]"]:checked').length;
|
||||
var dataChecked = $('input[name="table_data[]"]:checked').length;
|
||||
var strAll = $('#table_structure_all');
|
||||
var dataAll = $('#table_data_all');
|
||||
const total = $('input[name="table_select[]"]').length;
|
||||
const strChecked = $('input[name="table_structure[]"]:checked').length;
|
||||
const dataChecked = $('input[name="table_data[]"]:checked').length;
|
||||
const strAll = $('#table_structure_all');
|
||||
const dataAll = $('#table_data_all');
|
||||
|
||||
if (strChecked === total) {
|
||||
strAll
|
||||
@ -529,11 +529,11 @@ function checkTableSelectAll () {
|
||||
}
|
||||
|
||||
function checkTableSelectStructureOrData () {
|
||||
var dataChecked = $('input[name="table_data[]"]:checked').length;
|
||||
var autoIncrement = $('#checkbox_sql_auto_increment');
|
||||
const dataChecked = $('input[name="table_data[]"]:checked').length;
|
||||
const autoIncrement = $('#checkbox_sql_auto_increment');
|
||||
|
||||
var pluginName = $('select#plugins').val();
|
||||
var dataDiv = '#' + pluginName + '_data';
|
||||
const pluginName = $('select#plugins').val();
|
||||
const dataDiv = '#' + pluginName + '_data';
|
||||
|
||||
if (dataChecked === 0) {
|
||||
$(dataDiv).slideUp('slow');
|
||||
@ -545,7 +545,7 @@ function checkTableSelectStructureOrData () {
|
||||
}
|
||||
|
||||
function toggleTableSelectAllStr () {
|
||||
var strAll = $('#table_structure_all').is(':checked');
|
||||
const strAll = $('#table_structure_all').is(':checked');
|
||||
if (strAll) {
|
||||
$('input[name="table_structure[]"]').prop('checked', true);
|
||||
} else {
|
||||
@ -554,7 +554,7 @@ function toggleTableSelectAllStr () {
|
||||
}
|
||||
|
||||
function toggleTableSelectAllData () {
|
||||
var dataAll = $('#table_data_all').is(':checked');
|
||||
const dataAll = $('#table_data_all').is(':checked');
|
||||
if (dataAll) {
|
||||
$('input[name="table_data[]"]').prop('checked', true);
|
||||
} else {
|
||||
@ -569,13 +569,13 @@ function checkSelectedTables () {
|
||||
}
|
||||
|
||||
function checkTableSelected (row) {
|
||||
var $row = $(row);
|
||||
var tableSelect = $row.find('input[name="table_select[]"]');
|
||||
var strCheck = $row.find('input[name="table_structure[]"]');
|
||||
var dataCheck = $row.find('input[name="table_data[]"]');
|
||||
const $row = $(row);
|
||||
const tableSelect = $row.find('input[name="table_select[]"]');
|
||||
const strCheck = $row.find('input[name="table_structure[]"]');
|
||||
const dataCheck = $row.find('input[name="table_data[]"]');
|
||||
|
||||
var data = dataCheck.is(':checked:not(:disabled)');
|
||||
var structure = strCheck.is(':checked:not(:disabled)');
|
||||
const data = dataCheck.is(':checked:not(:disabled)');
|
||||
const structure = strCheck.is(':checked:not(:disabled)');
|
||||
|
||||
if (data && structure) {
|
||||
tableSelect.prop({ checked: true, indeterminate: false });
|
||||
@ -590,8 +590,8 @@ function checkTableSelected (row) {
|
||||
}
|
||||
|
||||
function toggleTableSelect (row) {
|
||||
var $row = $(row);
|
||||
var tableSelected = $row.find('input[name="table_select[]"]').is(':checked');
|
||||
const $row = $(row);
|
||||
const tableSelected = $row.find('input[name="table_select[]"]').is(':checked');
|
||||
|
||||
if (tableSelected) {
|
||||
$row.find('input[type="checkbox"]:not(:disabled)').prop('checked', true);
|
||||
@ -616,8 +616,8 @@ AJAX.registerOnload('export.js', function () {
|
||||
/**
|
||||
* For SQL plugin, if "CREATE TABLE options" is checked/unchecked, check/uncheck each of its sub-options
|
||||
*/
|
||||
var $create = $('#checkbox_sql_create_table_statements');
|
||||
var $createOptions = $('#ul_create_table_statements').find('input');
|
||||
const $create = $('#checkbox_sql_create_table_statements');
|
||||
const $createOptions = $('#ul_create_table_statements').find('input');
|
||||
$create.on('change', function () {
|
||||
$createOptions.prop('checked', $(this).prop('checked'));
|
||||
});
|
||||
@ -688,10 +688,10 @@ AJAX.registerOnload('export.js', function () {
|
||||
if ($('input[name=\'export_type\']').val() === 'database') {
|
||||
// Hide structure or data radio buttons
|
||||
$('input[type=\'radio\'][name$=\'_structure_or_data\']').each(function () {
|
||||
var $this = $(this);
|
||||
var name = $this.prop('name');
|
||||
var val = $('input[name="' + name + '"]:checked').val();
|
||||
var nameDefault = name + '_default';
|
||||
const $this = $(this);
|
||||
const name = $this.prop('name');
|
||||
const val = $('input[name="' + name + '"]:checked').val();
|
||||
const nameDefault = name + '_default';
|
||||
if (! $('input[name="' + nameDefault + '"]').length) {
|
||||
$this
|
||||
.after(
|
||||
@ -710,9 +710,9 @@ AJAX.registerOnload('export.js', function () {
|
||||
$('input[type=\'radio\'][name$=\'_structure_or_data\']').remove();
|
||||
|
||||
// Disable CREATE table checkbox for sql
|
||||
var createTableCheckbox = $('#checkbox_sql_create_table');
|
||||
const createTableCheckbox = $('#checkbox_sql_create_table');
|
||||
createTableCheckbox.prop('checked', true);
|
||||
var dummyCreateTable = $('#checkbox_sql_create_table')
|
||||
const dummyCreateTable = $('#checkbox_sql_create_table')
|
||||
.clone()
|
||||
.removeAttr('id')
|
||||
.attr('type', 'hidden');
|
||||
@ -784,10 +784,10 @@ function toggleQuickOrCustom () {
|
||||
pluginOptionsElement.classList.remove('d-none');
|
||||
}
|
||||
|
||||
var timeOut;
|
||||
let timeOut;
|
||||
|
||||
function checkTimeOut (timeLimit) {
|
||||
var limit = timeLimit;
|
||||
let limit = timeLimit;
|
||||
if (typeof limit === 'undefined' || limit === 0) {
|
||||
return true;
|
||||
}
|
||||
@ -822,24 +822,24 @@ function checkTimeOut (timeLimit) {
|
||||
*/
|
||||
function createAliasModal (event): void {
|
||||
event.preventDefault();
|
||||
var modal = $('#renameExportModal');
|
||||
const modal = $('#renameExportModal');
|
||||
modal.modal('show');
|
||||
modal.on('shown.bs.modal', function () {
|
||||
var db = CommonParams.get('db');
|
||||
const db = CommonParams.get('db');
|
||||
if (db) {
|
||||
var option = $('<option></option>');
|
||||
const option = $('<option></option>');
|
||||
option.text(db);
|
||||
option.attr('value', db);
|
||||
$('#db_alias_select').append(option).val(db).trigger('change');
|
||||
} else {
|
||||
var params = {
|
||||
const params = {
|
||||
'ajax_request': true,
|
||||
'server': CommonParams.get('server')
|
||||
'server': CommonParams.get('server'),
|
||||
};
|
||||
$.post('index.php?route=/databases', params, function (response) {
|
||||
if (response.success === true) {
|
||||
$.each(response.databases, function (idx, value) {
|
||||
var option = $('<option></option>');
|
||||
const option = $('<option></option>');
|
||||
option.text(value);
|
||||
option.attr('value', value);
|
||||
$('#db_alias_select').append(option);
|
||||
@ -852,7 +852,7 @@ function createAliasModal (event): void {
|
||||
});
|
||||
|
||||
modal.on('hidden.bs.modal', function () {
|
||||
var isEmpty = true;
|
||||
let isEmpty = true;
|
||||
$(this).find('input[type="text"]').each(function () {
|
||||
// trim empty input fields on close
|
||||
if ($(this).val()) {
|
||||
@ -872,7 +872,7 @@ function createAliasModal (event): void {
|
||||
}
|
||||
|
||||
function aliasToggleRow (elm) {
|
||||
var inputs = elm.parents('tr').find('input,button');
|
||||
const inputs = elm.parents('tr').find('input,button');
|
||||
if (elm.val()) {
|
||||
inputs.attr('disabled', false);
|
||||
} else {
|
||||
@ -889,7 +889,7 @@ function addAlias (type, name, field, value) {
|
||||
Export.aliasRow = $('#alias_data tfoot tr');
|
||||
}
|
||||
|
||||
var row = Export.aliasRow.clone();
|
||||
const row = Export.aliasRow.clone();
|
||||
row.find('th').text(type);
|
||||
row.find('td').first().text(name);
|
||||
row.find('input').attr('name', field);
|
||||
@ -898,7 +898,7 @@ function addAlias (type, name, field, value) {
|
||||
$(this).parents('tr').remove();
|
||||
});
|
||||
|
||||
var matching = $('#alias_data [name="' + $.escapeSelector(field) + '"]');
|
||||
const matching = $('#alias_data [name="' + $.escapeSelector(field) + '"]');
|
||||
if (matching.length > 0) {
|
||||
matching.parents('tr').remove();
|
||||
}
|
||||
@ -971,24 +971,24 @@ AJAX.registerOnload('export.js', function () {
|
||||
|
||||
$('#db_alias_select').on('change', function () {
|
||||
Export.aliasToggleRow($(this));
|
||||
var table = CommonParams.get('table');
|
||||
const table = CommonParams.get('table');
|
||||
if (table) {
|
||||
var option = $('<option></option>');
|
||||
const option = $('<option></option>');
|
||||
option.text(table);
|
||||
option.attr('value', table);
|
||||
$('#table_alias_select').append(option).val(table).trigger('change');
|
||||
} else {
|
||||
var database = $(this).val();
|
||||
var params = {
|
||||
const database = $(this).val();
|
||||
const params = {
|
||||
'ajax_request': true,
|
||||
'server': CommonParams.get('server'),
|
||||
'db': database,
|
||||
};
|
||||
var url = 'index.php?route=/tables';
|
||||
const url = 'index.php?route=/tables';
|
||||
$.post(url, params, function (response) {
|
||||
if (response.success === true) {
|
||||
$.each(response.tables, function (idx, value) {
|
||||
var option = $('<option></option>');
|
||||
const option = $('<option></option>');
|
||||
option.text(value);
|
||||
option.attr('value', value);
|
||||
$('#table_alias_select').append(option);
|
||||
@ -1002,19 +1002,19 @@ AJAX.registerOnload('export.js', function () {
|
||||
|
||||
$('#table_alias_select').on('change', function () {
|
||||
Export.aliasToggleRow($(this));
|
||||
var database = $('#db_alias_select').val();
|
||||
var table = $(this).val();
|
||||
var params = {
|
||||
const database = $('#db_alias_select').val();
|
||||
const table = $(this).val();
|
||||
const params = {
|
||||
'ajax_request': true,
|
||||
'server': CommonParams.get('server'),
|
||||
'db': database,
|
||||
'table': table,
|
||||
};
|
||||
var url = 'index.php?route=/columns';
|
||||
const url = 'index.php?route=/columns';
|
||||
$.post(url, params, function (response) {
|
||||
if (response.success === true) {
|
||||
$.each(response.columns, function (idx, value) {
|
||||
var option = $('<option></option>');
|
||||
const option = $('<option></option>');
|
||||
option.text(value);
|
||||
option.attr('value', value);
|
||||
$('#column_alias_select').append(option);
|
||||
@ -1031,7 +1031,7 @@ AJAX.registerOnload('export.js', function () {
|
||||
|
||||
$('#db_alias_button').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
var db = $('#db_alias_select').val();
|
||||
const db = $('#db_alias_select').val();
|
||||
Export.addAlias(
|
||||
window.Messages.strAliasDatabase,
|
||||
db,
|
||||
@ -1044,8 +1044,8 @@ AJAX.registerOnload('export.js', function () {
|
||||
|
||||
$('#table_alias_button').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
var db = $('#db_alias_select').val();
|
||||
var table = $('#table_alias_select').val();
|
||||
const db = $('#db_alias_select').val();
|
||||
const table = $('#table_alias_select').val();
|
||||
Export.addAlias(
|
||||
window.Messages.strAliasTable,
|
||||
db + '.' + table,
|
||||
@ -1058,9 +1058,9 @@ AJAX.registerOnload('export.js', function () {
|
||||
|
||||
$('#column_alias_button').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
var db = $('#db_alias_select').val();
|
||||
var table = $('#table_alias_select').val();
|
||||
var column = $('#column_alias_select').val();
|
||||
const db = $('#db_alias_select').val();
|
||||
const table = $('#table_alias_select').val();
|
||||
const column = $('#column_alias_select').val();
|
||||
Export.addAlias(
|
||||
window.Messages.strAliasColumn,
|
||||
db + '.' + table + '.' + column,
|
||||
@ -1071,7 +1071,7 @@ AJAX.registerOnload('export.js', function () {
|
||||
$('#column_alias_name').val('');
|
||||
});
|
||||
|
||||
var setDbSelectOptions = function (doCheck) {
|
||||
const setDbSelectOptions = function (doCheck) {
|
||||
setSelectOptions('dump', 'db_select[]', doCheck);
|
||||
};
|
||||
|
||||
@ -1086,7 +1086,7 @@ AJAX.registerOnload('export.js', function () {
|
||||
});
|
||||
|
||||
$('#buttonGo').on('click', function () {
|
||||
var timeLimit = parseInt($(this).attr('data-exec-time-limit'));
|
||||
const timeLimit = parseInt($(this).attr('data-exec-time-limit'));
|
||||
|
||||
// If the time limit set is zero,
|
||||
// then time out won't occur so no need to check for time out.
|
||||
|
||||
@ -17,7 +17,7 @@ AJAX.registerOnload('export_output.js', function () {
|
||||
|
||||
$('.export_copy_to_clipboard_btn').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
var copyStatus = copyToClipboard($('textarea#textSQLDUMP').val(), '<textarea>');
|
||||
const copyStatus = copyToClipboard($('textarea#textSQLDUMP').val(), '<textarea>');
|
||||
displayCopyStatus(this, copyStatus);
|
||||
});
|
||||
});
|
||||
|
||||
@ -20,7 +20,7 @@ function changePluginOpts () {
|
||||
$(this).hide();
|
||||
});
|
||||
|
||||
var selectedPluginName = $('#plugins').find('option:selected').val();
|
||||
const selectedPluginName = $('#plugins').find('option:selected').val();
|
||||
$('#' + selectedPluginName + '_options').fadeIn('slow');
|
||||
|
||||
const importNotification = document.getElementById('import_notification');
|
||||
@ -39,10 +39,10 @@ function changePluginOpts () {
|
||||
* @param {string} fname
|
||||
*/
|
||||
function matchFile (fname) {
|
||||
var fnameArray = fname.toLowerCase().split('.');
|
||||
var len = fnameArray.length;
|
||||
const fnameArray = fname.toLowerCase().split('.');
|
||||
let len = fnameArray.length;
|
||||
if (len !== 0) {
|
||||
var extension = fnameArray[len - 1];
|
||||
const extension = fnameArray[len - 1];
|
||||
if (extension === 'gz' || extension === 'bz2' || extension === 'zip') {
|
||||
len--;
|
||||
}
|
||||
@ -71,11 +71,11 @@ AJAX.registerTeardown('import.js', function () {
|
||||
AJAX.registerOnload('import.js', function () {
|
||||
// import_file_form validation.
|
||||
$(document).on('submit', '#import_file_form', function () {
|
||||
var radioLocalImport = $('#localFileTab');
|
||||
var radioImport = $('#uploadFileTab');
|
||||
var fileMsg = '<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title="" alt="" class="icon ic_s_error"> ' + window.Messages.strImportDialogMessage + '</div>';
|
||||
var wrongTblNameMsg = '<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title="" alt="" class="icon ic_s_error">' + window.Messages.strTableNameDialogMessage + '</div>';
|
||||
var wrongDBNameMsg = '<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title="" alt="" class="icon ic_s_error">' + window.Messages.strDBNameDialogMessage + '</div>';
|
||||
const radioLocalImport = $('#localFileTab');
|
||||
const radioImport = $('#uploadFileTab');
|
||||
const fileMsg = '<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title="" alt="" class="icon ic_s_error"> ' + window.Messages.strImportDialogMessage + '</div>';
|
||||
const wrongTblNameMsg = '<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title="" alt="" class="icon ic_s_error">' + window.Messages.strTableNameDialogMessage + '</div>';
|
||||
const wrongDBNameMsg = '<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title="" alt="" class="icon ic_s_error">' + window.Messages.strDBNameDialogMessage + '</div>';
|
||||
|
||||
if (radioLocalImport.length !== 0) {
|
||||
// remote upload.
|
||||
@ -111,7 +111,7 @@ AJAX.registerOnload('import.js', function () {
|
||||
}
|
||||
|
||||
if ($('#text_csv_new_tbl_name').length > 0) {
|
||||
var newTblName = ($('#text_csv_new_tbl_name').val() as string);
|
||||
const newTblName = ($('#text_csv_new_tbl_name').val() as string);
|
||||
if (newTblName.length > 0 && newTblName.trim().length === 0) {
|
||||
ajaxShowMessage(wrongTblNameMsg, false);
|
||||
|
||||
@ -120,7 +120,7 @@ AJAX.registerOnload('import.js', function () {
|
||||
}
|
||||
|
||||
if ($('#text_csv_new_db_name').length > 0) {
|
||||
var newDBName = ($('#text_csv_new_db_name').val() as string);
|
||||
const newDBName = ($('#text_csv_new_db_name').val() as string);
|
||||
if (newDBName.length > 0 && newDBName.trim().length === 0) {
|
||||
ajaxShowMessage(wrongDBNameMsg, false);
|
||||
|
||||
@ -184,14 +184,14 @@ AJAX.registerOnload('import.js', function () {
|
||||
const clockImage = '<img src="' + window.themeImagePath + 'ajax_clock_small.gif" width="16" height="16" alt="ajax clock">';
|
||||
|
||||
if (handler !== 'PhpMyAdmin\\Plugins\\Import\\Upload\\UploadNoplugin') {
|
||||
var finished = false;
|
||||
var percent = 0.0;
|
||||
var total = 0;
|
||||
var complete = 0;
|
||||
var originalTitle = parent && parent.document ? parent.document.title : false;
|
||||
var importStart;
|
||||
let finished = false;
|
||||
let percent = 0.0;
|
||||
let total = 0;
|
||||
let complete = 0;
|
||||
const originalTitle = parent && parent.document ? parent.document.title : false;
|
||||
let importStart;
|
||||
|
||||
var performUpload = function () {
|
||||
const performUpload = function () {
|
||||
$.getJSON(
|
||||
'index.php?route=/import-status',
|
||||
{ 'id': uploadId, 'import_status': 1, 'server': CommonParams.get('server') },
|
||||
@ -205,24 +205,24 @@ AJAX.registerOnload('import.js', function () {
|
||||
$('#upload_form_status_info').html(clockImage + ' ' + window.Messages.uploadProgressMaximumAllowedSize);
|
||||
$('#upload_form_status').css('display', 'none');
|
||||
} else {
|
||||
var nowDate = new Date();
|
||||
const nowDate = new Date();
|
||||
const now = Date.UTC(
|
||||
nowDate.getFullYear(),
|
||||
nowDate.getMonth(),
|
||||
nowDate.getDate(),
|
||||
nowDate.getHours(),
|
||||
nowDate.getMinutes(),
|
||||
nowDate.getSeconds()
|
||||
nowDate.getSeconds(),
|
||||
) + nowDate.getMilliseconds() - 1000;
|
||||
|
||||
var statusText = window.sprintf(
|
||||
let statusText = window.sprintf(
|
||||
window.Messages.uploadProgressStatusText,
|
||||
formatBytes(
|
||||
complete, 1, window.Messages.strDecimalSeparator
|
||||
complete, 1, window.Messages.strDecimalSeparator,
|
||||
),
|
||||
formatBytes(
|
||||
total, 1, window.Messages.strDecimalSeparator
|
||||
)
|
||||
total, 1, window.Messages.strDecimalSeparator,
|
||||
),
|
||||
);
|
||||
|
||||
if ($('#importmain').is(':visible')) {
|
||||
@ -239,16 +239,16 @@ AJAX.registerOnload('import.js', function () {
|
||||
importStart = now;
|
||||
} else if (percent > 9 || complete > 2000000) {
|
||||
// Calculate estimated time
|
||||
var usedTime = now - importStart;
|
||||
var seconds = parseInt((((total - complete) / complete) * usedTime / 1000).toString());
|
||||
var speed = window.sprintf(
|
||||
const usedTime = now - importStart;
|
||||
let seconds = parseInt((((total - complete) / complete) * usedTime / 1000).toString());
|
||||
const speed = window.sprintf(
|
||||
window.Messages.uploadProgressPerSecond,
|
||||
formatBytes(complete / usedTime * 1000, 1, window.Messages.strDecimalSeparator)
|
||||
formatBytes(complete / usedTime * 1000, 1, window.Messages.strDecimalSeparator),
|
||||
);
|
||||
|
||||
var minutes = parseInt((seconds / 60).toString());
|
||||
const minutes = parseInt((seconds / 60).toString());
|
||||
seconds %= 60;
|
||||
var estimatedTime;
|
||||
let estimatedTime;
|
||||
if (minutes > 0) {
|
||||
estimatedTime = window.Messages.uploadProgressRemainingMin
|
||||
.replace('%MIN', minutes.toString())
|
||||
@ -261,7 +261,7 @@ AJAX.registerOnload('import.js', function () {
|
||||
statusText += '<br>' + speed + '<br><br>' + estimatedTime;
|
||||
}
|
||||
|
||||
var percentString = Math.round(percent) + '%';
|
||||
const percentString = Math.round(percent) + '%';
|
||||
$('#status').animate({ width: percentString }, 150);
|
||||
$('.percentage').text(percentString);
|
||||
|
||||
@ -293,7 +293,7 @@ AJAX.registerOnload('import.js', function () {
|
||||
.show();
|
||||
|
||||
$('#import_form_status').load(
|
||||
'index.php?route=/import-status&message=1&import_status=1&server=' + CommonParams.get('server')
|
||||
'index.php?route=/import-status&message=1&import_status=1&server=' + CommonParams.get('server'),
|
||||
);
|
||||
|
||||
Navigation.reload();
|
||||
|
||||
@ -42,9 +42,9 @@ import $ from 'jquery';
|
||||
*/
|
||||
(function ($) {
|
||||
$.fn.sortableTable = function (method) {
|
||||
var methods = {
|
||||
const methods = {
|
||||
init: function (options) {
|
||||
var tb = new SortableTableInstance(this, options);
|
||||
const tb = new SortableTableInstance(this, options);
|
||||
tb.init();
|
||||
$(this).data('sortableTable', tb);
|
||||
},
|
||||
@ -53,7 +53,7 @@ import $ from 'jquery';
|
||||
},
|
||||
destroy: function () {
|
||||
$(this).data('sortableTable').destroy();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
if (methods[method]) {
|
||||
@ -65,18 +65,18 @@ import $ from 'jquery';
|
||||
}
|
||||
|
||||
function SortableTableInstance (table, options: {ignoreRect?: any, events?: any} = {}) {
|
||||
var down = false;
|
||||
var $draggedEl;
|
||||
var oldCell;
|
||||
var previewMove;
|
||||
var id;
|
||||
let down = false;
|
||||
let $draggedEl;
|
||||
let oldCell;
|
||||
let previewMove;
|
||||
let id;
|
||||
|
||||
/* Mouse handlers on the child elements */
|
||||
var onMouseUp = function (e) {
|
||||
const onMouseUp = function (e) {
|
||||
dropAt(e.pageX, e.pageY);
|
||||
};
|
||||
|
||||
var onMouseDown = function (e) {
|
||||
const onMouseDown = function (e) {
|
||||
$draggedEl = $(this).children();
|
||||
if ($draggedEl.length === 0) {
|
||||
return;
|
||||
@ -84,7 +84,7 @@ import $ from 'jquery';
|
||||
|
||||
if (options.ignoreRect && insideRect({
|
||||
x: e.pageX - $draggedEl.offset().left,
|
||||
y: e.pageY - $draggedEl.offset().top
|
||||
y: e.pageY - $draggedEl.offset().top,
|
||||
}, options.ignoreRect)) {
|
||||
return;
|
||||
}
|
||||
@ -99,7 +99,7 @@ import $ from 'jquery';
|
||||
return false;
|
||||
};
|
||||
|
||||
var globalMouseMove = function (e) {
|
||||
const globalMouseMove = function (e) {
|
||||
if (down) {
|
||||
move(e.pageX, e.pageY);
|
||||
|
||||
@ -121,8 +121,8 @@ import $ from 'jquery';
|
||||
moveTo($(previewMove), {
|
||||
pos: {
|
||||
top: $(oldCell).offset().top - $(previewMove).parent().offset().top,
|
||||
left: $(oldCell).offset().left - $(previewMove).parent().offset().left
|
||||
}
|
||||
left: $(oldCell).offset().left - $(previewMove).parent().offset().left,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -136,7 +136,7 @@ import $ from 'jquery';
|
||||
return false;
|
||||
};
|
||||
|
||||
var globalMouseOut = function () {
|
||||
const globalMouseOut = function () {
|
||||
if (down) {
|
||||
down = false;
|
||||
if (previewMove) {
|
||||
@ -188,12 +188,12 @@ import $ from 'jquery';
|
||||
};
|
||||
|
||||
function switchElement (drag, dropTo) {
|
||||
var dragPosDiff = {
|
||||
const dragPosDiff = {
|
||||
left: $(drag).children().first().offset().left - $(dropTo).offset().left,
|
||||
top: $(drag).children().first().offset().top - $(dropTo).offset().top
|
||||
top: $(drag).children().first().offset().top - $(dropTo).offset().top,
|
||||
};
|
||||
|
||||
var dropPosDiff = null;
|
||||
let dropPosDiff = null;
|
||||
if ($(dropTo).children().length > 0) {
|
||||
dropPosDiff = {
|
||||
left: $(dropTo).children().first().offset().left - $(drag).offset().left,
|
||||
@ -242,7 +242,7 @@ import $ from 'jquery';
|
||||
}
|
||||
|
||||
function inside ($el, x, y) {
|
||||
var off = $el.offset();
|
||||
const off = $el.offset();
|
||||
|
||||
return y >= off.top && x >= off.left && x < off.left + $el.width() && y < off.top + $el.height();
|
||||
}
|
||||
@ -258,7 +258,7 @@ import $ from 'jquery';
|
||||
|
||||
down = false;
|
||||
|
||||
var switched = false;
|
||||
let switched = false;
|
||||
|
||||
$(table).find('td').each(function () {
|
||||
if ($(this).children().first().attr('class') !== $(oldCell).children().first().attr('class') && inside($(this), x, y)) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -23,36 +23,36 @@ import getImageTag from './modules/functions/getImageTag.ts';
|
||||
*/
|
||||
(function ($) {
|
||||
function MenuResizer ($container, widthCalculator) {
|
||||
var self = this;
|
||||
const self = this;
|
||||
self.$container = $container;
|
||||
self.widthCalculator = widthCalculator;
|
||||
var windowWidth = $(window).width();
|
||||
const windowWidth = $(window).width();
|
||||
|
||||
if (windowWidth < 768) {
|
||||
$('#pma_navigation_resizer').css({ 'width': '0px' });
|
||||
}
|
||||
|
||||
// create submenu container
|
||||
var link = $('<a></a>', {
|
||||
const link = $('<a></a>', {
|
||||
'href': '#',
|
||||
'class': 'nav-link dropdown-toggle',
|
||||
'id': 'navbarDropdown',
|
||||
'role': 'button',
|
||||
'data-bs-toggle': 'dropdown',
|
||||
'aria-haspopup': 'true',
|
||||
'aria-expanded': 'false'
|
||||
'aria-expanded': 'false',
|
||||
}).text(window.Messages.strMore);
|
||||
|
||||
var img = $container.find('li img');
|
||||
const img = $container.find('li img');
|
||||
if (img.length) {
|
||||
$(getImageTag('b_more').toString()).prependTo(link);
|
||||
}
|
||||
|
||||
var $submenu = $('<li></li>', { 'class': 'nav-item dropdown d-none' })
|
||||
const $submenu = $('<li></li>', { 'class': 'nav-item dropdown d-none' })
|
||||
.append(link)
|
||||
.append($('<ul></ul>', {
|
||||
'class': 'dropdown-menu dropdown-menu-end',
|
||||
'aria-labelledby': 'navbarDropdown'
|
||||
'aria-labelledby': 'navbarDropdown',
|
||||
}));
|
||||
$container.append($submenu);
|
||||
setTimeout(function () {
|
||||
@ -61,24 +61,24 @@ import getImageTag from './modules/functions/getImageTag.ts';
|
||||
}
|
||||
|
||||
MenuResizer.prototype.resize = function () {
|
||||
var wmax = this.widthCalculator.call(this.$container);
|
||||
var windowWidth = $(window).width();
|
||||
var $submenu = this.$container.find('.nav-item.dropdown').last();
|
||||
var submenuW = $submenu.outerWidth(true);
|
||||
var $submenuUl = $submenu.find('.dropdown-menu');
|
||||
var $li = this.$container.find('> li');
|
||||
var $li2 = $submenuUl.find('.dropdown-item');
|
||||
var moreShown = $li2.length > 0;
|
||||
let wmax = this.widthCalculator.call(this.$container);
|
||||
let windowWidth = $(window).width();
|
||||
const $submenu = this.$container.find('.nav-item.dropdown').last();
|
||||
const submenuW = $submenu.outerWidth(true);
|
||||
const $submenuUl = $submenu.find('.dropdown-menu');
|
||||
const $li = this.$container.find('> li');
|
||||
const $li2 = $submenuUl.find('.dropdown-item');
|
||||
let moreShown = $li2.length > 0;
|
||||
// Calculate the total width used by all the shown tabs
|
||||
var totalLen = moreShown ? submenuW : 0;
|
||||
var l = $li.length - 1;
|
||||
var i;
|
||||
let totalLen = moreShown ? submenuW : 0;
|
||||
let l = $li.length - 1;
|
||||
let i;
|
||||
for (i = 0; i < l; i++) {
|
||||
totalLen += $($li[i]).outerWidth(true);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line compat/compat
|
||||
var hasVScroll = document.body.scrollHeight > document.body.clientHeight;
|
||||
const hasVScroll = document.body.scrollHeight > document.body.clientHeight;
|
||||
if (hasVScroll) {
|
||||
windowWidth += 15;
|
||||
}
|
||||
@ -88,12 +88,12 @@ import getImageTag from './modules/functions/getImageTag.ts';
|
||||
}
|
||||
|
||||
// Now hide menu elements that don't fit into the menubar
|
||||
var hidden = false; // Whether we have hidden any tabs
|
||||
let hidden = false; // Whether we have hidden any tabs
|
||||
while (totalLen >= wmax && --l >= 0) { // Process the tabs backwards
|
||||
hidden = true;
|
||||
var el = $($li[l]);
|
||||
const el = $($li[l]);
|
||||
el.removeClass('nav-item').addClass('dropdown-item');
|
||||
var elWidth = el.outerWidth(true);
|
||||
const elWidth = el.outerWidth(true);
|
||||
el.data('width', elWidth);
|
||||
if (! moreShown) {
|
||||
totalLen -= elWidth;
|
||||
@ -141,27 +141,27 @@ import getImageTag from './modules/functions/getImageTag.ts';
|
||||
};
|
||||
|
||||
MenuResizer.prototype.destroy = function () {
|
||||
var $submenu = this.$container.find('.nav-item.dropdown').removeData();
|
||||
const $submenu = this.$container.find('.nav-item.dropdown').removeData();
|
||||
$submenu.find('li').appendTo(this.$container);
|
||||
$submenu.remove();
|
||||
};
|
||||
|
||||
/** Public API */
|
||||
var methods = {
|
||||
const methods = {
|
||||
init: function (widthCalculator) {
|
||||
return this.each(function () {
|
||||
var $this = $(this);
|
||||
const $this = $(this);
|
||||
if (! $this.data('menuResizer')) {
|
||||
$this.data(
|
||||
'menuResizer',
|
||||
new MenuResizer($this, widthCalculator)
|
||||
new MenuResizer($this, widthCalculator),
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
resize: function () {
|
||||
return this.each(function () {
|
||||
var self = $(this).data('menuResizer');
|
||||
const self = $(this).data('menuResizer');
|
||||
if (self) {
|
||||
self.resize();
|
||||
}
|
||||
@ -169,12 +169,12 @@ import getImageTag from './modules/functions/getImageTag.ts';
|
||||
},
|
||||
destroy: function () {
|
||||
return this.each(function () {
|
||||
var self = $(this).data('menuResizer');
|
||||
const self = $(this).data('menuResizer');
|
||||
if (self) {
|
||||
self.destroy();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -47,17 +47,17 @@ let ajaxMessageCount = 0;
|
||||
* to remove the notification
|
||||
*/
|
||||
const ajaxShowMessage = function (message = null, timeout = null, type = null) {
|
||||
var msg = message;
|
||||
var newTimeOut = timeout;
|
||||
let msg = message;
|
||||
let newTimeOut = timeout;
|
||||
/**
|
||||
* @var self_closing Whether the notification will automatically disappear
|
||||
*/
|
||||
var selfClosing = true;
|
||||
let selfClosing = true;
|
||||
/**
|
||||
* @var dismissable Whether the user will be able to remove
|
||||
* the notification by clicking on it
|
||||
*/
|
||||
var dismissable = true;
|
||||
let dismissable = true;
|
||||
// Handle the case when a empty data.message is passed.
|
||||
// We don't want the empty message
|
||||
if (msg === '') {
|
||||
@ -102,10 +102,10 @@ const ajaxShowMessage = function (message = null, timeout = null, type = null) {
|
||||
* @var $retval a jQuery object containing the reference
|
||||
* to the created AJAX message
|
||||
*/
|
||||
var $retval = $(
|
||||
const $retval = $(
|
||||
'<span class="ajax_notification" id="ajax_message_num_' +
|
||||
ajaxMessageCount +
|
||||
'"></span>'
|
||||
'"></span>',
|
||||
)
|
||||
.hide()
|
||||
.appendTo('#loading_parent')
|
||||
|
||||
@ -57,12 +57,12 @@ const AJAX = {
|
||||
* @return {number}
|
||||
*/
|
||||
hash: function (key) {
|
||||
var newKey = key;
|
||||
let newKey = key;
|
||||
/* https://burtleburtle.net/bob/hash/doobs.html#one */
|
||||
newKey += '';
|
||||
var len = newKey.length;
|
||||
var hash = 0;
|
||||
var i = 0;
|
||||
const len = newKey.length;
|
||||
let hash = 0;
|
||||
let i = 0;
|
||||
for (; i < len; ++i) {
|
||||
hash += newKey.charCodeAt(i);
|
||||
hash += (hash << 10);
|
||||
@ -84,7 +84,7 @@ const AJAX = {
|
||||
* @return {self} For chaining
|
||||
*/
|
||||
registerOnload: function (file, func) {
|
||||
var eventName = 'onload_' + AJAX.hash(file);
|
||||
const eventName = 'onload_' + AJAX.hash(file);
|
||||
$(document).on(eventName, func);
|
||||
if (this.debug) {
|
||||
// eslint-disable-next-line no-console
|
||||
@ -107,7 +107,7 @@ const AJAX = {
|
||||
* @return {self} For chaining
|
||||
*/
|
||||
registerTeardown: function (file, func) {
|
||||
var eventName = 'teardown_' + AJAX.hash(file);
|
||||
const eventName = 'teardown_' + AJAX.hash(file);
|
||||
$(document).on(eventName, func);
|
||||
if (this.debug) {
|
||||
// eslint-disable-next-line no-console
|
||||
@ -126,7 +126,7 @@ const AJAX = {
|
||||
* @param {string} file The filename for which to fire the event
|
||||
*/
|
||||
fireOnload: function (file): void {
|
||||
var eventName = 'onload_' + AJAX.hash(file);
|
||||
const eventName = 'onload_' + AJAX.hash(file);
|
||||
$(document).trigger(eventName);
|
||||
if (this.debug) {
|
||||
// eslint-disable-next-line no-console
|
||||
@ -143,7 +143,7 @@ const AJAX = {
|
||||
* @param {string} file The filename for which to fire the event
|
||||
*/
|
||||
fireTeardown: function (file): void {
|
||||
var eventName = 'teardown_' + AJAX.hash(file);
|
||||
const eventName = 'teardown_' + AJAX.hash(file);
|
||||
$(document).triggerHandler(eventName);
|
||||
if (this.debug) {
|
||||
// eslint-disable-next-line no-console
|
||||
@ -166,9 +166,9 @@ const AJAX = {
|
||||
}
|
||||
}
|
||||
|
||||
var newHash = null;
|
||||
var oldHash = null;
|
||||
var lockId;
|
||||
let newHash = null;
|
||||
let oldHash = null;
|
||||
let lockId;
|
||||
// CodeMirror lock
|
||||
if (event.data.value === 3) {
|
||||
newHash = event.data.content;
|
||||
@ -242,7 +242,7 @@ const AJAX = {
|
||||
// In some cases we don't want to handle the request here and either
|
||||
// leave the browser deal with it natively (e.g: file download)
|
||||
// or leave an existing ajax event handler present elsewhere deal with it
|
||||
var href = $(this).attr('href');
|
||||
const href = $(this).attr('href');
|
||||
if (typeof event !== 'undefined' && (event.shiftKey || event.ctrlKey || event.metaKey)) {
|
||||
return true;
|
||||
} else if ($(this).attr('target')) {
|
||||
@ -280,8 +280,8 @@ const AJAX = {
|
||||
}
|
||||
|
||||
AJAX.resetLock();
|
||||
var isLink = !! href || false;
|
||||
var previousLinkAborted = false;
|
||||
let isLink = !! href || false;
|
||||
let previousLinkAborted = false;
|
||||
|
||||
if (AJAX.active === true) {
|
||||
// Cancel the old request if abortable, when the user requests
|
||||
@ -310,10 +310,10 @@ const AJAX = {
|
||||
|
||||
$('html, body').animate({ scrollTop: 0 }, 'fast');
|
||||
|
||||
var url = isLink ? href : $(this).attr('action');
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var params = 'ajax_request=true' + argsep + 'ajax_page_request=true';
|
||||
var dataPost = AJAX.source.getPostData();
|
||||
const url = isLink ? href : $(this).attr('action');
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
let params = 'ajax_request=true' + argsep + 'ajax_page_request=true';
|
||||
const dataPost = AJAX.source.getPostData();
|
||||
if (! isLink) {
|
||||
params += argsep + $(this).serialize();
|
||||
} else if (dataPost) {
|
||||
@ -331,8 +331,8 @@ const AJAX = {
|
||||
AJAX.$msgbox = ajaxShowMessage();
|
||||
// Save reference for the new link request
|
||||
AJAX.xhr = $.get(url, params, AJAX.responseHandler);
|
||||
var state = {
|
||||
url: href
|
||||
const state = {
|
||||
url: href,
|
||||
};
|
||||
if (previousLinkAborted) {
|
||||
// hack: there is already an aborted entry on stack
|
||||
@ -347,7 +347,7 @@ const AJAX = {
|
||||
* The event was saved in the jQuery data object by an onload
|
||||
* handler defined below. Workaround for bug #3583316
|
||||
*/
|
||||
var onsubmit = $(this).data('onsubmit');
|
||||
const onsubmit = $(this).data('onsubmit');
|
||||
// Submit the request if there is no onsubmit handler
|
||||
// or if it returns a value that evaluates to true
|
||||
if (typeof onsubmit !== 'function' || onsubmit.apply(this, [event])) {
|
||||
@ -387,7 +387,7 @@ const AJAX = {
|
||||
|
||||
$('#pma_errors').remove();
|
||||
|
||||
var msg = '';
|
||||
let msg = '';
|
||||
if (data.errSubmitMsg) {
|
||||
msg = data.errSubmitMsg;
|
||||
}
|
||||
@ -521,9 +521,9 @@ const AJAX = {
|
||||
}
|
||||
|
||||
if (data.menu) {
|
||||
var state = {
|
||||
const state = {
|
||||
url: data.selflink,
|
||||
menu: data.menu
|
||||
menu: data.menu,
|
||||
};
|
||||
history.replaceState(state, null);
|
||||
AJAX.handleMenu.replace(data.menu);
|
||||
@ -562,15 +562,15 @@ const AJAX = {
|
||||
}
|
||||
|
||||
if (data.selflink) {
|
||||
var source = data.selflink.split('?')[0];
|
||||
const source = data.selflink.split('?')[0];
|
||||
// Check for faulty links
|
||||
var $selflinkReplace = {
|
||||
const $selflinkReplace = {
|
||||
'index.php?route=/import': 'index.php?route=/table/sql',
|
||||
'index.php?route=/table/chart': 'index.php?route=/sql',
|
||||
'index.php?route=/table/gis-visualization': 'index.php?route=/sql'
|
||||
'index.php?route=/table/gis-visualization': 'index.php?route=/sql',
|
||||
};
|
||||
if ($selflinkReplace[source]) {
|
||||
var replacement = $selflinkReplace[source];
|
||||
const replacement = $selflinkReplace[source];
|
||||
data.selflink = data.selflink.replace(source, replacement);
|
||||
}
|
||||
|
||||
@ -592,7 +592,7 @@ const AJAX = {
|
||||
|
||||
$('#pma_errors').remove();
|
||||
|
||||
var msg = '';
|
||||
let msg = '';
|
||||
if (data.errSubmitMsg) {
|
||||
msg = data.errSubmitMsg;
|
||||
}
|
||||
@ -649,7 +649,7 @@ const AJAX = {
|
||||
} else {
|
||||
ajaxShowMessage(data.error, false);
|
||||
ajaxRemoveMessage(AJAX.$msgbox);
|
||||
var $ajaxError = $('<div></div>');
|
||||
const $ajaxError = $('<div></div>');
|
||||
$ajaxError.attr({ 'id': 'ajaxError' });
|
||||
$('#page_content').append($ajaxError);
|
||||
$ajaxError.html(data.error);
|
||||
@ -710,8 +710,8 @@ const AJAX = {
|
||||
* @param {Function} callback
|
||||
*/
|
||||
load: function (files, callback = undefined): void {
|
||||
var self = this;
|
||||
var i;
|
||||
const self = this;
|
||||
let i;
|
||||
// Clear loaded scripts if they are from another version of phpMyAdmin.
|
||||
// Depends on common params being set before loading scripts in responseHandler
|
||||
if (self.scriptsVersion === null) {
|
||||
@ -735,7 +735,7 @@ const AJAX = {
|
||||
}
|
||||
|
||||
for (i in files) {
|
||||
var script = files[i].name;
|
||||
const script = files[i].name;
|
||||
// Only for scripts that we don't already have
|
||||
if ($.inArray(script, self.scripts) === -1) {
|
||||
this.add(script, false);
|
||||
@ -781,9 +781,9 @@ const AJAX = {
|
||||
* @param {Function} callback
|
||||
*/
|
||||
appendScript: function (name, callback): void {
|
||||
var head = document.head || document.getElementsByTagName('head')[0];
|
||||
var script = document.createElement('script');
|
||||
var self = this;
|
||||
const head = document.head || document.getElementsByTagName('head')[0];
|
||||
const script = document.createElement('script');
|
||||
const self = this;
|
||||
|
||||
script.src = 'js/' + name + '?' + 'v=' + encodeURIComponent(CommonParams.get('version'));
|
||||
script.async = false;
|
||||
@ -800,7 +800,7 @@ const AJAX = {
|
||||
* @param {Function} callback The callback to call after resetting
|
||||
*/
|
||||
reset: function (callback): void {
|
||||
for (var i in this.scriptsToBeFired) {
|
||||
for (let i in this.scriptsToBeFired) {
|
||||
AJAX.fireTeardown(this.scriptsToBeFired[i]);
|
||||
}
|
||||
|
||||
@ -832,13 +832,13 @@ const AJAX = {
|
||||
}
|
||||
});
|
||||
|
||||
var $pageContent = $('#page_content');
|
||||
const $pageContent = $('#page_content');
|
||||
/**
|
||||
* Workaround for passing submit button name,value on ajax form submit
|
||||
* by appending hidden element with submit button name and value.
|
||||
*/
|
||||
$pageContent.on('click', 'form input[type=submit]', function () {
|
||||
var buttonName = $(this).attr('name');
|
||||
const buttonName = $(this).attr('name');
|
||||
if (typeof buttonName === 'undefined') {
|
||||
return;
|
||||
}
|
||||
@ -888,22 +888,22 @@ const AJAX = {
|
||||
*/
|
||||
loadEventHandler: function () {
|
||||
return function () {
|
||||
var menuContent = $('<div></div>')
|
||||
const menuContent = $('<div></div>')
|
||||
.append($('#server-breadcrumb').clone())
|
||||
.append($('#topmenucontainer').clone())
|
||||
.html();
|
||||
|
||||
// set initial state reload
|
||||
var initState = ('state' in window.history && window.history.state !== null);
|
||||
var initURL = $('#selflink').find('> a').attr('href') || location.href;
|
||||
var state = {
|
||||
let initState = ('state' in window.history && window.history.state !== null);
|
||||
const initURL = $('#selflink').find('> a').attr('href') || location.href;
|
||||
const state = {
|
||||
url: initURL,
|
||||
menu: menuContent
|
||||
menu: menuContent,
|
||||
};
|
||||
history.replaceState(state, null);
|
||||
|
||||
$(window).on('popstate', function (event) {
|
||||
var initPop = (! initState && location.href === initURL);
|
||||
const initPop = (!initState && location.href === initURL);
|
||||
initState = true;
|
||||
// check if popstate fired on first page itself
|
||||
if (initPop) {
|
||||
@ -911,11 +911,11 @@ const AJAX = {
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
var state = event.originalEvent.state;
|
||||
const state = event.originalEvent.state;
|
||||
if (state && state.menu) {
|
||||
AJAX.$msgbox = ajaxShowMessage();
|
||||
var params = 'ajax_request=true' + CommonParams.get('arg_separator') + 'ajax_page_request=true';
|
||||
var url = state.url || location.href;
|
||||
const params = 'ajax_request=true' + CommonParams.get('arg_separator') + 'ajax_page_request=true';
|
||||
const url = state.url || location.href;
|
||||
$.get(url, params, AJAX.responseHandler);
|
||||
// TODO: Check if sometimes menu is not retrieved from server,
|
||||
// Not sure but it seems menu was missing only for printview which
|
||||
@ -944,8 +944,8 @@ const AJAX = {
|
||||
|
||||
// Don't handle aborted requests
|
||||
if (request.status !== 0 || request.statusText !== 'abort') {
|
||||
var details = '';
|
||||
var state = request.state();
|
||||
let details = '';
|
||||
const state = request.state();
|
||||
|
||||
if (
|
||||
'responseJSON' in request &&
|
||||
|
||||
@ -11,7 +11,7 @@ const CommonParams = (function () {
|
||||
* @var {Object} params An associative array of key value pairs
|
||||
* @access private
|
||||
*/
|
||||
var params = {};
|
||||
const params = {};
|
||||
|
||||
// The returned object is the public part of the module
|
||||
return {
|
||||
@ -25,7 +25,7 @@ const CommonParams = (function () {
|
||||
*/
|
||||
setAll: function (obj) {
|
||||
let updateNavigation = false;
|
||||
for (var i in obj) {
|
||||
for (let i in obj) {
|
||||
if (params[i] !== undefined && params[i] !== obj[i]) {
|
||||
if (i === 'db' || i === 'table') {
|
||||
updateNavigation = true;
|
||||
@ -76,9 +76,9 @@ const CommonParams = (function () {
|
||||
* @return {string}
|
||||
*/
|
||||
getUrlQuery: function (separator) {
|
||||
var sep = (typeof separator !== 'undefined') ? separator : '?';
|
||||
var common = this.get('common_query');
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
const sep = (typeof separator !== 'undefined') ? separator : '?';
|
||||
let common = this.get('common_query');
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
if (typeof common === 'string' && common.length > 0) {
|
||||
// If the last char is the separator, do not add it
|
||||
// Else add it
|
||||
|
||||
@ -18,8 +18,8 @@ const defaultValues: object = {};
|
||||
* @return {string}
|
||||
*/
|
||||
function getFieldType (field) {
|
||||
var $field = $(field);
|
||||
var tagName = $field.prop('tagName');
|
||||
const $field = $(field);
|
||||
const tagName = $field.prop('tagName');
|
||||
if (tagName === 'INPUT') {
|
||||
return $field.attr('type');
|
||||
} else if (tagName === 'SELECT') {
|
||||
@ -38,7 +38,7 @@ function getFieldType (field) {
|
||||
* @param {boolean} display
|
||||
*/
|
||||
function setRestoreDefaultBtn (field, display): void {
|
||||
var $el = $(field).closest('td').find('.restore-default img');
|
||||
const $el = $(field).closest('td').find('.restore-default img');
|
||||
$el[display ? 'show' : 'hide']();
|
||||
}
|
||||
|
||||
@ -48,12 +48,12 @@ function setRestoreDefaultBtn (field, display): void {
|
||||
* @param {Element | JQuery<Element>} field
|
||||
*/
|
||||
function markField (field): void {
|
||||
var $field = $(field);
|
||||
var type = getFieldType($field);
|
||||
var isDefault = checkFieldDefault($field, type);
|
||||
const $field = $(field);
|
||||
const type = getFieldType($field);
|
||||
const isDefault = checkFieldDefault($field, type);
|
||||
|
||||
// checkboxes uses parent <span> for marking
|
||||
var $fieldMarker = (type === 'checkbox') ? $field.parent() : $field;
|
||||
const $fieldMarker = (type === 'checkbox') ? $field.parent() : $field;
|
||||
setRestoreDefaultBtn($field, ! isDefault);
|
||||
$fieldMarker[isDefault ? 'removeClass' : 'addClass']('custom');
|
||||
}
|
||||
@ -72,7 +72,11 @@ function markField (field): void {
|
||||
* @param {string | boolean} value
|
||||
*/
|
||||
function setFieldValue (field, fieldType, value) {
|
||||
var $field = $(field);
|
||||
const $field = $(field);
|
||||
let options;
|
||||
let imax;
|
||||
let i = 0;
|
||||
|
||||
switch (fieldType) {
|
||||
case 'text':
|
||||
case 'number':
|
||||
@ -82,9 +86,8 @@ function setFieldValue (field, fieldType, value) {
|
||||
$field.prop('checked', value);
|
||||
break;
|
||||
case 'select':
|
||||
var options = $field.prop('options');
|
||||
var i;
|
||||
var imax = options.length;
|
||||
options = $field.prop('options');
|
||||
imax = options.length;
|
||||
for (i = 0; i < imax; i++) {
|
||||
options[i].selected = (value.indexOf(options[i].value) !== -1);
|
||||
}
|
||||
@ -109,7 +112,12 @@ function setFieldValue (field, fieldType, value) {
|
||||
* @return {boolean | string | string[] | null}
|
||||
*/
|
||||
function getFieldValue (field, fieldType) {
|
||||
var $field = $(field);
|
||||
const $field = $(field);
|
||||
let options;
|
||||
let imax;
|
||||
let items;
|
||||
let i = 0;
|
||||
|
||||
switch (fieldType) {
|
||||
case 'text':
|
||||
case 'number':
|
||||
@ -117,10 +125,9 @@ function getFieldValue (field, fieldType) {
|
||||
case 'checkbox':
|
||||
return $field.prop('checked');
|
||||
case 'select':
|
||||
var options = $field.prop('options');
|
||||
var i;
|
||||
var imax = options.length;
|
||||
var items = [];
|
||||
options = $field.prop('options');
|
||||
imax = options.length;
|
||||
items = [];
|
||||
for (i = 0; i < imax; i++) {
|
||||
if (options[i].selected) {
|
||||
items.push(options[i].value);
|
||||
@ -139,11 +146,11 @@ function getFieldValue (field, fieldType) {
|
||||
* @return {object}
|
||||
*/
|
||||
function getAllValues () {
|
||||
var $elements = $('fieldset input, fieldset select, fieldset textarea') as JQuery<HTMLInputElement>;
|
||||
var values = {};
|
||||
var type;
|
||||
var value;
|
||||
for (var i = 0; i < $elements.length; i++) {
|
||||
const $elements = $('fieldset input, fieldset select, fieldset textarea') as JQuery<HTMLInputElement>;
|
||||
const values = {};
|
||||
let type;
|
||||
let value;
|
||||
for (let i = 0; i < $elements.length; i++) {
|
||||
type = getFieldType($elements[i]);
|
||||
value = getFieldValue($elements[i], type);
|
||||
if (typeof value !== 'undefined') {
|
||||
@ -168,14 +175,14 @@ function getAllValues () {
|
||||
* @return {boolean}
|
||||
*/
|
||||
function checkFieldDefault (field, type) {
|
||||
var $field = $(field);
|
||||
var fieldId = $field.attr('id');
|
||||
const $field = $(field);
|
||||
const fieldId = $field.attr('id');
|
||||
if (typeof defaultValues[fieldId] === 'undefined') {
|
||||
return true;
|
||||
}
|
||||
|
||||
var isDefault = true;
|
||||
var currentValue = getFieldValue($field, type);
|
||||
let isDefault = true;
|
||||
const currentValue = getFieldValue($field, type);
|
||||
if (type !== 'select') {
|
||||
isDefault = currentValue === defaultValues[fieldId];
|
||||
} else {
|
||||
@ -183,7 +190,7 @@ function checkFieldDefault (field, type) {
|
||||
if (currentValue.length !== defaultValues[fieldId].length) {
|
||||
isDefault = false;
|
||||
} else {
|
||||
for (var i = 0; i < currentValue.length; i++) {
|
||||
for (let i = 0; i < currentValue.length; i++) {
|
||||
if (currentValue[i] !== defaultValues[fieldId][i]) {
|
||||
isDefault = false;
|
||||
break;
|
||||
@ -230,7 +237,7 @@ const validators = {
|
||||
return true;
|
||||
}
|
||||
|
||||
var result = this.value !== '0' && window.validators.regExpNumeric.test(this.value);
|
||||
const result = this.value !== '0' && window.validators.regExpNumeric.test(this.value);
|
||||
|
||||
return result ? true : window.Messages.configErrorInvalidPositiveNumber;
|
||||
},
|
||||
@ -246,7 +253,7 @@ const validators = {
|
||||
return true;
|
||||
}
|
||||
|
||||
var result = window.validators.regExpNumeric.test(this.value);
|
||||
const result = window.validators.regExpNumeric.test(this.value);
|
||||
|
||||
return result ? true : window.Messages.configErrorInvalidNonNegativeNumber;
|
||||
},
|
||||
@ -260,7 +267,7 @@ const validators = {
|
||||
return true;
|
||||
}
|
||||
|
||||
var result = window.validators.regExpNumeric.test(this.value) && this.value !== '0';
|
||||
const result = window.validators.regExpNumeric.test(this.value) && this.value !== '0';
|
||||
|
||||
return result && this.value <= 65535 ? true : window.Messages.configErrorInvalidPortNumber;
|
||||
},
|
||||
@ -278,8 +285,8 @@ const validators = {
|
||||
}
|
||||
|
||||
// convert PCRE regexp
|
||||
var parts = regexp.match(window.validators.regExpPcreExtract);
|
||||
var valid = this.value.match(new RegExp(parts[2], parts[3])) !== null;
|
||||
const parts = regexp.match(window.validators.regExpPcreExtract);
|
||||
const valid = this.value.match(new RegExp(parts[2], parts[3])) !== null;
|
||||
|
||||
return valid ? true : window.Messages.configErrorInvalidValue;
|
||||
},
|
||||
@ -292,7 +299,7 @@ const validators = {
|
||||
* @return {true|string}
|
||||
*/
|
||||
validateUpperBound: function (isKeyUp, maxValue) {
|
||||
var val = parseInt(this.value, 10);
|
||||
const val = parseInt(this.value, 10);
|
||||
if (isNaN(val)) {
|
||||
return true;
|
||||
}
|
||||
@ -337,16 +344,18 @@ function registerFieldValidator (id, type, onKeyUp, params = undefined) {
|
||||
*/
|
||||
function getFieldValidators (fieldId, onKeyUpOnly) {
|
||||
// look for field bound validator
|
||||
var name = fieldId && fieldId.match(/[^-]+$/)[0];
|
||||
const name = fieldId && fieldId.match(/[^-]+$/)[0];
|
||||
if (typeof window.validators.field[name] !== 'undefined') {
|
||||
return [[window.validators.field[name], null]];
|
||||
}
|
||||
|
||||
// look for registered validators
|
||||
var functions = [];
|
||||
const functions = [];
|
||||
if (typeof validate[fieldId] !== 'undefined') {
|
||||
// validate[field_id]: array of [type, params, onKeyUp]
|
||||
for (var i = 0, imax = validate[fieldId].length; i < imax; i++) {
|
||||
let i = 0;
|
||||
const imax = validate[fieldId].length;
|
||||
for (; i < imax; i++) {
|
||||
if (onKeyUpOnly && ! validate[fieldId][i][2]) {
|
||||
continue;
|
||||
}
|
||||
@ -367,15 +376,15 @@ function getFieldValidators (fieldId, onKeyUpOnly) {
|
||||
* @param {object} errorList list of errors in the form {field id: error array}
|
||||
*/
|
||||
function displayErrors (errorList) {
|
||||
var tempIsEmpty = function (item) {
|
||||
const tempIsEmpty = function (item) {
|
||||
return item !== '';
|
||||
};
|
||||
|
||||
for (var fieldId in errorList) {
|
||||
var errors = errorList[fieldId];
|
||||
var $field = $('#' + fieldId);
|
||||
var isFieldset = $field.attr('tagName') === 'FIELDSET';
|
||||
var $errorCnt;
|
||||
for (let fieldId in errorList) {
|
||||
let errors = errorList[fieldId];
|
||||
const $field = $('#' + fieldId);
|
||||
const isFieldset = $field.attr('tagName') === 'FIELDSET';
|
||||
let $errorCnt;
|
||||
if (isFieldset) {
|
||||
$errorCnt = $field.find('dl.errors');
|
||||
} else {
|
||||
@ -388,7 +397,7 @@ function displayErrors (errorList) {
|
||||
// CSS error class
|
||||
if (! isFieldset) {
|
||||
// checkboxes uses parent <span> for marking
|
||||
var $fieldMarker = ($field.attr('type') === 'checkbox') ? $field.parent() : $field;
|
||||
const $fieldMarker = ($field.attr('type') === 'checkbox') ? $field.parent() : $field;
|
||||
$fieldMarker[errors.length ? 'addClass' : 'removeClass']('field-error');
|
||||
}
|
||||
|
||||
@ -404,8 +413,10 @@ function displayErrors (errorList) {
|
||||
}
|
||||
}
|
||||
|
||||
var html = '';
|
||||
for (var i = 0, imax = errors.length; i < imax; i++) {
|
||||
let html = '';
|
||||
let i = 0;
|
||||
const imax = errors.length;
|
||||
for (; i < imax; i++) {
|
||||
html += '<dd>' + errors[i] + '</dd>';
|
||||
}
|
||||
|
||||
@ -421,10 +432,10 @@ function displayErrors (errorList) {
|
||||
* Validates fields and fieldsets and call displayError function as required
|
||||
*/
|
||||
function setDisplayError () {
|
||||
var elements = $('.optbox input[id], .optbox select[id], .optbox textarea[id]');
|
||||
const elements = $('.optbox input[id], .optbox select[id], .optbox textarea[id]');
|
||||
// run all field validators
|
||||
var errors = {};
|
||||
for (var i = 0; i < elements.length; i++) {
|
||||
const errors = {};
|
||||
for (let i = 0; i < elements.length; i++) {
|
||||
validateField(elements[i], false, errors);
|
||||
}
|
||||
|
||||
@ -444,10 +455,10 @@ function setDisplayError () {
|
||||
* @param {object} errors
|
||||
*/
|
||||
function validateFieldset (fieldset, isKeyUp, errors) {
|
||||
var $fieldset = $(fieldset);
|
||||
const $fieldset = $(fieldset);
|
||||
if ($fieldset.length && typeof window.validators.fieldset[$fieldset.attr('id')] !== 'undefined') {
|
||||
var fieldsetErrors = window.validators.fieldset[$fieldset.attr('id')].apply($fieldset[0], [isKeyUp]);
|
||||
for (var fieldId in fieldsetErrors) {
|
||||
const fieldsetErrors = window.validators.fieldset[$fieldset.attr('id')].apply($fieldset[0], [isKeyUp]);
|
||||
for (let fieldId in fieldsetErrors) {
|
||||
if (typeof errors[fieldId] === 'undefined') {
|
||||
errors[fieldId] = [];
|
||||
}
|
||||
@ -469,13 +480,13 @@ function validateFieldset (fieldset, isKeyUp, errors) {
|
||||
* @param {object} errors
|
||||
*/
|
||||
function validateField (field, isKeyUp, errors) {
|
||||
var args;
|
||||
var result;
|
||||
var $field = $(field);
|
||||
var fieldId = $field.attr('id');
|
||||
let args;
|
||||
let result;
|
||||
const $field = $(field);
|
||||
const fieldId = $field.attr('id');
|
||||
errors[fieldId] = [];
|
||||
var functions = getFieldValidators(fieldId, isKeyUp);
|
||||
for (var i = 0; i < functions.length; i++) {
|
||||
const functions = getFieldValidators(fieldId, isKeyUp);
|
||||
for (let i = 0; i < functions.length; i++) {
|
||||
if (typeof functions[i][1] !== 'undefined' && functions[i][1] !== null) {
|
||||
args = functions[i][1].slice(0);
|
||||
} else {
|
||||
@ -501,8 +512,8 @@ function validateField (field, isKeyUp, errors) {
|
||||
* @param {boolean} isKeyUp
|
||||
*/
|
||||
function validateFieldAndFieldset (field, isKeyUp) {
|
||||
var $field = $(field);
|
||||
var errors = {};
|
||||
const $field = $(field);
|
||||
const errors = {};
|
||||
validateField($field, isKeyUp, errors);
|
||||
validateFieldset($field.closest('fieldset.optbox'), isKeyUp, errors);
|
||||
Config.displayErrors(errors);
|
||||
@ -513,7 +524,7 @@ function loadInlineConfig () {
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < configInlineParams.length; ++i) {
|
||||
for (let i = 0; i < configInlineParams.length; ++i) {
|
||||
if (typeof configInlineParams[i] === 'function') {
|
||||
configInlineParams[i]();
|
||||
}
|
||||
@ -551,16 +562,16 @@ function setupValidation () {
|
||||
}
|
||||
|
||||
// register validators and mark custom values
|
||||
var $elements = $('.optbox input[id], .optbox select[id], .optbox textarea[id]');
|
||||
const $elements = $('.optbox input[id], .optbox select[id], .optbox textarea[id]');
|
||||
$elements.each(function () {
|
||||
markField(this);
|
||||
var $el = $(this);
|
||||
const $el = $(this);
|
||||
$el.on('change', function () {
|
||||
validateFieldAndFieldset(this, false);
|
||||
markField(this);
|
||||
});
|
||||
|
||||
var tagName = $el.attr('tagName');
|
||||
const tagName = $el.attr('tagName');
|
||||
// text fields can be validated after each change
|
||||
if (tagName === 'INPUT' && $el.attr('type') === 'text') {
|
||||
$el.on('keyup', function () {
|
||||
@ -577,11 +588,11 @@ function setupValidation () {
|
||||
|
||||
// check whether we've refreshed a page and browser remembered modified
|
||||
// form values
|
||||
var $checkPageRefresh = $('#check_page_refresh');
|
||||
const $checkPageRefresh = $('#check_page_refresh');
|
||||
if ($checkPageRefresh.length === 0 || $checkPageRefresh.val() === '1') {
|
||||
// run all field validators
|
||||
var errors = {};
|
||||
for (var i = 0; i < $elements.length; i++) {
|
||||
const errors = {};
|
||||
for (let i = 0; i < $elements.length; i++) {
|
||||
validateField($elements[i], false, errors);
|
||||
}
|
||||
|
||||
@ -601,9 +612,9 @@ function setupValidation () {
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
function adjustPrefsNotification () {
|
||||
var $prefsAutoLoad = $('#prefs_autoload');
|
||||
var $tableNameControl = $('#table_name_col_no');
|
||||
var $prefsAutoShowing = ($prefsAutoLoad.css('display') !== 'none');
|
||||
const $prefsAutoLoad = $('#prefs_autoload');
|
||||
const $tableNameControl = $('#table_name_col_no');
|
||||
const $prefsAutoShowing = ($prefsAutoLoad.css('display') !== 'none');
|
||||
|
||||
if ($prefsAutoShowing && $tableNameControl.length) {
|
||||
$tableNameControl.css('top', '55px');
|
||||
@ -620,7 +631,7 @@ function adjustPrefsNotification () {
|
||||
* @param {string} fieldId
|
||||
*/
|
||||
function restoreField (fieldId): void {
|
||||
var $field = $('#' + fieldId);
|
||||
const $field = $('#' + fieldId);
|
||||
if ($field.length === 0 || defaultValues[fieldId] === undefined) {
|
||||
return;
|
||||
}
|
||||
@ -638,14 +649,14 @@ function setupRestoreField () {
|
||||
})
|
||||
.on('click', '.restore-default, .set-value', function (e) {
|
||||
e.preventDefault();
|
||||
var href = $(this).attr('href');
|
||||
var fieldSel;
|
||||
const href = $(this).attr('href');
|
||||
let fieldSel;
|
||||
if ($(this).hasClass('restore-default')) {
|
||||
fieldSel = href;
|
||||
restoreField(fieldSel.substring(1));
|
||||
} else {
|
||||
fieldSel = href.match(/^[^=]+/)[0];
|
||||
var value = href.match(/=(.+)$/)[1];
|
||||
const value = href.match(/=(.+)$/)[1];
|
||||
setFieldValue($(fieldSel), 'text', value);
|
||||
}
|
||||
|
||||
@ -666,8 +677,8 @@ function setupRestoreField () {
|
||||
* @param {Element} form
|
||||
*/
|
||||
function savePrefsToLocalStorage (form) {
|
||||
var $form = $(form);
|
||||
var submit = $form.find('input[type=submit]');
|
||||
const $form = $(form);
|
||||
const submit = $form.find('input[type=submit]');
|
||||
submit.prop('disabled', true);
|
||||
$.ajax({
|
||||
url: 'index.php?route=/preferences/manage',
|
||||
@ -686,7 +697,7 @@ function savePrefsToLocalStorage (form) {
|
||||
updatePrefsDate();
|
||||
$('div.localStorage-empty').hide();
|
||||
$('div.localStorage-exists').show();
|
||||
var group = $form.parent('.card-body');
|
||||
const group = $form.parent('.card-body');
|
||||
group.css('height', group.height() + 'px');
|
||||
$form.hide('fast');
|
||||
$form.prev('.click-hide-message').show('fast');
|
||||
@ -704,8 +715,8 @@ function savePrefsToLocalStorage (form) {
|
||||
* Updates preferences timestamp in Import form
|
||||
*/
|
||||
function updatePrefsDate () {
|
||||
var d = new Date(window.localStorage.configMtimeLocal);
|
||||
var msg = window.Messages.strSavedOn.replace('@DATE@', formatDateTime(d));
|
||||
const d = new Date(window.localStorage.configMtimeLocal);
|
||||
const msg = window.Messages.strSavedOn.replace('@DATE@', formatDateTime(d));
|
||||
$('#opts_import_local_storage').find('div.localStorage-exists').html(msg);
|
||||
}
|
||||
|
||||
@ -713,15 +724,15 @@ function updatePrefsDate () {
|
||||
* Prepares message which informs that localStorage preferences are available and can be imported or deleted
|
||||
*/
|
||||
function offerPrefsAutoimport () {
|
||||
var hasConfig = (isStorageSupported('localStorage')) && (window.localStorage.config || false);
|
||||
var $cnt = $('#prefs_autoload');
|
||||
const hasConfig = (isStorageSupported('localStorage')) && (window.localStorage.config || false);
|
||||
const $cnt = $('#prefs_autoload');
|
||||
if (! $cnt.length || ! hasConfig) {
|
||||
return;
|
||||
}
|
||||
|
||||
$cnt.find('a').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
var $a = $(this);
|
||||
const $a = $(this);
|
||||
if ($a.attr('href') === '#no') {
|
||||
$cnt.remove();
|
||||
$.post('index.php', {
|
||||
@ -768,7 +779,7 @@ function off () {
|
||||
*/
|
||||
function on () {
|
||||
return function () {
|
||||
var $topmenuUpt = $('#user_prefs_tabs');
|
||||
const $topmenuUpt = $('#user_prefs_tabs');
|
||||
$topmenuUpt.find('a.active').attr('rel', 'samepage');
|
||||
$topmenuUpt.find('a:not(.active)').attr('rel', 'newpage');
|
||||
|
||||
@ -776,8 +787,10 @@ function on () {
|
||||
adjustPrefsNotification();
|
||||
|
||||
$('.optbox input[type=button][name=submit_reset]').on('click', function () {
|
||||
var fields = $(this).closest('fieldset').find('input, select, textarea');
|
||||
for (var i = 0, imax = fields.length; i < imax; i++) {
|
||||
const fields = $(this).closest('fieldset').find('input, select, textarea');
|
||||
let i = 0;
|
||||
const imax = fields.length;
|
||||
for (; i < imax; i++) {
|
||||
setFieldValue(fields[i], getFieldType(fields[i]), defaultValues[fields[i].id]);
|
||||
}
|
||||
|
||||
@ -787,7 +800,7 @@ function on () {
|
||||
Config.setupRestoreField();
|
||||
|
||||
offerPrefsAutoimport();
|
||||
var $radios = $('#import_local_storage, #export_local_storage');
|
||||
const $radios = $('#import_local_storage, #export_local_storage');
|
||||
if (! $radios.length) {
|
||||
return;
|
||||
}
|
||||
@ -797,8 +810,8 @@ function on () {
|
||||
.prop('disabled', false)
|
||||
.add('#export_text_file, #import_text_file')
|
||||
.on('click', function () {
|
||||
var enableId = $(this).attr('id');
|
||||
var disableId;
|
||||
const enableId = $(this).attr('id');
|
||||
let disableId;
|
||||
if (enableId.match(/local_storage$/)) {
|
||||
disableId = enableId.replace(/local_storage$/, 'text_file');
|
||||
} else {
|
||||
@ -810,8 +823,8 @@ function on () {
|
||||
});
|
||||
|
||||
// detect localStorage state
|
||||
var lsSupported = isStorageSupported('localStorage', true);
|
||||
var lsExists = lsSupported ? (window.localStorage.config || false) : false;
|
||||
const lsSupported = isStorageSupported('localStorage', true);
|
||||
const lsExists = lsSupported ? (window.localStorage.config || false) : false;
|
||||
$('div.localStorage-' + (lsSupported ? 'un' : '') + 'supported').hide();
|
||||
$('div.localStorage-' + (lsExists ? 'empty' : 'exists')).hide();
|
||||
if (lsExists) {
|
||||
@ -819,8 +832,8 @@ function on () {
|
||||
}
|
||||
|
||||
$('form.prefs-form').on('change', function () {
|
||||
var $form = $(this);
|
||||
var disabled = false;
|
||||
const $form = $(this);
|
||||
let disabled = false;
|
||||
if (! lsSupported) {
|
||||
disabled = $form.find('input[type=radio][value$=local_storage]').prop('checked');
|
||||
} else if (! lsExists && $form.attr('name') === 'prefs_import' &&
|
||||
@ -831,7 +844,7 @@ function on () {
|
||||
|
||||
$form.find('input[type=submit]').prop('disabled', disabled);
|
||||
}).on('submit', function (e) {
|
||||
var $form = $(this);
|
||||
const $form = $(this);
|
||||
if ($form.attr('name') === 'prefs_export' && ($('#export_local_storage') as JQuery<HTMLInputElement>)[0].checked) {
|
||||
e.preventDefault();
|
||||
// use AJAX to read JSON settings and save them
|
||||
|
||||
@ -12,7 +12,7 @@ let config: Config;
|
||||
/**
|
||||
* Console object
|
||||
*/
|
||||
var Console = {
|
||||
const Console = {
|
||||
/**
|
||||
* @var {JQuery}, jQuery object, selector is '#pma_console>.content'
|
||||
* @access private
|
||||
@ -89,7 +89,7 @@ var Console = {
|
||||
'<input name="db" value="">' +
|
||||
'<input name="table" value="">' +
|
||||
'<input name="token" value="">' +
|
||||
'</form>'
|
||||
'</form>',
|
||||
);
|
||||
|
||||
Console.$requestForm.children('[name=token]').val(CommonParams.get('token'));
|
||||
@ -219,7 +219,7 @@ var Console = {
|
||||
}
|
||||
|
||||
try {
|
||||
var data = JSON.parse(xhr.responseText);
|
||||
const data = JSON.parse(xhr.responseText);
|
||||
Console.ajaxCallback(data);
|
||||
} catch (e) {
|
||||
// eslint-disable-next-line no-console, compat/compat
|
||||
@ -309,7 +309,7 @@ var Console = {
|
||||
*/
|
||||
collapse: function (): void {
|
||||
config.setMode('collapse');
|
||||
var pmaConsoleHeight = Math.max(92, config.height);
|
||||
const pmaConsoleHeight = Math.max(92, config.height);
|
||||
|
||||
Console.$consoleToolbar.addClass('collapsed');
|
||||
Console.$consoleAllContents.height(pmaConsoleHeight);
|
||||
@ -325,7 +325,7 @@ var Console = {
|
||||
show: function (inputFocus = undefined): void {
|
||||
config.setMode('show');
|
||||
|
||||
var pmaConsoleHeight = Math.max(92, config.height);
|
||||
let pmaConsoleHeight = Math.max(92, config.height);
|
||||
// eslint-disable-next-line compat/compat
|
||||
pmaConsoleHeight = Math.min(config.height, (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight) - 25);
|
||||
Console.$consoleContent.css({ display: 'block' });
|
||||
@ -372,7 +372,7 @@ var Console = {
|
||||
* this param also can be JQuery object, if you need.
|
||||
*/
|
||||
showCard: function (cardSelector): void {
|
||||
var $card = null;
|
||||
let $card = null;
|
||||
if (typeof (cardSelector) !== 'string') {
|
||||
if (cardSelector.length > 0) {
|
||||
$card = cardSelector;
|
||||
@ -410,10 +410,10 @@ var Console = {
|
||||
}
|
||||
},
|
||||
isSelect: function (queryString) {
|
||||
var regExp = /^SELECT\s+/i;
|
||||
const regExp = /^SELECT\s+/i;
|
||||
|
||||
return regExp.test(queryString);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@ -421,7 +421,7 @@ var Console = {
|
||||
* Careful: this object UI logics highly related with functions under Console
|
||||
* Resizing min-height is 32, if small than it, console will collapse
|
||||
*/
|
||||
var ConsoleResizer = {
|
||||
const ConsoleResizer = {
|
||||
posY: 0,
|
||||
height: 0,
|
||||
resultHeight: 0,
|
||||
@ -492,7 +492,7 @@ var ConsoleResizer = {
|
||||
/**
|
||||
* Console input object
|
||||
*/
|
||||
var ConsoleInput = {
|
||||
const ConsoleInput = {
|
||||
/**
|
||||
* @var array, contains Codemirror objects or input jQuery objects
|
||||
* @access private
|
||||
@ -589,17 +589,17 @@ var ConsoleInput = {
|
||||
*/
|
||||
historyNavigate: function (event) {
|
||||
if (event.keyCode === 38 || event.keyCode === 40) {
|
||||
var upPermitted = false;
|
||||
var downPermitted = false;
|
||||
var editor = ConsoleInput.inputs.console;
|
||||
var cursorLine;
|
||||
var totalLine;
|
||||
let upPermitted = false;
|
||||
let downPermitted = false;
|
||||
const editor = ConsoleInput.inputs.console;
|
||||
let cursorLine;
|
||||
let totalLine;
|
||||
if (ConsoleInput.codeMirror) {
|
||||
cursorLine = editor.getCursor().line;
|
||||
totalLine = editor.lineCount();
|
||||
} else {
|
||||
// Get cursor position from textarea
|
||||
var text = ConsoleInput.getText();
|
||||
const text = ConsoleInput.getText();
|
||||
cursorLine = text.substring(0, editor.prop('selectionStart')).split('\n').length - 1;
|
||||
totalLine = text.split(/\r*\n/).length;
|
||||
}
|
||||
@ -612,8 +612,8 @@ var ConsoleInput = {
|
||||
downPermitted = true;
|
||||
}
|
||||
|
||||
var nextCount;
|
||||
var queryString: string | boolean = false;
|
||||
let nextCount;
|
||||
let queryString: string | boolean = false;
|
||||
if (upPermitted && event.keyCode === 38) {
|
||||
// Navigate up in history
|
||||
if (ConsoleInput.historyCount === 0) {
|
||||
@ -768,7 +768,7 @@ var ConsoleInput = {
|
||||
/**
|
||||
* Console messages, and message items management object
|
||||
*/
|
||||
var ConsoleMessages = {
|
||||
const ConsoleMessages = {
|
||||
/**
|
||||
* Used for clear the messages
|
||||
*/
|
||||
@ -790,9 +790,9 @@ var ConsoleMessages = {
|
||||
* @return {string | false} message
|
||||
*/
|
||||
getHistory: function (nthLast) {
|
||||
var $queries = $('#pma_console').find('.content .console_message_container .query');
|
||||
var length = $queries.length;
|
||||
var $query = $queries.eq(length - nthLast);
|
||||
const $queries = $('#pma_console').find('.content .console_message_container .query');
|
||||
const length = $queries.length;
|
||||
const $query = $queries.eq(length - nthLast);
|
||||
if (! $query || (length - nthLast) < 0) {
|
||||
return false;
|
||||
} else {
|
||||
@ -806,8 +806,8 @@ var ConsoleMessages = {
|
||||
* @param {boolean} enterExecutes Only Enter has to be pressed to execute query.
|
||||
*/
|
||||
showInstructions: function (enterExecutes): void {
|
||||
var enter = +enterExecutes || 0; // conversion to int
|
||||
var $welcomeMsg = $('#pma_console').find('.content .console_message_container .message.welcome span');
|
||||
const enter = +enterExecutes || 0; // conversion to int
|
||||
const $welcomeMsg = $('#pma_console').find('.content .console_message_container .message.welcome span');
|
||||
$welcomeMsg.children('[id^=instructions]').hide();
|
||||
$welcomeMsg.children('#instructions-' + enter).show();
|
||||
},
|
||||
@ -824,9 +824,9 @@ var ConsoleMessages = {
|
||||
}
|
||||
|
||||
// Generate an ID for each message, we can find them later
|
||||
var msgId = Math.round(Math.random() * (899999999999) + 100000000000);
|
||||
var now = new Date();
|
||||
var $newMessage =
|
||||
const msgId = Math.round(Math.random() * (899999999999) + 100000000000);
|
||||
const now = new Date();
|
||||
const $newMessage =
|
||||
$('<div class="message ' +
|
||||
(config.alwaysExpand ? 'expanded' : 'collapsed') +
|
||||
'" msgid="' + msgId + '"><div class="action_content"></div></div>');
|
||||
@ -869,7 +869,7 @@ var ConsoleMessages = {
|
||||
* @return {object}, {message_id: string message id, $message: JQuery object}
|
||||
*/
|
||||
appendQuery: function (queryData, state = undefined) {
|
||||
var targetMessage = ConsoleMessages.append(queryData.sql_query, 'query');
|
||||
const targetMessage = ConsoleMessages.append(queryData.sql_query, 'query');
|
||||
if (! targetMessage) {
|
||||
return false;
|
||||
}
|
||||
@ -900,7 +900,7 @@ var ConsoleMessages = {
|
||||
},
|
||||
messageEventBinds: function ($target) {
|
||||
// Leave unbinded elements, remove binded.
|
||||
var $targetMessage = $target.filter(':not(.binded)');
|
||||
const $targetMessage = $target.filter(':not(.binded)');
|
||||
if ($targetMessage.length === 0) {
|
||||
return;
|
||||
}
|
||||
@ -923,8 +923,8 @@ var ConsoleMessages = {
|
||||
});
|
||||
|
||||
$targetMessage.find('.action.requery').on('click', function () {
|
||||
var query = $(this).parent().siblings('.query').text();
|
||||
var $message = $(this).closest('.message');
|
||||
const query = $(this).parent().siblings('.query').text();
|
||||
const $message = $(this).closest('.message');
|
||||
if (confirm(window.Messages.strConsoleRequeryConfirm + '\n' +
|
||||
(query.length < 100 ? query : query.slice(0, 100) + '...'))
|
||||
) {
|
||||
@ -933,23 +933,23 @@ var ConsoleMessages = {
|
||||
});
|
||||
|
||||
$targetMessage.find('.action.bookmark').on('click', function () {
|
||||
var query = $(this).parent().siblings('.query').text();
|
||||
var $message = $(this).closest('.message');
|
||||
const query = $(this).parent().siblings('.query').text();
|
||||
const $message = $(this).closest('.message');
|
||||
ConsoleBookmarks.addBookmark(query, $message.attr('targetdb'));
|
||||
Console.showCard('#pma_bookmarks .card.add');
|
||||
});
|
||||
|
||||
$targetMessage.find('.action.edit_bookmark').on('click', function () {
|
||||
var query = $(this).parent().siblings('.query').text();
|
||||
var $message = $(this).closest('.message');
|
||||
var isShared = $message.find('span.bookmark_label').hasClass('shared');
|
||||
var label = $message.find('span.bookmark_label').text();
|
||||
const query = $(this).parent().siblings('.query').text();
|
||||
const $message = $(this).closest('.message');
|
||||
const isShared = $message.find('span.bookmark_label').hasClass('shared');
|
||||
const label = $message.find('span.bookmark_label').text();
|
||||
ConsoleBookmarks.addBookmark(query, $message.attr('targetdb'), label, isShared);
|
||||
Console.showCard('#pma_bookmarks .card.add');
|
||||
});
|
||||
|
||||
$targetMessage.find('.action.delete_bookmark').on('click', function () {
|
||||
var $message = $(this).closest('.message');
|
||||
const $message = $(this).closest('.message');
|
||||
if (confirm(window.Messages.strConsoleDeleteBookmarkConfirm + '\n' + $message.find('.bookmark_label').text())) {
|
||||
$.post('index.php?route=/import',
|
||||
{
|
||||
@ -965,7 +965,7 @@ var ConsoleMessages = {
|
||||
});
|
||||
|
||||
$targetMessage.find('.action.profiling').on('click', function () {
|
||||
var $message = $(this).closest('.message');
|
||||
const $message = $(this).closest('.message');
|
||||
Console.execute($(this).parent().siblings('.query').text(),
|
||||
{
|
||||
db: $message.attr('targetdb'),
|
||||
@ -975,7 +975,7 @@ var ConsoleMessages = {
|
||||
});
|
||||
|
||||
$targetMessage.find('.action.explain').on('click', function () {
|
||||
var $message = $(this).closest('.message');
|
||||
const $message = $(this).closest('.message');
|
||||
Console.execute('EXPLAIN ' + $(this).parent().siblings('.query').text(),
|
||||
{
|
||||
db: $message.attr('targetdb'),
|
||||
@ -984,7 +984,7 @@ var ConsoleMessages = {
|
||||
});
|
||||
|
||||
$targetMessage.find('.action.dbg_show_trace').on('click', function () {
|
||||
var $message = $(this).closest('.message');
|
||||
const $message = $(this).closest('.message');
|
||||
if (! $message.find('.trace').length) {
|
||||
ConsoleDebug.getQueryDetails(
|
||||
$message.data('queryInfo'),
|
||||
@ -1000,19 +1000,19 @@ var ConsoleMessages = {
|
||||
});
|
||||
|
||||
$targetMessage.find('.action.dbg_hide_trace').on('click', function () {
|
||||
var $message = $(this).closest('.message');
|
||||
const $message = $(this).closest('.message');
|
||||
$message.addClass('hide_trace');
|
||||
$message.removeClass('show_trace');
|
||||
});
|
||||
|
||||
$targetMessage.find('.action.dbg_show_args').on('click', function () {
|
||||
var $message = $(this).closest('.message');
|
||||
const $message = $(this).closest('.message');
|
||||
$message.addClass('show_args expanded');
|
||||
$message.removeClass('hide_args collapsed');
|
||||
});
|
||||
|
||||
$targetMessage.find('.action.dbg_hide_args').on('click', function () {
|
||||
var $message = $(this).closest('.message');
|
||||
const $message = $(this).closest('.message');
|
||||
$message.addClass('hide_args collapsed');
|
||||
$message.removeClass('show_args expanded');
|
||||
});
|
||||
@ -1028,7 +1028,7 @@ var ConsoleMessages = {
|
||||
}
|
||||
},
|
||||
msgAppend: function (msgId, msgString) {
|
||||
var $targetMessage = $('#pma_console').find('.content .console_message_container .message[msgid=' + msgId + ']');
|
||||
const $targetMessage = $('#pma_console').find('.content .console_message_container .message[msgid=' + msgId + ']');
|
||||
if ($targetMessage.length === 0 || isNaN(parseInt(msgId)) || typeof (msgString) !== 'string') {
|
||||
return false;
|
||||
}
|
||||
@ -1036,7 +1036,7 @@ var ConsoleMessages = {
|
||||
$targetMessage.append('<div>' + msgString + '</div>');
|
||||
},
|
||||
updateQuery: function (msgId, isSuccessed, queryData) {
|
||||
var $targetMessage = $('#pma_console').find('.console_message_container .message[msgid=' + parseInt(msgId) + ']');
|
||||
const $targetMessage = $('#pma_console').find('.console_message_container .message[msgid=' + parseInt(msgId) + ']');
|
||||
if ($targetMessage.length === 0 || isNaN(parseInt(msgId))) {
|
||||
return false;
|
||||
}
|
||||
@ -1082,7 +1082,7 @@ var ConsoleMessages = {
|
||||
/**
|
||||
* Console bookmarks card, and bookmarks items management object
|
||||
*/
|
||||
var ConsoleBookmarks = {
|
||||
const ConsoleBookmarks = {
|
||||
bookmarks: [],
|
||||
addBookmark: function (queryString, targetDb, label = undefined, isShared = undefined) {
|
||||
$('#pma_bookmarks').find('.add [name=shared]').prop('checked', false);
|
||||
@ -1168,7 +1168,7 @@ var ConsoleBookmarks = {
|
||||
}
|
||||
};
|
||||
|
||||
var ConsoleDebug = {
|
||||
const ConsoleDebug = {
|
||||
lastDebugInfo: {
|
||||
debugInfo: null,
|
||||
url: null
|
||||
@ -1190,8 +1190,8 @@ var ConsoleDebug = {
|
||||
}
|
||||
}
|
||||
|
||||
var orderBy = config.orderBy;
|
||||
var order = config.order;
|
||||
const orderBy = config.orderBy;
|
||||
const order = config.order;
|
||||
$('#debug_console').find('.button.order_by.sort_' + orderBy).addClass('active');
|
||||
$('#debug_console').find('.button.order.order_' + order).addClass('active');
|
||||
|
||||
@ -1217,7 +1217,7 @@ var ConsoleDebug = {
|
||||
});
|
||||
|
||||
$('#debug_console').find('.button.order_by').on('click', function () {
|
||||
var $this = $(this);
|
||||
const $this = $(this);
|
||||
$('#debug_console').find('.button.order_by').removeClass('active');
|
||||
$this.addClass('active');
|
||||
if ($this.hasClass('sort_time')) {
|
||||
@ -1232,7 +1232,7 @@ var ConsoleDebug = {
|
||||
});
|
||||
|
||||
$('#debug_console').find('.button.order').on('click', function () {
|
||||
var $this = $(this);
|
||||
const $this = $(this);
|
||||
$('#debug_console').find('.button.order').removeClass('active');
|
||||
$this.addClass('active');
|
||||
if ($this.hasClass('order_asc')) {
|
||||
@ -1253,7 +1253,7 @@ var ConsoleDebug = {
|
||||
ConsoleDebug.showLog(Console.debugSqlInfo);
|
||||
},
|
||||
formatFunctionCall: function (dbgStep) {
|
||||
var functionName = '';
|
||||
let functionName = '';
|
||||
if ('class' in dbgStep) {
|
||||
functionName += dbgStep.class;
|
||||
functionName += dbgStep.type;
|
||||
@ -1269,7 +1269,7 @@ var ConsoleDebug = {
|
||||
return functionName;
|
||||
},
|
||||
formatFunctionArgs: function (dbgStep) {
|
||||
var $args = $('<div>');
|
||||
const $args = $('<div>');
|
||||
if (dbgStep.args.length) {
|
||||
$args.append('<div class="message welcome">')
|
||||
.append(
|
||||
@ -1282,7 +1282,7 @@ var ConsoleDebug = {
|
||||
)
|
||||
);
|
||||
|
||||
for (var i = 0; i < dbgStep.args.length; i++) {
|
||||
for (let i = 0; i < dbgStep.args.length; i++) {
|
||||
$args.append(
|
||||
$('<div class="message">')
|
||||
.html(
|
||||
@ -1297,7 +1297,7 @@ var ConsoleDebug = {
|
||||
return $args;
|
||||
},
|
||||
formatFileName: function (dbgStep) {
|
||||
var fileName = '';
|
||||
let fileName = '';
|
||||
if ('file' in dbgStep) {
|
||||
fileName += dbgStep.file;
|
||||
fileName += '#' + dbgStep.line;
|
||||
@ -1306,14 +1306,14 @@ var ConsoleDebug = {
|
||||
return fileName;
|
||||
},
|
||||
formatBackTrace: function (dbgTrace) {
|
||||
var $traceElem = $('<div class="trace">');
|
||||
const $traceElem = $('<div class="trace">');
|
||||
$traceElem.append(
|
||||
$('<div class="message welcome">')
|
||||
);
|
||||
|
||||
var step;
|
||||
var $stepElem;
|
||||
for (var stepId in dbgTrace) {
|
||||
let step;
|
||||
let $stepElem;
|
||||
for (let stepId in dbgTrace) {
|
||||
if (dbgTrace.hasOwnProperty(stepId)) {
|
||||
step = dbgTrace[stepId];
|
||||
if (! Array.isArray(step) && typeof step !== 'object') {
|
||||
@ -1364,11 +1364,11 @@ var ConsoleDebug = {
|
||||
return $traceElem;
|
||||
},
|
||||
formatQueryOrGroup: function (queryInfo, totalTime) {
|
||||
var grouped;
|
||||
var queryText;
|
||||
var queryTime;
|
||||
var count;
|
||||
var i;
|
||||
let grouped;
|
||||
let queryText;
|
||||
let queryTime;
|
||||
let count;
|
||||
let i;
|
||||
if (Array.isArray(queryInfo)) {
|
||||
// It is grouped
|
||||
grouped = true;
|
||||
@ -1386,13 +1386,13 @@ var ConsoleDebug = {
|
||||
queryTime = queryInfo.time;
|
||||
}
|
||||
|
||||
var $query = $('<div class="message collapsed hide_trace">')
|
||||
const $query = $('<div class="message collapsed hide_trace">')
|
||||
.append(
|
||||
$('#debug_console').find('.templates .debug_query').clone()
|
||||
$('#debug_console').find('.templates .debug_query').clone(),
|
||||
)
|
||||
.append(
|
||||
$('<div class="query">')
|
||||
.text(queryText)
|
||||
.text(queryText),
|
||||
)
|
||||
.data('queryInfo', queryInfo)
|
||||
.data('totalTime', totalTime);
|
||||
@ -1419,8 +1419,8 @@ var ConsoleDebug = {
|
||||
},
|
||||
getQueryDetails: function (queryInfo, totalTime, $query) {
|
||||
if (Array.isArray(queryInfo)) {
|
||||
var $singleQuery;
|
||||
for (var i in queryInfo) {
|
||||
let $singleQuery;
|
||||
for (let i in queryInfo) {
|
||||
$singleQuery = $('<div class="message welcome trace">')
|
||||
.text((parseInt(i) + 1) + '.')
|
||||
.append(
|
||||
@ -1445,8 +1445,8 @@ var ConsoleDebug = {
|
||||
$('#debug_console').find('.debugLog').empty();
|
||||
$('#debug_console').find('.debug>.welcome').empty();
|
||||
|
||||
var debugJson: any = false;
|
||||
var i;
|
||||
let debugJson: any = false;
|
||||
let i;
|
||||
if (typeof debugInfo === 'object' && 'queries' in debugInfo) {
|
||||
// Copy it to debugJson, so that it doesn't get changed
|
||||
if (! ('queries' in debugInfo)) {
|
||||
@ -1477,13 +1477,13 @@ var ConsoleDebug = {
|
||||
return;
|
||||
}
|
||||
|
||||
var allQueries = debugJson.queries;
|
||||
var uniqueQueries = [];
|
||||
const allQueries = debugJson.queries;
|
||||
let uniqueQueries = [];
|
||||
|
||||
var totalExec = allQueries.length;
|
||||
const totalExec = allQueries.length;
|
||||
|
||||
// Calculate total time and make unique query array
|
||||
var totalTime = 0;
|
||||
let totalTime = 0;
|
||||
for (i = 0; i < totalExec; ++i) {
|
||||
totalTime += allQueries[i].time;
|
||||
if (! (allQueries[i].hash in uniqueQueries)) {
|
||||
@ -1494,9 +1494,9 @@ var ConsoleDebug = {
|
||||
}
|
||||
|
||||
// Count total unique queries, convert uniqueQueries to Array
|
||||
var totalUnique = 0;
|
||||
var uniqueArray = [];
|
||||
for (var hash in uniqueQueries) {
|
||||
let totalUnique = 0;
|
||||
const uniqueArray = [];
|
||||
for (let hash in uniqueQueries) {
|
||||
if (uniqueQueries.hasOwnProperty(hash)) {
|
||||
++totalUnique;
|
||||
uniqueArray.push(uniqueQueries[hash]);
|
||||
@ -1517,7 +1517,7 @@ var ConsoleDebug = {
|
||||
);
|
||||
|
||||
if (url) {
|
||||
var decodedUrl = new URLSearchParams(url.split('?')[1]);
|
||||
const decodedUrl = new URLSearchParams(url.split('?')[1]);
|
||||
$('#debug_console').find('.debug>.welcome').append(
|
||||
$('<span class="script_name">').text(decodedUrl.has('route') ? decodedUrl.get('route') : url)
|
||||
);
|
||||
@ -1525,12 +1525,12 @@ var ConsoleDebug = {
|
||||
|
||||
// For sorting queries
|
||||
function sortByTime (a, b) {
|
||||
var order = config.order === 'asc' ? 1 : -1;
|
||||
const order = config.order === 'asc' ? 1 : -1;
|
||||
if (Array.isArray(a) && Array.isArray(b)) {
|
||||
// It is grouped
|
||||
var timeA = 0;
|
||||
var timeB = 0;
|
||||
var i;
|
||||
let timeA = 0;
|
||||
let timeB = 0;
|
||||
let i;
|
||||
for (i in a) {
|
||||
timeA += a[i].time;
|
||||
}
|
||||
@ -1546,13 +1546,13 @@ var ConsoleDebug = {
|
||||
}
|
||||
|
||||
function sortByCount (a, b) {
|
||||
var order = config.order === 'asc' ? 1 : -1;
|
||||
const order = config.order === 'asc' ? 1 : -1;
|
||||
|
||||
return (a.length - b.length) * order;
|
||||
}
|
||||
|
||||
var orderBy = config.orderBy;
|
||||
var order = config.order;
|
||||
const orderBy = config.orderBy;
|
||||
const order = config.order;
|
||||
|
||||
if (config.groupQueries) {
|
||||
// Sort queries
|
||||
@ -1588,7 +1588,7 @@ var ConsoleDebug = {
|
||||
ConsoleMessages.messageEventBinds($('#debug_console').find('.message:not(.binded)'));
|
||||
},
|
||||
refresh: function () {
|
||||
var last = this.lastDebugInfo;
|
||||
const last = this.lastDebugInfo;
|
||||
ConsoleDebug.showLog(last.debugInfo, last.url);
|
||||
}
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,7 @@ import $ from 'jquery';
|
||||
* when truncating, creating, dropping or inserting into a table
|
||||
*/
|
||||
export default function adjustTotals () {
|
||||
var byteUnits = [
|
||||
const byteUnits = [
|
||||
window.Messages.strB,
|
||||
window.Messages.strKiB,
|
||||
window.Messages.strMiB,
|
||||
@ -17,20 +17,20 @@ export default function adjustTotals () {
|
||||
/**
|
||||
* @var $allTr jQuery object that references all the rows in the list of tables
|
||||
*/
|
||||
var $allTr = $('#tablesForm').find('table.data tbody').first().find('tr');
|
||||
const $allTr = $('#tablesForm').find('table.data tbody').first().find('tr');
|
||||
// New summary values for the table
|
||||
var tableSum = $allTr.length;
|
||||
var rowsSum = 0;
|
||||
var sizeSum = 0;
|
||||
var overheadSum = 0;
|
||||
var rowSumApproximated = false;
|
||||
const tableSum = $allTr.length;
|
||||
let rowsSum = 0;
|
||||
let sizeSum = 0;
|
||||
let overheadSum = 0;
|
||||
let rowSumApproximated = false;
|
||||
|
||||
$allTr.each(function () {
|
||||
var $this = $(this);
|
||||
var i;
|
||||
var tmpVal;
|
||||
const $this = $(this);
|
||||
let i;
|
||||
let tmpVal;
|
||||
// Get the number of rows for this SQL table
|
||||
var strRows = $this.find('.tbl_rows').text();
|
||||
let strRows = $this.find('.tbl_rows').text();
|
||||
// If the value is approximated
|
||||
if (strRows.indexOf('~') === 0) {
|
||||
rowSumApproximated = true;
|
||||
@ -39,18 +39,18 @@ export default function adjustTotals () {
|
||||
}
|
||||
|
||||
strRows = strRows.replace(/[,.\s]/g, '');
|
||||
var intRow = parseInt(strRows, 10);
|
||||
const intRow = parseInt(strRows, 10);
|
||||
if (!isNaN(intRow)) {
|
||||
rowsSum += intRow;
|
||||
}
|
||||
|
||||
// Extract the size and overhead
|
||||
var valSize = 0;
|
||||
var valOverhead = 0;
|
||||
var strSize = $this.find('.tbl_size span:not(.unit)').text().trim();
|
||||
var strSizeUnit = $this.find('.tbl_size span.unit').text().trim();
|
||||
var strOverhead = $this.find('.tbl_overhead span:not(.unit)').text().trim();
|
||||
var strOverheadUnit = $this.find('.tbl_overhead span.unit').text().trim();
|
||||
let valSize = 0;
|
||||
let valOverhead = 0;
|
||||
const strSize = $this.find('.tbl_size span:not(.unit)').text().trim();
|
||||
const strSizeUnit = $this.find('.tbl_size span.unit').text().trim();
|
||||
const strOverhead = $this.find('.tbl_overhead span:not(.unit)').text().trim();
|
||||
const strOverheadUnit = $this.find('.tbl_overhead span.unit').text().trim();
|
||||
// Given a value and a unit, such as 100 and KiB, for the table size
|
||||
// and overhead calculate their numeric values in bytes, such as 102400
|
||||
for (i = 0; i < byteUnits.length; i++) {
|
||||
@ -75,8 +75,8 @@ export default function adjustTotals () {
|
||||
|
||||
// Add some commas for readability:
|
||||
// 1000000 becomes 1,000,000
|
||||
var strRowSum = rowsSum + '';
|
||||
var regex = /(\d+)(\d{3})/;
|
||||
let strRowSum = rowsSum + '';
|
||||
const regex = /(\d+)(\d{3})/;
|
||||
while (regex.test(strRowSum)) {
|
||||
strRowSum = strRowSum.replace(regex, '$1' + ',' + '$2');
|
||||
}
|
||||
@ -87,8 +87,8 @@ export default function adjustTotals () {
|
||||
}
|
||||
|
||||
// Calculate the magnitude for the size and overhead values
|
||||
var sizeMagnitude = 0;
|
||||
var overheadMagnitude = 0;
|
||||
let sizeMagnitude = 0;
|
||||
let overheadMagnitude = 0;
|
||||
while (sizeSum >= 1024) {
|
||||
sizeSum /= 1024;
|
||||
sizeMagnitude++;
|
||||
@ -103,7 +103,7 @@ export default function adjustTotals () {
|
||||
overheadSum = Math.round(overheadSum * 10) / 10;
|
||||
|
||||
// Update summary with new data
|
||||
var $summary = $('#tbl_summary_row');
|
||||
const $summary = $('#tbl_summary_row');
|
||||
$summary.find('.tbl_num').text(window.sprintf(window.Messages.strNTables, tableSum));
|
||||
if (rowSumApproximated) {
|
||||
$summary.find('.row_count_sum').text(strRowSum);
|
||||
|
||||
@ -16,9 +16,9 @@ export default function checkNumberOfFields () {
|
||||
}
|
||||
|
||||
$('form').each(function () {
|
||||
var nbInputs = $(this).find(':input').length;
|
||||
const nbInputs = $(this).find(':input').length;
|
||||
if (nbInputs > window.maxInputVars) {
|
||||
var warning = window.sprintf(window.Messages.strTooManyInputs, window.maxInputVars);
|
||||
const warning = window.sprintf(window.Messages.strTooManyInputs, window.maxInputVars);
|
||||
ajaxShowMessage(warning);
|
||||
|
||||
return false;
|
||||
|
||||
@ -8,8 +8,8 @@ import $ from 'jquery';
|
||||
* @return {string}
|
||||
*/
|
||||
export default function formatDateTime (date, seconds = false) {
|
||||
var result = $.datepicker.formatDate('yy-mm-dd', date);
|
||||
var timefmt = 'HH:mm';
|
||||
const result = $.datepicker.formatDate('yy-mm-dd', date);
|
||||
let timefmt = 'HH:mm';
|
||||
if (seconds) {
|
||||
timefmt = 'HH:mm:ss';
|
||||
}
|
||||
|
||||
@ -16,10 +16,10 @@ import { escapeHtml } from './escape.ts';
|
||||
* tag to the given value
|
||||
*/
|
||||
export default function getImageTag (image, alternate = undefined, attributes = undefined) {
|
||||
var alt = alternate;
|
||||
var attr = attributes;
|
||||
let alt = alternate;
|
||||
let attr = attributes;
|
||||
// custom image object, it will eventually be returned by this functions
|
||||
var retval = {
|
||||
let retval = {
|
||||
data: {
|
||||
// this is private
|
||||
alt: '',
|
||||
@ -38,15 +38,15 @@ export default function getImageTag (image, alternate = undefined, attributes =
|
||||
}
|
||||
},
|
||||
toString: function () {
|
||||
var retval = '<' + 'img';
|
||||
for (var i in this.data) {
|
||||
let retval = '<' + 'img';
|
||||
for (let i in this.data) {
|
||||
retval += ' ' + i + '="' + this.data[i] + '"';
|
||||
}
|
||||
|
||||
retval += ' /' + '>';
|
||||
|
||||
return retval;
|
||||
}
|
||||
},
|
||||
};
|
||||
// initialise missing parameters
|
||||
if (attr === undefined) {
|
||||
@ -74,7 +74,7 @@ export default function getImageTag (image, alternate = undefined, attributes =
|
||||
// set css classes
|
||||
retval.attr('class', 'icon ic_' + image);
|
||||
// set all other attributes
|
||||
for (var i in attr) {
|
||||
for (let i in attr) {
|
||||
if (i === 'src') {
|
||||
// do not allow to override the 'src' attribute
|
||||
continue;
|
||||
|
||||
@ -7,9 +7,9 @@ import { CommonParams } from '../common.ts';
|
||||
* @return {string}
|
||||
*/
|
||||
export default function getJsConfirmCommonParam (elem, parameters) {
|
||||
var $elem = $(elem);
|
||||
var params = parameters;
|
||||
var sep = CommonParams.get('arg_separator');
|
||||
const $elem = $(elem);
|
||||
let params = parameters;
|
||||
const sep = CommonParams.get('arg_separator');
|
||||
if (params) {
|
||||
// Strip possible leading ?
|
||||
if (params.startsWith('?')) {
|
||||
|
||||
@ -9,9 +9,9 @@ import getJsConfirmCommonParam from './getJsConfirmCommonParam.ts';
|
||||
* @param {JQuery<HTMLElement>} $this
|
||||
*/
|
||||
export default function handleCreateViewModal ($this): void {
|
||||
var $msg = ajaxShowMessage();
|
||||
var sep = CommonParams.get('arg_separator');
|
||||
var params = getJsConfirmCommonParam(this, $this.getPostData());
|
||||
let $msg = ajaxShowMessage();
|
||||
const sep = CommonParams.get('arg_separator');
|
||||
let params = getJsConfirmCommonParam(this, $this.getPostData());
|
||||
params += sep + 'ajax_dialog=1';
|
||||
$.post($this.attr('href'), params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
|
||||
@ -9,7 +9,7 @@ import $ from 'jquery';
|
||||
*
|
||||
*/
|
||||
function ignorePhpErrors (clearPrevErrors = undefined) {
|
||||
var clearPrevious = clearPrevErrors;
|
||||
let clearPrevious = clearPrevErrors;
|
||||
if (typeof (clearPrevious) === 'undefined' ||
|
||||
clearPrevious === null
|
||||
) {
|
||||
@ -19,13 +19,13 @@ function ignorePhpErrors (clearPrevErrors = undefined) {
|
||||
// send AJAX request to /error-report with send_error_report=0, exception_type=php & token.
|
||||
// It clears the prev_errors stored in session.
|
||||
if (clearPrevious) {
|
||||
var $pmaReportErrorsForm = $('#pma_report_errors_form');
|
||||
const $pmaReportErrorsForm = $('#pma_report_errors_form');
|
||||
$pmaReportErrorsForm.find('input[name="send_error_report"]').val(0); // change send_error_report to '0'
|
||||
$pmaReportErrorsForm.trigger('submit');
|
||||
}
|
||||
|
||||
// remove displayed errors
|
||||
var $pmaErrors = $('#pma_errors');
|
||||
const $pmaErrors = $('#pma_errors');
|
||||
$pmaErrors.fadeOut('slow');
|
||||
$pmaErrors.remove();
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ import { CommonParams } from '../common.ts';
|
||||
* String to go to a different page, e.g: 'index.php'
|
||||
*/
|
||||
export default function refreshMainContent (url = undefined): void {
|
||||
var newUrl = url;
|
||||
let newUrl = url;
|
||||
if (! newUrl) {
|
||||
newUrl = $('#selflink').find('a').attr('href') || window.location.pathname;
|
||||
newUrl = newUrl.substring(0, newUrl.indexOf('?'));
|
||||
|
||||
@ -111,19 +111,19 @@ function setIndexFormParameters (sourceArray, indexChoice): void {
|
||||
*/
|
||||
function removeColumnFromIndex (colIndex): void {
|
||||
// Get previous index details.
|
||||
var previousIndex = $('select[name="field_key[' + colIndex + ']"]')
|
||||
const previousIndex = $('select[name="field_key[' + colIndex + ']"]')
|
||||
.attr('data-index');
|
||||
if (previousIndex.length) {
|
||||
const previousIndexes = previousIndex.split(',');
|
||||
var sourceArray = Indexes.getIndexArray(previousIndexes[0]);
|
||||
const sourceArray = Indexes.getIndexArray(previousIndexes[0]);
|
||||
if (sourceArray === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (previousIndex[1] in sourceArray) {
|
||||
// Remove column from index array.
|
||||
var sourceLength = sourceArray[previousIndexes[1]].columns.length;
|
||||
for (var i = 0; i < sourceLength; i++) {
|
||||
const sourceLength = sourceArray[previousIndexes[1]].columns.length;
|
||||
for (let i = 0; i < sourceLength; i++) {
|
||||
if (i in sourceArray[previousIndex[1]].columns) {
|
||||
if (sourceArray[previousIndexes[1]].columns[i].col_index === colIndex) {
|
||||
sourceArray[previousIndexes[1]].columns.splice(i, 1);
|
||||
@ -158,16 +158,16 @@ function addColumnToIndex (sourceArray, arrayIndex, indexChoice, colIndex): void
|
||||
Indexes.removeColumnFromIndex(colIndex);
|
||||
}
|
||||
|
||||
var indexName = ($('input[name="index[Key_name]"]').val() as string);
|
||||
var indexComment = $('input[name="index[Index_comment]"]').val();
|
||||
var keyBlockSize = $('input[name="index[Key_block_size]"]').val();
|
||||
var parser = $('input[name="index[Parser]"]').val();
|
||||
var indexType = $('select[name="index[Index_type]"]').val();
|
||||
var columns = [];
|
||||
const indexName = ($('input[name="index[Key_name]"]').val() as string);
|
||||
const indexComment = $('input[name="index[Index_comment]"]').val();
|
||||
const keyBlockSize = $('input[name="index[Key_block_size]"]').val();
|
||||
const parser = $('input[name="index[Parser]"]').val();
|
||||
const indexType = $('select[name="index[Index_type]"]').val();
|
||||
const columns = [];
|
||||
$('#index_columns').find('tbody').find('tr').each(function () {
|
||||
// Get columns in particular order.
|
||||
var colIndex = $(this).find('select[name="index[columns][names][]"]').val();
|
||||
var size = $(this).find('input[name="index[columns][sub_parts][]"]').val();
|
||||
const colIndex = $(this).find('select[name="index[columns][names][]"]').val();
|
||||
const size = $(this).find('input[name="index[columns][sub_parts][]"]').val();
|
||||
columns.push({
|
||||
'col_index': colIndex,
|
||||
'size': size
|
||||
@ -186,9 +186,9 @@ function addColumnToIndex (sourceArray, arrayIndex, indexChoice, colIndex): void
|
||||
};
|
||||
|
||||
// Display index name (or column list)
|
||||
var displayName = indexName;
|
||||
let displayName = indexName;
|
||||
if (displayName === '') {
|
||||
var columnNames = [];
|
||||
const columnNames = [];
|
||||
$.each(columns, function () {
|
||||
columnNames.push($('input[name="field_name[' + this.col_index + ']"]').val());
|
||||
});
|
||||
@ -197,14 +197,14 @@ function addColumnToIndex (sourceArray, arrayIndex, indexChoice, colIndex): void
|
||||
}
|
||||
|
||||
$.each(columns, function () {
|
||||
var id = 'index_name_' + this.col_index + '_8';
|
||||
var $name = $('#' + id);
|
||||
const id = 'index_name_' + this.col_index + '_8';
|
||||
let $name = $('#' + id);
|
||||
if ($name.length === 0) {
|
||||
$name = $('<a id="' + id + '" href="#" class="ajax show_index_dialog"></a>');
|
||||
$name.insertAfter($('select[name="field_key[' + this.col_index + ']"]'));
|
||||
}
|
||||
|
||||
var $text = $('<small>').text(displayName);
|
||||
const $text = $('<small>').text(displayName);
|
||||
// @ts-ignore
|
||||
$name.html($text);
|
||||
});
|
||||
@ -233,19 +233,19 @@ function getCompositeIndexList (sourceArray, colIndex) {
|
||||
}
|
||||
|
||||
// Html list.
|
||||
var $compositeIndexList = $(
|
||||
const $compositeIndexList = $(
|
||||
'<ul id="composite_index_list">' +
|
||||
'<div>' + window.Messages.strCompositeWith + '</div>' +
|
||||
'</ul>'
|
||||
'</ul>',
|
||||
);
|
||||
|
||||
// Add each column to list available for composite index.
|
||||
var sourceLength = sourceArray.length;
|
||||
var alreadyPresent = false;
|
||||
for (var i = 0; i < sourceLength; i++) {
|
||||
var subArrayLen = sourceArray[i].columns.length;
|
||||
var columnNames = [];
|
||||
for (var j = 0; j < subArrayLen; j++) {
|
||||
const sourceLength = sourceArray.length;
|
||||
let alreadyPresent = false;
|
||||
for (let i = 0; i < sourceLength; i++) {
|
||||
const subArrayLen = sourceArray[i].columns.length;
|
||||
const columnNames = [];
|
||||
for (let j = 0; j < subArrayLen; j++) {
|
||||
columnNames.push(
|
||||
$('input[name="field_name[' + sourceArray[i].columns[j].col_index + ']"]').val()
|
||||
);
|
||||
@ -269,8 +269,8 @@ function getCompositeIndexList (sourceArray, colIndex) {
|
||||
return $compositeIndexList;
|
||||
}
|
||||
|
||||
var addIndexGo = function (sourceArray, arrayIndex, index, colIndex) {
|
||||
var isMissingValue = false;
|
||||
const addIndexGo = function (sourceArray, arrayIndex, index, colIndex) {
|
||||
let isMissingValue = false;
|
||||
$('select[name="index[columns][names][]"]').each(function () {
|
||||
if ($(this).val() === '') {
|
||||
isMissingValue = true;
|
||||
@ -282,13 +282,13 @@ var addIndexGo = function (sourceArray, arrayIndex, index, colIndex) {
|
||||
sourceArray,
|
||||
arrayIndex,
|
||||
index.Index_choice,
|
||||
colIndex
|
||||
colIndex,
|
||||
);
|
||||
} else {
|
||||
ajaxShowMessage(
|
||||
'<div class="alert alert-danger" role="alert"><img src="themes/dot.gif" title="" alt=""' +
|
||||
' class="icon ic_s_error"> ' + window.Messages.strMissingColumn +
|
||||
' </div>', false
|
||||
' </div>', false,
|
||||
);
|
||||
|
||||
return false;
|
||||
@ -308,11 +308,11 @@ var addIndexGo = function (sourceArray, arrayIndex, index, colIndex) {
|
||||
* @param {boolean} showDialog Whether to show index creation dialog or not
|
||||
*/
|
||||
function showAddIndexDialog (sourceArray, arrayIndex, targetColumns, colIndex, index, showDialog = undefined): void {
|
||||
var showDialogLocal = typeof showDialog !== 'undefined' ? showDialog : true;
|
||||
const showDialogLocal = typeof showDialog !== 'undefined' ? showDialog : true;
|
||||
// Prepare post-data.
|
||||
var $table = $('input[name="table"]');
|
||||
var table = $table.length > 0 ? $table.val() : '';
|
||||
var postData = {
|
||||
const $table = $('input[name="table"]');
|
||||
const table = $table.length > 0 ? $table.val() : '';
|
||||
const postData = {
|
||||
'server': CommonParams.get('server'),
|
||||
'db': $('input[name="db"]').val(),
|
||||
'table': table,
|
||||
@ -322,10 +322,10 @@ function showAddIndexDialog (sourceArray, arrayIndex, targetColumns, colIndex, i
|
||||
'columns': '',
|
||||
};
|
||||
|
||||
var columns = {};
|
||||
for (var i = 0; i < targetColumns.length; i++) {
|
||||
var columnName = ($('input[name="field_name[' + targetColumns[i] + ']"]').val() as string);
|
||||
var columnType = ($('select[name="field_type[' + targetColumns[i] + ']"]').val() as string).toLowerCase();
|
||||
const columns = {};
|
||||
for (let i = 0; i < targetColumns.length; i++) {
|
||||
const columnName = ($('input[name="field_name[' + targetColumns[i] + ']"]').val() as string);
|
||||
const columnType = ($('select[name="field_type[' + targetColumns[i] + ']"]').val() as string).toLowerCase();
|
||||
columns[columnName] = [columnType, targetColumns[i]];
|
||||
}
|
||||
|
||||
@ -340,11 +340,11 @@ function showAddIndexDialog (sourceArray, arrayIndex, targetColumns, colIndex, i
|
||||
$('#addIndexModalCancelButton').on('click', function () {
|
||||
if (colIndex >= 0) {
|
||||
// Handle state on 'Cancel'.
|
||||
var $selectList = $('select[name="field_key[' + colIndex + ']"]');
|
||||
const $selectList = $('select[name="field_key[' + colIndex + ']"]');
|
||||
if (! $selectList.attr('data-index').length) {
|
||||
$selectList.find('option[value*="none"]').attr('selected', 'selected');
|
||||
} else {
|
||||
var previousIndex = $selectList.attr('data-index').split(',');
|
||||
const previousIndex = $selectList.attr('data-index').split(',');
|
||||
$selectList.find('option[value*="' + previousIndex[0].toLowerCase() + '"]')
|
||||
.attr('selected', 'selected');
|
||||
}
|
||||
@ -357,14 +357,14 @@ function showAddIndexDialog (sourceArray, arrayIndex, targetColumns, colIndex, i
|
||||
$('#addIndexModal').modal('hide');
|
||||
});
|
||||
|
||||
var $msgbox = ajaxShowMessage();
|
||||
const $msgbox = ajaxShowMessage();
|
||||
$.post('index.php?route=/table/indexes', postData, function (data) {
|
||||
if (data.success === false) {
|
||||
// in the case of an error, show the error message returned.
|
||||
ajaxShowMessage(data.error, false);
|
||||
} else {
|
||||
ajaxRemoveMessage($msgbox);
|
||||
var $div = $('<div></div>');
|
||||
const $div = $('<div></div>');
|
||||
if (showDialogLocal) {
|
||||
// Show dialog if the request was successful
|
||||
if ($('#addIndex').length > 0) {
|
||||
@ -401,7 +401,7 @@ function showAddIndexDialog (sourceArray, arrayIndex, targetColumns, colIndex, i
|
||||
$div.css({ 'display': 'none' });
|
||||
$div.appendTo($('body'));
|
||||
$div.attr({ 'id': 'addIndex' });
|
||||
var isMissingValue = false;
|
||||
let isMissingValue = false;
|
||||
$('select[name="index[columns][names][]"]').each(function () {
|
||||
if ($(this).val() === '') {
|
||||
isMissingValue = true;
|
||||
@ -429,7 +429,7 @@ function showAddIndexDialog (sourceArray, arrayIndex, targetColumns, colIndex, i
|
||||
});
|
||||
}
|
||||
|
||||
var removeIndexOnChangeEvent = function () {
|
||||
const removeIndexOnChangeEvent = function () {
|
||||
$('#composite_index').off('change');
|
||||
$('#single_column').off('change');
|
||||
$('#addIndexModal').modal('hide');
|
||||
@ -443,15 +443,15 @@ var removeIndexOnChangeEvent = function () {
|
||||
* @param {string} colIndex Index of new column on form
|
||||
*/
|
||||
function indexTypeSelectionDialog (sourceArray, indexChoice, colIndex): void {
|
||||
var $singleColumnRadio = $('<div class="form-check">' +
|
||||
const $singleColumnRadio = $('<div class="form-check">' +
|
||||
'<input class="form-check-input" type="radio" id="single_column" name="index_choice" checked>' +
|
||||
'<label class="form-check-label" for="single_column">' +
|
||||
window.Messages.strCreateSingleColumnIndex + '</label></div>');
|
||||
var $compositeIndexRadio = $('<div class="form-check">' +
|
||||
const $compositeIndexRadio = $('<div class="form-check">' +
|
||||
'<input class="form-check-input" type="radio" id="composite_index" name="index_choice">' +
|
||||
'<label class="form-check-label" for="composite_index">' +
|
||||
window.Messages.strCreateCompositeIndex + '</label></div>');
|
||||
var $dialogContent = $('<fieldset id="advance_index_creator"></fieldset>');
|
||||
const $dialogContent = $('<fieldset id="advance_index_creator"></fieldset>');
|
||||
$dialogContent.append('<legend>' + indexChoice.toUpperCase() + '</legend>');
|
||||
|
||||
// For UNIQUE/INDEX type, show choice for single-column and composite index.
|
||||
@ -463,9 +463,9 @@ function indexTypeSelectionDialog (sourceArray, indexChoice, colIndex): void {
|
||||
// 'OK' operation.
|
||||
$('#addIndexModalGoButton').on('click', function () {
|
||||
if ($('#single_column').is(':checked')) {
|
||||
var index = {
|
||||
const index = {
|
||||
'Key_name': (indexChoice === 'primary' ? 'PRIMARY' : ''),
|
||||
'Index_choice': indexChoice.toUpperCase()
|
||||
'Index_choice': indexChoice.toUpperCase(),
|
||||
};
|
||||
Indexes.showAddIndexDialog(sourceArray, (sourceArray.length), [colIndex], colIndex, index);
|
||||
}
|
||||
@ -484,10 +484,10 @@ function indexTypeSelectionDialog (sourceArray, indexChoice, colIndex): void {
|
||||
return false;
|
||||
}
|
||||
|
||||
var arrayIndex = Number($('input[name="composite_with"]:checked').val());
|
||||
var sourceLength = sourceArray[arrayIndex].columns.length;
|
||||
var targetColumns = [];
|
||||
for (var i = 0; i < sourceLength; i++) {
|
||||
const arrayIndex = Number($('input[name="composite_with"]:checked').val());
|
||||
const sourceLength = sourceArray[arrayIndex].columns.length;
|
||||
const targetColumns = [];
|
||||
for (let i = 0; i < sourceLength; i++) {
|
||||
targetColumns.push(sourceArray[arrayIndex].columns[i].col_index);
|
||||
}
|
||||
|
||||
@ -502,11 +502,11 @@ function indexTypeSelectionDialog (sourceArray, indexChoice, colIndex): void {
|
||||
|
||||
$('#addIndexModalCancelButton').on('click', function () {
|
||||
// Handle state on 'Cancel'.
|
||||
var $selectList = $('select[name="field_key[' + colIndex + ']"]');
|
||||
const $selectList = $('select[name="field_key[' + colIndex + ']"]');
|
||||
if (! $selectList.attr('data-index').length) {
|
||||
$selectList.find('option[value*="none"]').attr('selected', 'selected');
|
||||
} else {
|
||||
var previousIndex = $selectList.attr('data-index').split(',');
|
||||
const previousIndex = $selectList.attr('data-index').split(',');
|
||||
$selectList.find('option[value*="' + previousIndex[0].toLowerCase() + '"]')
|
||||
.attr('selected', 'selected');
|
||||
}
|
||||
@ -587,21 +587,21 @@ function on () {
|
||||
Indexes.resetColumnLists();
|
||||
|
||||
// for table creation form
|
||||
var $engineSelector = $('.create_table_form select[name=tbl_storage_engine]');
|
||||
const $engineSelector = $('.create_table_form select[name=tbl_storage_engine]');
|
||||
if ($engineSelector.length) {
|
||||
hideShowConnection($engineSelector);
|
||||
}
|
||||
|
||||
var $form = $('#index_frm');
|
||||
const $form = $('#index_frm');
|
||||
if ($form.length > 0) {
|
||||
showIndexEditDialog($form);
|
||||
}
|
||||
|
||||
$(document).on('click', '#save_index_frm', function (event) {
|
||||
event.preventDefault();
|
||||
var $form = $('#index_frm');
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var submitData = $form.serialize() + argsep + 'do_save_data=1' + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
|
||||
const $form = $('#index_frm');
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
const submitData = $form.serialize() + argsep + 'do_save_data=1' + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
|
||||
ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
AJAX.source = $form;
|
||||
$.post($form.attr('action'), submitData, AJAX.responseHandler);
|
||||
@ -623,30 +623,32 @@ function on () {
|
||||
*/
|
||||
$(document).on('click', 'a.drop_primary_key_index_anchor.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var $anchor = $(this);
|
||||
const $anchor = $(this);
|
||||
/**
|
||||
* @var $currRow Object containing reference to the current field's row
|
||||
*/
|
||||
var $currRow = $anchor.parents('tr');
|
||||
const $currRow = $anchor.parents('tr');
|
||||
/** @var {number} rows Number of columns in the key */
|
||||
var rows = Number($anchor.parents('td').attr('rowspan')) || 1;
|
||||
const rows = Number($anchor.parents('td').attr('rowspan')) || 1;
|
||||
/** @var {number} $rowsToHide Rows that should be hidden */
|
||||
var $rowsToHide = $currRow;
|
||||
for (var i = 1, $lastRow = $currRow.next(); i < rows; i++, $lastRow = $lastRow.next()) {
|
||||
let $rowsToHide = $currRow;
|
||||
let i = 1;
|
||||
let $lastRow = $currRow.next();
|
||||
for (; i < rows; i++, $lastRow = $lastRow.next()) {
|
||||
$rowsToHide = $rowsToHide.add($lastRow);
|
||||
}
|
||||
|
||||
var question = $currRow.children('td')
|
||||
const question = $currRow.children('td')
|
||||
.children('.drop_primary_key_index_msg')
|
||||
.val();
|
||||
|
||||
confirmPreviewSql(question, $anchor.attr('href'), function (url) {
|
||||
var $msg = ajaxShowMessage(window.Messages.strDroppingPrimaryKeyIndex, false);
|
||||
var params = getJsConfirmCommonParam(this, $anchor.getPostData());
|
||||
const $msg = ajaxShowMessage(window.Messages.strDroppingPrimaryKeyIndex, false);
|
||||
const params = getJsConfirmCommonParam(this, $anchor.getPostData());
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
ajaxRemoveMessage($msg);
|
||||
var $tableRef = $rowsToHide.closest('table');
|
||||
const $tableRef = $rowsToHide.closest('table');
|
||||
if ($rowsToHide.length === $tableRef.find('tbody > tr').length) {
|
||||
// We are about to remove all rows from the table
|
||||
$tableRef.hide('medium', function () {
|
||||
@ -688,14 +690,14 @@ function on () {
|
||||
**/
|
||||
$(document).on('click', '#table_index tbody tr td.edit_index.ajax, #index_div .add_index.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var url;
|
||||
var title;
|
||||
let url;
|
||||
let title;
|
||||
if ($(this).find('a').length === 0) {
|
||||
// Add index
|
||||
var valid = checkFormElementInRange(
|
||||
const valid = checkFormElementInRange(
|
||||
$(this).closest('form')[0],
|
||||
'added_fields',
|
||||
'Column count has to be larger than zero.'
|
||||
'Column count has to be larger than zero.',
|
||||
);
|
||||
if (! valid) {
|
||||
return;
|
||||
@ -722,8 +724,8 @@ function on () {
|
||||
**/
|
||||
$(document).on('click', '#table_index tbody tr td.rename_index.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var url = $(this).find('a').getPostData();
|
||||
var title = window.Messages.strRenameIndex;
|
||||
let url = $(this).find('a').getPostData();
|
||||
const title = window.Messages.strRenameIndex;
|
||||
url += CommonParams.get('arg_separator') + 'ajax_request=true';
|
||||
indexRenameDialog(url, title, function (data) {
|
||||
Navigation.update(CommonParams.set('db', data.params.db));
|
||||
@ -737,20 +739,20 @@ function on () {
|
||||
* and column addition.
|
||||
*/
|
||||
$('body').on('change', 'select[name*="field_key"]', function (e, showDialog) {
|
||||
var showDialogLocal = typeof showDialog !== 'undefined' ? showDialog : true;
|
||||
const showDialogLocal = typeof showDialog !== 'undefined' ? showDialog : true;
|
||||
// Index of column on Table edit and create page.
|
||||
var colIndexRegEx = /\d+/.exec($(this).attr('name'));
|
||||
const colIndexRegEx = /\d+/.exec($(this).attr('name'));
|
||||
const colIndex = colIndexRegEx[0];
|
||||
// Choice of selected index.
|
||||
var indexChoiceRegEx = /[a-z]+/.exec(($(this).val() as string));
|
||||
const indexChoiceRegEx = /[a-z]+/.exec(($(this).val() as string));
|
||||
const indexChoice = indexChoiceRegEx[0];
|
||||
// Array containing corresponding indexes.
|
||||
var sourceArray = null;
|
||||
let sourceArray = null;
|
||||
|
||||
if (indexChoice === 'none') {
|
||||
Indexes.removeColumnFromIndex(colIndex);
|
||||
var id = 'index_name_' + colIndex + '_8';
|
||||
var $name = $('#' + id);
|
||||
const id = 'index_name_' + colIndex + '_8';
|
||||
let $name = $('#' + id);
|
||||
if ($name.length === 0) {
|
||||
$name = $('<a id="' + id + '" href="#" class="ajax show_index_dialog"></a>');
|
||||
$name.insertAfter($('select[name="field_key[' + '0' + ']"]'));
|
||||
@ -768,17 +770,17 @@ function on () {
|
||||
}
|
||||
|
||||
if (sourceArray.length === 0) {
|
||||
var index = {
|
||||
const index = {
|
||||
'Key_name': (indexChoice === 'primary' ? 'PRIMARY' : ''),
|
||||
'Index_choice': indexChoice.toUpperCase()
|
||||
'Index_choice': indexChoice.toUpperCase(),
|
||||
};
|
||||
Indexes.showAddIndexDialog(sourceArray, 0, [colIndex], colIndex, index, showDialogLocal);
|
||||
} else {
|
||||
if (indexChoice === 'primary') {
|
||||
var arrayIndex = 0;
|
||||
var sourceLength = sourceArray[arrayIndex].columns.length;
|
||||
var targetColumns = [];
|
||||
for (var i = 0; i < sourceLength; i++) {
|
||||
const arrayIndex = 0;
|
||||
const sourceLength = sourceArray[arrayIndex].columns.length;
|
||||
const targetColumns = [];
|
||||
for (let i = 0; i < sourceLength; i++) {
|
||||
targetColumns.push(sourceArray[arrayIndex].columns[i].col_index);
|
||||
}
|
||||
|
||||
@ -796,23 +798,23 @@ function on () {
|
||||
e.preventDefault();
|
||||
|
||||
// Get index details.
|
||||
var previousIndex = $(this).prev('select')
|
||||
const previousIndex = $(this).prev('select')
|
||||
.attr('data-index')
|
||||
.split(',');
|
||||
|
||||
var indexChoice = previousIndex[0];
|
||||
var arrayIndex = previousIndex[1];
|
||||
const indexChoice = previousIndex[0];
|
||||
const arrayIndex = previousIndex[1];
|
||||
|
||||
var sourceArray = Indexes.getIndexArray(indexChoice);
|
||||
const sourceArray = Indexes.getIndexArray(indexChoice);
|
||||
if (sourceArray === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (arrayIndex in sourceArray) {
|
||||
var sourceLength = sourceArray[arrayIndex].columns.length;
|
||||
const sourceLength = sourceArray[arrayIndex].columns.length;
|
||||
|
||||
var targetColumns = [];
|
||||
for (var i = 0; i < sourceLength; i++) {
|
||||
const targetColumns = [];
|
||||
for (let i = 0; i < sourceLength; i++) {
|
||||
targetColumns.push(sourceArray[arrayIndex].columns[i].col_index);
|
||||
}
|
||||
|
||||
|
||||
@ -13,8 +13,8 @@ export default function checkIndexName (formId) {
|
||||
}
|
||||
|
||||
// Gets the elements pointers
|
||||
var $theIdxName = $('#input_index_name');
|
||||
var $theIdxChoice = $('#select_index_choice');
|
||||
const $theIdxName = $('#input_index_name');
|
||||
const $theIdxChoice = $('#select_index_choice');
|
||||
|
||||
// Index is a primary key
|
||||
if ($theIdxChoice.find('option:selected').val() === 'PRIMARY') {
|
||||
|
||||
@ -8,27 +8,27 @@ export default function checkIndexType () {
|
||||
/**
|
||||
* @var {JQuery<HTMLElement}, Dropdown to select the index choice.
|
||||
*/
|
||||
var $selectIndexChoice = $('#select_index_choice');
|
||||
const $selectIndexChoice = $('#select_index_choice');
|
||||
/**
|
||||
* @var {JQuery<HTMLElement}, Dropdown to select the index type.
|
||||
*/
|
||||
var $selectIndexType = $('#select_index_type');
|
||||
const $selectIndexType = $('#select_index_type');
|
||||
/**
|
||||
* @var {JQuery<HTMLElement}, Table header for the size column.
|
||||
*/
|
||||
var $sizeHeader = $('#index_columns').find('thead tr').children('th').eq(1);
|
||||
const $sizeHeader = $('#index_columns').find('thead tr').children('th').eq(1);
|
||||
/**
|
||||
* @var {JQuery<HTMLElement}, Inputs to specify the columns for the index.
|
||||
*/
|
||||
var $columnInputs = $('select[name="index[columns][names][]"]');
|
||||
const $columnInputs = $('select[name="index[columns][names][]"]');
|
||||
/**
|
||||
* @var {JQuery<HTMLElement}, Inputs to specify sizes for columns of the index.
|
||||
*/
|
||||
var $sizeInputs = $('input[name="index[columns][sub_parts][]"]');
|
||||
const $sizeInputs = $('input[name="index[columns][sub_parts][]"]');
|
||||
/**
|
||||
* @var {JQuery<HTMLElement}, Footer containing the controllers to add more columns
|
||||
*/
|
||||
var $addMore = $('#index_frm').find('.add_more');
|
||||
const $addMore = $('#index_frm').find('.add_more');
|
||||
|
||||
if ($selectIndexChoice.val() === 'SPATIAL') {
|
||||
// Disable and hide the size column
|
||||
@ -40,9 +40,9 @@ export default function checkIndexType () {
|
||||
});
|
||||
|
||||
// Disable and hide the columns of the index other than the first one
|
||||
var initial = true;
|
||||
let initial = true;
|
||||
$columnInputs.each(function () {
|
||||
var $columnInput = $(this);
|
||||
const $columnInput = $(this);
|
||||
if (! initial) {
|
||||
$columnInput
|
||||
.prop('disabled', true)
|
||||
|
||||
@ -5,13 +5,13 @@
|
||||
* @param {JQuery} $base base element which contains the JSON code blocks
|
||||
*/
|
||||
export default function highlightJson ($base) {
|
||||
var $elm = $base.find('code.json');
|
||||
const $elm = $base.find('code.json');
|
||||
$elm.each(function () {
|
||||
var $json = $(this);
|
||||
var $pre = $json.find('pre');
|
||||
const $json = $(this);
|
||||
const $pre = $json.find('pre');
|
||||
/* We only care about visible elements to avoid double processing */
|
||||
if ($pre.is(':visible')) {
|
||||
var $highlight = $('<div class="json-highlight cm-s-default"></div>');
|
||||
const $highlight = $('<div class="json-highlight cm-s-default"></div>');
|
||||
$json.append($highlight);
|
||||
// @ts-ignore
|
||||
if (typeof window.CodeMirror !== 'undefined' && typeof window.CodeMirror.runMode === 'function') {
|
||||
|
||||
@ -9,9 +9,9 @@ let ctrlKeyHistory = 0;
|
||||
* @param {object} event data
|
||||
*/
|
||||
const onKeyDownArrowsHandler = function (event) {
|
||||
var e = event || window.event;
|
||||
const e = event || window.event;
|
||||
|
||||
var o = (e.srcElement || e.target);
|
||||
const o = (e.srcElement || e.target);
|
||||
if (! o) {
|
||||
return;
|
||||
}
|
||||
@ -46,13 +46,13 @@ const onKeyDownArrowsHandler = function (event) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
var pos = o.id.split('_');
|
||||
const pos = o.id.split('_');
|
||||
if (pos[0] !== 'field' || typeof pos[2] === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
var x = pos[2];
|
||||
var y = pos[1];
|
||||
let x = pos[2];
|
||||
let y = pos[1];
|
||||
|
||||
switch (e.keyCode) {
|
||||
case 38:
|
||||
@ -75,9 +75,9 @@ const onKeyDownArrowsHandler = function (event) {
|
||||
return;
|
||||
}
|
||||
|
||||
var id = 'field_' + y + '_' + x;
|
||||
let id = 'field_' + y + '_' + x;
|
||||
|
||||
var nO = document.getElementById(id);
|
||||
let nO = document.getElementById(id);
|
||||
if (! nO) {
|
||||
id = 'field_' + y + '_' + x + '_0';
|
||||
nO = document.getElementById(id);
|
||||
|
||||
@ -12,7 +12,7 @@ import isStorageSupported from './functions/isStorageSupported.ts';
|
||||
function treeStateUpdate (): void {
|
||||
// update if session storage is supported
|
||||
if (isStorageSupported('sessionStorage')) {
|
||||
var storage = window.sessionStorage;
|
||||
const storage = window.sessionStorage;
|
||||
// try catch necessary here to detect whether
|
||||
// content to be stored exceeds storage capacity
|
||||
try {
|
||||
@ -37,10 +37,10 @@ function treeStateUpdate (): void {
|
||||
*/
|
||||
function filterStateUpdate (filterName, filterValue): void {
|
||||
if (isStorageSupported('sessionStorage')) {
|
||||
var storage = window.sessionStorage;
|
||||
const storage = window.sessionStorage;
|
||||
try {
|
||||
var currentFilter = $.extend({}, JSON.parse(storage.getItem('navTreeSearchFilters')));
|
||||
var filter = {};
|
||||
let currentFilter = $.extend({}, JSON.parse(storage.getItem('navTreeSearchFilters')));
|
||||
const filter = {};
|
||||
filter[filterName] = filterValue;
|
||||
currentFilter = $.extend(currentFilter, filter);
|
||||
storage.setItem('navTreeSearchFilters', JSON.stringify(currentFilter));
|
||||
@ -57,7 +57,7 @@ function filterStateRestore (): void {
|
||||
if (isStorageSupported('sessionStorage')
|
||||
&& typeof window.sessionStorage.navTreeSearchFilters !== 'undefined'
|
||||
) {
|
||||
var searchClauses = JSON.parse(window.sessionStorage.navTreeSearchFilters);
|
||||
const searchClauses = JSON.parse(window.sessionStorage.navTreeSearchFilters);
|
||||
if (Object.keys(searchClauses).length < 1) {
|
||||
return;
|
||||
}
|
||||
@ -66,7 +66,7 @@ function filterStateRestore (): void {
|
||||
if (searchClauses.hasOwnProperty('dbFilter')
|
||||
&& searchClauses.dbFilter.length
|
||||
) {
|
||||
var $obj = $('#pma_navigation_tree');
|
||||
const $obj = $('#pma_navigation_tree');
|
||||
if (! $obj.data('fastFilter')) {
|
||||
$obj.data(
|
||||
'fastFilter',
|
||||
@ -80,15 +80,15 @@ function filterStateRestore (): void {
|
||||
}
|
||||
|
||||
// find all table filters present in the tree
|
||||
var $tableFilters = $('#pma_navigation_tree li.database')
|
||||
const $tableFilters = $('#pma_navigation_tree li.database')
|
||||
.children('div.list_container')
|
||||
.find('li.fast_filter input.searchClause');
|
||||
// restore table filters
|
||||
|
||||
$tableFilters.each(function () {
|
||||
$obj = $(this).closest('div.list_container');
|
||||
const $obj = $(this).closest('div.list_container');
|
||||
// aPath associated with this filter
|
||||
var filterName = ($(this).siblings('input[name=aPath]').val() as string);
|
||||
const filterName = ($(this).siblings('input[name=aPath]').val() as string);
|
||||
// if this table's filter has a state stored in storage
|
||||
if (searchClauses.hasOwnProperty(filterName)
|
||||
&& searchClauses[filterName].length
|
||||
@ -124,8 +124,8 @@ function filterStateRestore (): void {
|
||||
* @param callback callback function
|
||||
*/
|
||||
function loadChildNodes (isNode, $expandElem, callback): void {
|
||||
var $destination = null;
|
||||
var params = null;
|
||||
let $destination = null;
|
||||
let params = null;
|
||||
|
||||
if (isNode) {
|
||||
if (! $expandElem.hasClass('expander')) {
|
||||
@ -133,8 +133,8 @@ function loadChildNodes (isNode, $expandElem, callback): void {
|
||||
}
|
||||
|
||||
$destination = $expandElem.closest('li');
|
||||
var pos2Name = $expandElem.find('span.pos2_nav');
|
||||
var pathsNav = $expandElem.find('span.paths_nav');
|
||||
const pos2Name = $expandElem.find('span.pos2_nav');
|
||||
const pathsNav = $expandElem.find('span.paths_nav');
|
||||
params = {
|
||||
'server': CommonParams.get('server'),
|
||||
'aPath': pathsNav.attr('data-apath'),
|
||||
@ -187,7 +187,7 @@ function loadChildNodes (isNode, $expandElem, callback): void {
|
||||
}
|
||||
|
||||
if (data.errors) {
|
||||
var $errors = $(data.errors);
|
||||
const $errors = $(data.errors);
|
||||
if ($errors.children().length > 0) {
|
||||
$('#pma_errors').append(data.errors);
|
||||
}
|
||||
@ -205,9 +205,9 @@ function loadChildNodes (isNode, $expandElem, callback): void {
|
||||
|
||||
window.location.reload();
|
||||
} else {
|
||||
var $throbber = $expandElem.find('img.throbber');
|
||||
const $throbber = $expandElem.find('img.throbber');
|
||||
$throbber.hide();
|
||||
var $icon = $expandElem.find('img.ic_b_plus');
|
||||
const $icon = $expandElem.find('img.ic_b_plus');
|
||||
$icon.show();
|
||||
ajaxShowMessage(data.error, false);
|
||||
}
|
||||
@ -220,8 +220,8 @@ function loadChildNodes (isNode, $expandElem, callback): void {
|
||||
* @param $expandElem expander
|
||||
*/
|
||||
function collapseTreeNode ($expandElem): void {
|
||||
var $children = $expandElem.closest('li').children('div.list_container');
|
||||
var $icon = $expandElem.find('img');
|
||||
const $children = $expandElem.closest('li').children('div.list_container');
|
||||
const $icon = $expandElem.find('img');
|
||||
if ($expandElem.hasClass('loaded')) {
|
||||
if ($icon.is('.ic_b_minus')) {
|
||||
$icon.removeClass('ic_b_minus').addClass('ic_b_plus');
|
||||
@ -241,23 +241,23 @@ function collapseTreeNode ($expandElem): void {
|
||||
* @return {object}
|
||||
*/
|
||||
function traverseForPaths () {
|
||||
var params = {
|
||||
pos: $('#pma_navigation_tree').find('div.dbselector select').val()
|
||||
const params = {
|
||||
pos: $('#pma_navigation_tree').find('div.dbselector select').val(),
|
||||
};
|
||||
if ($('#navi_db_select').length) {
|
||||
return params;
|
||||
}
|
||||
|
||||
var count = 0;
|
||||
let count = 0;
|
||||
$('#pma_navigation_tree').find('a.expander:visible').each(function () {
|
||||
if ($(this).find('img').is('.ic_b_minus') &&
|
||||
$(this).closest('li').find('div.list_container .ic_b_minus').length === 0
|
||||
) {
|
||||
var pathsNav = $(this).find('span.paths_nav');
|
||||
const pathsNav = $(this).find('span.paths_nav');
|
||||
params['n' + count + '_aPath'] = pathsNav.attr('data-apath');
|
||||
params['n' + count + '_vPath'] = pathsNav.attr('data-vpath');
|
||||
|
||||
var pos2Nav = $(this).find('span.pos2_nav');
|
||||
let pos2Nav = $(this).find('span.pos2_nav');
|
||||
|
||||
if (pos2Nav.length === 0) {
|
||||
pos2Nav = $(this)
|
||||
@ -269,7 +269,7 @@ function traverseForPaths () {
|
||||
params['n' + count + '_pos2_name'] = pos2Nav.attr('data-name');
|
||||
params['n' + count + '_pos2_value'] = pos2Nav.attr('data-value');
|
||||
|
||||
var pos3Nav = $(this).find('span.pos3_nav');
|
||||
const pos3Nav = $(this).find('span.pos3_nav');
|
||||
|
||||
params['n' + count + '_pos3_name'] = pos3Nav.attr('data-name');
|
||||
params['n' + count + '_pos3_value'] = pos3Nav.attr('data-value');
|
||||
@ -287,8 +287,8 @@ function traverseForPaths () {
|
||||
* @param callback callback function
|
||||
*/
|
||||
function expandTreeNode ($expandElem, callback = undefined): void {
|
||||
var $children = $expandElem.closest('li').children('div.list_container');
|
||||
var $icon = $expandElem.find('img');
|
||||
let $children = $expandElem.closest('li').children('div.list_container');
|
||||
const $icon = $expandElem.find('img');
|
||||
if ($expandElem.hasClass('loaded')) {
|
||||
if ($icon.is('.ic_b_plus')) {
|
||||
$icon.removeClass('ic_b_plus').addClass('ic_b_minus');
|
||||
@ -301,7 +301,7 @@ function expandTreeNode ($expandElem, callback = undefined): void {
|
||||
|
||||
$children.promise().done(Navigation.treeStateUpdate);
|
||||
} else {
|
||||
var $throbber = $('#pma_navigation').find('.throbber')
|
||||
const $throbber = $('#pma_navigation').find('.throbber')
|
||||
.first()
|
||||
.clone()
|
||||
.css({ visibility: 'visible', display: 'block' })
|
||||
@ -311,7 +311,7 @@ function expandTreeNode ($expandElem, callback = undefined): void {
|
||||
|
||||
Navigation.loadChildNodes(true, $expandElem, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
var $destination = $expandElem.closest('li');
|
||||
const $destination = $expandElem.closest('li');
|
||||
$icon.removeClass('ic_b_plus').addClass('ic_b_minus');
|
||||
$children = $destination.children('div.list_container');
|
||||
$children.slideDown('fast');
|
||||
@ -348,10 +348,10 @@ function expandTreeNode ($expandElem, callback = undefined): void {
|
||||
*/
|
||||
function scrollToView ($element, $forceToTop) {
|
||||
Navigation.filterStateRestore();
|
||||
var $container = $('#pma_navigation_tree_content');
|
||||
var elemTop = $element.offset().top - $container.offset().top;
|
||||
var textHeight = 20;
|
||||
var scrollPadding = 20; // extra padding from top of bottom when scrolling to view
|
||||
const $container = $('#pma_navigation_tree_content');
|
||||
const elemTop = $element.offset().top - $container.offset().top;
|
||||
const textHeight = 20;
|
||||
const scrollPadding = 20; // extra padding from top of bottom when scrolling to view
|
||||
if (elemTop < 0 || $forceToTop) {
|
||||
$container.stop().animate({
|
||||
scrollTop: elemTop + $container.scrollTop() - scrollPadding
|
||||
@ -367,16 +367,16 @@ function scrollToView ($element, $forceToTop) {
|
||||
* Expand the navigation and highlight the current database or table/view
|
||||
*/
|
||||
function showCurrent (): void {
|
||||
var db = CommonParams.get('db');
|
||||
var table = CommonParams.get('table');
|
||||
const db = CommonParams.get('db');
|
||||
const table = CommonParams.get('table');
|
||||
|
||||
var autoexpand = $('#pma_navigation_tree').hasClass('autoexpand');
|
||||
const autoexpand = $('#pma_navigation_tree').hasClass('autoexpand');
|
||||
|
||||
$('#pma_navigation_tree')
|
||||
.find('li.selected')
|
||||
.removeClass('selected');
|
||||
|
||||
var $dbItem;
|
||||
let $dbItem;
|
||||
if (db) {
|
||||
$dbItem = findLoadedItem(
|
||||
$('#pma_navigation_tree').find('> div'), db, 'database', ! table
|
||||
@ -395,7 +395,7 @@ function showCurrent (): void {
|
||||
) {
|
||||
Navigation.loadChildNodes(false, $('option:selected', $('#navi_db_select')), function () {
|
||||
handleTableOrDb(table, $('#pma_navigation_tree_content'));
|
||||
var $children = $('#pma_navigation_tree_content').children('div.list_container');
|
||||
const $children = $('#pma_navigation_tree_content').children('div.list_container');
|
||||
$children.promise().done(Navigation.treeStateUpdate);
|
||||
});
|
||||
} else {
|
||||
@ -410,10 +410,10 @@ function showCurrent (): void {
|
||||
// automatically expand the list if there is only single database
|
||||
|
||||
// find the name of the database
|
||||
var dbItemName = '';
|
||||
let dbItemName = '';
|
||||
|
||||
$('#pma_navigation_tree_content > ul > li.database').children('a').each(function () {
|
||||
var name = $(this).text();
|
||||
const name = $(this).text();
|
||||
if (! dbItemName && name.trim()) { // if the name is not empty, it is the desired element
|
||||
dbItemName = name;
|
||||
}
|
||||
@ -429,7 +429,7 @@ function showCurrent (): void {
|
||||
Navigation.showFullName($('#pma_navigation_tree'));
|
||||
|
||||
function fullExpand (table, $dbItem) {
|
||||
var $expander = $dbItem.children('div').first().children('a.expander');
|
||||
const $expander = $dbItem.children('div').first().children('a.expander');
|
||||
// if not loaded or loaded but collapsed
|
||||
if (! $expander.hasClass('loaded') ||
|
||||
$expander.find('img').is('.ic_b_plus')
|
||||
@ -446,10 +446,10 @@ function showCurrent (): void {
|
||||
if (table) {
|
||||
loadAndHighlightTableOrView($dbItem, table);
|
||||
} else {
|
||||
var $container = $dbItem.children('div.list_container');
|
||||
var $tableContainer = $container.children('ul').children('li.tableContainer');
|
||||
const $container = $dbItem.children('div.list_container');
|
||||
const $tableContainer = $container.children('ul').children('li.tableContainer');
|
||||
if ($tableContainer.length > 0) {
|
||||
var $expander = $tableContainer.children('div').first().children('a.expander');
|
||||
const $expander = $tableContainer.children('div').first().children('a.expander');
|
||||
$tableContainer.addClass('selected');
|
||||
Navigation.expandTreeNode($expander, function () {
|
||||
Navigation.scrollToView($dbItem, true);
|
||||
@ -461,14 +461,14 @@ function showCurrent (): void {
|
||||
}
|
||||
|
||||
function findLoadedItem ($container, name, clazz, doSelect) {
|
||||
var ret: any = false;
|
||||
let ret: any = false;
|
||||
$container.children('ul').children('li').each(function () {
|
||||
var $li = $(this);
|
||||
const $li = $(this);
|
||||
// this is a navigation group, recurse
|
||||
if ($li.is('.navGroup')) {
|
||||
var $container = $li.children('div.list_container');
|
||||
var $childRet = findLoadedItem(
|
||||
$container, name, clazz, doSelect
|
||||
const $container = $li.children('div.list_container');
|
||||
const $childRet = findLoadedItem(
|
||||
$container, name, clazz, doSelect,
|
||||
);
|
||||
if ($childRet) {
|
||||
ret = $childRet;
|
||||
@ -485,7 +485,7 @@ function showCurrent (): void {
|
||||
|
||||
// traverse up and expand and parent navigation groups
|
||||
$li.parents('.navGroup').each(function () {
|
||||
var $cont = $(this).children('div.list_container');
|
||||
const $cont = $(this).children('div.list_container');
|
||||
if (! $cont.is(':visible')) {
|
||||
$(this)
|
||||
.children('div').first()
|
||||
@ -505,13 +505,13 @@ function showCurrent (): void {
|
||||
}
|
||||
|
||||
function loadAndHighlightTableOrView ($dbItem, itemName) {
|
||||
var $container = $dbItem.children('div.list_container');
|
||||
var $expander;
|
||||
var $whichItem = isItemInContainer($container, itemName, 'li.nav_node_table, li.view');
|
||||
const $container = $dbItem.children('div.list_container');
|
||||
let $expander;
|
||||
let $whichItem = isItemInContainer($container, itemName, 'li.nav_node_table, li.view');
|
||||
// If item already there in some container
|
||||
if ($whichItem) {
|
||||
// get the relevant container while may also be a subcontainer
|
||||
var $relatedContainer = $whichItem.closest('li.subContainer').length
|
||||
const $relatedContainer = $whichItem.closest('li.subContainer').length
|
||||
? $whichItem.closest('li.subContainer')
|
||||
: $dbItem;
|
||||
$whichItem = findLoadedItem(
|
||||
@ -523,10 +523,10 @@ function showCurrent (): void {
|
||||
showTableOrView($whichItem, $relatedContainer.children('div').first().children('a.expander'));
|
||||
// else if item not there, try loading once
|
||||
} else {
|
||||
var $subContainers = $dbItem.find('.subContainer');
|
||||
const $subContainers = $dbItem.find('.subContainer');
|
||||
// If there are subContainers i.e. tableContainer or viewContainer
|
||||
if ($subContainers.length > 0) {
|
||||
var $containers = [];
|
||||
const $containers = [];
|
||||
$subContainers.each(function (index) {
|
||||
$containers[index] = $(this);
|
||||
$expander = $containers[index]
|
||||
@ -552,9 +552,9 @@ function showCurrent (): void {
|
||||
|
||||
function loadAndShowTableOrView ($expander, $relatedContainer, itemName) {
|
||||
Navigation.loadChildNodes(true, $expander, function () {
|
||||
var $whichItem = findLoadedItem(
|
||||
const $whichItem = findLoadedItem(
|
||||
$relatedContainer.children('div.list_container'),
|
||||
itemName, null, true
|
||||
itemName, null, true,
|
||||
);
|
||||
if ($whichItem) {
|
||||
showTableOrView($whichItem, $expander);
|
||||
@ -571,8 +571,8 @@ function showCurrent (): void {
|
||||
}
|
||||
|
||||
function isItemInContainer ($container, name, clazz) {
|
||||
var $whichItem = null;
|
||||
var $items = $container.find(clazz);
|
||||
let $whichItem = null;
|
||||
const $items = $container.find(clazz);
|
||||
$items.each(function () {
|
||||
if ($(this).children('a').text() === name) {
|
||||
$whichItem = $(this);
|
||||
@ -603,7 +603,7 @@ function ensureSettings (selflink): void {
|
||||
$('#pma_navigation_settings_icon').removeClass('hide');
|
||||
|
||||
if (! $('#pma_navigation_settings').length) {
|
||||
var params = {
|
||||
const params = {
|
||||
getNaviSettings: true,
|
||||
server: CommonParams.get('server'),
|
||||
};
|
||||
@ -629,12 +629,12 @@ function ensureSettings (selflink): void {
|
||||
* @param {object} paths stored navigation paths
|
||||
*/
|
||||
function reload (callback = null, paths = null): void {
|
||||
var params: { server: any; reload: boolean; no_debug: boolean, db?: string } = {
|
||||
const params: { server: any; reload: boolean; no_debug: boolean, db?: string } = {
|
||||
'reload': true,
|
||||
'no_debug': true,
|
||||
'server': CommonParams.get('server'),
|
||||
};
|
||||
var pathsLocal = paths || Navigation.traverseForPaths();
|
||||
const pathsLocal = paths || Navigation.traverseForPaths();
|
||||
$.extend(params, pathsLocal);
|
||||
if ($('#navi_db_select').length) {
|
||||
params.db = CommonParams.get('db');
|
||||
@ -672,7 +672,7 @@ function reload (callback = null, paths = null): void {
|
||||
}
|
||||
|
||||
function selectCurrentDatabase () {
|
||||
var $naviDbSelect = $('#navi_db_select');
|
||||
const $naviDbSelect = $('#navi_db_select');
|
||||
|
||||
if (! $naviDbSelect.length) {
|
||||
return false;
|
||||
@ -696,17 +696,17 @@ function selectCurrentDatabase () {
|
||||
* initiated the action of changing the page
|
||||
*/
|
||||
function treePagination ($this): void {
|
||||
var $msgbox = ajaxShowMessage();
|
||||
var isDbSelector = $this.closest('div.pageselector').is('.dbselector');
|
||||
var url = 'index.php?route=/navigation';
|
||||
var params = 'ajax_request=true';
|
||||
const $msgbox = ajaxShowMessage();
|
||||
const isDbSelector = $this.closest('div.pageselector').is('.dbselector');
|
||||
const url = 'index.php?route=/navigation';
|
||||
let params = 'ajax_request=true';
|
||||
if ($this[0].tagName === 'A') {
|
||||
params += CommonParams.get('arg_separator') + $this.getPostData();
|
||||
} else { // tagName === 'SELECT'
|
||||
params += CommonParams.get('arg_separator') + $this.closest('form').serialize();
|
||||
}
|
||||
|
||||
var searchClause = Navigation.FastFilter.getSearchClause();
|
||||
const searchClause = Navigation.FastFilter.getSearchClause();
|
||||
if (searchClause) {
|
||||
params += CommonParams.get('arg_separator') + 'searchClause=' + encodeURIComponent(searchClause);
|
||||
}
|
||||
@ -714,7 +714,7 @@ function treePagination ($this): void {
|
||||
if (isDbSelector) {
|
||||
params += CommonParams.get('arg_separator') + 'full=true';
|
||||
} else {
|
||||
var searchClause2 = Navigation.FastFilter.getSearchClause2($this);
|
||||
const searchClause2 = Navigation.FastFilter.getSearchClause2($this);
|
||||
if (searchClause2) {
|
||||
params += CommonParams.get('arg_separator') + 'searchClause2=' + encodeURIComponent(searchClause2);
|
||||
}
|
||||
@ -723,7 +723,7 @@ function treePagination ($this): void {
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success) {
|
||||
ajaxRemoveMessage($msgbox);
|
||||
var val;
|
||||
let val;
|
||||
if (isDbSelector) {
|
||||
val = Navigation.FastFilter.getSearchClause();
|
||||
$('#pma_navigation_tree')
|
||||
@ -737,7 +737,7 @@ function treePagination ($this): void {
|
||||
.val(val);
|
||||
}
|
||||
} else {
|
||||
var $parent = $this.closest('div.list_container').parent();
|
||||
const $parent = $this.closest('div.list_container').parent();
|
||||
val = Navigation.FastFilter.getSearchClause2($this);
|
||||
$this.closest('div.list_container').html(
|
||||
$(data.message).children().show()
|
||||
@ -786,15 +786,15 @@ const ResizeHandler = function () {
|
||||
* @param {number} position Navigation width in pixels
|
||||
*/
|
||||
this.setWidth = function (position): void {
|
||||
var pos = position;
|
||||
let pos = position;
|
||||
if (typeof pos !== 'number') {
|
||||
pos = 240;
|
||||
}
|
||||
|
||||
var $resizer = $('#pma_navigation_resizer');
|
||||
var resizerWidth = $resizer.width();
|
||||
var $collapser = $('#pma_navigation_collapser');
|
||||
var windowWidth = $(window).width();
|
||||
const $resizer = $('#pma_navigation_resizer');
|
||||
const resizerWidth = $resizer.width();
|
||||
const $collapser = $('#pma_navigation_collapser');
|
||||
const windowWidth = $(window).width();
|
||||
$('#pma_navigation').width(pos);
|
||||
$('body').css('margin-' + this.left, pos + 'px');
|
||||
// Issue #15127 : Adding fixed positioning to menubar
|
||||
@ -813,9 +813,9 @@ const ResizeHandler = function () {
|
||||
}, 2);
|
||||
|
||||
if (window.MutationObserver) {
|
||||
var target = document.getElementById('floating_menubar');
|
||||
const target = document.getElementById('floating_menubar');
|
||||
if (target) {
|
||||
var observer = new MutationObserver(function () {
|
||||
const observer = new MutationObserver(function () {
|
||||
$('body').css('padding-top', $('#floating_menubar').outerHeight(true));
|
||||
});
|
||||
observer.observe(target, { attributes: true, childList: true, subtree: true });
|
||||
@ -863,9 +863,9 @@ const ResizeHandler = function () {
|
||||
* @return {number} Navigation width in pixels
|
||||
*/
|
||||
this.getPos = function (event) {
|
||||
var pos = event.pageX;
|
||||
var windowWidth = $(window).width();
|
||||
var windowScroll = $(window).scrollLeft();
|
||||
let pos = event.pageX;
|
||||
const windowWidth = $(window).width();
|
||||
const windowScroll = $(window).scrollLeft();
|
||||
pos = pos - windowScroll;
|
||||
if (this.left !== 'left') {
|
||||
pos = windowWidth - event.pageX;
|
||||
@ -941,7 +941,7 @@ const ResizeHandler = function () {
|
||||
this.mousemove = function (event): void {
|
||||
event.preventDefault();
|
||||
if (event.data && event.data.resize_handler) {
|
||||
var pos = event.data.resize_handler.getPos(event);
|
||||
const pos = event.data.resize_handler.getPos(event);
|
||||
event.data.resize_handler.setWidth(pos);
|
||||
}
|
||||
};
|
||||
@ -953,8 +953,8 @@ const ResizeHandler = function () {
|
||||
*/
|
||||
this.collapse = function (event): void {
|
||||
event.preventDefault();
|
||||
var panelWidth = event.data.resize_handler.panelWidth;
|
||||
var width = $('#pma_navigation').width();
|
||||
let panelWidth = event.data.resize_handler.panelWidth;
|
||||
const width = $('#pma_navigation').width();
|
||||
if (width === 0 && panelWidth === 0) {
|
||||
panelWidth = 240;
|
||||
}
|
||||
@ -968,11 +968,11 @@ const ResizeHandler = function () {
|
||||
* Event handler for resizing the navigation tree height on window resize
|
||||
*/
|
||||
this.treeResize = function (): void {
|
||||
var $nav = $('#pma_navigation');
|
||||
var $navTree = $('#pma_navigation_tree');
|
||||
var $navHeader = $('#pma_navigation_header');
|
||||
var $navTreeContent = $('#pma_navigation_tree_content');
|
||||
var height = ($nav.height() - $navHeader.height());
|
||||
const $nav = $('#pma_navigation');
|
||||
const $navTree = $('#pma_navigation_tree');
|
||||
const $navHeader = $('#pma_navigation_header');
|
||||
const $navTreeContent = $('#pma_navigation_tree_content');
|
||||
let height = ($nav.height() - $navHeader.height());
|
||||
|
||||
height = height > 50 ? height : 800; // keep min. height
|
||||
$navTree.height(height);
|
||||
@ -1059,7 +1059,7 @@ const FastFilter = {
|
||||
*/
|
||||
this.timeout = null;
|
||||
|
||||
var $filterInput = $this.find('li.fast_filter input.searchClause');
|
||||
const $filterInput = $this.find('li.fast_filter input.searchClause');
|
||||
if ($filterInput.length !== 0 &&
|
||||
$filterInput.val() !== '' &&
|
||||
$filterInput.val() !== $filterInput[0].defaultValue
|
||||
@ -1073,8 +1073,8 @@ const FastFilter = {
|
||||
* @return {string}
|
||||
*/
|
||||
getSearchClause: function () {
|
||||
var retval = '';
|
||||
var $input = ($('#pma_navigation_tree').find('li.fast_filter.db_fast_filter input.searchClause') as JQuery<HTMLInputElement>);
|
||||
let retval = '';
|
||||
const $input = ($('#pma_navigation_tree').find('li.fast_filter.db_fast_filter input.searchClause') as JQuery<HTMLInputElement>);
|
||||
if ($input.length && $input.val() !== $input[0].defaultValue) {
|
||||
retval = ($input.val() as string);
|
||||
}
|
||||
@ -1090,8 +1090,8 @@ const FastFilter = {
|
||||
* @return {string}
|
||||
*/
|
||||
getSearchClause2: function ($this) {
|
||||
var $filterContainer = $this.closest('div.list_container');
|
||||
var $filterInput = $([]);
|
||||
const $filterContainer = $this.closest('div.list_container');
|
||||
let $filterInput = $([]);
|
||||
if ($filterContainer
|
||||
.find('li.fast_filter:not(.db_fast_filter) input.searchClause')
|
||||
.length !== 0) {
|
||||
@ -1099,7 +1099,7 @@ const FastFilter = {
|
||||
.find('li.fast_filter:not(.db_fast_filter) input.searchClause');
|
||||
}
|
||||
|
||||
var searchClause2 = '';
|
||||
let searchClause2 = '';
|
||||
if ($filterInput.length !== 0 &&
|
||||
$filterInput.first().val() !== $filterInput[0].defaultValue
|
||||
) {
|
||||
@ -1114,7 +1114,7 @@ const FastFilter = {
|
||||
*/
|
||||
events: {
|
||||
focus: function () {
|
||||
var $obj = $(this).closest('div.list_container');
|
||||
const $obj = $(this).closest('div.list_container');
|
||||
if (! $obj.data('fastFilter')) {
|
||||
$obj.data(
|
||||
'fastFilter',
|
||||
@ -1133,14 +1133,14 @@ const FastFilter = {
|
||||
$(this).val(this.defaultValue);
|
||||
}
|
||||
|
||||
var $obj = $(this).closest('div.list_container');
|
||||
const $obj = $(this).closest('div.list_container');
|
||||
if ($(this).val() === this.defaultValue && $obj.data('fastFilter')) {
|
||||
$obj.data('fastFilter').restore();
|
||||
}
|
||||
},
|
||||
keyup: function (event) {
|
||||
var $obj = $(this).closest('div.list_container');
|
||||
var str = '';
|
||||
const $obj = $(this).closest('div.list_container');
|
||||
let str = '';
|
||||
if ($(this).val() !== this.defaultValue && $(this).val() !== '') {
|
||||
$obj.find('div.pageselector').hide();
|
||||
str = ($(this).val() as string);
|
||||
@ -1150,9 +1150,7 @@ const FastFilter = {
|
||||
* FIXME at the server level a value match is done while on
|
||||
* the client side it is a regex match. These two should be aligned
|
||||
*/
|
||||
|
||||
// regex used for filtering.
|
||||
var regex;
|
||||
let regex;
|
||||
try {
|
||||
regex = new RegExp(str, 'i');
|
||||
} catch (err) {
|
||||
@ -1160,7 +1158,7 @@ const FastFilter = {
|
||||
}
|
||||
|
||||
// this is the div that houses the items to be filtered by this filter.
|
||||
var outerContainer;
|
||||
let outerContainer;
|
||||
if ($(this).closest('li.fast_filter').is('.db_fast_filter')) {
|
||||
outerContainer = $('#pma_navigation_tree_content');
|
||||
} else {
|
||||
@ -1170,7 +1168,7 @@ const FastFilter = {
|
||||
// filters items that are directly under the div as well as grouped in
|
||||
// groups. Does not filter child items (i.e. a database search does
|
||||
// not filter tables)
|
||||
var itemFilter = function ($curr) {
|
||||
const itemFilter = function ($curr) {
|
||||
$curr.children('ul').children('li.navGroup').each(function () {
|
||||
$(this).children('div.list_container').each(function () {
|
||||
itemFilter($(this)); // recursive
|
||||
@ -1189,9 +1187,9 @@ const FastFilter = {
|
||||
itemFilter(outerContainer);
|
||||
|
||||
// hides containers that does not have any visible children
|
||||
var containerFilter = function ($curr) {
|
||||
const containerFilter = function ($curr) {
|
||||
$curr.children('ul').children('li.navGroup').each(function () {
|
||||
var $group = $(this);
|
||||
const $group = $(this);
|
||||
$group.children('div.list_container').each(function () {
|
||||
containerFilter($(this)); // recursive
|
||||
});
|
||||
@ -1222,7 +1220,7 @@ const FastFilter = {
|
||||
}
|
||||
|
||||
// update filter state
|
||||
var filterName;
|
||||
let filterName;
|
||||
if ($(this).attr('name') === 'searchClause2') {
|
||||
filterName = $(this).siblings('input[name=aPath]').val();
|
||||
} else {
|
||||
@ -1234,12 +1232,12 @@ const FastFilter = {
|
||||
clear: function (event) {
|
||||
event.stopPropagation();
|
||||
// Clear the input and apply the fast filter with empty input
|
||||
var filter = $(this).closest('div.list_container').data('fastFilter');
|
||||
const filter = $(this).closest('div.list_container').data('fastFilter');
|
||||
if (filter) {
|
||||
filter.restore();
|
||||
}
|
||||
|
||||
var value = ($(this).prev()[0] as HTMLInputElement).defaultValue;
|
||||
const value = ($(this).prev()[0] as HTMLInputElement).defaultValue;
|
||||
$(this).prev().val(value).trigger('keyup');
|
||||
}
|
||||
}
|
||||
@ -1262,7 +1260,7 @@ FastFilter.Filter.prototype.update = function (searchClause): void {
|
||||
* Multiple calls to this function will always abort the previous request
|
||||
*/
|
||||
FastFilter.Filter.prototype.request = function (): void {
|
||||
var self = this;
|
||||
const self = this;
|
||||
if (self.$this.find('li.fast_filter').find('img.throbber').length === 0) {
|
||||
self.$this.find('li.fast_filter').append(
|
||||
$('<div class="throbber"></div>').append(
|
||||
@ -1278,10 +1276,10 @@ FastFilter.Filter.prototype.request = function (): void {
|
||||
self.xhr.abort();
|
||||
}
|
||||
|
||||
var params = self.$this.find('> ul > li > form.fast_filter').first().serialize();
|
||||
let params = self.$this.find('> ul > li > form.fast_filter').first().serialize();
|
||||
|
||||
if (self.$this.find('> ul > li > form.fast_filter').first().find('input[name=searchClause]').length === 0) {
|
||||
var $input = ($('#pma_navigation_tree').find('li.fast_filter.db_fast_filter input.searchClause') as JQuery<HTMLInputElement>);
|
||||
const $input = ($('#pma_navigation_tree').find('li.fast_filter.db_fast_filter input.searchClause') as JQuery<HTMLInputElement>);
|
||||
if ($input.length && $input.val() !== $input[0].defaultValue) {
|
||||
params += CommonParams.get('arg_separator') + 'searchClause=' + encodeURIComponent(($input.val() as string));
|
||||
}
|
||||
@ -1294,7 +1292,7 @@ FastFilter.Filter.prototype.request = function (): void {
|
||||
data: params,
|
||||
complete: function (jqXHR, status) {
|
||||
if (status !== 'abort') {
|
||||
var data = JSON.parse(jqXHR.responseText);
|
||||
const data = JSON.parse(jqXHR.responseText);
|
||||
self.$this.find('li.fast_filter').find('div.throbber').remove();
|
||||
if (data && data.results) {
|
||||
self.swap.apply(self, [data.message]);
|
||||
@ -1348,16 +1346,16 @@ FastFilter.Filter.prototype.restore = function (focus): void {
|
||||
function showFullName ($containerELem): void {
|
||||
$containerELem.find('.hover_show_full').on('mouseenter', function () {
|
||||
/** mouseenter */
|
||||
var $this = $(this);
|
||||
var thisOffset = $this.offset();
|
||||
const $this = $(this);
|
||||
const thisOffset = $this.offset();
|
||||
if ($this.text() === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
var $parent = $this.parent();
|
||||
const $parent = $this.parent();
|
||||
if (($parent.offset().left + $parent.outerWidth())
|
||||
< (thisOffset.left + $this.outerWidth())) {
|
||||
var $fullNameLayer = $('#full_name_layer');
|
||||
let $fullNameLayer = $('#full_name_layer');
|
||||
if ($fullNameLayer.length === 0) {
|
||||
$('body').append('<div id="full_name_layer" class="hide"></div>');
|
||||
$('#full_name_layer').on('mouseleave', function () {
|
||||
|
||||
@ -40,7 +40,7 @@ export default function onloadNavigation () {
|
||||
$(document).on('click', '#pma_navigation_tree a.expander', function (event) {
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
var $icon = $(this).find('img');
|
||||
const $icon = $(this).find('img');
|
||||
if ($icon.is('.ic_b_plus')) {
|
||||
Navigation.expandTreeNode($(this));
|
||||
} else {
|
||||
@ -56,7 +56,7 @@ export default function onloadNavigation () {
|
||||
event.preventDefault();
|
||||
|
||||
// Find the loading symbol and show it
|
||||
var $iconThrobberSrc = $('#pma_navigation').find('.throbber');
|
||||
const $iconThrobberSrc = $('#pma_navigation').find('.throbber');
|
||||
$iconThrobberSrc.show();
|
||||
// TODO Why is a loading symbol both hidden, and invisible?
|
||||
$iconThrobberSrc.css('visibility', '');
|
||||
@ -86,7 +86,7 @@ export default function onloadNavigation () {
|
||||
$(document).on('click', '#pma_navigation_collapse', function (event) {
|
||||
event.preventDefault();
|
||||
$('#pma_navigation_tree').find('a.expander').each(function () {
|
||||
var $icon = $(this).find('img');
|
||||
const $icon = $(this).find('img');
|
||||
if ($icon.is('.ic_b_minus')) {
|
||||
$(this).trigger('click');
|
||||
}
|
||||
@ -99,8 +99,8 @@ export default function onloadNavigation () {
|
||||
*/
|
||||
$(document).on('mouseenter', '#pma_navigation_sync', function (event) {
|
||||
event.preventDefault();
|
||||
var synced = $('#pma_navigation_tree').hasClass('synced');
|
||||
var $img = $('#pma_navigation_sync').children('img');
|
||||
const synced = $('#pma_navigation_tree').hasClass('synced');
|
||||
const $img = $('#pma_navigation_sync').children('img');
|
||||
if (synced) {
|
||||
$img.removeClass('ic_s_link').addClass('ic_s_unlink');
|
||||
} else {
|
||||
@ -114,8 +114,8 @@ export default function onloadNavigation () {
|
||||
*/
|
||||
$(document).on('mouseout', '#pma_navigation_sync', function (event) {
|
||||
event.preventDefault();
|
||||
var synced = $('#pma_navigation_tree').hasClass('synced');
|
||||
var $img = $('#pma_navigation_sync').children('img');
|
||||
const synced = $('#pma_navigation_tree').hasClass('synced');
|
||||
const $img = $('#pma_navigation_sync').children('img');
|
||||
if (synced) {
|
||||
$img.removeClass('ic_s_unlink').addClass('ic_s_link');
|
||||
} else {
|
||||
@ -129,8 +129,8 @@ export default function onloadNavigation () {
|
||||
*/
|
||||
$(document).on('click', '#pma_navigation_sync', function (event) {
|
||||
event.preventDefault();
|
||||
var synced = $('#pma_navigation_tree').hasClass('synced');
|
||||
var $img = $('#pma_navigation_sync').children('img');
|
||||
const synced = $('#pma_navigation_tree').hasClass('synced');
|
||||
const $img = $('#pma_navigation_sync').children('img');
|
||||
if (synced) {
|
||||
$img
|
||||
.removeClass('ic_s_unlink')
|
||||
@ -200,8 +200,8 @@ export default function onloadNavigation () {
|
||||
/** Hide navigation tree item */
|
||||
$(document).on('click', 'a.hideNavItem.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var argSep = CommonParams.get('arg_separator');
|
||||
var params = $(this).getPostData();
|
||||
const argSep = CommonParams.get('arg_separator');
|
||||
let params = $(this).getPostData();
|
||||
params += argSep + 'ajax_request=true' + argSep + 'server=' + CommonParams.get('server');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
@ -220,9 +220,9 @@ export default function onloadNavigation () {
|
||||
/** Display a dialog to choose hidden navigation items to show */
|
||||
$(document).on('click', 'a.showUnhide.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var $msg = ajaxShowMessage();
|
||||
var argSep = CommonParams.get('arg_separator');
|
||||
var params = $(this).getPostData();
|
||||
const $msg = ajaxShowMessage();
|
||||
const argSep = CommonParams.get('arg_separator');
|
||||
let params = $(this).getPostData();
|
||||
params += argSep + 'ajax_request=true';
|
||||
$.post($(this).attr('href'), params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
@ -238,10 +238,10 @@ export default function onloadNavigation () {
|
||||
/** Show a hidden navigation tree item */
|
||||
$(document).on('click', 'a.unhideNavItem.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var $tr = $(this).parents('tr');
|
||||
var $msg = ajaxShowMessage();
|
||||
var argSep = CommonParams.get('arg_separator');
|
||||
var params = $(this).getPostData();
|
||||
const $tr = $(this).parents('tr');
|
||||
const $msg = ajaxShowMessage();
|
||||
const argSep = CommonParams.get('arg_separator');
|
||||
let params = $(this).getPostData();
|
||||
params += argSep + 'ajax_request=true' + argSep + 'server=' + CommonParams.get('server');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
@ -262,9 +262,9 @@ export default function onloadNavigation () {
|
||||
// Add/Remove favorite table using Ajax.
|
||||
$(document).on('click', '.favorite_table_anchor', function (event) {
|
||||
event.preventDefault();
|
||||
var $self = $(this);
|
||||
const $self = $(this);
|
||||
if ($self.data('favtargetn') !== null) {
|
||||
var $dataFavTargets = $('a[data-favtargets="' + $self.data('favtargetn') + '"]');
|
||||
const $dataFavTargets = $('a[data-favtargets="' + $self.data('favtargetn') + '"]');
|
||||
if ($dataFavTargets.length > 0) {
|
||||
$dataFavTargets.trigger('click');
|
||||
|
||||
@ -272,7 +272,7 @@ export default function onloadNavigation () {
|
||||
}
|
||||
}
|
||||
|
||||
var hasLocalStorage = isStorageSupported('localStorage') &&
|
||||
const hasLocalStorage = isStorageSupported('localStorage') &&
|
||||
typeof window.localStorage.favoriteTables !== 'undefined';
|
||||
$.ajax({
|
||||
url: $self.attr('href'),
|
||||
@ -302,7 +302,7 @@ export default function onloadNavigation () {
|
||||
|
||||
// Check if session storage is supported
|
||||
if (isStorageSupported('sessionStorage')) {
|
||||
var storage = window.sessionStorage;
|
||||
const storage = window.sessionStorage;
|
||||
// remove tree from storage if Navi_panel config form is submitted
|
||||
$(document).on('submit', 'form.config-form', function () {
|
||||
storage.removeItem('navTreePaths');
|
||||
|
||||
@ -34,7 +34,7 @@ function showSettings (selector) {
|
||||
createPageSettingsModal();
|
||||
|
||||
// Keeping a clone to restore in case the user cancels the operation
|
||||
var $clone = $(selector + ' .page_settings').clone(true);
|
||||
const $clone = $(selector + ' .page_settings').clone(true);
|
||||
|
||||
$('#pageSettingsModalApplyButton').on('click', function () {
|
||||
$('.config-form').trigger('submit');
|
||||
|
||||
@ -377,16 +377,16 @@ function documentationAdd ($elm, params) {
|
||||
return;
|
||||
}
|
||||
|
||||
var url = window.sprintf(
|
||||
let url = window.sprintf(
|
||||
decodeURIComponent(window.mysqlDocTemplate),
|
||||
params[0]
|
||||
params[0],
|
||||
);
|
||||
if (params.length > 1) {
|
||||
// The # needs to be escaped to be part of the destination URL
|
||||
url += encodeURIComponent('#') + params[1];
|
||||
}
|
||||
|
||||
var content = $elm.text();
|
||||
const content = $elm.text();
|
||||
$elm.text('');
|
||||
$elm.append('<a target="mysql_doc" class="cm-sql-doc" href="' + url + '">' + content + '</a>');
|
||||
}
|
||||
@ -398,22 +398,22 @@ function documentationAdd ($elm, params) {
|
||||
* @param elm
|
||||
*/
|
||||
function documentationKeyword (idx, elm) {
|
||||
var $elm = $(elm);
|
||||
const $elm = $(elm);
|
||||
/* Skip already processed ones */
|
||||
if ($elm.find('a').length > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var keyword = $elm.text().toUpperCase();
|
||||
var $next = $elm.next('.cm-keyword');
|
||||
const keyword = $elm.text().toUpperCase();
|
||||
const $next = $elm.next('.cm-keyword');
|
||||
if ($next) {
|
||||
var nextKeyword = $next.text().toUpperCase();
|
||||
var full = keyword + ' ' + nextKeyword;
|
||||
const nextKeyword = $next.text().toUpperCase();
|
||||
const full = keyword + ' ' + nextKeyword;
|
||||
|
||||
var $next2 = $next.next('.cm-keyword');
|
||||
const $next2 = $next.next('.cm-keyword');
|
||||
if ($next2) {
|
||||
var next2Keyword = $next2.text().toUpperCase();
|
||||
var full2 = full + ' ' + next2Keyword;
|
||||
const next2Keyword = $next2.text().toUpperCase();
|
||||
const full2 = full + ' ' + next2Keyword;
|
||||
if (full2 in mysqlDocKeyword) {
|
||||
documentationAdd($elm, mysqlDocKeyword[full2]);
|
||||
documentationAdd($next, mysqlDocKeyword[full2]);
|
||||
@ -443,8 +443,8 @@ function documentationKeyword (idx, elm) {
|
||||
* @param elm
|
||||
*/
|
||||
function documentationBuiltin (idx, elm) {
|
||||
var $elm = $(elm);
|
||||
var builtin = $elm.text().toUpperCase();
|
||||
const $elm = $(elm);
|
||||
const builtin = $elm.text().toUpperCase();
|
||||
if (builtin in mysqlDocBuiltin) {
|
||||
documentationAdd($elm, mysqlDocBuiltin[builtin]);
|
||||
}
|
||||
@ -456,14 +456,14 @@ function documentationBuiltin (idx, elm) {
|
||||
* @param $base
|
||||
*/
|
||||
export default function highlightSql ($base) {
|
||||
var $elm = $base.find('code.sql');
|
||||
const $elm = $base.find('code.sql');
|
||||
$elm.each(function () {
|
||||
var $sql = $(this);
|
||||
var $pre = $sql.closest('pre');
|
||||
const $sql = $(this);
|
||||
const $pre = $sql.closest('pre');
|
||||
/* We only care about visible elements to avoid double processing */
|
||||
if ($sql.is(':visible')) {
|
||||
if (typeof window.CodeMirror !== 'undefined') {
|
||||
var $highlight = $('<div class="sql-highlight cm-s-default"></div>');
|
||||
const $highlight = $('<div class="sql-highlight cm-s-default"></div>');
|
||||
$pre.append($highlight);
|
||||
// @ts-ignore
|
||||
window.CodeMirror.runMode($sql.text(), 'text/x-mysql', $highlight[0]);
|
||||
|
||||
@ -13,9 +13,9 @@ import { ajaxShowMessage } from './modules/ajax-message.ts';
|
||||
|
||||
AJAX.registerOnload('multi_column_sort.js', function () {
|
||||
$('th.draggable.column_heading.pointer.marker a').on('click', function (event) {
|
||||
var orderUrlRemove = ($(this).parent().find('input[name="url-remove-order"]').val() as string);
|
||||
var orderUrlAdd = ($(this).parent().find('input[name="url-add-order"]').val() as string);
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
let orderUrlRemove = ($(this).parent().find('input[name="url-remove-order"]').val() as string);
|
||||
let orderUrlAdd = ($(this).parent().find('input[name="url-add-order"]').val() as string);
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
if (event.ctrlKey || event.altKey) {
|
||||
event.preventDefault();
|
||||
AJAX.source = $(this);
|
||||
|
||||
@ -16,10 +16,9 @@ import { escapeHtml, escapeJsString } from './modules/functions/escape.ts';
|
||||
* AJAX scripts for normalization
|
||||
*
|
||||
*/
|
||||
|
||||
var normalizeto = '1nf';
|
||||
var primaryKey;
|
||||
var dataParsed = null;
|
||||
let normalizeto = '1nf';
|
||||
let primaryKey;
|
||||
let dataParsed = null;
|
||||
|
||||
function appendHtmlColumnsList () {
|
||||
$.post(
|
||||
@ -39,7 +38,7 @@ function appendHtmlColumnsList () {
|
||||
}
|
||||
|
||||
function goTo3NFStep1 (newTables) {
|
||||
var tables = newTables;
|
||||
let tables = newTables;
|
||||
if (Object.keys(tables).length === 1) {
|
||||
tables = [CommonParams.get('table')];
|
||||
}
|
||||
@ -58,8 +57,8 @@ function goTo3NFStep1 (newTables) {
|
||||
$('#mainContent').find('p').html(data.subText);
|
||||
$('#mainContent').find('#extra').html(data.extra);
|
||||
$('#extra').find('form').each(function () {
|
||||
var formId = $(this).attr('id');
|
||||
var colName = $(this).data('colname');
|
||||
const formId = $(this).attr('id');
|
||||
const colName = $(this).data('colname');
|
||||
$('#' + formId + ' input[value=\'' + colName + '\']').next().remove();
|
||||
$('#' + formId + ' input[value=\'' + colName + '\']').remove();
|
||||
});
|
||||
@ -153,7 +152,7 @@ function goToStep4 () {
|
||||
$('#mainContent #extra').html(data.extra);
|
||||
$('#mainContent #newCols').html('');
|
||||
$('#mainContent .card-footer').html('');
|
||||
for (var pk in primaryKey) {
|
||||
for (let pk in primaryKey) {
|
||||
$('#extra input[value=\'' + escapeJsString(primaryKey[pk]) + '\']').attr('disabled', 'disabled');
|
||||
}
|
||||
}
|
||||
@ -186,7 +185,7 @@ function goToStep3 () {
|
||||
$('#mainContent #newCols').html('');
|
||||
$('#mainContent .card-footer').html('');
|
||||
primaryKey = JSON.parse(data.primary_key);
|
||||
for (var pk in primaryKey) {
|
||||
for (let pk in primaryKey) {
|
||||
$('#extra input[value=\'' + escapeJsString(primaryKey[pk]) + '\']').attr('disabled', 'disabled');
|
||||
}
|
||||
}
|
||||
@ -229,12 +228,12 @@ function goToStep2 (extra = undefined) {
|
||||
}
|
||||
|
||||
function goTo2NFFinish (pd) {
|
||||
var tables = {};
|
||||
for (var dependson in pd) {
|
||||
const tables = {};
|
||||
for (let dependson in pd) {
|
||||
tables[dependson] = $('#extra input[name="' + dependson + '"]').val();
|
||||
}
|
||||
|
||||
var datastring = {
|
||||
const datastring = {
|
||||
'ajax_request': true,
|
||||
'db': CommonParams.get('db'),
|
||||
'table': CommonParams.get('table'),
|
||||
@ -275,9 +274,9 @@ function goTo2NFFinish (pd) {
|
||||
}
|
||||
|
||||
function goTo3NFFinish (newTables) {
|
||||
for (var table in newTables) {
|
||||
for (var newtbl in newTables[table]) {
|
||||
var updatedname = ($('#extra input[name="' + newtbl + '"]').val() as string);
|
||||
for (let table in newTables) {
|
||||
for (let newtbl in newTables[table]) {
|
||||
const updatedname = ($('#extra input[name="' + newtbl + '"]').val() as string);
|
||||
newTables[table][updatedname] = newTables[table][newtbl];
|
||||
if (updatedname !== newtbl) {
|
||||
delete newTables[table][newtbl];
|
||||
@ -285,7 +284,7 @@ function goTo3NFFinish (newTables) {
|
||||
}
|
||||
}
|
||||
|
||||
var datastring = {
|
||||
const datastring = {
|
||||
'ajax_request': true,
|
||||
'db': CommonParams.get('db'),
|
||||
'server': CommonParams.get('server'),
|
||||
@ -316,16 +315,16 @@ function goTo3NFFinish (newTables) {
|
||||
});
|
||||
}
|
||||
|
||||
var backup = '';
|
||||
let backup = '';
|
||||
|
||||
function goTo2NFStep2 (pd, primaryKey) {
|
||||
$('#newCols').html('');
|
||||
$('#mainContent .card-header').html(window.Messages.strStep + ' 2.2 ' + window.Messages.strConfirmPd);
|
||||
$('#mainContent h4').html(window.Messages.strSelectedPd);
|
||||
$('#mainContent p').html(window.Messages.strPdHintNote);
|
||||
var extra = '<div class="dependencies_box">';
|
||||
var pdFound = false;
|
||||
for (var dependson in pd) {
|
||||
let extra = '<div class="dependencies_box">';
|
||||
let pdFound = false;
|
||||
for (let dependson in pd) {
|
||||
if (dependson !== primaryKey) {
|
||||
pdFound = true;
|
||||
extra += '<p class="d-block m-1">' + escapeHtml(dependson) + ' -> ' + escapeHtml(pd[dependson].toString()) + '</p>';
|
||||
@ -337,7 +336,7 @@ function goTo2NFStep2 (pd, primaryKey) {
|
||||
extra += '</div>';
|
||||
} else {
|
||||
extra += '</div>';
|
||||
var datastring = {
|
||||
const datastring = {
|
||||
'ajax_request': true,
|
||||
'db': CommonParams.get('db'),
|
||||
'table': CommonParams.get('table'),
|
||||
@ -371,11 +370,11 @@ function goTo3NFStep2 (pd, tablesTds) {
|
||||
$('#mainContent .card-header').html(window.Messages.strStep + ' 3.2 ' + window.Messages.strConfirmTd);
|
||||
$('#mainContent h4').html(window.Messages.strSelectedTd);
|
||||
$('#mainContent p').html(window.Messages.strPdHintNote);
|
||||
var extra = '<div class="dependencies_box">';
|
||||
var pdFound = false;
|
||||
for (var table in tablesTds) {
|
||||
for (var i in tablesTds[table]) {
|
||||
var dependson = tablesTds[table][i];
|
||||
let extra = '<div class="dependencies_box">';
|
||||
let pdFound = false;
|
||||
for (let table in tablesTds) {
|
||||
for (let i in tablesTds[table]) {
|
||||
const dependson = tablesTds[table][i];
|
||||
if (dependson !== '' && dependson !== table) {
|
||||
pdFound = true;
|
||||
extra += '<p class="d-block m-1">' + escapeHtml(dependson) + ' -> ' + escapeHtml(pd[dependson].toString()) + '</p>';
|
||||
@ -388,7 +387,7 @@ function goTo3NFStep2 (pd, tablesTds) {
|
||||
extra += '</div>';
|
||||
} else {
|
||||
extra += '</div>';
|
||||
var datastring = {
|
||||
const datastring = {
|
||||
'ajax_request': true,
|
||||
'db': CommonParams.get('db'),
|
||||
'tables': JSON.stringify(tablesTds),
|
||||
@ -423,13 +422,13 @@ function goTo3NFStep2 (pd, tablesTds) {
|
||||
}
|
||||
|
||||
function processDependencies (primaryKey, isTransitive = undefined) {
|
||||
var pk = primaryKey;
|
||||
var pd = {};
|
||||
var tablesTds = {};
|
||||
var dependsOn;
|
||||
let pk = primaryKey;
|
||||
const pd = {};
|
||||
const tablesTds = {};
|
||||
let dependsOn;
|
||||
pd[pk] = [];
|
||||
$('#extra form').each(function () {
|
||||
var tblname;
|
||||
let tblname;
|
||||
if (isTransitive === true) {
|
||||
tblname = $(this).data('tablename');
|
||||
pk = tblname;
|
||||
@ -440,7 +439,7 @@ function processDependencies (primaryKey, isTransitive = undefined) {
|
||||
tablesTds[tblname].push(pk);
|
||||
}
|
||||
|
||||
var formId = $(this).attr('id');
|
||||
const formId = $(this).attr('id');
|
||||
$('#' + formId + ' input[type=checkbox]:not(:checked)').prop('checked', false);
|
||||
dependsOn = '';
|
||||
$('#' + formId + ' input[type=checkbox]:checked').each(function () {
|
||||
@ -481,8 +480,8 @@ function processDependencies (primaryKey, isTransitive = undefined) {
|
||||
}
|
||||
|
||||
function moveRepeatingGroup (repeatingCols) {
|
||||
var newTable = $('input[name=repeatGroupTable]').val();
|
||||
var newColumn = $('input[name=repeatGroupColumn]').val();
|
||||
const newTable = $('input[name=repeatGroupTable]').val();
|
||||
const newColumn = $('input[name=repeatGroupColumn]').val();
|
||||
if (! newTable) {
|
||||
$('input[name=repeatGroupTable]').trigger('focus');
|
||||
|
||||
@ -495,7 +494,7 @@ function moveRepeatingGroup (repeatingCols) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var datastring = {
|
||||
const datastring = {
|
||||
'ajax_request': true,
|
||||
'db': CommonParams.get('db'),
|
||||
'table': CommonParams.get('table'),
|
||||
@ -503,7 +502,7 @@ function moveRepeatingGroup (repeatingCols) {
|
||||
'repeatingColumns': repeatingCols,
|
||||
'newTable': newTable,
|
||||
'newColumn': newColumn,
|
||||
'primary_columns': primaryKey.toString()
|
||||
'primary_columns': primaryKey.toString(),
|
||||
};
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
@ -541,7 +540,7 @@ AJAX.registerTeardown('normalization.js', function () {
|
||||
});
|
||||
|
||||
AJAX.registerOnload('normalization.js', function () {
|
||||
var selectedCol;
|
||||
let selectedCol;
|
||||
normalizeto = $('#mainContent').data('normalizeto');
|
||||
$('#extra').on('click', '#selectNonAtomicCol', function () {
|
||||
if ($(this).val() === 'no_such_col') {
|
||||
@ -556,7 +555,7 @@ AJAX.registerOnload('normalization.js', function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
var numField = $('#numField').val();
|
||||
const numField = $('#numField').val();
|
||||
$.post(
|
||||
'index.php?route=/normalization/create-new-column',
|
||||
{
|
||||
@ -608,8 +607,8 @@ AJAX.registerOnload('normalization.js', function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var datastring = $('#newCols :input').serialize();
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
let datastring = $('#newCols :input').serialize();
|
||||
datastring += argsep + 'ajax_request=1' + argsep + 'do_save_data=1' + argsep + 'field_where=last';
|
||||
$.post('index.php?route=/table/add-field', datastring, function (data) {
|
||||
if (data.success) {
|
||||
@ -689,8 +688,8 @@ AJAX.registerOnload('normalization.js', function () {
|
||||
});
|
||||
|
||||
$('#mainContent .card-footer').on('click', '#saveNewPrimary', function () {
|
||||
var datastring = $('#newCols :input').serialize();
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
let datastring = $('#newCols :input').serialize();
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
datastring += argsep + 'field_key[0]=primary_0' + argsep + 'ajax_request=1' + argsep + 'do_save_data=1' + argsep + 'field_where=last';
|
||||
$.post('index.php?route=/table/add-field', datastring, function (data) {
|
||||
if (data.success === true) {
|
||||
@ -709,7 +708,7 @@ AJAX.registerOnload('normalization.js', function () {
|
||||
});
|
||||
|
||||
$('#extra').on('click', '#removeRedundant', function () {
|
||||
var dropQuery = 'ALTER TABLE `' + CommonParams.get('table') + '` ';
|
||||
let dropQuery = 'ALTER TABLE `' + CommonParams.get('table') + '` ';
|
||||
$('#extra input[type=checkbox]:checked').each(function () {
|
||||
dropQuery += 'DROP `' + $(this).val() + '`, ';
|
||||
});
|
||||
@ -736,15 +735,15 @@ AJAX.registerOnload('normalization.js', function () {
|
||||
});
|
||||
|
||||
$('#extra').on('click', '#moveRepeatingGroup', function () {
|
||||
var repeatingCols = '';
|
||||
let repeatingCols = '';
|
||||
$('#extra input[type=checkbox]:checked').each(function () {
|
||||
repeatingCols += $(this).val() + ', ';
|
||||
});
|
||||
|
||||
if (repeatingCols !== '') {
|
||||
var newColName = ($('#extra input[type=checkbox]:checked').first().val() as string);
|
||||
const newColName = ($('#extra input[type=checkbox]:checked').first().val() as string);
|
||||
repeatingCols = repeatingCols.slice(0, -2);
|
||||
var confirmStr = window.sprintf(window.Messages.strMoveRepeatingGroup, escapeHtml(repeatingCols), escapeHtml(CommonParams.get('table')));
|
||||
let confirmStr = window.sprintf(window.Messages.strMoveRepeatingGroup, escapeHtml(repeatingCols), escapeHtml(CommonParams.get('table')));
|
||||
confirmStr += '<input type="text" name="repeatGroupTable" placeholder="' + window.Messages.strNewTablePlaceholder + '">' +
|
||||
'( ' + escapeHtml(primaryKey.toString()) + ', <input type="text" name="repeatGroupColumn" placeholder="' + window.Messages.strNewColumnPlaceholder + '" value="' + escapeHtml(newColName) + '">)' +
|
||||
'</ol>';
|
||||
@ -778,7 +777,7 @@ AJAX.registerOnload('normalization.js', function () {
|
||||
|
||||
$('#mainContent p').on('click', '#createPrimaryKey', function (event) {
|
||||
event.preventDefault();
|
||||
var url = {
|
||||
const url = {
|
||||
'create_index': 1,
|
||||
'server': CommonParams.get('server'),
|
||||
'db': CommonParams.get('db'),
|
||||
@ -786,9 +785,9 @@ AJAX.registerOnload('normalization.js', function () {
|
||||
'added_fields': 1,
|
||||
'add_fields': 1,
|
||||
'index': { 'Key_name': 'PRIMARY' },
|
||||
'ajax_request': true
|
||||
'ajax_request': true,
|
||||
};
|
||||
var title = window.Messages.strAddPrimaryKey;
|
||||
const title = window.Messages.strAddPrimaryKey;
|
||||
indexEditorDialog(url, title, function () {
|
||||
// on success
|
||||
$('.sqlqueryresults').remove();
|
||||
@ -838,13 +837,13 @@ AJAX.registerOnload('normalization.js', function () {
|
||||
});
|
||||
|
||||
$('#mainContent').on('click', '.pickPd', function () {
|
||||
var strColsLeft = $(this).next('.determinants').html();
|
||||
var colsLeft = strColsLeft.split(',');
|
||||
var strColsRight = $(this).next().next().html();
|
||||
var colsRight = strColsRight.split(',');
|
||||
for (var i in colsRight) {
|
||||
const strColsLeft = $(this).next('.determinants').html();
|
||||
const colsLeft = strColsLeft.split(',');
|
||||
const strColsRight = $(this).next().next().html();
|
||||
const colsRight = strColsRight.split(',');
|
||||
for (let i in colsRight) {
|
||||
$('form[data-colname="' + colsRight[i].trim() + '"] input[type="checkbox"]').prop('checked', false);
|
||||
for (var j in colsLeft) {
|
||||
for (let j in colsLeft) {
|
||||
$('form[data-colname="' + colsRight[i].trim() + '"] input[value="' + colsLeft[j].trim() + '"]').prop('checked', true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,14 +10,13 @@ import getJsConfirmCommonParam from './modules/functions/getJsConfirmCommonParam
|
||||
*
|
||||
* @requires jQueryUI
|
||||
*/
|
||||
|
||||
var randomServerId = Math.floor(Math.random() * 10000000);
|
||||
var confPrefix = 'server-id=' + randomServerId + '\nlog_bin=mysql-bin\nlog_error=mysql-bin.err\n';
|
||||
const randomServerId = Math.floor(Math.random() * 10000000);
|
||||
const confPrefix = 'server-id=' + randomServerId + '\nlog_bin=mysql-bin\nlog_error=mysql-bin.err\n';
|
||||
|
||||
function updateConfig () {
|
||||
var confIgnore = 'binlog_ignore_db=';
|
||||
var confDo = 'binlog_do_db=';
|
||||
var databaseList = '';
|
||||
const confIgnore = 'binlog_ignore_db=';
|
||||
const confDo = 'binlog_do_db=';
|
||||
let databaseList = '';
|
||||
|
||||
if ($('#db_select option:selected').length === 0) {
|
||||
$('#rep').text(confPrefix);
|
||||
@ -94,14 +93,14 @@ AJAX.registerOnload('replication.js', function () {
|
||||
|
||||
$('#reset_replica').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
var $anchor = $(this);
|
||||
var question = window.Messages.strResetReplicaWarning;
|
||||
const $anchor = $(this);
|
||||
const question = window.Messages.strResetReplicaWarning;
|
||||
$anchor.confirm(question, $anchor.attr('href'), function (url) {
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $anchor;
|
||||
var params = getJsConfirmCommonParam({
|
||||
const params = getJsConfirmCommonParam({
|
||||
'ajax_page_request': true,
|
||||
'ajax_request': true
|
||||
'ajax_request': true,
|
||||
}, $anchor.getPostData());
|
||||
$.post(url, params, AJAX.responseHandler);
|
||||
});
|
||||
|
||||
@ -18,12 +18,12 @@ const DropDatabases = {
|
||||
handleEvent: function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var $form = $(this);
|
||||
const $form = $(this);
|
||||
|
||||
/**
|
||||
* @var selected_dbs Array containing the names of the checked databases
|
||||
*/
|
||||
var selectedDbs = [];
|
||||
const selectedDbs = [];
|
||||
// loop over all checked checkboxes, except the .checkall_box checkbox
|
||||
$form.find('input:checkbox:checked:not(.checkall_box)').each(function () {
|
||||
$(this).closest('tr').addClass('removeMe');
|
||||
@ -44,7 +44,7 @@ const DropDatabases = {
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = window.Messages.strDropDatabaseStrongWarning + ' ' +
|
||||
const question = window.Messages.strDropDatabaseStrongWarning + ' ' +
|
||||
window.sprintf(window.Messages.strDoYouReally, selectedDbs.join('<br>'));
|
||||
|
||||
const modal = $('#dropDatabaseModal');
|
||||
@ -56,16 +56,16 @@ const DropDatabases = {
|
||||
$('#dropDatabaseModalDropButton').on('click', function () {
|
||||
ajaxShowMessage(window.Messages.strProcessingRequest, false);
|
||||
|
||||
var parts = url.split('?');
|
||||
var params = getJsConfirmCommonParam(this, parts[1]);
|
||||
const parts = url.split('?');
|
||||
const params = getJsConfirmCommonParam(this, parts[1]);
|
||||
|
||||
$.post(parts[0], params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
ajaxShowMessage(data.message);
|
||||
|
||||
var $rowsToRemove = $form.find('tr.removeMe');
|
||||
var $databasesCount = $('#filter-rows-count');
|
||||
var newCount = parseInt($databasesCount.text(), 10) - $rowsToRemove.length;
|
||||
const $rowsToRemove = $form.find('tr.removeMe');
|
||||
const $databasesCount = $('#filter-rows-count');
|
||||
const newCount = parseInt($databasesCount.text(), 10) - $rowsToRemove.length;
|
||||
$databasesCount.text(newCount);
|
||||
|
||||
$rowsToRemove.remove();
|
||||
@ -98,10 +98,10 @@ const CreateDatabase = {
|
||||
handleEvent: function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var $form = $(this);
|
||||
const $form = $(this);
|
||||
|
||||
// TODO Remove this section when all browsers support HTML5 "required" property
|
||||
var newDbNameInput = $form.find('input[name=new_db]');
|
||||
const newDbNameInput = $form.find('input[name=new_db]');
|
||||
if (newDbNameInput.val() === '') {
|
||||
newDbNameInput.trigger('focus');
|
||||
alert(window.Messages.strFormEmpty);
|
||||
@ -117,15 +117,15 @@ const CreateDatabase = {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
ajaxShowMessage(data.message);
|
||||
|
||||
var $databasesCountObject = $('#filter-rows-count');
|
||||
var databasesCount = parseInt($databasesCountObject.text(), 10) + 1;
|
||||
const $databasesCountObject = $('#filter-rows-count');
|
||||
const databasesCount = parseInt($databasesCountObject.text(), 10) + 1;
|
||||
$databasesCountObject.text(databasesCount);
|
||||
Navigation.reload();
|
||||
|
||||
// make ajax request to load db structure page - taken from ajax.js
|
||||
var dbStructUrl = data.url;
|
||||
let dbStructUrl = data.url;
|
||||
dbStructUrl = dbStructUrl.replace(/amp;/ig, '');
|
||||
var params = 'ajax_request=true' + CommonParams.get('arg_separator') + 'ajax_page_request=true';
|
||||
const params = 'ajax_request=true' + CommonParams.get('arg_separator') + 'ajax_page_request=true';
|
||||
$.get(dbStructUrl, params, AJAX.responseHandler);
|
||||
} else {
|
||||
ajaxShowMessage(data.error, false);
|
||||
|
||||
@ -5,7 +5,7 @@ import { AJAX } from '../modules/ajax.ts';
|
||||
* Make columns sortable, but only for tables with more than 1 data row.
|
||||
*/
|
||||
function makeColumnsSortable () {
|
||||
var $tables = $('#plugins_plugins table:has(tbody tr + tr)');
|
||||
const $tables = $('#plugins_plugins table:has(tbody tr + tr)');
|
||||
$tables.tablesorter({
|
||||
sortList: [[0, 0]],
|
||||
headers: {
|
||||
|
||||
@ -24,7 +24,7 @@ import getImageTag from '../modules/functions/getImageTag.ts';
|
||||
*/
|
||||
function exportPrivilegesModalHandler (data, msgbox) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
var modal = $('#exportPrivilegesModal');
|
||||
const modal = $('#exportPrivilegesModal');
|
||||
// Remove any previous privilege modal data, if any
|
||||
modal.find('.modal-body').first().html('');
|
||||
$('#exportPrivilegesModalLabel').first().html('Loading');
|
||||
@ -150,15 +150,15 @@ const AccountLocking = {
|
||||
*/
|
||||
const AddUserLoginCheckUsername = {
|
||||
handleEvent: function () {
|
||||
var username = $(this).val();
|
||||
var $warning = $('#user_exists_warning');
|
||||
const username = $(this).val();
|
||||
const $warning = $('#user_exists_warning');
|
||||
if ($('#select_pred_username').val() === 'userdefined' && username !== '') {
|
||||
var href = $('form[name=\'usersForm\']').attr('action');
|
||||
var params = {
|
||||
const href = $('form[name=\'usersForm\']').attr('action');
|
||||
const params = {
|
||||
'ajax_request': true,
|
||||
'server': CommonParams.get('server'),
|
||||
'validate_username': true,
|
||||
'username': username
|
||||
'username': username,
|
||||
};
|
||||
$.get(href, params, function (data) {
|
||||
if (data.user_exists) {
|
||||
@ -180,9 +180,9 @@ const AddUserLoginCheckUsername = {
|
||||
*/
|
||||
const PasswordStrength = {
|
||||
handleEvent: function () {
|
||||
var meterObj = $('#password_strength_meter');
|
||||
var meterObjLabel = $('#password_strength');
|
||||
var username = $('input[name="username"]');
|
||||
const meterObj = $('#password_strength_meter');
|
||||
const meterObjLabel = $('#password_strength');
|
||||
const username = $('input[name="username"]');
|
||||
checkPasswordStrength($(this).val(), meterObj, meterObjLabel, username.val());
|
||||
}
|
||||
};
|
||||
@ -205,8 +205,8 @@ const SwitchToUseTextField = {
|
||||
*/
|
||||
const ChangePasswordStrength = {
|
||||
handleEvent: function () {
|
||||
var meterObj = $('#change_password_strength_meter');
|
||||
var meterObjLabel = $('#change_password_strength');
|
||||
const meterObj = $('#change_password_strength_meter');
|
||||
const meterObjLabel = $('#change_password_strength');
|
||||
checkPasswordStrength($(this).val(), meterObj, meterObjLabel, CommonParams.get('user'));
|
||||
}
|
||||
};
|
||||
@ -218,7 +218,7 @@ const ChangePasswordStrength = {
|
||||
*/
|
||||
const ShowSha256PasswordNotice = {
|
||||
handleEvent: function () {
|
||||
var selectedPlugin = $(this).val();
|
||||
const selectedPlugin = $(this).val();
|
||||
if (selectedPlugin === 'sha256_password') {
|
||||
$('#ssl_reqd_warning').show();
|
||||
} else {
|
||||
@ -237,13 +237,13 @@ const RevokeUser = {
|
||||
handleEvent: function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var $thisButton = $(this);
|
||||
var $form = $('#usersForm');
|
||||
const $thisButton = $(this);
|
||||
const $form = $('#usersForm');
|
||||
|
||||
$thisButton.confirm(window.Messages.strDropUserWarning, $form.attr('action'), function (url) {
|
||||
var $dropUsersDbCheckbox = $('#dropUsersDbCheckbox');
|
||||
const $dropUsersDbCheckbox = $('#dropUsersDbCheckbox');
|
||||
if ($dropUsersDbCheckbox.is(':checked')) {
|
||||
var isConfirmed = confirm(window.Messages.strDropDatabaseStrongWarning + '\n' + window.sprintf(window.Messages.strDoYouReally, 'DROP DATABASE'));
|
||||
const isConfirmed = confirm(window.Messages.strDropDatabaseStrongWarning + '\n' + window.sprintf(window.Messages.strDoYouReally, 'DROP DATABASE'));
|
||||
if (! isConfirmed) {
|
||||
// Uncheck the drop users database checkbox
|
||||
$dropUsersDbCheckbox.prop('checked', false);
|
||||
@ -252,7 +252,7 @@ const RevokeUser = {
|
||||
|
||||
ajaxShowMessage(window.Messages.strRemovingSelectedUsers);
|
||||
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
$.post(url, $form.serialize() + argsep + 'delete=' + $thisButton.val() + argsep + 'ajax_request=true', function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
ajaxShowMessage(data.message);
|
||||
@ -264,7 +264,7 @@ const RevokeUser = {
|
||||
|
||||
// Remove the revoked user from the users list
|
||||
$form.find('input:checkbox:checked').parents('tr').slideUp('medium', function () {
|
||||
var thisUserInitial = ($(this).find('input:checkbox').val() as string).charAt(0).toUpperCase();
|
||||
const thisUserInitial = ($(this).find('input:checkbox').val() as string).charAt(0).toUpperCase();
|
||||
$(this).remove();
|
||||
|
||||
// If this is the last user with thisUserInitial, remove the link from #userAccountsPagination
|
||||
@ -313,11 +313,11 @@ const ExportPrivileges = {
|
||||
return;
|
||||
}
|
||||
|
||||
var msgbox = ajaxShowMessage();
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var serverId = CommonParams.get('server');
|
||||
var selectedUsers = $('#usersForm input[name*=\'selected_usr\']:checkbox').serialize();
|
||||
var postStr = selectedUsers + '&submit_mult=export' + argsep + 'ajax_request=true&server=' + serverId;
|
||||
const msgbox = ajaxShowMessage();
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
const serverId = CommonParams.get('server');
|
||||
const selectedUsers = $('#usersForm input[name*=\'selected_usr\']:checkbox').serialize();
|
||||
const postStr = selectedUsers + '&submit_mult=export' + argsep + 'ajax_request=true&server=' + serverId;
|
||||
|
||||
$.post($(this.form).prop('action'), postStr, function (data) {
|
||||
exportPrivilegesModalHandler(data, msgbox);
|
||||
@ -334,7 +334,7 @@ const ExportUser = {
|
||||
*/
|
||||
handleEvent: function (event) {
|
||||
event.preventDefault();
|
||||
var msgbox = ajaxShowMessage();
|
||||
const msgbox = ajaxShowMessage();
|
||||
$.get($(this).attr('href'), { 'ajax_request': true }, function (data) {
|
||||
exportPrivilegesModalHandler(data, msgbox);
|
||||
});
|
||||
@ -346,7 +346,7 @@ const ExportUser = {
|
||||
*/
|
||||
const SslTypeToggle = {
|
||||
handleEvent: function () {
|
||||
var $div = $('#specified_div');
|
||||
const $div = $('#specified_div');
|
||||
if ($('#ssl_type_SPECIFIED').is(':checked')) {
|
||||
$div.find('input').prop('disabled', false);
|
||||
} else {
|
||||
@ -360,7 +360,7 @@ const SslTypeToggle = {
|
||||
*/
|
||||
const SslPrivilegeToggle = {
|
||||
handleEvent: function () {
|
||||
var $div = $('#require_ssl_div');
|
||||
const $div = $('#require_ssl_div');
|
||||
if ($(this).is(':checked')) {
|
||||
$div.find('input').prop('disabled', false);
|
||||
$('#ssl_type_SPECIFIED').trigger('change');
|
||||
@ -374,15 +374,15 @@ const SslPrivilegeToggle = {
|
||||
* Create submenu for simpler interface
|
||||
*/
|
||||
function addOrUpdateSubmenu () {
|
||||
var $editUserDialog = $('#edit_user_dialog');
|
||||
const $editUserDialog = $('#edit_user_dialog');
|
||||
if ($editUserDialog.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $subNav = $('.nav-pills');
|
||||
var submenuLabel;
|
||||
var submenuLink;
|
||||
var linkNumber;
|
||||
let $subNav = $('.nav-pills');
|
||||
let submenuLabel;
|
||||
let submenuLink;
|
||||
let linkNumber;
|
||||
|
||||
// if submenu exists yet, remove it first
|
||||
if ($subNav.length > 0) {
|
||||
@ -444,7 +444,7 @@ const SelectAllPrivileges = {
|
||||
*/
|
||||
handleEvent: function (event) {
|
||||
const method = event.target.getAttribute('data-select-target');
|
||||
var options = $(method).first().children();
|
||||
const options = $(method).first().children();
|
||||
options.each(function (_, obj: HTMLOptionElement) {
|
||||
obj.selected = true;
|
||||
});
|
||||
@ -452,7 +452,7 @@ const SelectAllPrivileges = {
|
||||
};
|
||||
|
||||
function setMaxWidth () {
|
||||
var windowWidth = $(window).width();
|
||||
const windowWidth = $(window).width();
|
||||
$('.jsresponsive').css('max-width', (windowWidth - 35) + 'px');
|
||||
}
|
||||
|
||||
|
||||
@ -16,13 +16,13 @@ import chartByteFormatter from '../../modules/functions/chartByteFormatter.ts';
|
||||
* @requires jQueryUI
|
||||
*/
|
||||
|
||||
var runtime: { [k: string]: any } = {};
|
||||
var serverTimeDiff;
|
||||
var serverOs;
|
||||
var isSuperUser;
|
||||
var serverDbIsLocal;
|
||||
var chartSize;
|
||||
var monitorSettings;
|
||||
let runtime: { [k: string]: any } = {};
|
||||
let serverTimeDiff;
|
||||
let serverOs;
|
||||
let isSuperUser;
|
||||
let serverDbIsLocal;
|
||||
let chartSize;
|
||||
let monitorSettings;
|
||||
|
||||
function serverResponseError () {
|
||||
bootstrap.Modal.getOrCreateInstance('#serverResponseErrorModal').show();
|
||||
@ -65,7 +65,7 @@ function destroyGrid () {
|
||||
}
|
||||
|
||||
AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
var $jsDataForm = $('#js_data');
|
||||
const $jsDataForm = $('#js_data');
|
||||
serverTimeDiff = new Date().getTime() - Number($jsDataForm.find('input[name=server_time]').val());
|
||||
serverOs = $jsDataForm.find('input[name=server_os]').val();
|
||||
isSuperUser = $jsDataForm.find('input[name=is_superuser]').val();
|
||||
@ -121,7 +121,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
$('#loadingMonitorIcon').remove();
|
||||
// Codemirror is loaded on demand so we might need to initialize it
|
||||
if (! window.codeMirrorEditor) {
|
||||
var $elm = ($('#sqlquery') as JQuery<HTMLTextAreaElement>);
|
||||
const $elm = ($('#sqlquery') as JQuery<HTMLTextAreaElement>);
|
||||
if ($elm.length > 0 && typeof window.CodeMirror !== 'undefined') {
|
||||
window.codeMirrorEditor = window.CodeMirror.fromTextArea(
|
||||
$elm[0],
|
||||
@ -145,16 +145,16 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
/** ** Monitor charting implementation ****/
|
||||
/* Saves the previous ajax response for differential values */
|
||||
var oldChartData = null;
|
||||
let oldChartData = null;
|
||||
// Holds about to be created chart
|
||||
var newChart = null;
|
||||
var chartSpacing;
|
||||
let newChart = null;
|
||||
let chartSpacing;
|
||||
|
||||
// Whenever the monitor object (runtime.charts) or the settings object
|
||||
// (monitorSettings) changes in a way incompatible to the previous version,
|
||||
// increase this number. It will reset the users monitor and settings object
|
||||
// in their localStorage to the default configuration
|
||||
var monitorProtocolVersion = '1.0';
|
||||
const monitorProtocolVersion = '1.0';
|
||||
|
||||
// Runtime parameter of the monitor, is being fully set in initGrid()
|
||||
runtime = {
|
||||
@ -180,58 +180,58 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
monitorSettings = null;
|
||||
|
||||
var defaultMonitorSettings = {
|
||||
const defaultMonitorSettings = {
|
||||
columns: 3,
|
||||
chartSize: { width: 295, height: 250 },
|
||||
// Max points in each chart. Settings it to 'auto' sets
|
||||
// gridMaxPoints to (chartwidth - 40) / 12
|
||||
gridMaxPoints: 'auto',
|
||||
/* Refresh rate of all grid charts in ms */
|
||||
gridRefresh: 5000
|
||||
gridRefresh: 5000,
|
||||
};
|
||||
|
||||
// Allows drag and drop rearrange and print/edit icons on charts
|
||||
var editMode = false;
|
||||
let editMode = false;
|
||||
|
||||
/* List of preconfigured charts that the user may select */
|
||||
var presetCharts: { [p: string]: any } = {
|
||||
const presetCharts: { [p: string]: any } = {
|
||||
// Query cache efficiency
|
||||
'qce': {
|
||||
title: window.Messages.strQueryCacheEfficiency,
|
||||
series: [
|
||||
{
|
||||
label: window.Messages.strQueryCacheEfficiency
|
||||
}
|
||||
label: window.Messages.strQueryCacheEfficiency,
|
||||
},
|
||||
],
|
||||
nodes: [
|
||||
{
|
||||
dataPoints: [{ type: 'statusvar', name: 'Qcache_hits' }, { type: 'statusvar', name: 'Com_select' }],
|
||||
transformFn: 'qce'
|
||||
}
|
||||
transformFn: 'qce',
|
||||
},
|
||||
],
|
||||
maxYLabel: 0
|
||||
maxYLabel: 0,
|
||||
},
|
||||
// Query cache usage
|
||||
'qcu': {
|
||||
title: window.Messages.strQueryCacheUsage,
|
||||
series: [
|
||||
{
|
||||
label: window.Messages.strQueryCacheUsed
|
||||
}
|
||||
label: window.Messages.strQueryCacheUsed,
|
||||
},
|
||||
],
|
||||
nodes: [
|
||||
{
|
||||
dataPoints: [
|
||||
{ type: 'statusvar', name: 'Qcache_free_memory' }, {
|
||||
type: 'servervar',
|
||||
name: 'query_cache_size'
|
||||
}
|
||||
name: 'query_cache_size',
|
||||
},
|
||||
],
|
||||
transformFn: 'qcu'
|
||||
}
|
||||
transformFn: 'qcu',
|
||||
},
|
||||
],
|
||||
maxYLabel: 0
|
||||
}
|
||||
maxYLabel: 0,
|
||||
},
|
||||
};
|
||||
|
||||
/* Add OS specific system info charts to the preset chart list */
|
||||
@ -385,45 +385,45 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
}
|
||||
|
||||
// Default setting for the chart grid
|
||||
var defaultChartGrid: { [p: string]: any } = {
|
||||
const defaultChartGrid: { [p: string]: any } = {
|
||||
'c0': {
|
||||
title: window.Messages.strQuestions,
|
||||
series: [{ label: window.Messages.strQuestions }],
|
||||
nodes: [{ dataPoints: [{ type: 'statusvar', name: 'Questions' }], display: 'differential' }],
|
||||
maxYLabel: 0
|
||||
maxYLabel: 0,
|
||||
},
|
||||
'c1': {
|
||||
title: window.Messages.strChartConnectionsTitle,
|
||||
series: [
|
||||
{ label: window.Messages.strConnections },
|
||||
{ label: window.Messages.strProcesses }
|
||||
{ label: window.Messages.strProcesses },
|
||||
],
|
||||
nodes: [
|
||||
{ dataPoints: [{ type: 'statusvar', name: 'Connections' }], display: 'differential' },
|
||||
{ dataPoints: [{ type: 'proc', name: 'processes' }] }
|
||||
{ dataPoints: [{ type: 'proc', name: 'processes' }] },
|
||||
],
|
||||
maxYLabel: 0
|
||||
maxYLabel: 0,
|
||||
},
|
||||
'c2': {
|
||||
title: window.Messages.strTraffic,
|
||||
series: [
|
||||
{ label: window.Messages.strBytesSent },
|
||||
{ label: window.Messages.strBytesReceived }
|
||||
{ label: window.Messages.strBytesReceived },
|
||||
],
|
||||
nodes: [
|
||||
{
|
||||
dataPoints: [{ type: 'statusvar', name: 'Bytes_sent' }],
|
||||
display: 'differential',
|
||||
valueDivisor: 1024
|
||||
valueDivisor: 1024,
|
||||
},
|
||||
{
|
||||
dataPoints: [{ type: 'statusvar', name: 'Bytes_received' }],
|
||||
display: 'differential',
|
||||
valueDivisor: 1024
|
||||
}
|
||||
valueDivisor: 1024,
|
||||
},
|
||||
],
|
||||
maxYLabel: 0
|
||||
}
|
||||
maxYLabel: 0,
|
||||
},
|
||||
};
|
||||
|
||||
// Server is localhost => We can add cpu/memory/swap to the default chart
|
||||
@ -475,10 +475,10 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
});
|
||||
|
||||
/* Reorder all charts that it fills all column cells */
|
||||
var numColumns;
|
||||
var $tr = $('#chartGrid').find('tr').first();
|
||||
let numColumns;
|
||||
let $tr = $('#chartGrid').find('tr').first();
|
||||
|
||||
var tempManageCols = function () {
|
||||
const tempManageCols = function () {
|
||||
if (numColumns > monitorSettings.columns) {
|
||||
if ($tr.next().length === 0) {
|
||||
$tr.after('<tr></tr>');
|
||||
@ -490,7 +490,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
numColumns++;
|
||||
};
|
||||
|
||||
var tempAddCol = function () {
|
||||
const tempAddCol = function () {
|
||||
if ($(this).next().length !== 0) {
|
||||
$(this).append($(this).next().find('td').first());
|
||||
}
|
||||
@ -504,8 +504,8 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
// To little cells in one row => for each cell to little,
|
||||
// move all cells backwards by 1
|
||||
if ($tr.next().length > 0) {
|
||||
var cnt = monitorSettings.columns - $tr.find('td').length;
|
||||
for (var i = 0; i < cnt; i++) {
|
||||
const cnt = monitorSettings.columns - $tr.find('td').length;
|
||||
for (let i = 0; i < cnt; i++) {
|
||||
$tr.append($tr.next().find('td').first());
|
||||
$tr.nextAll().each(tempAddCol);
|
||||
}
|
||||
@ -547,7 +547,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
$('#monitorAddNewChartButton').on('click', function (event) {
|
||||
$('#addChartButton').on('click', function () {
|
||||
var type = $('input[name="chartType"]:checked').val();
|
||||
const type = $('input[name="chartType"]:checked').val();
|
||||
|
||||
if (type === 'preset') {
|
||||
newChart = presetCharts[$('#addChartModal').find('select[name="presetCharts"]').prop('value')];
|
||||
@ -582,7 +582,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
$('#addChartButton').off('click');
|
||||
});
|
||||
|
||||
var $presetList = $('#addChartModal').find('select[name="presetCharts"]');
|
||||
const $presetList = $('#addChartModal').find('select[name="presetCharts"]');
|
||||
if ($presetList.html().length === 0) {
|
||||
$.each(presetCharts, function (key, value) {
|
||||
$presetList.append('<option value="' + key + '">' + value.title + '</option>');
|
||||
@ -621,7 +621,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
});
|
||||
|
||||
$('#monitorExportConfigButton').on('click', function () {
|
||||
var gridCopy = {};
|
||||
const gridCopy = {};
|
||||
$.each(runtime.charts, function (key, elem) {
|
||||
gridCopy[key] = {};
|
||||
gridCopy[key].nodes = elem.nodes;
|
||||
@ -631,14 +631,14 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
gridCopy[key].maxYLabel = elem.maxYLabel;
|
||||
});
|
||||
|
||||
var exportData = {
|
||||
const exportData = {
|
||||
monitorCharts: gridCopy,
|
||||
monitorSettings: monitorSettings
|
||||
monitorSettings: monitorSettings,
|
||||
};
|
||||
|
||||
var blob = new Blob([JSON.stringify(exportData)], { type: 'application/octet-stream' });
|
||||
var url = null;
|
||||
var fileName = 'monitor-config.json';
|
||||
let blob = new Blob([JSON.stringify(exportData)], { type: 'application/octet-stream' });
|
||||
let url = null;
|
||||
const fileName = 'monitor-config.json';
|
||||
// @ts-ignore
|
||||
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
|
||||
// @ts-ignore
|
||||
@ -660,16 +660,16 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
});
|
||||
|
||||
function monitorImportConfigImportEventHandler () {
|
||||
var input = ($('#monitorImportConfigModal').find('#import_file') as JQuery<HTMLInputElement>)[0];
|
||||
var reader = new FileReader();
|
||||
const input = ($('#monitorImportConfigModal').find('#import_file') as JQuery<HTMLInputElement>)[0];
|
||||
const reader = new FileReader();
|
||||
|
||||
reader.onerror = function (event) {
|
||||
alert(window.Messages.strFailedParsingConfig + '\n' + event.target.error.code);
|
||||
};
|
||||
|
||||
reader.onload = function (e) {
|
||||
var data = (e.target.result as string);
|
||||
var json = null;
|
||||
const data = (e.target.result as string);
|
||||
let json = null;
|
||||
// Try loading config
|
||||
try {
|
||||
json = JSON.parse(data);
|
||||
@ -752,7 +752,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
const $dialog = $('#monitorInstructionsModal');
|
||||
|
||||
function loadLogVars (getvars = undefined) {
|
||||
var vars = {
|
||||
const vars = {
|
||||
'ajax_request': true,
|
||||
'server': CommonParams.get('server'),
|
||||
};
|
||||
@ -762,7 +762,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
$.post('index.php?route=/server/status/monitor/log-vars', vars,
|
||||
function (data) {
|
||||
var logVars;
|
||||
let logVars;
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
logVars = data.message;
|
||||
} else {
|
||||
@ -772,9 +772,9 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
return;
|
||||
}
|
||||
|
||||
var icon = getImageTag('s_success');
|
||||
var msg = '';
|
||||
var str = '';
|
||||
let icon = getImageTag('s_success');
|
||||
let msg = '';
|
||||
let str = '';
|
||||
|
||||
if (logVars.general_log === 'ON') {
|
||||
if (logVars.slow_query_log === 'ON') {
|
||||
@ -823,7 +823,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
str += '<div class="smallIndent">';
|
||||
str += window.Messages.strSettingsAppliedGlobal + '<br>';
|
||||
|
||||
var varValue: string | number = 'TABLE';
|
||||
let varValue: string | number = 'TABLE';
|
||||
if (logVars.log_output === 'TABLE') {
|
||||
varValue = 'FILE';
|
||||
}
|
||||
@ -873,7 +873,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
$dialog.find('div.ajaxContent').html(str);
|
||||
$dialog.find('img.ajaxIcon').hide();
|
||||
$dialog.find('a.set').on('click', function () {
|
||||
var nameValue = $(this).attr('href').split('-');
|
||||
const nameValue = $(this).attr('href').split('-');
|
||||
loadLogVars({ varName: nameValue[0].substring(1), varValue: nameValue[1] });
|
||||
$dialog.find('img.ajaxIcon').show();
|
||||
});
|
||||
@ -888,7 +888,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
($('input[name="chartType"]') as JQuery<HTMLInputElement>).on('change', function () {
|
||||
$('#chartVariableSettings').toggle(this.checked && this.value === 'variable');
|
||||
var title = $('input[name="chartTitle"]').val();
|
||||
const title = $('input[name="chartTitle"]').val();
|
||||
if (title === window.Messages.strChartTitle ||
|
||||
title === $('label[for="' + $('input[name="chartTitle"]').data('lastRadio') + '"]').text()
|
||||
) {
|
||||
@ -956,9 +956,9 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
};
|
||||
}
|
||||
|
||||
var serie: { [p: string]: any } = {
|
||||
const serie: { [p: string]: any } = {
|
||||
dataPoints: [{ type: 'statusvar', name: $('#variableInput').val() }],
|
||||
display: $('input[name="differentialValue"]').prop('checked') ? 'differential' : ''
|
||||
display: $('input[name="differentialValue"]').prop('checked') ? 'differential' : '',
|
||||
};
|
||||
|
||||
if (serie.dataPoints[0].name === 'Processes') {
|
||||
@ -973,12 +973,12 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
serie.unit = $('input[name="valueUnit"]').val();
|
||||
}
|
||||
|
||||
var str = serie.display === 'differential' ? ', ' + window.Messages.strDifferential : '';
|
||||
let str = serie.display === 'differential' ? ', ' + window.Messages.strDifferential : '';
|
||||
str += serie.valueDivisor ? (', ' + window.sprintf(window.Messages.strDividedBy, serie.valueDivisor)) : '';
|
||||
str += serie.unit ? (', ' + window.Messages.strUnit + ': ' + serie.unit) : '';
|
||||
|
||||
var newSeries = {
|
||||
label: ($('#variableInput').val() as string).replace(/_/g, ' ')
|
||||
const newSeries = {
|
||||
label: ($('#variableInput').val() as string).replace(/_/g, ' '),
|
||||
};
|
||||
newChart.series.push(newSeries);
|
||||
$('#seriesPreview').append('- ' + escapeHtml(newSeries.label + str) + '<br>');
|
||||
@ -1002,7 +1002,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
/* Initializes the monitor, called only once */
|
||||
function initGrid () {
|
||||
var i;
|
||||
let i;
|
||||
|
||||
/* Apply default values & config */
|
||||
if (isStorageSupported('localStorage')) {
|
||||
@ -1056,7 +1056,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
$('#chartGrid').html('');
|
||||
|
||||
/* Add all charts - in correct order */
|
||||
var keys = [];
|
||||
const keys = [];
|
||||
$.each(runtime.charts, function (key) {
|
||||
keys.push(key);
|
||||
});
|
||||
@ -1067,8 +1067,8 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
}
|
||||
|
||||
/* Fill in missing cells */
|
||||
var numCharts = $('#chartGrid').find('.monitorChart').length;
|
||||
var numMissingCells = (monitorSettings.columns - numCharts % monitorSettings.columns) % monitorSettings.columns;
|
||||
const numCharts = $('#chartGrid').find('.monitorChart').length;
|
||||
const numMissingCells = (monitorSettings.columns - numCharts % monitorSettings.columns) % monitorSettings.columns;
|
||||
for (i = 0; i < numMissingCells; i++) {
|
||||
$('#chartGrid').find('tr').last().append('<td></td>');
|
||||
}
|
||||
@ -1084,13 +1084,17 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
/* Calls destroyGrid() and initGrid(), but before doing so it saves the chart
|
||||
* data from each chart and restores it after the monitor is initialized again */
|
||||
function rebuildGrid () {
|
||||
var oldData = null;
|
||||
let oldData = null;
|
||||
if (runtime.charts) {
|
||||
oldData = {};
|
||||
$.each(runtime.charts, function (key, chartObj) {
|
||||
for (var i = 0, l = chartObj.nodes.length; i < l; i++) {
|
||||
let i = 0;
|
||||
const l = chartObj.nodes.length;
|
||||
for (; i < l; i++) {
|
||||
oldData[chartObj.nodes[i].dataPoint] = [];
|
||||
for (var j = 0, ll = chartObj.chart.data.datasets[i].data.length; j < ll; j++) {
|
||||
let j = 0;
|
||||
const ll = chartObj.chart.data.datasets[i].data.length;
|
||||
for (; j < ll; j++) {
|
||||
oldData[chartObj.nodes[i].dataPoint].push([chartObj.chart.data.datasets[i].data[j].x, chartObj.chart.data.datasets[i].data[j].y]);
|
||||
}
|
||||
}
|
||||
@ -1103,15 +1107,15 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
/* Calculates the dynamic chart size that depends on the column width */
|
||||
function calculateChartSize () {
|
||||
var panelWidth;
|
||||
let panelWidth;
|
||||
if ($('body').height() > $(window).height()) { // has vertical scroll bar
|
||||
panelWidth = $('#logTable').innerWidth();
|
||||
} else {
|
||||
panelWidth = $('#logTable').innerWidth() - 10; // leave some space for vertical scroll bar
|
||||
}
|
||||
|
||||
var wdt = panelWidth;
|
||||
var windowWidth = $(window).width();
|
||||
let wdt = panelWidth;
|
||||
const windowWidth = $(window).width();
|
||||
|
||||
if (windowWidth > 768) {
|
||||
wdt = (panelWidth - monitorSettings.columns * Math.abs(chartSpacing.width)) / monitorSettings.columns;
|
||||
@ -1125,42 +1129,42 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
/* Adds a chart to the chart grid */
|
||||
function addChart (chartObj, initialize = undefined) {
|
||||
var i;
|
||||
var settings: { [p: string]: any } = {
|
||||
let i;
|
||||
const settings: { [p: string]: any } = {
|
||||
title: escapeHtml(chartObj.title),
|
||||
grid: {
|
||||
drawBorder: false,
|
||||
shadow: false,
|
||||
background: 'rgba(0,0,0,0)'
|
||||
background: 'rgba(0,0,0,0)',
|
||||
},
|
||||
axes: {
|
||||
xaxis: {
|
||||
tickOptions: {
|
||||
formatString: '%H:%M:%S',
|
||||
showGridline: false
|
||||
showGridline: false,
|
||||
},
|
||||
min: runtime.xmin,
|
||||
max: runtime.xmax
|
||||
max: runtime.xmax,
|
||||
},
|
||||
yaxis: {
|
||||
min: 0,
|
||||
max: 100,
|
||||
tickInterval: 20
|
||||
}
|
||||
tickInterval: 20,
|
||||
},
|
||||
},
|
||||
seriesDefaults: {
|
||||
rendererOptions: {
|
||||
smooth: true
|
||||
smooth: true,
|
||||
},
|
||||
showLine: true,
|
||||
lineWidth: 2,
|
||||
markerOptions: {
|
||||
size: 6
|
||||
}
|
||||
size: 6,
|
||||
},
|
||||
},
|
||||
highlighter: {
|
||||
show: true
|
||||
}
|
||||
show: true,
|
||||
},
|
||||
};
|
||||
|
||||
if (settings.title === window.Messages.strSystemCPUUsage ||
|
||||
@ -1199,7 +1203,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
settings.series = chartObj.series;
|
||||
|
||||
if ($('#' + 'gridChartCanvas' + runtime.chartAI).length === 0) {
|
||||
var numCharts = $('#chartGrid').find('.monitorChart').length;
|
||||
const numCharts = $('#chartGrid').find('.monitorChart').length;
|
||||
|
||||
if (numCharts === 0 || (numCharts % monitorSettings.columns === 0)) {
|
||||
$('#chartGrid').append('<tr></tr>');
|
||||
@ -1219,18 +1223,18 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
// Set series' data as [0,0], smooth lines won't plot with data array having null values.
|
||||
// also chart won't plot initially with no data and data comes on refreshChartGrid()
|
||||
var series = [];
|
||||
const series = [];
|
||||
for (i in chartObj.series) {
|
||||
series.push([[0, 0]]);
|
||||
}
|
||||
|
||||
var tempTooltipContentEditor = function (str, seriesIndex, pointIndex, plot) {
|
||||
var j;
|
||||
const tempTooltipContentEditor = function (str, seriesIndex, pointIndex, plot) {
|
||||
let j;
|
||||
// TODO: move style to theme CSS
|
||||
var tooltipHtml = '<div id="tooltip_editor">';
|
||||
let tooltipHtml = '<div id="tooltip_editor">';
|
||||
// x value i.e. time
|
||||
var timeValue = str.split(',')[0];
|
||||
var seriesValue;
|
||||
const timeValue = str.split(',')[0];
|
||||
let seriesValue;
|
||||
tooltipHtml += 'Time: ' + timeValue;
|
||||
tooltipHtml += '<span id="tooltip_font">';
|
||||
// Add y values to the tooltip per series
|
||||
@ -1242,8 +1246,8 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
return;
|
||||
}
|
||||
|
||||
var seriesLabel = plot.series[j].label;
|
||||
var seriesColor = plot.series[j].color;
|
||||
const seriesLabel = plot.series[j].label;
|
||||
const seriesColor = plot.series[j].color;
|
||||
// format y value
|
||||
if (plot.series[0]._yaxis.tickOptions.formatter) { // eslint-disable-line no-underscore-dangle
|
||||
// using formatter function
|
||||
@ -1405,8 +1409,8 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
}
|
||||
|
||||
function loadLog (type: string, min: Date, max: Date) {
|
||||
var dateStart = Date.parse($('#logAnalyseDialog').find('input[name="dateStart"]').datepicker('getDate').toString()) || min;
|
||||
var dateEnd = Date.parse($('#logAnalyseDialog').find('input[name="dateEnd"]').datepicker('getDate').toString()) || max;
|
||||
const dateStart = Date.parse($('#logAnalyseDialog').find('input[name="dateStart"]').datepicker('getDate').toString()) || min;
|
||||
const dateEnd = Date.parse($('#logAnalyseDialog').find('input[name="dateEnd"]').datepicker('getDate').toString()) || max;
|
||||
|
||||
loadLogStatistics({
|
||||
src: type,
|
||||
@ -1425,7 +1429,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
'requiredData': JSON.stringify(runtime.dataList),
|
||||
'server': CommonParams.get('server')
|
||||
}, function (data) {
|
||||
var chartData;
|
||||
let chartData;
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
chartData = data.message;
|
||||
} else {
|
||||
@ -1434,14 +1438,14 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
return;
|
||||
}
|
||||
|
||||
var value;
|
||||
var i = 0;
|
||||
var diff;
|
||||
var total;
|
||||
let value;
|
||||
let i = 0;
|
||||
let diff;
|
||||
let total;
|
||||
|
||||
/* Update values in each graph */
|
||||
$.each(runtime.charts, function (orderKey, elem) {
|
||||
var key = elem.chartID;
|
||||
const key = elem.chartID;
|
||||
// If newly added chart, we have no data for it yet
|
||||
if (! chartData[key]) {
|
||||
return;
|
||||
@ -1449,7 +1453,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
// Draw all series
|
||||
total = 0;
|
||||
for (var j = 0; j < elem.nodes.length; j++) {
|
||||
for (let j = 0; j < elem.nodes.length; j++) {
|
||||
// Update x-axis
|
||||
if (i === 0 && j === 0) {
|
||||
if (oldChartData === null) {
|
||||
@ -1535,7 +1539,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
// update chart options
|
||||
// keep ticks number/positioning consistent while refreshrate changes
|
||||
var tickInterval = (runtime.xmax - runtime.xmin) / 5;
|
||||
const tickInterval = (runtime.xmax - runtime.xmin) / 5;
|
||||
elem.chart.data.labels = [
|
||||
(runtime.xmax - tickInterval * 4),
|
||||
(runtime.xmax - tickInterval * 3),
|
||||
@ -1577,7 +1581,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
* Function to get the highest plotted point's y label, to scale the chart.
|
||||
*/
|
||||
function getMaxYLabel (dataValues) {
|
||||
var maxY = dataValues[0].y;
|
||||
let maxY = dataValues[0].y;
|
||||
$.each(dataValues, function (k, v) {
|
||||
maxY = (v.y > maxY) ? v.y : maxY;
|
||||
});
|
||||
@ -1587,6 +1591,12 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
/* Function that supplies special value transform functions for chart values */
|
||||
function chartValueTransform (name, cur, prev) {
|
||||
let newCur;
|
||||
let newPrev;
|
||||
let diffTotal;
|
||||
let diffIdle;
|
||||
let diffQHits;
|
||||
|
||||
switch (name) {
|
||||
case 'cpu-linux':
|
||||
if (prev === null) {
|
||||
@ -1595,11 +1605,11 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
// cur and prev are datapoint arrays, but containing
|
||||
// only 1 element for cpu-linux
|
||||
var newCur = cur[0];
|
||||
var newPrev = prev[0];
|
||||
newCur = cur[0];
|
||||
newPrev = prev[0];
|
||||
|
||||
var diffTotal = newCur.busy + newCur.idle - (newPrev.busy + newPrev.idle);
|
||||
var diffIdle = newCur.idle - newPrev.idle;
|
||||
diffTotal = newCur.busy + newCur.idle - (newPrev.busy + newPrev.idle);
|
||||
diffIdle = newCur.idle - newPrev.idle;
|
||||
|
||||
return 100 * (diffTotal - diffIdle) / diffTotal;
|
||||
|
||||
@ -1610,7 +1620,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
}
|
||||
|
||||
// cur[0].value is Qcache_hits, cur[1].value is Com_select
|
||||
var diffQHits = cur[0].value - prev[0].value;
|
||||
diffQHits = cur[0].value - prev[0].value;
|
||||
// No NaN please :-)
|
||||
if (cur[1].value - prev[1].value === 0) {
|
||||
return 0;
|
||||
@ -1638,10 +1648,12 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
runtime.dataList = {};
|
||||
// Store an own id, because the property name is subject of reordering,
|
||||
// thus destroying our mapping with runtime.charts <=> runtime.dataList
|
||||
var chartID = 0;
|
||||
let chartID = 0;
|
||||
$.each(runtime.charts, function (key, chart) {
|
||||
runtime.dataList[chartID] = [];
|
||||
for (var i = 0, l = chart.nodes.length; i < l; i++) {
|
||||
let i = 0;
|
||||
const l = chart.nodes.length;
|
||||
for (; i < l; i++) {
|
||||
runtime.dataList[chartID][i] = chart.nodes[i].dataPoints;
|
||||
}
|
||||
|
||||
@ -1652,7 +1664,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
/* Loads the log table data, generates the table and handles the filters */
|
||||
function loadLogStatistics (opts) {
|
||||
var logRequest = null;
|
||||
let logRequest = null;
|
||||
|
||||
if (! opts.removeVariables) {
|
||||
opts.removeVariables = false;
|
||||
@ -1672,7 +1684,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
bootstrap.Modal.getOrCreateInstance(analysingLogsModal).show();
|
||||
|
||||
var url = 'index.php?route=/server/status/monitor/slow-log';
|
||||
let url = 'index.php?route=/server/status/monitor/slow-log';
|
||||
if (opts.src === 'general') {
|
||||
url = 'index.php?route=/server/status/monitor/general-log';
|
||||
}
|
||||
@ -1688,7 +1700,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
'server': CommonParams.get('server')
|
||||
},
|
||||
function (data) {
|
||||
var logData;
|
||||
let logData;
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
logData = data.message;
|
||||
} else {
|
||||
@ -1709,7 +1721,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
const analysingLogsLogDataLoadedModalBody = $('#analysingLogsLogDataLoadedModal .modal-body');
|
||||
$.each(logData.sum, function (key: string, value) {
|
||||
var newKey = key.charAt(0).toUpperCase() + key.slice(1).toLowerCase();
|
||||
let newKey = key.charAt(0).toUpperCase() + key.slice(1).toLowerCase();
|
||||
if (newKey === 'Total') {
|
||||
newKey = '<b>' + newKey + '</b>';
|
||||
}
|
||||
@ -1777,8 +1789,8 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
* to group queries ignoring data in WHERE clauses
|
||||
*/
|
||||
function filterQueries (varFilterChange) {
|
||||
var textFilter;
|
||||
var val = ($('#filterQueryText').val() as string);
|
||||
let textFilter;
|
||||
const val = ($('#filterQueryText').val() as string);
|
||||
|
||||
if (val.length === 0) {
|
||||
textFilter = null;
|
||||
@ -1794,25 +1806,25 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
}
|
||||
}
|
||||
|
||||
var rowSum = 0;
|
||||
var totalSum = 0;
|
||||
var i = 0;
|
||||
var q;
|
||||
var noVars = $('#noWHEREData').prop('checked');
|
||||
var equalsFilter = /([^=]+)=(\d+|(('|"|).*?[^\\])\4((\s+)|$))/gi;
|
||||
var functionFilter = /([a-z0-9_]+)\(.+?\)/gi;
|
||||
var filteredQueries = {};
|
||||
var filteredQueriesLines = {};
|
||||
var hide = false;
|
||||
var rowData;
|
||||
var queryColumnName = runtime.logDataCols[runtime.logDataCols.length - 2];
|
||||
var sumColumnName = runtime.logDataCols[runtime.logDataCols.length - 1];
|
||||
var isSlowLog = opts.src === 'slow';
|
||||
var columnSums = {};
|
||||
let rowSum = 0;
|
||||
let totalSum = 0;
|
||||
let i = 0;
|
||||
let q;
|
||||
const noVars = $('#noWHEREData').prop('checked');
|
||||
const equalsFilter = /([^=]+)=(\d+|(('|"|).*?[^\\])\4((\s+)|$))/gi;
|
||||
const functionFilter = /([a-z0-9_]+)\(.+?\)/gi;
|
||||
const filteredQueries = {};
|
||||
const filteredQueriesLines = {};
|
||||
let hide = false;
|
||||
let rowData;
|
||||
const queryColumnName = runtime.logDataCols[runtime.logDataCols.length - 2];
|
||||
const sumColumnName = runtime.logDataCols[runtime.logDataCols.length - 1];
|
||||
const isSlowLog = opts.src === 'slow';
|
||||
const columnSums = {};
|
||||
|
||||
// For the slow log we have to count many columns (query_time, lock_time, rows_examined, rows_sent, etc.)
|
||||
var countRow = function (query, row) {
|
||||
var cells = row.match(/<td>(.*?)<\/td>/gi);
|
||||
const countRow = function (query, row) {
|
||||
const cells = row.match(/<td>(.*?)<\/td>/gi);
|
||||
if (! columnSums[query]) {
|
||||
columnSums[query] = [0, 0, 0, 0];
|
||||
}
|
||||
@ -1827,7 +1839,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
// We just assume the sql text is always in the second last column, and that the total count is right of it
|
||||
$('#logTable').find('table tbody tr td.queryCell').each(function () {
|
||||
var $t = $(this);
|
||||
const $t = $(this);
|
||||
// If query is a SELECT and user enabled or disabled to group
|
||||
// queries ignoring data in where statements, we
|
||||
// need to re-calculate the sums of each row
|
||||
@ -1893,9 +1905,9 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
// We finished summarizing counts => Update count values of all grouped entries
|
||||
if (varFilterChange) {
|
||||
if (noVars) {
|
||||
var numCol;
|
||||
var row;
|
||||
var $table = $('#logTable').find('table tbody');
|
||||
let numCol;
|
||||
let row;
|
||||
const $table = $('#logTable').find('table tbody');
|
||||
$.each(filteredQueriesLines, function (key, value) {
|
||||
if (filteredQueries[key] <= 1) {
|
||||
return;
|
||||
@ -1930,17 +1942,17 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
/* Turns a timespan (12:12:12) into a number */
|
||||
function timeToSec (timeStr) {
|
||||
var time = timeStr.split(':');
|
||||
const time = timeStr.split(':');
|
||||
|
||||
return (parseInt(time[0], 10) * 3600) + (parseInt(time[1], 10) * 60) + parseInt(time[2], 10);
|
||||
}
|
||||
|
||||
/* Turns a number into a timespan (100 into 00:01:40) */
|
||||
function secToTime (timeInt) {
|
||||
var time = timeInt;
|
||||
var hours: number | string = Math.floor(time / 3600);
|
||||
let time = timeInt;
|
||||
let hours: number | string = Math.floor(time / 3600);
|
||||
time -= hours * 3600;
|
||||
var minutes: number | string = Math.floor(time / 60);
|
||||
let minutes: number | string = Math.floor(time / 60);
|
||||
time -= minutes * 60;
|
||||
|
||||
if (hours < 10) {
|
||||
@ -1960,21 +1972,21 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
/* Constructs the log table out of the retrieved server data */
|
||||
function buildLogTable (data, groupInserts) {
|
||||
var rows = data.rows;
|
||||
var cols = [];
|
||||
var $table = $('<table class="table table-striped table-hover align-middle sortable"></table>');
|
||||
var $tBody;
|
||||
var $tRow;
|
||||
var $tCell;
|
||||
const rows = data.rows;
|
||||
const cols = [];
|
||||
const $table = $('<table class="table table-striped table-hover align-middle sortable"></table>');
|
||||
let $tBody;
|
||||
let $tRow;
|
||||
let $tCell;
|
||||
|
||||
// @ts-ignore
|
||||
$('#logTable').html($table);
|
||||
|
||||
var tempPushKey = function (key) {
|
||||
const tempPushKey = function (key) {
|
||||
cols.push(key);
|
||||
};
|
||||
|
||||
var formatValue = function (name, value) {
|
||||
const formatValue = function (name, value) {
|
||||
if (name === 'user_host') {
|
||||
return value.replace(/(\[.*?\])+/g, '');
|
||||
}
|
||||
@ -1982,7 +1994,9 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
return escapeHtml(value);
|
||||
};
|
||||
|
||||
for (var i = 0, l = rows.length; i < l; i++) {
|
||||
let i = 0;
|
||||
const l = rows.length;
|
||||
for (; i < l; i++) {
|
||||
if (i === 0) {
|
||||
$.each(rows[0], tempPushKey);
|
||||
$table.append('<thead>' +
|
||||
@ -1994,7 +2008,9 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
}
|
||||
|
||||
$tBody.append($tRow = $('<tr class="noclick"></tr>'));
|
||||
for (var j = 0, ll = cols.length; j < ll; j++) {
|
||||
let j = 0;
|
||||
const ll = cols.length;
|
||||
for (; j < ll; j++) {
|
||||
// Assuming the query column is the second last
|
||||
if (j === cols.length - 2 && rows[i][cols[j]].match(/^SELECT/i)) {
|
||||
$tRow.append($tCell = $('<td class="linkElem queryCell">' + formatValue(cols[j], rows[i][cols[j]]) + '</td>'));
|
||||
@ -2084,8 +2100,8 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
/* Loads and displays the analyzed query data */
|
||||
function loadQueryAnalysis (rowData) {
|
||||
var db = rowData.db || '';
|
||||
var profilingChart = null;
|
||||
const db = rowData.db || '';
|
||||
let profilingChart = null;
|
||||
|
||||
$('#queryAnalyzerDialog').find('div.placeHolder').html(
|
||||
window.Messages.strAnalyzing + ' <img class="ajaxIcon" src="' +
|
||||
@ -2097,9 +2113,9 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
'database': db,
|
||||
'server': CommonParams.get('server')
|
||||
}, function (responseData) {
|
||||
var data = responseData;
|
||||
var i;
|
||||
var l;
|
||||
let data = responseData;
|
||||
let i;
|
||||
let l;
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
data = data.message;
|
||||
}
|
||||
@ -2114,12 +2130,12 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
return;
|
||||
}
|
||||
|
||||
var totalTime = 0;
|
||||
let totalTime = 0;
|
||||
// Float sux, I'll use table :(
|
||||
$('#queryAnalyzerDialog').find('div.placeHolder')
|
||||
.html('<table class="table table-borderless"><tr><td class="explain"></td><td class="chart"></td></tr></table>');
|
||||
|
||||
var explain = '<b>' + window.Messages.strExplainOutput + '</b> ' + $('#explain_docu').html();
|
||||
let explain = '<b>' + window.Messages.strExplainOutput + '</b> ' + $('#explain_docu').html();
|
||||
if (data.explain.length > 1) {
|
||||
explain += ' (';
|
||||
for (i = 0; i < data.explain.length; i++) {
|
||||
@ -2135,8 +2151,8 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
explain += '<p></p>';
|
||||
|
||||
var tempExplain = function (key, value) {
|
||||
var newValue = (value === null) ? 'null' : escapeHtml(value);
|
||||
const tempExplain = function (key, value) {
|
||||
let newValue = (value === null) ? 'null' : escapeHtml(value);
|
||||
|
||||
if (key === 'type' && newValue.toLowerCase() === 'all') {
|
||||
newValue = '<span class="text-danger">' + newValue + '</span>';
|
||||
@ -2160,16 +2176,16 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
$('#queryAnalyzerDialog').find('div.placeHolder td.explain').append(explain);
|
||||
|
||||
$('#queryAnalyzerDialog').find('div.placeHolder a[href*="#showExplain"]').on('click', function () {
|
||||
var id = $(this).attr('href').split('-')[1];
|
||||
const id = $(this).attr('href').split('-')[1];
|
||||
$(this).parent().find('div[class*="explain"]').hide();
|
||||
$(this).parent().find('div[class*="explain-' + id + '"]').show();
|
||||
});
|
||||
|
||||
if (data.profiling) {
|
||||
var chartData = [];
|
||||
var numberTable = '<table class="table table-sm table-striped table-hover w-auto queryNums"><thead><tr><th>' + window.Messages.strStatus + '</th><th>' + window.Messages.strTime + '</th></tr></thead><tbody>';
|
||||
var duration;
|
||||
var otherTime = 0;
|
||||
const chartData = [];
|
||||
let numberTable = '<table class="table table-sm table-striped table-hover w-auto queryNums"><thead><tr><th>' + window.Messages.strStatus + '</th><th>' + window.Messages.strTime + '</th></tr></thead><tbody>';
|
||||
let duration;
|
||||
let otherTime = 0;
|
||||
|
||||
for (i = 0, l = data.profiling.length; i < l; i++) {
|
||||
duration = parseFloat(data.profiling[i].duration);
|
||||
@ -2225,7 +2241,7 @@ AJAX.registerOnload('server/status/monitor.js', function () {
|
||||
|
||||
/* Saves the monitor to localstorage */
|
||||
function saveMonitor () {
|
||||
var gridCopy = {};
|
||||
const gridCopy = {};
|
||||
|
||||
$.each(runtime.charts, function (key, elem) {
|
||||
gridCopy[key] = {};
|
||||
|
||||
@ -12,8 +12,8 @@ import getImageTag from '../../modules/functions/getImageTag.ts';
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
|
||||
// object to store process list state information
|
||||
var processList = {
|
||||
/** object to store process list state information */
|
||||
const processList = {
|
||||
|
||||
// denotes whether auto refresh is on or off
|
||||
autoRefresh: false,
|
||||
@ -50,11 +50,11 @@ var processList = {
|
||||
*/
|
||||
killProcessHandler: function (event): void {
|
||||
event.preventDefault();
|
||||
var argSep = CommonParams.get('arg_separator');
|
||||
var params = $(this).getPostData();
|
||||
const argSep = CommonParams.get('arg_separator');
|
||||
let params = $(this).getPostData();
|
||||
params += argSep + 'ajax_request=1' + argSep + 'server=' + CommonParams.get('server');
|
||||
// Get row element of the process to be killed.
|
||||
var $tr = $(this).closest('tr');
|
||||
const $tr = $(this).closest('tr');
|
||||
$.post($(this).attr('href'), params, function (data) {
|
||||
// Check if process was killed or not.
|
||||
if (data.hasOwnProperty('success') && data.success) {
|
||||
@ -62,7 +62,7 @@ var processList = {
|
||||
$tr.remove();
|
||||
// As we just removed a row, reapply odd-even classes
|
||||
// to keep table stripes consistent
|
||||
var $tableProcessListTr = $('#tableprocesslist').find('> tbody > tr');
|
||||
const $tableProcessListTr = $('#tableprocesslist').find('> tbody > tr');
|
||||
$tableProcessListTr.each(function (index) {
|
||||
if (index >= 0 && index % 2 === 0) {
|
||||
$(this).removeClass('odd').addClass('even');
|
||||
@ -93,20 +93,20 @@ var processList = {
|
||||
if (processList.autoRefresh) {
|
||||
// Only fetch the table contents
|
||||
processList.refreshUrl = 'index.php?route=/server/status/processes/refresh';
|
||||
var interval = parseInt(processList.refreshInterval, 10) * 1000;
|
||||
var urlParams = processList.getUrlParams();
|
||||
const interval = parseInt(processList.refreshInterval, 10) * 1000;
|
||||
const urlParams = processList.getUrlParams();
|
||||
processList.refreshRequest = $.post(processList.refreshUrl,
|
||||
urlParams,
|
||||
function (data) {
|
||||
if (data.hasOwnProperty('success') && data.success) {
|
||||
var $newTable = $(data.message);
|
||||
const $newTable = $(data.message);
|
||||
$('#tableprocesslist').html($newTable.html());
|
||||
highlightSql($('#tableprocesslist'));
|
||||
}
|
||||
|
||||
processList.refreshTimeout = setTimeout(
|
||||
processList.refresh,
|
||||
interval
|
||||
interval,
|
||||
);
|
||||
});
|
||||
}
|
||||
@ -129,8 +129,8 @@ var processList = {
|
||||
* change between play & pause
|
||||
*/
|
||||
setRefreshLabel: function (): void {
|
||||
var img = 'play';
|
||||
var label = window.Messages.strStartRefresh;
|
||||
let img = 'play';
|
||||
let label = window.Messages.strStartRefresh;
|
||||
if (processList.autoRefresh) {
|
||||
img = 'pause';
|
||||
label = window.Messages.strStopRefresh;
|
||||
@ -148,14 +148,14 @@ var processList = {
|
||||
* @return {object} urlParams - url parameters with autoRefresh request
|
||||
*/
|
||||
getUrlParams: function () {
|
||||
var urlParams: { [k: string]: any } = {
|
||||
const urlParams: { [k: string]: any } = {
|
||||
'server': CommonParams.get('server'),
|
||||
'ajax_request': true,
|
||||
'refresh': true,
|
||||
'full': $('input[name="full"]').val(),
|
||||
'order_by_field': $('input[name="order_by_field"]').val(),
|
||||
'column_name': $('input[name="column_name"]').val(),
|
||||
'sort_order': $('input[name="sort_order"]').val()
|
||||
'sort_order': $('input[name="sort_order"]').val(),
|
||||
};
|
||||
if ($('#showExecuting').is(':checked')) {
|
||||
urlParams.showExecuting = true;
|
||||
@ -164,7 +164,7 @@ var processList = {
|
||||
}
|
||||
|
||||
return urlParams;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
AJAX.registerOnload('server/status/processes.js', function () {
|
||||
|
||||
@ -19,10 +19,10 @@ AJAX.registerTeardown('server/status/variables.js', function () {
|
||||
|
||||
AJAX.registerOnload('server/status/variables.js', function () {
|
||||
// Filters for status variables
|
||||
var textFilter = null;
|
||||
var alertFilter = $('#filterAlert').prop('checked');
|
||||
var categoryFilter = ($('#filterCategory').find(':selected').val() as string);
|
||||
var text = ''; // Holds filter text
|
||||
let textFilter = null;
|
||||
let alertFilter = $('#filterAlert').prop('checked');
|
||||
let categoryFilter = ($('#filterCategory').find(':selected').val() as string);
|
||||
let text = ''; // Holds filter text
|
||||
|
||||
/* 3 Filtering functions */
|
||||
($('#filterAlert') as JQuery<HTMLInputElement>).on('change', function () {
|
||||
@ -45,7 +45,7 @@ AJAX.registerOnload('server/status/variables.js', function () {
|
||||
}).trigger('change');
|
||||
|
||||
$('#filterText').on('keyup', function () {
|
||||
var word = ($(this).val() as string).replace(/_/g, ' ');
|
||||
const word = ($(this).val() as string).replace(/_/g, ' ');
|
||||
if (word.length === 0 || word.length >= 32768) {
|
||||
textFilter = null;
|
||||
} else {
|
||||
@ -66,8 +66,8 @@ AJAX.registerOnload('server/status/variables.js', function () {
|
||||
|
||||
/* Filters the status variables by name/category/alert in the variables tab */
|
||||
function filterVariables () {
|
||||
var usefulLinks = 0;
|
||||
var section = text;
|
||||
let usefulLinks = 0;
|
||||
let section = text;
|
||||
|
||||
if (categoryFilter.length > 0) {
|
||||
section = categoryFilter;
|
||||
|
||||
@ -18,8 +18,8 @@ AJAX.registerTeardown('server/variables.js', function () {
|
||||
});
|
||||
|
||||
AJAX.registerOnload('server/variables.js', function () {
|
||||
var $saveLink = $('a.saveLink');
|
||||
var $cancelLink = $('a.cancelLink');
|
||||
const $saveLink = $('a.saveLink');
|
||||
const $cancelLink = $('a.cancelLink');
|
||||
|
||||
$('#serverVariables').find('.var-name').find('a').append(
|
||||
$('#docImage').clone().css('display', 'inline-block')
|
||||
@ -33,20 +33,20 @@ AJAX.registerOnload('server/variables.js', function () {
|
||||
|
||||
/* Allows the user to edit a server variable */
|
||||
function editVariable (link) {
|
||||
var $link = $(link);
|
||||
var $cell = $link.parent();
|
||||
var $valueCell = $link.parents('.var-row').find('.var-value');
|
||||
var varName = $link.data('variable');
|
||||
const $link = $(link);
|
||||
const $cell = $link.parent();
|
||||
const $valueCell = $link.parents('.var-row').find('.var-value');
|
||||
const varName = $link.data('variable');
|
||||
|
||||
var $mySaveLink = $saveLink.clone().css('display', 'inline-block');
|
||||
var $myCancelLink = $cancelLink.clone().css('display', 'inline-block');
|
||||
var $msgbox = ajaxShowMessage();
|
||||
var $myEditLink = $cell.find('a.editLink');
|
||||
const $mySaveLink = $saveLink.clone().css('display', 'inline-block');
|
||||
const $myCancelLink = $cancelLink.clone().css('display', 'inline-block');
|
||||
const $msgbox = ajaxShowMessage();
|
||||
const $myEditLink = $cell.find('a.editLink');
|
||||
$cell.addClass('edit'); // variable is being edited
|
||||
$myEditLink.remove(); // remove edit link
|
||||
|
||||
$mySaveLink.on('click', function () {
|
||||
var $msgbox = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
const $msgbox = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
$.post('index.php?route=/server/variables/set/' + encodeURIComponent(varName), {
|
||||
'ajax_request': true,
|
||||
'server': CommonParams.get('server'),
|
||||
@ -90,15 +90,15 @@ AJAX.registerOnload('server/variables.js', function () {
|
||||
'server': CommonParams.get('server')
|
||||
}, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
var $links = $('<div></div>')
|
||||
const $links = $('<div></div>')
|
||||
.append($myCancelLink)
|
||||
.append(' ')
|
||||
.append($mySaveLink);
|
||||
var $editor = $('<div></div>', { 'class': 'serverVariableEditor' })
|
||||
const $editor = $('<div></div>', { 'class': 'serverVariableEditor' })
|
||||
.append(
|
||||
$('<div></div>').append(
|
||||
$('<input>', { type: 'text', 'class': 'form-control form-control-sm' }).val(data.message)
|
||||
)
|
||||
$('<input>', { type: 'text', 'class': 'form-control form-control-sm' }).val(data.message),
|
||||
),
|
||||
);
|
||||
// Save and replace content
|
||||
$cell
|
||||
|
||||
@ -20,18 +20,18 @@ $(function () {
|
||||
$('#no_https').remove();
|
||||
} else {
|
||||
$('#no_https a').on('click', function () {
|
||||
var oldLocation = window.location;
|
||||
const oldLocation = window.location;
|
||||
window.location.href = 'https:' + oldLocation.href.substring(oldLocation.protocol.length);
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
var hiddenMessages = $('.hiddenmessage');
|
||||
const hiddenMessages = $('.hiddenmessage');
|
||||
|
||||
if (hiddenMessages.length > 0) {
|
||||
hiddenMessages.hide();
|
||||
var link = $('#show_hidden_messages');
|
||||
const link = $('#show_hidden_messages');
|
||||
link.on('click', function (e) {
|
||||
e.preventDefault();
|
||||
hiddenMessages.show();
|
||||
@ -45,12 +45,12 @@ $(function () {
|
||||
|
||||
// set document width
|
||||
$(function () {
|
||||
var width = 0;
|
||||
let width = 0;
|
||||
$('ul.tabs li').each(function () {
|
||||
width += $(this).width() + 10;
|
||||
});
|
||||
|
||||
var contentWidth = width;
|
||||
const contentWidth = width;
|
||||
width += 250;
|
||||
$('body').css('min-width', width);
|
||||
$('.tabs_contents').css('min-width', contentWidth);
|
||||
@ -74,7 +74,7 @@ $(function () {
|
||||
* @return {boolean|void}
|
||||
*/
|
||||
function ajaxValidate (parent, id, values) {
|
||||
var $parent = $(parent);
|
||||
let $parent = $(parent);
|
||||
// ensure that parent is a fieldset
|
||||
if ($parent.attr('tagName') !== 'FIELDSET') {
|
||||
$parent = $parent.closest('fieldset');
|
||||
@ -101,7 +101,7 @@ function ajaxValidate (parent, id, values) {
|
||||
return;
|
||||
}
|
||||
|
||||
var error = {};
|
||||
const error = {};
|
||||
if (typeof response !== 'object') {
|
||||
// @ts-ignore
|
||||
error[$parent.id] = [response];
|
||||
@ -109,8 +109,8 @@ function ajaxValidate (parent, id, values) {
|
||||
// @ts-ignore
|
||||
error[$parent.id] = [response.error];
|
||||
} else {
|
||||
for (var key in response) {
|
||||
var value = response[key];
|
||||
for (let key in response) {
|
||||
const value = response[key];
|
||||
error[key] = Array.isArray(value) ? value : [value];
|
||||
}
|
||||
}
|
||||
@ -144,7 +144,7 @@ $.extend(true, window.validators, {
|
||||
*/
|
||||
hide_db: function (isKeyUp) { // eslint-disable-line camelcase
|
||||
if (! isKeyUp && this.value !== '') {
|
||||
var data = {};
|
||||
const data = {};
|
||||
data[this.id] = this.value;
|
||||
ajaxValidate(this, 'Servers/1/hide_db', data);
|
||||
}
|
||||
@ -160,7 +160,7 @@ $.extend(true, window.validators, {
|
||||
*/
|
||||
TrustedProxies: function (isKeyUp) {
|
||||
if (! isKeyUp && this.value !== '') {
|
||||
var data = {};
|
||||
const data = {};
|
||||
data[this.id] = this.value;
|
||||
ajaxValidate(this, 'TrustedProxies', data);
|
||||
}
|
||||
@ -207,7 +207,7 @@ $.extend(true, window.validators, {
|
||||
return true;
|
||||
}
|
||||
|
||||
var prefix = Config.getIdPrefix($(this).find('input'));
|
||||
const prefix = Config.getIdPrefix($(this).find('input'));
|
||||
if ($('#' + prefix + 'pmadb').val() !== '') {
|
||||
ajaxValidate(this, 'Server_pmadb', Config.getAllValues());
|
||||
}
|
||||
@ -231,7 +231,7 @@ $(function () {
|
||||
return;
|
||||
}
|
||||
|
||||
var el = $(this).find('input');
|
||||
const el = $(this).find('input');
|
||||
if (el.prop('disabled')) {
|
||||
return;
|
||||
}
|
||||
@ -247,7 +247,7 @@ $(function () {
|
||||
$(function () {
|
||||
$('.delete-server').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
var $this = $(this);
|
||||
const $this = $(this);
|
||||
$.post($this.attr('href'), $this.attr('data-post'), function () {
|
||||
window.location.replace('../setup/index.php?route=/setup');
|
||||
});
|
||||
|
||||
@ -13,17 +13,17 @@ import { CommonParams } from './modules/common.ts';
|
||||
* Register key events on load
|
||||
*/
|
||||
$(function () {
|
||||
var databaseOp = false;
|
||||
var tableOp = false;
|
||||
var keyD = 68;
|
||||
var keyT = 84;
|
||||
var keyK = 75;
|
||||
var keyS = 83;
|
||||
var keyF = 70;
|
||||
var keyE = 69;
|
||||
var keyH = 72;
|
||||
var keyC = 67;
|
||||
var keyBackSpace = 8;
|
||||
let databaseOp = false;
|
||||
let tableOp = false;
|
||||
const keyD = 68;
|
||||
const keyT = 84;
|
||||
const keyK = 75;
|
||||
const keyS = 83;
|
||||
const keyF = 70;
|
||||
const keyE = 69;
|
||||
const keyH = 72;
|
||||
const keyC = 67;
|
||||
const keyBackSpace = 8;
|
||||
$(document).on('keyup', function (e) {
|
||||
// is a string but is also a boolean according to https://api.jquery.com/prop/
|
||||
if ($(e.target).prop('contenteditable') === 'true' || $(e.target).prop('contenteditable') === true) {
|
||||
@ -69,8 +69,8 @@ $(function () {
|
||||
return;
|
||||
}
|
||||
|
||||
var isTable;
|
||||
var isDb;
|
||||
let isTable;
|
||||
let isDb;
|
||||
if (e.keyCode === keyD) {
|
||||
databaseOp = true;
|
||||
} else if (e.keyCode === keyK) {
|
||||
|
||||
@ -49,7 +49,7 @@ function urlEncode (str) {
|
||||
*/
|
||||
function autoSave (query): void {
|
||||
if (query) {
|
||||
var key = Sql.getAutoSavedKey();
|
||||
const key = Sql.getAutoSavedKey();
|
||||
try {
|
||||
if (isStorageSupported('localStorage')) {
|
||||
window.localStorage.setItem(key, query);
|
||||
@ -73,10 +73,10 @@ function autoSave (query): void {
|
||||
* @param {string} query SQL query
|
||||
*/
|
||||
function showThisQuery (db, table, query): void {
|
||||
var showThisQueryObject = {
|
||||
const showThisQueryObject = {
|
||||
'db': db,
|
||||
'table': table,
|
||||
'query': query
|
||||
'query': query,
|
||||
};
|
||||
if (isStorageSupported('localStorage')) {
|
||||
window.localStorage.showThisQuery = 1;
|
||||
@ -92,13 +92,16 @@ function showThisQuery (db, table, query): void {
|
||||
* checked and query for the db and table pair exists
|
||||
*/
|
||||
function setShowThisQuery () {
|
||||
var db = $('input[name="db"]').val();
|
||||
var table = $('input[name="table"]').val();
|
||||
const db = $('input[name="db"]').val();
|
||||
const table = $('input[name="table"]').val();
|
||||
let storedDb;
|
||||
let storedTable;
|
||||
let storedQuery;
|
||||
if (isStorageSupported('localStorage')) {
|
||||
if (window.localStorage.showThisQueryObject !== undefined) {
|
||||
var storedDb = JSON.parse(window.localStorage.showThisQueryObject).db;
|
||||
var storedTable = JSON.parse(window.localStorage.showThisQueryObject).table;
|
||||
var storedQuery = JSON.parse(window.localStorage.showThisQueryObject).query;
|
||||
storedDb = JSON.parse(window.localStorage.showThisQueryObject).db;
|
||||
storedTable = JSON.parse(window.localStorage.showThisQueryObject).table;
|
||||
storedQuery = JSON.parse(window.localStorage.showThisQueryObject).query;
|
||||
}
|
||||
|
||||
if (window.localStorage.showThisQuery !== undefined
|
||||
@ -155,18 +158,18 @@ function clearAutoSavedSort (): void {
|
||||
* @return {string}
|
||||
*/
|
||||
function getFieldName ($tableResults, $thisField) {
|
||||
var thisFieldIndex = $thisField.index();
|
||||
const thisFieldIndex = $thisField.index();
|
||||
// ltr or rtl direction does not impact how the DOM was generated
|
||||
// check if the action column in the left exist
|
||||
var leftActionExist = ! $tableResults.find('th').first().hasClass('draggable');
|
||||
const leftActionExist = !$tableResults.find('th').first().hasClass('draggable');
|
||||
// number of column span for checkbox and Actions
|
||||
var leftActionSkip = leftActionExist ? $tableResults.find('th').first().attr('colspan') - 1 : 0;
|
||||
const leftActionSkip = leftActionExist ? $tableResults.find('th').first().attr('colspan') - 1 : 0;
|
||||
|
||||
// If this column was sorted, the text of the a element contains something
|
||||
// like <small>1</small> that is useful to indicate the order in case
|
||||
// of a sort on multiple columns; however, we dont want this as part
|
||||
// of the column name so we strip it ( .clone() to .end() )
|
||||
var fieldName = $tableResults
|
||||
let fieldName = $tableResults
|
||||
.find('thead')
|
||||
.find('th')
|
||||
.eq(thisFieldIndex - leftActionSkip)
|
||||
@ -178,9 +181,9 @@ function getFieldName ($tableResults, $thisField) {
|
||||
.text(); // grab the text
|
||||
// happens when just one row (headings contain no a)
|
||||
if (fieldName === '') {
|
||||
var $heading = $tableResults.find('thead').find('th').eq(thisFieldIndex - leftActionSkip).children('span');
|
||||
const $heading = $tableResults.find('thead').find('th').eq(thisFieldIndex - leftActionSkip).children('span');
|
||||
// may contain column comment enclosed in a span - detach it temporarily to read the column name
|
||||
var $tempColComment = $heading.children().detach();
|
||||
const $tempColComment = $heading.children().detach();
|
||||
fieldName = $heading.text();
|
||||
// re-attach the column comment
|
||||
$heading.append($tempColComment);
|
||||
@ -268,7 +271,7 @@ const setQuery = function (query): void {
|
||||
*
|
||||
*/
|
||||
const insertQuery = function (queryType) {
|
||||
var table;
|
||||
let table;
|
||||
if (queryType === 'clear') {
|
||||
setQuery('');
|
||||
|
||||
@ -279,11 +282,11 @@ const insertQuery = function (queryType) {
|
||||
' <img class="ajaxIcon" src="' +
|
||||
window.themeImagePath + 'ajax_clock_small.gif" alt="">');
|
||||
|
||||
var params = {
|
||||
const params = {
|
||||
'ajax_request': true,
|
||||
'sql': window.codeMirrorEditor.getValue(),
|
||||
'server': CommonParams.get('server'),
|
||||
'formatSingleLine': queryType === 'formatSingleLine'
|
||||
'formatSingleLine': queryType === 'formatSingleLine',
|
||||
};
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
@ -304,9 +307,9 @@ const insertQuery = function (queryType) {
|
||||
|
||||
return;
|
||||
} else if (queryType === 'saved') {
|
||||
var db = $('input[name="db"]').val();
|
||||
const db = $('input[name="db"]').val();
|
||||
table = $('input[name="table"]').val();
|
||||
var key = db;
|
||||
let key = db;
|
||||
if (table !== undefined) {
|
||||
key += '.' + table;
|
||||
}
|
||||
@ -324,19 +327,19 @@ const insertQuery = function (queryType) {
|
||||
return;
|
||||
}
|
||||
|
||||
var query = '';
|
||||
let query = '';
|
||||
// @ts-ignore
|
||||
var myListBox = document.sqlform.dummy;
|
||||
const myListBox = document.sqlform.dummy;
|
||||
// @ts-ignore
|
||||
table = escapeBacktick(document.sqlform.table.value);
|
||||
|
||||
if (myListBox.options.length > 0) {
|
||||
sqlBoxLocked = true;
|
||||
var columnsList = '';
|
||||
var valDis = '';
|
||||
var editDis = '';
|
||||
var NbSelect = 0;
|
||||
for (var i = 0; i < myListBox.options.length; i++) {
|
||||
let columnsList = '';
|
||||
let valDis = '';
|
||||
let editDis = '';
|
||||
let NbSelect = 0;
|
||||
for (let i = 0; i < myListBox.options.length; i++) {
|
||||
NbSelect++;
|
||||
if (NbSelect > 1) {
|
||||
columnsList += ', ';
|
||||
@ -372,15 +375,15 @@ const insertQuery = function (queryType) {
|
||||
*/
|
||||
const insertValueQuery = function () {
|
||||
// @ts-ignore
|
||||
var myQuery = document.sqlform.sql_query;
|
||||
const myQuery = document.sqlform.sql_query;
|
||||
// @ts-ignore
|
||||
var myListBox = document.sqlform.dummy;
|
||||
const myListBox = document.sqlform.dummy;
|
||||
|
||||
if (myListBox.options.length > 0) {
|
||||
sqlBoxLocked = true;
|
||||
var columnsList = '';
|
||||
var NbSelect = 0;
|
||||
for (var i = 0; i < myListBox.options.length; i++) {
|
||||
let columnsList = '';
|
||||
let NbSelect = 0;
|
||||
for (let i = 0; i < myListBox.options.length; i++) {
|
||||
if (myListBox.options[i].selected) {
|
||||
NbSelect++;
|
||||
if (NbSelect > 1) {
|
||||
@ -400,17 +403,17 @@ const insertValueQuery = function () {
|
||||
} else if (document.selection) {
|
||||
myQuery.focus();
|
||||
// @ts-ignore
|
||||
var sel = document.selection.createRange();
|
||||
const sel = document.selection.createRange();
|
||||
sel.text = columnsList;
|
||||
// MOZILLA/NETSCAPE support
|
||||
// @ts-ignore
|
||||
} else if (document.sqlform.sql_query.selectionStart || document.sqlform.sql_query.selectionStart === '0') {
|
||||
// @ts-ignore
|
||||
var startPos = document.sqlform.sql_query.selectionStart;
|
||||
const startPos = document.sqlform.sql_query.selectionStart;
|
||||
// @ts-ignore
|
||||
var endPos = document.sqlform.sql_query.selectionEnd;
|
||||
const endPos = document.sqlform.sql_query.selectionEnd;
|
||||
// @ts-ignore
|
||||
var SqlString = document.sqlform.sql_query.value;
|
||||
const SqlString = document.sqlform.sql_query.value;
|
||||
|
||||
myQuery.value = SqlString.substring(0, startPos) + columnsList + SqlString.substring(endPos, SqlString.length);
|
||||
myQuery.focus();
|
||||
@ -493,7 +496,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
Sql.autoSave($('#sqlquery').val());
|
||||
});
|
||||
|
||||
var useLocalStorageValue = isStorageSupported('localStorage') && typeof window.localStorage.autoSavedSqlSort !== 'undefined';
|
||||
const useLocalStorageValue = isStorageSupported('localStorage') && typeof window.localStorage.autoSavedSqlSort !== 'undefined';
|
||||
// Save sql query with sort
|
||||
if ($('#RememberSorting') !== undefined && $('#RememberSorting').is(':checked')) {
|
||||
$('select[name="sql_query"]').on('change', function () {
|
||||
@ -508,7 +511,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
}
|
||||
|
||||
// If sql query with sort for current table is stored, change sort by key select value
|
||||
var sortStoredQuery = useLocalStorageValue
|
||||
const sortStoredQuery = useLocalStorageValue
|
||||
? window.localStorage.autoSavedSqlSort
|
||||
// @ts-ignore
|
||||
: window.Cookies.get('autoSavedSqlSort', { path: CommonParams.get('rootPath') });
|
||||
@ -522,13 +525,13 @@ AJAX.registerOnload('sql.js', function () {
|
||||
// Delete row from SQL results
|
||||
$(document).on('click', 'a.delete_row.ajax', function (e) {
|
||||
e.preventDefault();
|
||||
var question = window.sprintf(window.Messages.strDoYouReally, escapeHtml($(this).closest('td').find('div').text()));
|
||||
var $link = $(this);
|
||||
const question = window.sprintf(window.Messages.strDoYouReally, escapeHtml($(this).closest('td').find('div').text()));
|
||||
const $link = $(this);
|
||||
$link.confirm(question, $link.attr('href'), function (url) {
|
||||
ajaxShowMessage();
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var params = 'ajax_request=1' + argsep + 'is_js_confirmed=1';
|
||||
var postData = $link.getPostData();
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
let params = 'ajax_request=1' + argsep + 'is_js_confirmed=1';
|
||||
const postData = $link.getPostData();
|
||||
if (postData) {
|
||||
params += argsep + postData;
|
||||
}
|
||||
@ -555,7 +558,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
}
|
||||
|
||||
ajaxShowMessage();
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
$.post($(this).attr('action'), 'ajax_request=1' + argsep + $(this).serialize(), function (data) {
|
||||
if (data.success) {
|
||||
ajaxShowMessage(data.message);
|
||||
@ -578,7 +581,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
$(document).on('click', '#copyToClipBoard', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var textArea = document.createElement('textarea');
|
||||
const textArea = document.createElement('textarea');
|
||||
|
||||
//
|
||||
// *** This styling is an extra step which is likely not required. ***
|
||||
@ -645,7 +648,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
|
||||
$(this).find('.data span').each(function () {
|
||||
// Extract <em> tag for NULL values before converting to string to not mess up formatting
|
||||
var data = $(this).find('em').length !== 0 ? $(this).find('em')[0] : this;
|
||||
const data = $(this).find('em').length !== 0 ? $(this).find('em')[0] : this;
|
||||
textArea.value += $(data).text() + '\t';
|
||||
});
|
||||
|
||||
@ -697,7 +700,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
|
||||
// Attach the toggling of the query box visibility to a click
|
||||
$('#togglequerybox').on('click', function () {
|
||||
var $link = $(this);
|
||||
const $link = $(this);
|
||||
$link.siblings().slideToggle('fast');
|
||||
if ($link.text() === window.Messages.strHideQueryBox) {
|
||||
$link.text(window.Messages.strShowQueryBox);
|
||||
@ -723,18 +726,18 @@ AJAX.registerOnload('sql.js', function () {
|
||||
$(document).on('click', '#button_submit_query', function () {
|
||||
$('.alert-success,.alert-danger').hide();
|
||||
// hide already existing error or success message
|
||||
var $form = $(this).closest('form');
|
||||
const $form = $(this).closest('form');
|
||||
// the Go button related to query submission was clicked,
|
||||
// instead of the one related to Bookmarks, so empty the
|
||||
// id_bookmark selector to avoid misinterpretation in
|
||||
// /import about what needs to be done
|
||||
$form.find('select[name=id_bookmark]').val('');
|
||||
var isShowQuery = $('input[name="show_query"]').is(':checked');
|
||||
const isShowQuery = $('input[name="show_query"]').is(':checked');
|
||||
if (isShowQuery) {
|
||||
window.localStorage.showThisQuery = '1';
|
||||
var db = $('input[name="db"]').val();
|
||||
var table = $('input[name="table"]').val();
|
||||
var query;
|
||||
const db = $('input[name="db"]').val();
|
||||
const table = $('input[name="table"]').val();
|
||||
let query;
|
||||
if (window.codeMirrorEditor) {
|
||||
query = window.codeMirrorEditor.getValue();
|
||||
} else {
|
||||
@ -752,14 +755,14 @@ AJAX.registerOnload('sql.js', function () {
|
||||
* based on the bookmarked query
|
||||
*/
|
||||
$(document).on('change', '#id_bookmark', function () {
|
||||
var varCount = $(this).find('option:selected').data('varcount');
|
||||
let varCount = $(this).find('option:selected').data('varcount');
|
||||
if (typeof varCount === 'undefined') {
|
||||
varCount = 0;
|
||||
}
|
||||
|
||||
var $varDiv = $('#bookmarkVariables');
|
||||
const $varDiv = $('#bookmarkVariables');
|
||||
$varDiv.empty();
|
||||
for (var i = 1; i <= varCount; i++) {
|
||||
for (let i = 1; i <= varCount; i++) {
|
||||
$varDiv.append($('<div class="mb-3">'));
|
||||
$varDiv.append($('<label for="bookmarkVariable' + i + '">' + window.sprintf(window.Messages.strBookmarkVariable, i) + '</label>'));
|
||||
$varDiv.append($('<input class="form-control" type="text" size="10" name="bookmark_variable[' + i + ']" id="bookmarkVariable' + i + '">'));
|
||||
@ -781,7 +784,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
*/
|
||||
$('input[name=bookmark_variable]').on('keypress', function (event) {
|
||||
// force the 'Enter Key' to implicitly click the #button_submit_bookmark
|
||||
var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode));
|
||||
const keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode));
|
||||
if (keycode === 13) { // keycode for enter key
|
||||
// When you press enter in the sqlqueryform, which
|
||||
// has 2 submit buttons, the default is to run the
|
||||
@ -809,7 +812,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
$(document).on('submit', '#sqlqueryform.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var $form = $(this);
|
||||
const $form = $(this);
|
||||
if (window.codeMirrorEditor) {
|
||||
$form[0].elements.sql_query.value = window.codeMirrorEditor.getValue();
|
||||
}
|
||||
@ -821,12 +824,12 @@ AJAX.registerOnload('sql.js', function () {
|
||||
// remove any div containing a previous error message
|
||||
$('.alert-danger').remove();
|
||||
|
||||
var $msgbox = ajaxShowMessage();
|
||||
var $sqlqueryresultsouter = $('#sqlqueryresultsouter');
|
||||
const $msgbox = ajaxShowMessage();
|
||||
const $sqlqueryresultsouter = $('#sqlqueryresultsouter');
|
||||
|
||||
prepareForAjaxRequest($form);
|
||||
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
$.post($form.attr('action'), $form.serialize() + argsep + 'ajax_page_request=true', function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
// success happens if the query returns rows or not
|
||||
@ -887,7 +890,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
Navigation.update(CommonParams.setAll({ 'db': data.db, 'table': '' }));
|
||||
}
|
||||
|
||||
var url;
|
||||
let url;
|
||||
if (data.db) {
|
||||
if (data.table) {
|
||||
url = 'index.php?route=/table/sql';
|
||||
@ -939,13 +942,13 @@ AJAX.registerOnload('sql.js', function () {
|
||||
$(document).on('submit', 'form[name=\'displayOptionsForm\'].ajax', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var $form = $(this);
|
||||
const $form = $(this);
|
||||
|
||||
var $msgbox = ajaxShowMessage();
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
const $msgbox = ajaxShowMessage();
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
$.post($form.attr('action'), $form.serialize() + argsep + 'ajax_request=true', function (data) {
|
||||
ajaxRemoveMessage($msgbox);
|
||||
var $sqlqueryresults = $form.parents('.sqlqueryresults');
|
||||
const $sqlqueryresults = $form.parents('.sqlqueryresults');
|
||||
$sqlqueryresults
|
||||
.html(data.message)
|
||||
.trigger('makeGrid');
|
||||
@ -957,21 +960,21 @@ AJAX.registerOnload('sql.js', function () {
|
||||
|
||||
// Filter row handling. --STARTS--
|
||||
$(document).on('keyup', '.filter_rows', function () {
|
||||
var uniqueId = $(this).data('for');
|
||||
var $targetTable = $('.table_results[data-uniqueId=\'' + uniqueId + '\']');
|
||||
var $headerCells = $targetTable.find('th[data-column]');
|
||||
var targetColumns = [];
|
||||
const uniqueId = $(this).data('for');
|
||||
const $targetTable = $('.table_results[data-uniqueId=\'' + uniqueId + '\']');
|
||||
const $headerCells = $targetTable.find('th[data-column]');
|
||||
const targetColumns = [];
|
||||
|
||||
// To handle colspan=4, in case of edit, copy, etc options (Table row links). Add 3 dummy <TH> elements - only when the Table row links are NOT on the "Right"
|
||||
var rowLinksLocation = ($targetTable.find('thead > tr > th')).first();
|
||||
var dummyTh = (rowLinksLocation[0].getAttribute('colspan') !== null) ? '<th class="hide dummy_th"></th><th class="hide dummy_th"></th><th class="hide dummy_th"></th>' : ''; // Selecting columns that will be considered for filtering and searching.
|
||||
const rowLinksLocation = ($targetTable.find('thead > tr > th')).first();
|
||||
const dummyTh = (rowLinksLocation[0].getAttribute('colspan') !== null) ? '<th class="hide dummy_th"></th><th class="hide dummy_th"></th><th class="hide dummy_th"></th>' : ''; // Selecting columns that will be considered for filtering and searching.
|
||||
|
||||
// Selecting columns that will be considered for filtering and searching.
|
||||
$headerCells.each(function () {
|
||||
targetColumns.push($(this).text().trim());
|
||||
});
|
||||
|
||||
var phrase = $(this).val();
|
||||
const phrase = $(this).val();
|
||||
// Set same value to both Filter rows fields.
|
||||
$('.filter_rows[data-for=\'' + uniqueId + '\']').not(this).val(phrase);
|
||||
// Handle colspan.
|
||||
@ -984,11 +987,11 @@ AJAX.registerOnload('sql.js', function () {
|
||||
// Prompt to confirm on Show All
|
||||
$('body').on('click', '.navigation .showAllRows', function (e) {
|
||||
e.preventDefault();
|
||||
var $form = $(this).parents('form');
|
||||
const $form = $(this).parents('form');
|
||||
|
||||
const submitShowAllForm = function () {
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
const submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $form;
|
||||
$.post($form.attr('action'), submitData, AJAX.responseHandler);
|
||||
@ -1011,10 +1014,10 @@ AJAX.registerOnload('sql.js', function () {
|
||||
* Ajax event handler for 'Simulate DML'.
|
||||
*/
|
||||
$('body').on('click', '#simulate_dml', function () {
|
||||
var $form = $('#sqlqueryform');
|
||||
var query = '';
|
||||
var delimiter = $('#id_sql_delimiter').val();
|
||||
var dbName = $form.find('input[name="db"]').val();
|
||||
const $form = $('#sqlqueryform');
|
||||
let query = '';
|
||||
const delimiter = $('#id_sql_delimiter').val();
|
||||
const dbName = $form.find('input[name="db"]').val();
|
||||
|
||||
if (window.codeMirrorEditor) {
|
||||
query = window.codeMirrorEditor.getValue();
|
||||
@ -1029,7 +1032,7 @@ AJAX.registerOnload('sql.js', function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
var $msgbox = ajaxShowMessage();
|
||||
const $msgbox = ajaxShowMessage();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'index.php?route=/import/simulate-dml',
|
||||
@ -1043,10 +1046,10 @@ AJAX.registerOnload('sql.js', function () {
|
||||
success: function (response) {
|
||||
ajaxRemoveMessage($msgbox);
|
||||
if (response.success) {
|
||||
var dialogContent = '<div class="preview_sql">';
|
||||
let dialogContent = '<div class="preview_sql">';
|
||||
if (response.sql_data) {
|
||||
var len = response.sql_data.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
const len = response.sql_data.length;
|
||||
for (let i = 0; i < len; i++) {
|
||||
dialogContent += '<strong>' + window.Messages.strSQLQuery +
|
||||
'</strong>' + response.sql_data[i].sql_query +
|
||||
window.Messages.strAffectedRows +
|
||||
@ -1062,8 +1065,8 @@ AJAX.registerOnload('sql.js', function () {
|
||||
}
|
||||
|
||||
dialogContent += '</div>';
|
||||
var $dialogContent = $(dialogContent);
|
||||
var modal = $('#simulateDmlModal');
|
||||
const $dialogContent = $(dialogContent);
|
||||
const modal = $('#simulateDmlModal');
|
||||
modal.modal('show');
|
||||
modal.find('.modal-body').first()
|
||||
// @ts-ignore
|
||||
@ -1087,15 +1090,15 @@ AJAX.registerOnload('sql.js', function () {
|
||||
*/
|
||||
$('body').on('click', 'form[name="resultsForm"].ajax button[name="submit_mult"], form[name="resultsForm"].ajax input[name="submit_mult"]', function (e) {
|
||||
e.preventDefault();
|
||||
var $button = $(this);
|
||||
var action = $button.val();
|
||||
var $form = $button.closest('form');
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep;
|
||||
const $button = $(this);
|
||||
const action = $button.val();
|
||||
const $form = $button.closest('form');
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
let submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep;
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $form;
|
||||
|
||||
var url;
|
||||
let url;
|
||||
if (action === 'edit') {
|
||||
submitData = submitData + argsep + 'default_action=update';
|
||||
url = 'index.php?route=/table/change/rows';
|
||||
@ -1114,20 +1117,20 @@ AJAX.registerOnload('sql.js', function () {
|
||||
});
|
||||
|
||||
$(document).on('submit', '.maxRowsForm', function () {
|
||||
var unlimNumRows = Number($(this).find('input[name="unlim_num_rows"]').val());
|
||||
const unlimNumRows = Number($(this).find('input[name="unlim_num_rows"]').val());
|
||||
|
||||
var maxRowsCheck = checkFormElementInRange(
|
||||
const maxRowsCheck = checkFormElementInRange(
|
||||
this,
|
||||
'session_max_rows',
|
||||
window.Messages.strNotValidRowNumber,
|
||||
1
|
||||
1,
|
||||
);
|
||||
var posCheck = checkFormElementInRange(
|
||||
const posCheck = checkFormElementInRange(
|
||||
this,
|
||||
'pos',
|
||||
window.Messages.strNotValidRowNumber,
|
||||
0,
|
||||
unlimNumRows > 0 ? unlimNumRows - 1 : null
|
||||
unlimNumRows > 0 ? unlimNumRows - 1 : null,
|
||||
);
|
||||
|
||||
return maxRowsCheck && posCheck;
|
||||
@ -1169,19 +1172,19 @@ AJAX.registerOnload('sql.js', function () {
|
||||
*/
|
||||
function changeClassForColumn ($thisTh, newClass, isAddClass = undefined) {
|
||||
// index 0 is the th containing the big T
|
||||
var thIndex = $thisTh.index();
|
||||
var hasBigT = $thisTh.closest('tr').children().first().hasClass('column_action');
|
||||
let thIndex = $thisTh.index();
|
||||
const hasBigT = $thisTh.closest('tr').children().first().hasClass('column_action');
|
||||
// .eq() is zero-based
|
||||
if (hasBigT) {
|
||||
thIndex--;
|
||||
}
|
||||
|
||||
var $table = $thisTh.parents('.table_results');
|
||||
let $table = $thisTh.parents('.table_results');
|
||||
if (! $table.length) {
|
||||
$table = $thisTh.parents('table').siblings('.table_results');
|
||||
}
|
||||
|
||||
var $tds = $table.find('tbody tr').find('td.data').eq(thIndex);
|
||||
const $tds = $table.find('tbody tr').find('td.data').eq(thIndex);
|
||||
if (isAddClass === undefined) {
|
||||
$tds.toggleClass(newClass);
|
||||
} else {
|
||||
@ -1195,12 +1198,12 @@ function changeClassForColumn ($thisTh, newClass, isAddClass = undefined) {
|
||||
* @param {object} $thisA reference to the browse foreign value link
|
||||
*/
|
||||
function browseForeignDialog ($thisA) {
|
||||
var formId = '#browse_foreign_form';
|
||||
var showAllId = '#foreign_showAll';
|
||||
var tableId = '#browse_foreign_table';
|
||||
var filterId = '#input_foreign_filter';
|
||||
var argSep = CommonParams.get('arg_separator');
|
||||
var params = $thisA.getPostData();
|
||||
const formId = '#browse_foreign_form';
|
||||
const showAllId = '#foreign_showAll';
|
||||
const tableId = '#browse_foreign_table';
|
||||
const filterId = '#input_foreign_filter';
|
||||
const argSep = CommonParams.get('arg_separator');
|
||||
let params = $thisA.getPostData();
|
||||
params += argSep + 'ajax_request=true';
|
||||
|
||||
let browseForeignModal = document.getElementById('browseForeignModal');
|
||||
@ -1240,10 +1243,10 @@ function browseForeignDialog ($thisA) {
|
||||
browseForeignModal.querySelector('.modal-body').innerHTML = data.message;
|
||||
modal.show();
|
||||
}).done(function () {
|
||||
var showAll = false;
|
||||
let showAll = false;
|
||||
$(tableId).on('click', 'td a.foreign_value', function (e) {
|
||||
e.preventDefault();
|
||||
var $input = $thisA.prev('input[type=text]');
|
||||
let $input = $thisA.prev('input[type=text]');
|
||||
// Check if input exists or get CEdit edit_box
|
||||
if ($input.length === 0) {
|
||||
$input = $thisA.closest('.edit_area').prev('.edit_box');
|
||||
@ -1269,7 +1272,7 @@ function browseForeignDialog ($thisA) {
|
||||
$(formId).find('select[name=pos]').val('0');
|
||||
}
|
||||
|
||||
var postParams = $(this).serializeArray();
|
||||
const postParams = $(this).serializeArray();
|
||||
// if showAll button was clicked to submit form then
|
||||
// add showAll button parameter to form
|
||||
if (showAll) {
|
||||
@ -1281,7 +1284,7 @@ function browseForeignDialog ($thisA) {
|
||||
|
||||
// updates values in dialog
|
||||
$.post($(this).attr('action') + '&ajax_request=1', postParams, function (data) {
|
||||
var $obj = $('<div>').html(data.message);
|
||||
const $obj = $('<div>').html(data.message);
|
||||
$(formId).html($obj.find(formId).html());
|
||||
$(tableId).html($obj.find(tableId).html());
|
||||
});
|
||||
@ -1296,9 +1299,9 @@ function browseForeignDialog ($thisA) {
|
||||
* @return {string}
|
||||
*/
|
||||
function getAutoSavedKey () {
|
||||
var db = $('input[name="db"]').val();
|
||||
var table = $('input[name="table"]').val();
|
||||
var key = db;
|
||||
const db = $('input[name="db"]').val();
|
||||
const table = $('input[name="table"]').val();
|
||||
let key = db;
|
||||
if (table !== undefined) {
|
||||
key += '.' + table;
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ import { addDateTimePicker } from '../modules/functions.ts';
|
||||
*/
|
||||
function nullify (theType, md5Field, multiEdit) {
|
||||
// @ts-ignore
|
||||
var rowForm = document.forms.insertForm;
|
||||
const rowForm = document.forms.insertForm;
|
||||
|
||||
if (typeof (rowForm.elements['funcs' + multiEdit + '[' + md5Field + ']']) !== 'undefined') {
|
||||
rowForm.elements['funcs' + multiEdit + '[' + md5Field + ']'].selectedIndex = -1;
|
||||
@ -30,13 +30,13 @@ function nullify (theType, md5Field, multiEdit) {
|
||||
rowForm.elements['fields' + multiEdit + '[' + md5Field + ']'][1].selectedIndex = -1;
|
||||
// Other "ENUM" field
|
||||
} else if (Number(theType) === 2) {
|
||||
var elts = rowForm.elements['fields' + multiEdit + '[' + md5Field + ']'];
|
||||
const elts = rowForm.elements['fields' + multiEdit + '[' + md5Field + ']'];
|
||||
// when there is just one option in ENUM:
|
||||
if (elts.checked) {
|
||||
elts.checked = false;
|
||||
} else {
|
||||
var eltsCnt = elts.length;
|
||||
for (var i = 0; i < eltsCnt; i++) {
|
||||
const eltsCnt = elts.length;
|
||||
for (let i = 0; i < eltsCnt; i++) {
|
||||
elts[i].checked = false;
|
||||
} // end for
|
||||
} // end if
|
||||
@ -69,7 +69,7 @@ function daysInFebruary (year) {
|
||||
|
||||
// function to convert single digit to double digit
|
||||
function fractionReplace (number) {
|
||||
var num = parseInt(number, 10);
|
||||
const num = parseInt(number, 10);
|
||||
|
||||
return num >= 1 && num <= 9 ? '0' + num : '00';
|
||||
}
|
||||
@ -82,25 +82,25 @@ function fractionReplace (number) {
|
||||
* 4) And instead of using '-' the following punctuations can be used (+,.,*,^,@,/) All these are accepted by mysql as well. Therefore no issues
|
||||
*/
|
||||
function isDate (val, tmstmp = undefined) {
|
||||
var value = val.replace(/[.|*|^|+|//|@]/g, '-');
|
||||
var arrayVal = value.split('-');
|
||||
for (var a = 0; a < arrayVal.length; a++) {
|
||||
let value = val.replace(/[.|*|^|+|//|@]/g, '-');
|
||||
const arrayVal = value.split('-');
|
||||
for (let a = 0; a < arrayVal.length; a++) {
|
||||
if (arrayVal[a].length === 1) {
|
||||
arrayVal[a] = fractionReplace(arrayVal[a]);
|
||||
}
|
||||
}
|
||||
|
||||
value = arrayVal.join('-');
|
||||
var pos = 2;
|
||||
var dtexp = new RegExp(/^([0-9]{4})-(((01|03|05|07|08|10|12)-((0[0-9])|([1-2][0-9])|(3[0-1])))|((02|04|06|09|11)-((0[0-9])|([1-2][0-9])|30))|((00)-(00)))$/);
|
||||
let pos = 2;
|
||||
const dtexp = new RegExp(/^([0-9]{4})-(((01|03|05|07|08|10|12)-((0[0-9])|([1-2][0-9])|(3[0-1])))|((02|04|06|09|11)-((0[0-9])|([1-2][0-9])|30))|((00)-(00)))$/);
|
||||
if (value.length === 8) {
|
||||
pos = 0;
|
||||
}
|
||||
|
||||
if (dtexp.test(value)) {
|
||||
var month = parseInt(value.substring(pos + 3, pos + 5), 10);
|
||||
var day = parseInt(value.substring(pos + 6, pos + 8), 10);
|
||||
var year = parseInt(value.substring(0, pos + 2), 10);
|
||||
const month = parseInt(value.substring(pos + 3, pos + 5), 10);
|
||||
const day = parseInt(value.substring(pos + 6, pos + 8), 10);
|
||||
let year = parseInt(value.substring(0, pos + 2), 10);
|
||||
if (month === 2 && day > daysInFebruary(year)) {
|
||||
return false;
|
||||
}
|
||||
@ -132,15 +132,17 @@ function isDate (val, tmstmp = undefined) {
|
||||
* 3) 2:23:43.123456
|
||||
*/
|
||||
function isTime (val) {
|
||||
var arrayVal = val.split(':');
|
||||
for (var a = 0, l = arrayVal.length; a < l; a++) {
|
||||
const arrayVal = val.split(':');
|
||||
let a = 0;
|
||||
const l = arrayVal.length;
|
||||
for (; a < l; a++) {
|
||||
if (arrayVal[a].length === 1) {
|
||||
arrayVal[a] = fractionReplace(arrayVal[a]);
|
||||
}
|
||||
}
|
||||
|
||||
var newVal = arrayVal.join(':');
|
||||
var tmexp = new RegExp(/^(-)?(([0-7]?[0-9][0-9])|(8[0-2][0-9])|(83[0-8])):((0[0-9])|([1-5][0-9])):((0[0-9])|([1-5][0-9]))(\.[0-9]{1,6}){0,1}$/);
|
||||
const newVal = arrayVal.join(':');
|
||||
const tmexp = new RegExp(/^(-)?(([0-7]?[0-9][0-9])|(8[0-2][0-9])|(83[0-8])):((0[0-9])|([1-5][0-9])):((0[0-9])|([1-5][0-9]))(\.[0-9]{1,6}){0,1}$/);
|
||||
|
||||
return tmexp.test(newVal);
|
||||
}
|
||||
@ -161,7 +163,7 @@ function checkForCheckbox (multiEdit) {
|
||||
// used in Search page mostly for INT fields
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function verifyAfterSearchFieldChange (index, searchFormId) {
|
||||
var $thisInput = $('input[name=\'criteriaValues[' + index + ']\']');
|
||||
const $thisInput = $('input[name=\'criteriaValues[' + index + ']\']');
|
||||
// Add data-skip-validators attribute to skip validation in changeValueFieldType function
|
||||
if ($('#fieldID_' + index).data('data-skip-validators')) {
|
||||
$(searchFormId).validate().destroy();
|
||||
@ -175,7 +177,7 @@ function verifyAfterSearchFieldChange (index, searchFormId) {
|
||||
// Trim spaces if it's an integer
|
||||
$thisInput.val(($thisInput.val() as string).trim());
|
||||
|
||||
var hasMultiple = $thisInput.prop('multiple');
|
||||
const hasMultiple = $thisInput.prop('multiple');
|
||||
|
||||
if (hasMultiple) {
|
||||
$(searchFormId).validate({
|
||||
@ -266,8 +268,8 @@ function validateMultipleIntField (jqueryInput, returnValueIfFine): void {
|
||||
* @param {boolean} returnValueIfIsNumber the value to return if the validator passes
|
||||
*/
|
||||
function validateIntField (jqueryInput, returnValueIfIsNumber): void {
|
||||
var mini = parseInt(jqueryInput.data('min'));
|
||||
var maxi = parseInt(jqueryInput.data('max'));
|
||||
const mini = parseInt(jqueryInput.data('min'));
|
||||
const maxi = parseInt(jqueryInput.data('max'));
|
||||
// removing previous rules
|
||||
jqueryInput.rules('remove');
|
||||
|
||||
@ -321,14 +323,14 @@ function validateFloatField (jqueryInput, returnValueIfIsNumber): void {
|
||||
}
|
||||
|
||||
function verificationsAfterFieldChange (urlField, multiEdit, theType) {
|
||||
var evt = window.event || arguments.callee.caller.arguments[0];
|
||||
var target = evt.target || evt.srcElement;
|
||||
var $thisInput = ($(':input[name^=\'fields[multi_edit][' + multiEdit + '][' +
|
||||
const evt = window.event || arguments.callee.caller.arguments[0];
|
||||
const target = evt.target || evt.srcElement;
|
||||
const $thisInput = ($(':input[name^=\'fields[multi_edit][' + multiEdit + '][' +
|
||||
urlField + ']\']') as JQuery<HTMLInputElement>);
|
||||
// the function drop-down that corresponds to this input field
|
||||
var $thisFunction = ($('select[name=\'funcs[multi_edit][' + multiEdit + '][' +
|
||||
const $thisFunction = ($('select[name=\'funcs[multi_edit][' + multiEdit + '][' +
|
||||
urlField + ']\']') as JQuery<HTMLSelectElement>);
|
||||
var functionSelected = false;
|
||||
let functionSelected = false;
|
||||
if (typeof $thisFunction.val() !== 'undefined' &&
|
||||
$thisFunction.val() !== null &&
|
||||
($thisFunction.val() as string).length > 0
|
||||
@ -337,7 +339,7 @@ function verificationsAfterFieldChange (urlField, multiEdit, theType) {
|
||||
}
|
||||
|
||||
// To generate the textbox that can take the salt
|
||||
var newSaltBox = '<br><input type=text name=salt[multi_edit][' + multiEdit + '][' + urlField + ']' +
|
||||
const newSaltBox = '<br><input type=text name=salt[multi_edit][' + multiEdit + '][' + urlField + ']' +
|
||||
' id=salt_' + target.id + ' placeholder=\'' + window.Messages.strEncryptionKey + '\'>';
|
||||
|
||||
// If encrypting or decrypting functions that take salt as input is selected append the new textbox for salt
|
||||
@ -356,7 +358,7 @@ function verificationsAfterFieldChange (urlField, multiEdit, theType) {
|
||||
$('#salt_' + target.id).remove();
|
||||
}
|
||||
|
||||
var couldFetchRules = false;
|
||||
let couldFetchRules = false;
|
||||
try {
|
||||
// See: issue #18792 - In some weird cases the input goes away before it validates
|
||||
// And it breaks jquery, this is a well known jquery bug with different trigger schemes
|
||||
@ -396,7 +398,7 @@ function verificationsAfterFieldChange (urlField, multiEdit, theType) {
|
||||
|
||||
if (target.value === 'HEX' && theType.startsWith('int')) {
|
||||
// Add note when HEX function is selected on a int
|
||||
var newHexInfo = '<br><p id="note' + target.id + '">' + window.Messages.HexConversionInfo + '</p>';
|
||||
const newHexInfo = '<br><p id="note' + target.id + '">' + window.Messages.HexConversionInfo + '</p>';
|
||||
if (! $('#note' + target.id).length) {
|
||||
$thisInput.after(newHexInfo);
|
||||
}
|
||||
@ -414,7 +416,7 @@ function verificationsAfterFieldChange (urlField, multiEdit, theType) {
|
||||
// Unchecks the Ignore checkbox for the current row
|
||||
$('input[name=\'insert_ignore_' + multiEdit + '\']').prop('checked', false);
|
||||
|
||||
var charExceptionHandling;
|
||||
let charExceptionHandling;
|
||||
if (theType.startsWith('char')) {
|
||||
charExceptionHandling = theType.substring(5, 6);
|
||||
} else if (theType.startsWith('varchar')) {
|
||||
@ -452,7 +454,7 @@ function verificationsAfterFieldChange (urlField, multiEdit, theType) {
|
||||
validateIntField($thisInput, checkForCheckbox(multiEdit));
|
||||
// validation for CHAR types
|
||||
} else if ($thisInput.data('type') === 'CHAR') {
|
||||
var maxlen = $thisInput.data('maxlength');
|
||||
let maxlen = $thisInput.data('maxlength');
|
||||
if (typeof maxlen !== 'undefined') {
|
||||
if (maxlen <= 4) {
|
||||
maxlen = charExceptionHandling;
|
||||
@ -507,7 +509,7 @@ AJAX.registerTeardown('table/change.js', function () {
|
||||
$(document).off('change', '#insert_rows');
|
||||
|
||||
// Reset grid edit state
|
||||
var grid = $('table.table_results').data('pmaGrid');
|
||||
const grid = $('table.table_results').data('pmaGrid');
|
||||
|
||||
if (grid && typeof grid.resetGridEditState === 'function') {
|
||||
grid.resetGridEditState();
|
||||
@ -550,12 +552,12 @@ AJAX.registerOnload('table/change.js', function () {
|
||||
});
|
||||
|
||||
$.validator.addMethod('validationFunctionForAesDesEncrypt', function (value, element, options) {
|
||||
var funType = value.substring(0, 3);
|
||||
const funType = value.substring(0, 3);
|
||||
if (funType !== 'AES' && funType !== 'DES') {
|
||||
return false;
|
||||
}
|
||||
|
||||
var dataType = options.data('type');
|
||||
const dataType = options.data('type');
|
||||
|
||||
if (dataType === 'HEX' || dataType === 'CHAR') {
|
||||
return true;
|
||||
@ -565,14 +567,14 @@ AJAX.registerOnload('table/change.js', function () {
|
||||
});
|
||||
|
||||
$.validator.addMethod('validationFunctionForDateTime', function (value, element, options) {
|
||||
var dtValue = value;
|
||||
var theType = options;
|
||||
let dtValue = value;
|
||||
const theType = options;
|
||||
if (theType === 'date') {
|
||||
return isDate(dtValue);
|
||||
} else if (theType === 'time') {
|
||||
return isTime(dtValue);
|
||||
} else if (theType === 'datetime' || theType === 'timestamp') {
|
||||
var tmstmp = false;
|
||||
let tmstmp = false;
|
||||
dtValue = dtValue.trim();
|
||||
if (dtValue === 'CURRENT_TIMESTAMP' || dtValue === 'current_timestamp()') {
|
||||
return true;
|
||||
@ -586,7 +588,7 @@ AJAX.registerOnload('table/change.js', function () {
|
||||
return true;
|
||||
}
|
||||
|
||||
var dv = dtValue.indexOf(' ');
|
||||
const dv = dtValue.indexOf(' ');
|
||||
if (dv === -1) { // Only the date component, which is valid
|
||||
return isDate(dtValue, tmstmp);
|
||||
}
|
||||
@ -633,11 +635,11 @@ AJAX.registerOnload('table/change.js', function () {
|
||||
* Uncheck the null checkbox as geometry data is placed on the input field
|
||||
*/
|
||||
$(document).on('click', 'button.gis-copy-data', function () {
|
||||
var inputName = $('form#gis_data_editor_form').find('input[name=\'input_name\']').val();
|
||||
var currentRow = $('input[name=\'' + inputName + '\']').parents('tr');
|
||||
var $nullCheckbox = currentRow.find('.checkbox_null');
|
||||
const inputName = $('form#gis_data_editor_form').find('input[name=\'input_name\']').val();
|
||||
const currentRow = $('input[name=\'' + inputName + '\']').parents('tr');
|
||||
const $nullCheckbox = currentRow.find('.checkbox_null');
|
||||
$nullCheckbox.prop('checked', false);
|
||||
var rowId = currentRow.find('.open_gis_editor').data('row-id');
|
||||
const rowId = currentRow.find('.open_gis_editor').data('row-id');
|
||||
|
||||
// Unchecks the Ignore checkbox for the current row
|
||||
$('input[name=\'insert_ignore_' + rowId + '\']').prop('checked', false);
|
||||
@ -665,16 +667,16 @@ AJAX.registerOnload('table/change.js', function () {
|
||||
* available).
|
||||
*/
|
||||
$('select[name="submit_type"]').on('change', function () {
|
||||
var thisElemSubmitTypeVal = $(this).val();
|
||||
var $table = $('table.insertRowTable');
|
||||
var autoIncrementColumn = $table.find('input[name^="auto_increment"]');
|
||||
const thisElemSubmitTypeVal = $(this).val();
|
||||
const $table = $('table.insertRowTable');
|
||||
const autoIncrementColumn = $table.find('input[name^="auto_increment"]');
|
||||
autoIncrementColumn.each(function () {
|
||||
var $thisElemAIField = $(this);
|
||||
var thisElemName = $thisElemAIField.attr('name');
|
||||
const $thisElemAIField = $(this);
|
||||
const thisElemName = $thisElemAIField.attr('name');
|
||||
|
||||
var prevValueField = $table.find('input[name="' + thisElemName.replace('auto_increment', 'fields_prev') + '"]');
|
||||
var valueField = $table.find('input[name="' + thisElemName.replace('auto_increment', 'fields') + '"]');
|
||||
var previousValue = $(prevValueField).val();
|
||||
const prevValueField = $table.find('input[name="' + thisElemName.replace('auto_increment', 'fields_prev') + '"]');
|
||||
const valueField = $table.find('input[name="' + thisElemName.replace('auto_increment', 'fields') + '"]');
|
||||
const previousValue = $(prevValueField).val();
|
||||
if (previousValue !== undefined) {
|
||||
if (thisElemSubmitTypeVal === 'insert'
|
||||
|| thisElemSubmitTypeVal === 'insertignore'
|
||||
@ -692,7 +694,7 @@ AJAX.registerOnload('table/change.js', function () {
|
||||
* Handle ENTER key when press on Continue insert with field
|
||||
*/
|
||||
$('#insert_rows').on('keypress', function (e) {
|
||||
var key = e.which;
|
||||
const key = e.which;
|
||||
if (key === 13) {
|
||||
addNewContinueInsertionFields(e);
|
||||
}
|
||||
@ -709,24 +711,25 @@ function addNewContinueInsertionFields (event) {
|
||||
/**
|
||||
* @var columnCount Number of number of columns table has.
|
||||
*/
|
||||
var columnCount = $('table.insertRowTable').first().find('tr').has('input[name*=\'fields_name\']').length;
|
||||
const columnCount = $('table.insertRowTable').first().find('tr').has('input[name*=\'fields_name\']').length;
|
||||
/**
|
||||
* @var curr_rows Number of current insert rows already on page
|
||||
*/
|
||||
var currRows = $('table.insertRowTable').length;
|
||||
let currRows = $('table.insertRowTable').length;
|
||||
/**
|
||||
* @var target_rows Number of rows the user wants
|
||||
*/
|
||||
var targetRows = Number($('#insert_rows').val());
|
||||
const targetRows = Number($('#insert_rows').val());
|
||||
|
||||
// remove all datepickers
|
||||
$('input.datefield, input.datetimefield').each(function () {
|
||||
$(this).datepicker('destroy');
|
||||
});
|
||||
|
||||
let newRowIndex: number;
|
||||
if (currRows < targetRows) {
|
||||
var tempIncrementIndex = function () {
|
||||
var $thisElement = $(this);
|
||||
const tempIncrementIndex = function () {
|
||||
const $thisElement = $(this);
|
||||
/**
|
||||
* Extract the index from the name attribute for all input/select fields and increment it
|
||||
* name is of format funcs[multi_edit][10][<long random string of alphanum chars>]
|
||||
@ -735,37 +738,37 @@ function addNewContinueInsertionFields (event) {
|
||||
/**
|
||||
* @var this_name String containing name of the input/select elements
|
||||
*/
|
||||
var thisName = $thisElement.attr('name');
|
||||
const thisName = $thisElement.attr('name');
|
||||
/** split {@link thisName} at [10], so we have the parts that can be concatenated later */
|
||||
var nameParts = thisName.split(/\[\d+\]/);
|
||||
const nameParts = thisName.split(/\[\d+\]/);
|
||||
/** extract the [10] from {@link nameParts} */
|
||||
var oldRowIndexString = thisName.match(/\[\d+\]/)[0];
|
||||
const oldRowIndexString = thisName.match(/\[\d+\]/)[0];
|
||||
/** extract 10 - had to split into two steps to accomodate double digits */
|
||||
var oldRowIndex = parseInt(oldRowIndexString.match(/\d+/)[0], 10);
|
||||
const oldRowIndex = parseInt(oldRowIndexString.match(/\d+/)[0], 10);
|
||||
|
||||
/** calculate next index i.e. 11 */
|
||||
newRowIndex = oldRowIndex + 1;
|
||||
/** generate the new name i.e. funcs[multi_edit][11][foobarbaz] */
|
||||
var newName = nameParts[0] + '[' + newRowIndex + ']' + nameParts[1];
|
||||
const newName = nameParts[0] + '[' + newRowIndex + ']' + nameParts[1];
|
||||
|
||||
var hashedField = nameParts[1].match(/\[(.+)\]/)[1];
|
||||
const hashedField = nameParts[1].match(/\[(.+)\]/)[1];
|
||||
$thisElement.attr('name', newName);
|
||||
|
||||
/** If element is select[name*='funcs'], update id */
|
||||
if ($thisElement.is('select[name*=\'funcs\']')) {
|
||||
var thisId = $thisElement.attr('id');
|
||||
var idParts = thisId.split(/_/);
|
||||
var oldIdIndex = idParts[1];
|
||||
var prevSelectedValue = $('#field_' + oldIdIndex + '_1').val();
|
||||
var newIdIndex = parseInt(oldIdIndex) + columnCount;
|
||||
var newId = 'field_' + newIdIndex + '_1';
|
||||
const thisId = $thisElement.attr('id');
|
||||
const idParts = thisId.split(/_/);
|
||||
const oldIdIndex = idParts[1];
|
||||
const prevSelectedValue = $('#field_' + oldIdIndex + '_1').val();
|
||||
const newIdIndex = parseInt(oldIdIndex) + columnCount;
|
||||
const newId = 'field_' + newIdIndex + '_1';
|
||||
$thisElement.attr('id', newId);
|
||||
$thisElement.find('option').filter(function () {
|
||||
return $(this).text() === prevSelectedValue;
|
||||
}).attr('selected', 'selected');
|
||||
|
||||
// If salt field is there then update its id.
|
||||
var nextSaltInput = $thisElement.parent().next('td').next('td').find('input[name*=\'salt\']');
|
||||
const nextSaltInput = $thisElement.parent().next('td').next('td').find('input[name*=\'salt\']');
|
||||
if (nextSaltInput.length !== 0) {
|
||||
nextSaltInput.attr('id', 'salt_' + newId);
|
||||
}
|
||||
@ -789,11 +792,11 @@ function addNewContinueInsertionFields (event) {
|
||||
.data('hashed_field', hashedField)
|
||||
.data('new_row_index', newRowIndex)
|
||||
.on('change', function () {
|
||||
var $changedElement = $(this);
|
||||
const $changedElement = $(this);
|
||||
verificationsAfterFieldChange(
|
||||
$changedElement.data('hashed_field'),
|
||||
$changedElement.data('new_row_index'),
|
||||
$changedElement.closest('tr').find('span.column_type').html()
|
||||
$changedElement.closest('tr').find('span.column_type').html(),
|
||||
);
|
||||
});
|
||||
}
|
||||
@ -808,26 +811,28 @@ function addNewContinueInsertionFields (event) {
|
||||
.data('hashed_field', hashedField)
|
||||
.data('new_row_index', newRowIndex)
|
||||
.on('click', function () {
|
||||
var $changedElement = $(this);
|
||||
const $changedElement = $(this);
|
||||
nullify(
|
||||
$changedElement.siblings('.nullify_code').val(),
|
||||
$changedElement.data('hashed_field'),
|
||||
'[multi_edit][' + $changedElement.data('new_row_index') + ']'
|
||||
'[multi_edit][' + $changedElement.data('new_row_index') + ']',
|
||||
);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var tempReplaceAnchor = function () {
|
||||
var $anchor = $(this);
|
||||
var newValue = 'rownumber=' + newRowIndex;
|
||||
const tempReplaceAnchor = function () {
|
||||
const $anchor = $(this);
|
||||
const newValue = 'rownumber=' + newRowIndex;
|
||||
// needs improvement in case something else inside
|
||||
// the href contains this pattern
|
||||
var newHref = $anchor.attr('href').replace(/rownumber=\d+/, newValue);
|
||||
const newHref = $anchor.attr('href').replace(/rownumber=\d+/, newValue);
|
||||
$anchor.attr('href', newHref);
|
||||
};
|
||||
|
||||
var restoreValue = function () {
|
||||
let $checkedValue;
|
||||
|
||||
const restoreValue = function () {
|
||||
if ($(this).closest('tr').find('span.column_type').html() === 'enum') {
|
||||
if ($(this).val() === $checkedValue) {
|
||||
$(this).prop('checked', true);
|
||||
@ -841,13 +846,13 @@ function addNewContinueInsertionFields (event) {
|
||||
/**
|
||||
* @var $last_row Object referring to the last row
|
||||
*/
|
||||
var $lastRow = $('#insertForm').find('.insertRowTable').last();
|
||||
const $lastRow = $('#insertForm').find('.insertRowTable').last();
|
||||
|
||||
// need to access this at more than one level
|
||||
// (also needs improvement because it should be calculated
|
||||
// just once per cloned row, not once per column)
|
||||
var newRowIndex = 0;
|
||||
var $checkedValue = $lastRow.find('input:checked').val();
|
||||
newRowIndex = 0;
|
||||
$checkedValue = $lastRow.find('input:checked').val();
|
||||
|
||||
// Clone the insert tables
|
||||
$lastRow
|
||||
@ -859,11 +864,11 @@ function addNewContinueInsertionFields (event) {
|
||||
.find('.foreign_values_anchor')
|
||||
.each(tempReplaceAnchor);
|
||||
|
||||
var $oldRow = $lastRow.find('.textfield');
|
||||
const $oldRow = $lastRow.find('.textfield');
|
||||
$oldRow.each(restoreValue);
|
||||
|
||||
// set the value of enum field of new row to default
|
||||
var $newRow = $('#insertForm').find('.insertRowTable').last();
|
||||
const $newRow = $('#insertForm').find('.insertRowTable').last();
|
||||
$newRow.find('.textfield').each(function () {
|
||||
if ($(this).closest('tr').find('span.column_type').html() === 'enum') {
|
||||
if ($(this).val() === $(this).closest('tr').find('span.default_value').html()) {
|
||||
@ -884,15 +889,15 @@ function addNewContinueInsertionFields (event) {
|
||||
/**
|
||||
* @var $last_checkbox Object reference to the last checkbox in #insertForm
|
||||
*/
|
||||
var $lastCheckbox = $('#insertForm').children('input:checkbox').last();
|
||||
const $lastCheckbox = $('#insertForm').children('input:checkbox').last();
|
||||
|
||||
/** name of {@link $lastCheckbox} */
|
||||
var lastCheckboxName = $lastCheckbox.attr('name');
|
||||
const lastCheckboxName = $lastCheckbox.attr('name');
|
||||
/** index of {@link $lastCheckbox} */
|
||||
// @ts-ignore
|
||||
var lastCheckboxIndex = parseInt(lastCheckboxName.match(/\d+/), 10);
|
||||
const lastCheckboxIndex = parseInt(lastCheckboxName.match(/\d+/), 10);
|
||||
/** name of new {@link $lastCheckbox} */
|
||||
var newName = lastCheckboxName.replace(/\d+/, (lastCheckboxIndex + 1).toString());
|
||||
const newName = lastCheckboxName.replace(/\d+/, (lastCheckboxIndex + 1).toString());
|
||||
|
||||
$('<br><div class="clearfloat"></div>')
|
||||
.insertBefore($('table.insertRowTable').last());
|
||||
@ -918,7 +923,7 @@ function addNewContinueInsertionFields (event) {
|
||||
// recompute tabindex for text fields and other controls at footer;
|
||||
// IMO it's not really important to handle the tabindex for
|
||||
// function and Null
|
||||
var tabIndex = 0;
|
||||
let tabIndex = 0;
|
||||
$('.textfield, .char, textarea')
|
||||
.each(function () {
|
||||
tabIndex++;
|
||||
@ -937,7 +942,7 @@ function addNewContinueInsertionFields (event) {
|
||||
* Displays alert if data loss possible on decrease
|
||||
* of rows.
|
||||
*/
|
||||
var checkLock = $.isEmptyObject(AJAX.lockedTargets);
|
||||
const checkLock = $.isEmptyObject(AJAX.lockedTargets);
|
||||
if (checkLock || confirm(window.Messages.strConfirmRowChange) === true) {
|
||||
while (currRows > targetRows) {
|
||||
$('input[id^=insert_ignore]').last()
|
||||
@ -957,13 +962,13 @@ function addNewContinueInsertionFields (event) {
|
||||
}
|
||||
|
||||
function changeValueFieldType (elem, searchIndex) {
|
||||
var fieldsValue = $('input#fieldID_' + searchIndex);
|
||||
const fieldsValue = $('input#fieldID_' + searchIndex);
|
||||
// @ts-ignore
|
||||
if (0 === fieldsValue.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var type = $(elem).val();
|
||||
const type = $(elem).val();
|
||||
|
||||
if ('LIKE' === type ||
|
||||
'LIKE %...%' === type ||
|
||||
|
||||
@ -5,20 +5,20 @@ import { ajaxRemoveMessage, ajaxShowMessage } from '../modules/ajax-message.ts';
|
||||
import { escapeHtml } from '../modules/functions/escape.ts';
|
||||
import { ColumnType, DataTable } from '../modules/chart.ts';
|
||||
|
||||
var chartData = {};
|
||||
var tempChartTitle;
|
||||
let chartData = {};
|
||||
let tempChartTitle;
|
||||
|
||||
var currentChart = null;
|
||||
var currentSettings = null;
|
||||
let currentChart = null;
|
||||
let currentSettings = null;
|
||||
|
||||
var dateTimeCols = [];
|
||||
var numericCols = [];
|
||||
const dateTimeCols = [];
|
||||
const numericCols = [];
|
||||
|
||||
function extractDate (dateString) {
|
||||
var matches;
|
||||
var match;
|
||||
var dateTimeRegExp = /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/;
|
||||
var dateRegExp = /[0-9]{4}-[0-9]{2}-[0-9]{2}/;
|
||||
let matches;
|
||||
let match;
|
||||
const dateTimeRegExp = /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/;
|
||||
const dateRegExp = /[0-9]{4}-[0-9]{2}-[0-9]{2}/;
|
||||
|
||||
matches = dateTimeRegExp.exec(dateString);
|
||||
if (matches !== null && matches.length > 0) {
|
||||
@ -43,33 +43,33 @@ function queryChart (data, columnNames, settings) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var plotSettings = {
|
||||
const plotSettings = {
|
||||
title: {
|
||||
text: settings.title,
|
||||
escapeHtml: true
|
||||
escapeHtml: true,
|
||||
},
|
||||
grid: {
|
||||
drawBorder: false,
|
||||
shadow: false,
|
||||
background: 'rgba(0,0,0,0)'
|
||||
background: 'rgba(0,0,0,0)',
|
||||
},
|
||||
legend: {
|
||||
show: true,
|
||||
placement: 'outsideGrid',
|
||||
location: 'e',
|
||||
rendererOptions: {
|
||||
numberColumns: 2
|
||||
}
|
||||
numberColumns: 2,
|
||||
},
|
||||
},
|
||||
axes: {
|
||||
xaxis: {
|
||||
label: escapeHtml(settings.xaxisLabel)
|
||||
label: escapeHtml(settings.xaxisLabel),
|
||||
},
|
||||
yaxis: {
|
||||
label: settings.yaxisLabel
|
||||
}
|
||||
label: settings.yaxisLabel,
|
||||
},
|
||||
},
|
||||
stackSeries: settings.stackSeries
|
||||
stackSeries: settings.stackSeries,
|
||||
};
|
||||
|
||||
// create the data table and add columns
|
||||
@ -82,26 +82,26 @@ function queryChart (data, columnNames, settings) {
|
||||
dataTable.addColumn(ColumnType.STRING, columnNames[settings.mainAxis]);
|
||||
}
|
||||
|
||||
var i;
|
||||
var values = [];
|
||||
let i;
|
||||
const values = [];
|
||||
if (settings.seriesColumn === null) {
|
||||
$.each(settings.selectedSeries, function (index, element) {
|
||||
dataTable.addColumn(ColumnType.NUMBER, columnNames[element]);
|
||||
});
|
||||
|
||||
// set data to the data table
|
||||
var columnsToExtract = [settings.mainAxis];
|
||||
const columnsToExtract = [settings.mainAxis];
|
||||
$.each(settings.selectedSeries, function (index, element) {
|
||||
columnsToExtract.push(element);
|
||||
});
|
||||
|
||||
var newRow;
|
||||
var row;
|
||||
var col;
|
||||
let newRow;
|
||||
let row;
|
||||
let col;
|
||||
for (i = 0; i < data.length; i++) {
|
||||
row = data[i];
|
||||
newRow = [];
|
||||
for (var j = 0; j < columnsToExtract.length; j++) {
|
||||
for (let j = 0; j < columnsToExtract.length; j++) {
|
||||
col = columnNames[columnsToExtract[j]];
|
||||
if (j === 0) {
|
||||
if (settings.type === 'timeline') { // first column is date type
|
||||
@ -121,9 +121,9 @@ function queryChart (data, columnNames, settings) {
|
||||
|
||||
dataTable.setData(values);
|
||||
} else {
|
||||
var seriesNames = {};
|
||||
var seriesNumber = 1;
|
||||
var seriesColumnName = columnNames[settings.seriesColumn];
|
||||
const seriesNames = {};
|
||||
let seriesNumber = 1;
|
||||
const seriesColumnName = columnNames[settings.seriesColumn];
|
||||
for (i = 0; i < data.length; i++) {
|
||||
if (! seriesNames[data[i][seriesColumnName]]) {
|
||||
seriesNames[data[i][seriesColumnName]] = seriesNumber;
|
||||
@ -135,11 +135,11 @@ function queryChart (data, columnNames, settings) {
|
||||
dataTable.addColumn(ColumnType.NUMBER, seriesName);
|
||||
});
|
||||
|
||||
var valueMap = {};
|
||||
var xValue;
|
||||
var value;
|
||||
var mainAxisName = columnNames[settings.mainAxis];
|
||||
var valueColumnName = columnNames[settings.valueColumn];
|
||||
const valueMap = {};
|
||||
let xValue;
|
||||
let value;
|
||||
const mainAxisName = columnNames[settings.mainAxis];
|
||||
const valueColumnName = columnNames[settings.valueColumn];
|
||||
for (i = 0; i < data.length; i++) {
|
||||
xValue = data[i][mainAxisName];
|
||||
value = valueMap[xValue];
|
||||
@ -241,7 +241,7 @@ function drawChart () {
|
||||
currentChart.destroy();
|
||||
}
|
||||
|
||||
var columnNames = [];
|
||||
const columnNames = [];
|
||||
$('#chartXAxisSelect option').each(function () {
|
||||
columnNames.push(escapeHtml($(this).text()));
|
||||
});
|
||||
@ -257,8 +257,8 @@ function drawChart () {
|
||||
}
|
||||
|
||||
function getSelectedSeries () {
|
||||
var val = ($('#chartSeriesSelect').val() as string[]) || [];
|
||||
var ret = [];
|
||||
const val = ($('#chartSeriesSelect').val() as string[]) || [];
|
||||
const ret = [];
|
||||
$.each(val, function (i, v) {
|
||||
ret.push(parseInt(v, 10));
|
||||
});
|
||||
@ -267,7 +267,7 @@ function getSelectedSeries () {
|
||||
}
|
||||
|
||||
function onXAxisChange () {
|
||||
var $xAxisSelect = $('#chartXAxisSelect');
|
||||
const $xAxisSelect = $('#chartXAxisSelect');
|
||||
currentSettings.mainAxis = parseInt(($xAxisSelect.val() as string), 10);
|
||||
if (dateTimeCols.indexOf(currentSettings.mainAxis) !== -1) {
|
||||
document.getElementById('timelineChartType').classList.remove('d-none');
|
||||
@ -289,15 +289,15 @@ function onXAxisChange () {
|
||||
}
|
||||
}
|
||||
|
||||
var xAxisTitle = $xAxisSelect.children('option:selected').text();
|
||||
const xAxisTitle = $xAxisSelect.children('option:selected').text();
|
||||
$('#xAxisLabelInput').val(xAxisTitle);
|
||||
currentSettings.xaxisLabel = xAxisTitle;
|
||||
}
|
||||
|
||||
function onDataSeriesChange () {
|
||||
var $seriesSelect = $('#chartSeriesSelect');
|
||||
const $seriesSelect = $('#chartSeriesSelect');
|
||||
currentSettings.selectedSeries = getSelectedSeries();
|
||||
var yAxisTitle;
|
||||
let yAxisTitle;
|
||||
if (currentSettings.selectedSeries.length === 1) {
|
||||
document.getElementById('pieChartType').classList.remove('d-none');
|
||||
yAxisTitle = $seriesSelect.children('option:selected').text();
|
||||
@ -336,7 +336,7 @@ AJAX.registerTeardown('table/chart.js', function () {
|
||||
AJAX.registerOnload('table/chart.js', function () {
|
||||
// handle chart type changes
|
||||
$('input[name="chartType"]').on('click', function () {
|
||||
var type = currentSettings.type = $(this).val();
|
||||
const type = currentSettings.type = $(this).val();
|
||||
if (type === 'bar' || type === 'column' || type === 'area') {
|
||||
document.getElementById('barStacked').classList.remove('d-none');
|
||||
} else {
|
||||
@ -350,9 +350,9 @@ AJAX.registerOnload('table/chart.js', function () {
|
||||
|
||||
// handle chosing alternative data format
|
||||
$('#seriesColumnCheckbox').on('click', function () {
|
||||
var $seriesColumn = $('#chartSeriesColumnSelect');
|
||||
var $valueColumn = $('#chartValueColumnSelect');
|
||||
var $chartSeries = $('#chartSeriesSelect');
|
||||
const $seriesColumn = $('#chartSeriesColumnSelect');
|
||||
const $valueColumn = $('#chartValueColumnSelect');
|
||||
const $chartSeries = $('#chartSeriesSelect');
|
||||
if ($(this).is(':checked')) {
|
||||
$seriesColumn.prop('disabled', false);
|
||||
$valueColumn.prop('disabled', false);
|
||||
@ -434,7 +434,7 @@ AJAX.registerOnload('table/chart.js', function () {
|
||||
|
||||
// handler for ajax form submission
|
||||
($('#tblchartform') as JQuery<HTMLFormElement>).on('submit', function () {
|
||||
var $form = ($(this) as JQuery<HTMLFormElement>);
|
||||
const $form = ($(this) as JQuery<HTMLFormElement>);
|
||||
if (window.codeMirrorEditor) {
|
||||
// @ts-ignore
|
||||
$form[0].elements.sql_query.value = window.codeMirrorEditor.getValue();
|
||||
@ -444,7 +444,7 @@ AJAX.registerOnload('table/chart.js', function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
var $msgbox = ajaxShowMessage();
|
||||
const $msgbox = ajaxShowMessage();
|
||||
prepareForAjaxRequest($form);
|
||||
$.post($form.attr('action'), $form.serialize(), function (data) {
|
||||
if (typeof data !== 'undefined' &&
|
||||
@ -482,7 +482,7 @@ AJAX.registerOnload('table/chart.js', function () {
|
||||
seriesColumn: null
|
||||
};
|
||||
|
||||
var vals = ($('input[name="dateTimeCols"]').val() as string).split(' ');
|
||||
let vals = ($('input[name="dateTimeCols"]').val() as string).split(' ');
|
||||
$.each(vals, function (i, v) {
|
||||
dateTimeCols.push(parseInt(v, 10));
|
||||
});
|
||||
|
||||
@ -22,7 +22,7 @@ AJAX.registerOnload('table/find_replace.js', function () {
|
||||
$('#toggle_find')
|
||||
.html(window.Messages.strHideFindNReplaceCriteria)
|
||||
.on('click', function () {
|
||||
var $link = $(this);
|
||||
const $link = $(this);
|
||||
$('#find_replace_form').slideToggle();
|
||||
if ($link.text() === window.Messages.strHideFindNReplaceCriteria) {
|
||||
$link.text(window.Messages.strShowFindNReplaceCriteria);
|
||||
@ -35,9 +35,9 @@ AJAX.registerOnload('table/find_replace.js', function () {
|
||||
|
||||
$('#find_replace_form').on('submit', function (e) {
|
||||
e.preventDefault();
|
||||
var findReplaceForm = $('#find_replace_form');
|
||||
const findReplaceForm = $('#find_replace_form');
|
||||
prepareForAjaxRequest(findReplaceForm);
|
||||
var $msgbox = ajaxShowMessage();
|
||||
const $msgbox = ajaxShowMessage();
|
||||
$.post(findReplaceForm.attr('action'), findReplaceForm.serialize(), function (data) {
|
||||
ajaxRemoveMessage($msgbox);
|
||||
if (data.success === true) {
|
||||
|
||||
@ -30,11 +30,11 @@ AJAX.registerTeardown('table/operations.js', function () {
|
||||
* @param {JQuery} linkObject
|
||||
* @param {'TRUNCATE'|'DELETE'} action
|
||||
*/
|
||||
var confirmAndPost = function (linkObject, action): void {
|
||||
const confirmAndPost = function (linkObject, action): void {
|
||||
/**
|
||||
* @var {string} question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = '';
|
||||
let question = '';
|
||||
if (action === 'TRUNCATE') {
|
||||
question += window.Messages.strTruncateTableStrongWarning + ' ';
|
||||
} else if (action === 'DELETE') {
|
||||
@ -46,7 +46,7 @@ var confirmAndPost = function (linkObject, action): void {
|
||||
linkObject.confirm(question, linkObject.attr('href'), function (url) {
|
||||
ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
|
||||
var params = getJsConfirmCommonParam(this, linkObject.getPostData());
|
||||
const params = getJsConfirmCommonParam(this, linkObject.getPostData());
|
||||
|
||||
$.post(url, params, function (data) {
|
||||
if ($('.sqlqueryresults').length !== 0) {
|
||||
@ -79,9 +79,9 @@ AJAX.registerOnload('table/operations.js', function () {
|
||||
*/
|
||||
$(document).on('submit', '#copyTable.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var $form = $(this);
|
||||
const $form = $(this);
|
||||
prepareForAjaxRequest($form);
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
$.post($form.attr('action'), $form.serialize() + argsep + 'submit_copy=Go', function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
if ($form.find('input[name=\'switch_to_new\']').prop('checked')) {
|
||||
@ -116,9 +116,9 @@ AJAX.registerOnload('table/operations.js', function () {
|
||||
*/
|
||||
$(document).on('submit', '#moveTableForm', function (event) {
|
||||
event.preventDefault();
|
||||
var $form = $(this);
|
||||
const $form = $(this);
|
||||
prepareForAjaxRequest($form);
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
$.post($form.attr('action'), $form.serialize() + argsep + 'submit_move=1', function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
Navigation.update(CommonParams.set('db', data.params.db));
|
||||
@ -142,12 +142,12 @@ AJAX.registerOnload('table/operations.js', function () {
|
||||
$(document).on('submit', '#tableOptionsForm', function (event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
var $form = $(this);
|
||||
var $tblNameField = ($form.find('input[name=new_name]') as JQuery<HTMLInputElement>);
|
||||
var $tblCollationField = $form.find('select[name=tbl_collation]');
|
||||
var collationOrigValue = $('select[name="tbl_collation"] option[selected]').val();
|
||||
var $changeAllColumnCollationsCheckBox = $('#checkbox_change_all_collations');
|
||||
var question = window.Messages.strChangeAllColumnCollationsWarning;
|
||||
const $form = $(this);
|
||||
const $tblNameField = ($form.find('input[name=new_name]') as JQuery<HTMLInputElement>);
|
||||
const $tblCollationField = $form.find('select[name=tbl_collation]');
|
||||
const collationOrigValue = $('select[name="tbl_collation"] option[selected]').val();
|
||||
const $changeAllColumnCollationsCheckBox = $('#checkbox_change_all_collations');
|
||||
const question = window.Messages.strChangeAllColumnCollationsWarning;
|
||||
|
||||
if ($tblNameField.val() !== $tblNameField[0].defaultValue) {
|
||||
// reload page and navigation if the table has been renamed
|
||||
@ -194,7 +194,7 @@ AJAX.registerOnload('table/operations.js', function () {
|
||||
*/
|
||||
$(document).on('click', '#tbl_maintenance li a.maintain_action.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var $link = $(this);
|
||||
const $link = $(this);
|
||||
|
||||
if ($('.sqlqueryresults').length !== 0) {
|
||||
$('.sqlqueryresults').remove();
|
||||
@ -205,11 +205,11 @@ AJAX.registerOnload('table/operations.js', function () {
|
||||
}
|
||||
|
||||
// variables which stores the common attributes
|
||||
var params = $.param({
|
||||
let params = $.param({
|
||||
'ajax_request': 1,
|
||||
'server': CommonParams.get('server')
|
||||
'server': CommonParams.get('server'),
|
||||
});
|
||||
var postData = $link.getPostData();
|
||||
const postData = $link.getPostData();
|
||||
if (postData) {
|
||||
params += CommonParams.get('arg_separator') + postData;
|
||||
}
|
||||
@ -219,7 +219,7 @@ AJAX.registerOnload('table/operations.js', function () {
|
||||
$('html, body').animate({ scrollTop: 0 });
|
||||
}
|
||||
|
||||
var $tempDiv;
|
||||
let $tempDiv;
|
||||
if (typeof data !== 'undefined' && data.success === true && data.sql_query !== undefined) {
|
||||
ajaxShowMessage(data.message);
|
||||
$('<div class=\'sqlqueryresults ajax\'></div>').prependTo('#page_content');
|
||||
@ -229,7 +229,7 @@ AJAX.registerOnload('table/operations.js', function () {
|
||||
} else if (typeof data !== 'undefined' && data.success === true) {
|
||||
$tempDiv = $('<div id=\'temp_div\'></div>');
|
||||
$tempDiv.html(data.message);
|
||||
var $success = $tempDiv.find('.result_query .alert-success');
|
||||
const $success = $tempDiv.find('.result_query .alert-success');
|
||||
ajaxShowMessage($success);
|
||||
$('<div class=\'sqlqueryresults ajax\'></div>').prependTo('#page_content');
|
||||
$('.sqlqueryresults').html(data.message);
|
||||
@ -240,7 +240,7 @@ AJAX.registerOnload('table/operations.js', function () {
|
||||
$tempDiv = $('<div id=\'temp_div\'></div>');
|
||||
$tempDiv.html(data.error);
|
||||
|
||||
var $error;
|
||||
let $error;
|
||||
if ($tempDiv.find('.error code').length !== 0) {
|
||||
$error = $tempDiv.find('.error code').addClass('error');
|
||||
} else {
|
||||
@ -258,11 +258,11 @@ AJAX.registerOnload('table/operations.js', function () {
|
||||
*/
|
||||
$(document).on('submit', '#partitionsForm', function (event) {
|
||||
event.preventDefault();
|
||||
var $form = $(this);
|
||||
const $form = $(this);
|
||||
|
||||
function submitPartitionMaintenance () {
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
const submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
|
||||
ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
AJAX.source = $form;
|
||||
$.post($form.attr('action'), submitData, AJAX.responseHandler);
|
||||
@ -283,18 +283,18 @@ AJAX.registerOnload('table/operations.js', function () {
|
||||
|
||||
$(document).on('click', '#drop_tbl_anchor.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var $link = $(this);
|
||||
const $link = $(this);
|
||||
/**
|
||||
* @var {string} question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = window.Messages.strDropTableStrongWarning + ' ';
|
||||
let question = window.Messages.strDropTableStrongWarning + ' ';
|
||||
question += window.sprintf(window.Messages.strDoYouReally, $link[0].getAttribute('data-query'));
|
||||
question += getForeignKeyCheckboxLoader();
|
||||
|
||||
$(this).confirm(question, $(this).attr('href'), function (url) {
|
||||
var $msgbox = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
const $msgbox = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
|
||||
var params = getJsConfirmCommonParam(this, $link.getPostData());
|
||||
const params = getJsConfirmCommonParam(this, $link.getPostData());
|
||||
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
@ -315,19 +315,19 @@ AJAX.registerOnload('table/operations.js', function () {
|
||||
|
||||
$(document).on('click', '#drop_view_anchor.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var $link = $(this);
|
||||
const $link = $(this);
|
||||
/**
|
||||
* @var {string} question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = window.Messages.strDropTableStrongWarning + ' ';
|
||||
let question = window.Messages.strDropTableStrongWarning + ' ';
|
||||
question += window.sprintf(
|
||||
window.Messages.strDoYouReally,
|
||||
'DROP VIEW `' + escapeHtml(CommonParams.get('table') + '`')
|
||||
);
|
||||
|
||||
$(this).confirm(question, $(this).attr('href'), function (url) {
|
||||
var $msgbox = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var params = getJsConfirmCommonParam(this, $link.getPostData());
|
||||
const $msgbox = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
const params = getJsConfirmCommonParam(this, $link.getPostData());
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
ajaxRemoveMessage($msgbox);
|
||||
|
||||
@ -28,7 +28,7 @@ const showHideClauses = function ($thisDropdown) {
|
||||
*/
|
||||
const setDropdownValues = function ($dropdown, values, selectedValue = undefined): void {
|
||||
$dropdown.empty();
|
||||
var optionsAsString = '';
|
||||
let optionsAsString = '';
|
||||
// add an empty string to the beginning for empty selection
|
||||
values.unshift('');
|
||||
$.each(values, function () {
|
||||
@ -44,12 +44,12 @@ const setDropdownValues = function ($dropdown, values, selectedValue = undefined
|
||||
* @param $dropdown the dropdown whose value got changed
|
||||
*/
|
||||
const getDropdownValues = function ($dropdown): void {
|
||||
var foreignDb = null;
|
||||
var foreignTable = null;
|
||||
var $databaseDd;
|
||||
var $tableDd;
|
||||
var $columnDd;
|
||||
var foreign = '';
|
||||
let foreignDb = null;
|
||||
let foreignTable = null;
|
||||
let $databaseDd;
|
||||
let $tableDd;
|
||||
let $columnDd;
|
||||
let foreign = '';
|
||||
// if the changed dropdown is for foreign key constraints
|
||||
if ($dropdown.is('select[name^="destination_foreign"]')) {
|
||||
$databaseDd = $dropdown.parent().parent().parent().find('select[name^="destination_foreign_db"]');
|
||||
@ -83,12 +83,12 @@ const getDropdownValues = function ($dropdown): void {
|
||||
}
|
||||
}
|
||||
|
||||
var $msgbox = ajaxShowMessage();
|
||||
var $form = $dropdown.parents('form');
|
||||
var $db = $form.find('input[name="db"]').val();
|
||||
var $table = $form.find('input[name="table"]').val();
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var params = 'getDropdownValues=true' + argsep + 'ajax_request=true' +
|
||||
const $msgbox = ajaxShowMessage();
|
||||
const $form = $dropdown.parents('form');
|
||||
const $db = $form.find('input[name="db"]').val();
|
||||
const $table = $form.find('input[name="table"]').val();
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
let params = 'getDropdownValues=true' + argsep + 'ajax_request=true' +
|
||||
argsep + 'db=' + encodeURIComponent($db) +
|
||||
argsep + 'table=' + encodeURIComponent($table) +
|
||||
argsep + 'foreign=' + (foreign !== '') +
|
||||
@ -96,7 +96,7 @@ const getDropdownValues = function ($dropdown): void {
|
||||
(foreignTable !== null ?
|
||||
argsep + 'foreignTable=' + encodeURIComponent(foreignTable) : ''
|
||||
);
|
||||
var $server = $form.find('input[name="server"]');
|
||||
const $server = $form.find('input[name="server"]');
|
||||
if ($server.length > 0) {
|
||||
params += argsep + 'server=' + $form.find('input[name="server"]').val();
|
||||
}
|
||||
@ -116,7 +116,7 @@ const getDropdownValues = function ($dropdown): void {
|
||||
TableRelation.setDropdownValues($columnDd, []);
|
||||
} else { // if a table selector
|
||||
// set values for the column dropdown
|
||||
var primary = null;
|
||||
let primary = null;
|
||||
if (typeof data.primary !== 'undefined'
|
||||
&& 1 === data.primary.length
|
||||
) {
|
||||
@ -185,7 +185,7 @@ AJAX.registerOnload('table/relation.js', function () {
|
||||
.val('');
|
||||
|
||||
// Add foreign field.
|
||||
var $sourceElem = $('select[name^="destination_foreign_column[' +
|
||||
const $sourceElem = $('select[name^="destination_foreign_column[' +
|
||||
$(this).attr('data-index') + ']"]').last().parent();
|
||||
$sourceElem
|
||||
.clone(true, true)
|
||||
@ -201,14 +201,14 @@ AJAX.registerOnload('table/relation.js', function () {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
var $prevRow = $(this).closest('tr').prev('tr');
|
||||
var $newRow = $prevRow.clone(true, true);
|
||||
const $prevRow = $(this).closest('tr').prev('tr');
|
||||
const $newRow = $prevRow.clone(true, true);
|
||||
|
||||
// Update serial number.
|
||||
var currIndex = $newRow
|
||||
const currIndex = $newRow
|
||||
.find('a.add_foreign_key_field')
|
||||
.attr('data-index');
|
||||
var newIndex = parseInt(currIndex) + 1;
|
||||
const newIndex = parseInt(currIndex) + 1;
|
||||
$newRow.find('a.add_foreign_key_field').attr('data-index', newIndex);
|
||||
|
||||
// Update form parameter names.
|
||||
@ -241,22 +241,22 @@ AJAX.registerOnload('table/relation.js', function () {
|
||||
*/
|
||||
$('a.drop_foreign_key_anchor.ajax').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
var $anchor = $(this);
|
||||
const $anchor = $(this);
|
||||
|
||||
// Object containing reference to the current field's row
|
||||
var $currRow = $anchor.parents('tr');
|
||||
const $currRow = $anchor.parents('tr');
|
||||
|
||||
var dropQuery = escapeHtml(
|
||||
const dropQuery = escapeHtml(
|
||||
($currRow.children('td')
|
||||
.children('.drop_foreign_key_msg')
|
||||
.val() as string)
|
||||
.val() as string),
|
||||
);
|
||||
|
||||
var question = window.sprintf(window.Messages.strDoYouReally, dropQuery);
|
||||
const question = window.sprintf(window.Messages.strDoYouReally, dropQuery);
|
||||
|
||||
$anchor.confirm(question, $anchor.attr('href'), function (url) {
|
||||
var $msg = ajaxShowMessage(window.Messages.strDroppingForeignKey, false);
|
||||
var params = getJsConfirmCommonParam(this, $anchor.getPostData());
|
||||
const $msg = ajaxShowMessage(window.Messages.strDroppingForeignKey, false);
|
||||
const params = getJsConfirmCommonParam(this, $anchor.getPostData());
|
||||
$.post(url, params, function (data) {
|
||||
if (data.success === true) {
|
||||
ajaxRemoveMessage($msg);
|
||||
@ -268,6 +268,6 @@ AJAX.registerOnload('table/relation.js', function () {
|
||||
});
|
||||
}); // end Drop Foreign key
|
||||
|
||||
var windowWidth = $(window).width();
|
||||
const windowWidth = $(window).width();
|
||||
$('.jsresponsive').css('max-width', (windowWidth - 35) + 'px');
|
||||
});
|
||||
|
||||
@ -19,15 +19,15 @@ import { ajaxRemoveMessage, ajaxShowMessage } from '../modules/ajax-message.ts';
|
||||
*/
|
||||
const checkIfDataTypeNumericOrDate = function (dataType) {
|
||||
// To test for numeric data-types.
|
||||
var numericRegExp = new RegExp(
|
||||
const numericRegExp = new RegExp(
|
||||
'TINYINT|SMALLINT|MEDIUMINT|INT|BIGINT|DECIMAL|FLOAT|DOUBLE|REAL',
|
||||
'i'
|
||||
'i',
|
||||
);
|
||||
|
||||
// To test for date data-types.
|
||||
var dateRegExp = new RegExp(
|
||||
const dateRegExp = new RegExp(
|
||||
'DATETIME|DATE|TIMESTAMP|TIME|YEAR',
|
||||
'i'
|
||||
'i',
|
||||
);
|
||||
|
||||
// Return matched data-type
|
||||
@ -77,7 +77,7 @@ AJAX.registerOnload('table/select.js', function () {
|
||||
$('#togglesearchformlink')
|
||||
.html(window.Messages.strShowSearchCriteria)
|
||||
.on('click', function () {
|
||||
var $link = $(this);
|
||||
const $link = $(this);
|
||||
$('#tbl_search_form').slideToggle();
|
||||
if ($link.text() === window.Messages.strHideSearchCriteria) {
|
||||
$link.text(window.Messages.strShowSearchCriteria);
|
||||
@ -89,7 +89,7 @@ AJAX.registerOnload('table/select.js', function () {
|
||||
return false;
|
||||
});
|
||||
|
||||
var tableRows = $('#fieldset_table_qbe select.column-operator');
|
||||
const tableRows = $('#fieldset_table_qbe select.column-operator');
|
||||
$.each(tableRows, function (index, item) {
|
||||
$(item).on('change', function () {
|
||||
window.changeValueFieldType(this, index);
|
||||
@ -101,14 +101,14 @@ AJAX.registerOnload('table/select.js', function () {
|
||||
* Ajax event handler for Table search
|
||||
*/
|
||||
$(document).on('submit', '#tbl_search_form.ajax', function (event) {
|
||||
var unaryFunctions = [
|
||||
const unaryFunctions = [
|
||||
'IS NULL',
|
||||
'IS NOT NULL',
|
||||
'= \'\'',
|
||||
'!= \'\'',
|
||||
];
|
||||
|
||||
var geomUnaryFunctions = [
|
||||
const geomUnaryFunctions = [
|
||||
'IsEmpty',
|
||||
'IsSimple',
|
||||
'IsRing',
|
||||
@ -116,7 +116,7 @@ AJAX.registerOnload('table/select.js', function () {
|
||||
];
|
||||
|
||||
// jQuery object to reuse
|
||||
var $searchForm = $(this);
|
||||
const $searchForm = $(this);
|
||||
event.preventDefault();
|
||||
|
||||
// Dispose tooltips. See #19950
|
||||
@ -129,13 +129,13 @@ AJAX.registerOnload('table/select.js', function () {
|
||||
|
||||
// empty previous search results while we are waiting for new results
|
||||
$('#sqlqueryresultsouter').empty();
|
||||
var $msgbox = ajaxShowMessage(window.Messages.strSearching, false);
|
||||
const $msgbox = ajaxShowMessage(window.Messages.strSearching, false);
|
||||
|
||||
prepareForAjaxRequest($searchForm);
|
||||
|
||||
var values: { [k: string]: any } = {};
|
||||
const values: { [k: string]: any } = {};
|
||||
($searchForm.find(':input') as JQuery<HTMLInputElement>).each(function () {
|
||||
var $input = $(this);
|
||||
const $input = $(this);
|
||||
if ($input.attr('type') === 'checkbox' || $input.attr('type') === 'radio') {
|
||||
if ($input.is(':checked')) {
|
||||
values[this.name] = $input.val();
|
||||
@ -145,9 +145,9 @@ AJAX.registerOnload('table/select.js', function () {
|
||||
}
|
||||
});
|
||||
|
||||
var columnCount = $('select[name="columnsToDisplay[]"] option').length;
|
||||
const columnCount = $('select[name="columnsToDisplay[]"] option').length;
|
||||
// Submit values only for the columns that have unary column operator or a search criteria
|
||||
for (var a = 0; a < columnCount; a++) {
|
||||
for (let a = 0; a < columnCount; a++) {
|
||||
if ($.inArray(values['criteriaColumnOperators[' + a + ']'], unaryFunctions) >= 0) {
|
||||
continue;
|
||||
}
|
||||
@ -213,9 +213,9 @@ AJAX.registerOnload('table/select.js', function () {
|
||||
$('.open_search_gis_editor').hide();
|
||||
|
||||
$('select.geom_func').on('change', function () {
|
||||
var $geomFuncSelector = $(this);
|
||||
const $geomFuncSelector = $(this);
|
||||
|
||||
var binaryFunctions = [
|
||||
const binaryFunctions = [
|
||||
'Contains',
|
||||
'Crosses',
|
||||
'Disjoint',
|
||||
@ -238,21 +238,21 @@ AJAX.registerOnload('table/select.js', function () {
|
||||
'ST_Intersects',
|
||||
'ST_Overlaps',
|
||||
'ST_Touches',
|
||||
'ST_Within'
|
||||
'ST_Within',
|
||||
];
|
||||
|
||||
var tempArray = [
|
||||
const tempArray = [
|
||||
'Envelope',
|
||||
'EndPoint',
|
||||
'StartPoint',
|
||||
'ExteriorRing',
|
||||
'Centroid',
|
||||
'PointOnSurface'
|
||||
'PointOnSurface',
|
||||
];
|
||||
var outputGeomFunctions = binaryFunctions.concat(tempArray);
|
||||
const outputGeomFunctions = binaryFunctions.concat(tempArray);
|
||||
|
||||
// If the chosen function takes two geometry objects as parameters
|
||||
var $operator = $geomFuncSelector.parents('tr').find('td').eq(4).find('select');
|
||||
const $operator = $geomFuncSelector.parents('tr').find('td').eq(4).find('select');
|
||||
if ($.inArray($geomFuncSelector.val(), binaryFunctions) >= 0) {
|
||||
$operator.prop('readonly', true);
|
||||
} else {
|
||||
@ -260,7 +260,7 @@ AJAX.registerOnload('table/select.js', function () {
|
||||
}
|
||||
|
||||
// if the chosen function's output is a geometry, enable GIS editor
|
||||
var $editorSpan = $geomFuncSelector.parents('tr').find('.open_search_gis_editor');
|
||||
const $editorSpan = $geomFuncSelector.parents('tr').find('.open_search_gis_editor');
|
||||
if ($.inArray($geomFuncSelector.val(), outputGeomFunctions) >= 0) {
|
||||
$editorSpan.show();
|
||||
} else {
|
||||
@ -300,14 +300,14 @@ AJAX.registerOnload('table/select.js', function () {
|
||||
*/
|
||||
$('body').on('change', 'select[name*="criteriaColumnOperators"]', function () { // Fix for bug #13778, changed 'click' to 'change'
|
||||
// Get the column name.
|
||||
var columnName = $(this)
|
||||
const columnName = $(this)
|
||||
.closest('tr')
|
||||
.find('th')
|
||||
.first()
|
||||
.text();
|
||||
|
||||
// Get the data-type of column excluding size.
|
||||
var dataType: string | false = $(this)
|
||||
let dataType: string | false = $(this)
|
||||
.closest('tr')
|
||||
.find('td[data-type]')
|
||||
.attr('data-type');
|
||||
@ -321,7 +321,7 @@ AJAX.registerOnload('table/select.js', function () {
|
||||
$targetField.siblings('.ui-datepicker-trigger').eq(0).toggle(!opIsUnary(operator));
|
||||
|
||||
if ((operator === 'BETWEEN' || operator === 'NOT BETWEEN') && dataType) {
|
||||
var $msgbox = ajaxShowMessage();
|
||||
const $msgbox = ajaxShowMessage();
|
||||
$.ajax({
|
||||
url: 'index.php?route=/table/search',
|
||||
type: 'POST',
|
||||
@ -337,12 +337,12 @@ AJAX.registerOnload('table/select.js', function () {
|
||||
ajaxRemoveMessage($msgbox);
|
||||
if (response.success) {
|
||||
// Get the column min value.
|
||||
var min = response.column_data.min
|
||||
const min = response.column_data.min
|
||||
? '(' + window.Messages.strColumnMin +
|
||||
' ' + response.column_data.min + ')'
|
||||
: '';
|
||||
// Get the column max value.
|
||||
var max = response.column_data.max
|
||||
const max = response.column_data.max
|
||||
? '(' + window.Messages.strColumnMax +
|
||||
' ' + response.column_data.max + ')'
|
||||
: '';
|
||||
@ -357,9 +357,9 @@ AJAX.registerOnload('table/select.js', function () {
|
||||
addDatepicker($('#min_value'), dataType);
|
||||
addDatepicker($('#max_value'), dataType);
|
||||
$('#rangeSearchModalGo').on('click', function () {
|
||||
var minValue = ($('#min_value').val() as string);
|
||||
var maxValue = ($('#max_value').val() as string);
|
||||
var finalValue = '';
|
||||
const minValue = ($('#min_value').val() as string);
|
||||
const maxValue = ($('#max_value').val() as string);
|
||||
let finalValue = '';
|
||||
if (minValue.length && maxValue.length) {
|
||||
finalValue = minValue + ', ' +
|
||||
maxValue;
|
||||
@ -368,9 +368,9 @@ AJAX.registerOnload('table/select.js', function () {
|
||||
// If target field is a select list.
|
||||
if ($targetField.is('select')) {
|
||||
$targetField.val(finalValue);
|
||||
var $options = $targetField.find('option');
|
||||
var $closestMin: JQuery<HTMLOptionElement> | null = null;
|
||||
var $closestMax: JQuery<HTMLOptionElement> | null = null;
|
||||
const $options = $targetField.find('option');
|
||||
let $closestMin: JQuery<HTMLOptionElement> | null = null;
|
||||
let $closestMax: JQuery<HTMLOptionElement> | null = null;
|
||||
// Find closest min and max value.
|
||||
$options.each(function () {
|
||||
if (
|
||||
@ -408,6 +408,6 @@ AJAX.registerOnload('table/select.js', function () {
|
||||
}
|
||||
});
|
||||
|
||||
var windowWidth = $(window).width();
|
||||
const windowWidth = $(window).width();
|
||||
$('.jsresponsive').css('max-width', (windowWidth - 69) + 'px');
|
||||
});
|
||||
|
||||
@ -32,7 +32,7 @@ import refreshMainContent from '../modules/functions/refreshMainContent.ts';
|
||||
*/
|
||||
function reloadFieldForm () {
|
||||
$.post($('#fieldsForm').attr('action'), $('#fieldsForm').serialize() + CommonParams.get('arg_separator') + 'ajax_request=true', function (formData) {
|
||||
var $tempDiv = $('<div id=\'temp_div\'><div>').append(formData.message);
|
||||
const $tempDiv = $('<div id=\'temp_div\'><div>').append(formData.message);
|
||||
$('#fieldsForm').replaceWith($tempDiv.find('#fieldsForm'));
|
||||
$('#addColumns').replaceWith($tempDiv.find('#addColumns'));
|
||||
$('#move_columns_dialog').find('ul').replaceWith($tempDiv.find('#move_columns_dialog ul'));
|
||||
@ -74,11 +74,11 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
/**
|
||||
* @var form object referring to the export form
|
||||
*/
|
||||
var $form = $(this);
|
||||
var fieldCnt = Number($form.find('input[name=orig_num_fields]').val());
|
||||
const $form = $(this);
|
||||
const fieldCnt = Number($form.find('input[name=orig_num_fields]').val());
|
||||
|
||||
function submitForm () {
|
||||
var $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
const $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
$.post($form.attr('action'), $form.serialize() + CommonParams.get('arg_separator') + 'do_save_data=1', function (data) {
|
||||
if ($('.sqlqueryresults').length !== 0) {
|
||||
$('.sqlqueryresults').remove();
|
||||
@ -119,14 +119,14 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
}
|
||||
|
||||
function checkIfConfirmRequired ($form) {
|
||||
var i = 0;
|
||||
var id;
|
||||
var elm;
|
||||
var val;
|
||||
var nameOrig;
|
||||
var elmOrig;
|
||||
var valOrig;
|
||||
var checkRequired = false;
|
||||
let i = 0;
|
||||
let id;
|
||||
let elm;
|
||||
let val;
|
||||
let nameOrig;
|
||||
let elmOrig;
|
||||
let valOrig;
|
||||
let checkRequired = false;
|
||||
for (i = 0; i < fieldCnt; i++) {
|
||||
id = '#field_' + i + '_5';
|
||||
elm = $(id);
|
||||
@ -161,8 +161,8 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
|
||||
// If Collation is changed, Warn and Confirm
|
||||
if (checkIfConfirmRequired($form)) {
|
||||
var question = window.sprintf(
|
||||
window.Messages.strChangeColumnCollation, 'https://wiki.phpmyadmin.net/pma/Garbled_data'
|
||||
const question = window.sprintf(
|
||||
window.Messages.strChangeColumnCollation, 'https://wiki.phpmyadmin.net/pma/Garbled_data',
|
||||
);
|
||||
$form.confirm(question, $form.attr('action'), function () {
|
||||
submitForm();
|
||||
@ -182,29 +182,29 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
/**
|
||||
* @var currTableName String containing the name of the current table
|
||||
*/
|
||||
var currTableName = $(this).closest('form').find('input[name=table]').val();
|
||||
const currTableName = $(this).closest('form').find('input[name=table]').val();
|
||||
/**
|
||||
* @var currRow Object reference to the currently selected row (i.e. field in the table)
|
||||
*/
|
||||
var $currRow = $(this).parents('tr');
|
||||
const $currRow = $(this).parents('tr');
|
||||
/**
|
||||
* @var currColumnName String containing name of the field referred to by {@link curr_row}
|
||||
*/
|
||||
var currColumnName = $currRow.children('th').children('label').text().trim();
|
||||
let currColumnName = $currRow.children('th').children('label').text().trim();
|
||||
currColumnName = escapeJsString(escapeHtml(currColumnName));
|
||||
|
||||
/**
|
||||
* @var $afterFieldItem Corresponding entry in the 'After' field.
|
||||
*/
|
||||
var $afterFieldItem = $('select[name=\'after_field\'] option[value=\'' + currColumnName + '\']');
|
||||
const $afterFieldItem = $('select[name=\'after_field\'] option[value=\'' + currColumnName + '\']');
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = window.sprintf(window.Messages.strDoYouReally, 'ALTER TABLE `' + currTableName + '` DROP `' + currColumnName + '`;');
|
||||
var $thisAnchor = $(this);
|
||||
const question = window.sprintf(window.Messages.strDoYouReally, 'ALTER TABLE `' + currTableName + '` DROP `' + currColumnName + '`;');
|
||||
const $thisAnchor = $(this);
|
||||
$thisAnchor.confirm(question, $thisAnchor.attr('href'), function (url) {
|
||||
var $msg = ajaxShowMessage(window.Messages.strDroppingColumn, false);
|
||||
var params = getJsConfirmCommonParam(this, $thisAnchor.getPostData());
|
||||
const $msg = ajaxShowMessage(window.Messages.strDroppingColumn, false);
|
||||
let params = getJsConfirmCommonParam(this, $thisAnchor.getPostData());
|
||||
params += CommonParams.get('arg_separator') + 'ajax_page_request=1';
|
||||
$.post(url, params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
@ -222,8 +222,8 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
}
|
||||
|
||||
// Adjust the row numbers
|
||||
for (var $row = $currRow.next(); $row.length > 0; $row = $row.next()) {
|
||||
var newVal = parseInt($row.find('td').eq(1).text(), 10) - 1;
|
||||
for (let $row = $currRow.next(); $row.length > 0; $row = $row.next()) {
|
||||
const newVal = parseInt($row.find('td').eq(1).text(), 10) - 1;
|
||||
$row.find('td').eq(1).text(newVal);
|
||||
}
|
||||
|
||||
@ -260,11 +260,11 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
$(document).on('click', 'a.add_key.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
var $this = $(this);
|
||||
var currTableName = ($this.closest('form').find('input[name=table]').val() as string);
|
||||
var currColumnName = $this.parents('tr').children('th').children('label').text().trim();
|
||||
const $this = $(this);
|
||||
const currTableName = ($this.closest('form').find('input[name=table]').val() as string);
|
||||
const currColumnName = $this.parents('tr').children('th').children('label').text().trim();
|
||||
|
||||
var addClause = '';
|
||||
let addClause = '';
|
||||
if ($this.is('.add_primary_key_anchor')) {
|
||||
addClause = 'ADD PRIMARY KEY';
|
||||
} else if ($this.is('.add_index_anchor')) {
|
||||
@ -277,16 +277,16 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
addClause = 'ADD FULLTEXT';
|
||||
}
|
||||
|
||||
var question = window.sprintf(window.Messages.strDoYouReally, 'ALTER TABLE `' +
|
||||
const question = window.sprintf(window.Messages.strDoYouReally, 'ALTER TABLE `' +
|
||||
escapeHtml(currTableName) + '` ' + addClause + '(`' + escapeHtml(currColumnName) + '`);');
|
||||
|
||||
var $thisAnchor = $(this);
|
||||
const $thisAnchor = $(this);
|
||||
|
||||
$thisAnchor.confirm(question, $thisAnchor.attr('href'), function (url) {
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $this;
|
||||
|
||||
var params = getJsConfirmCommonParam(this, $thisAnchor.getPostData());
|
||||
let params = getJsConfirmCommonParam(this, $thisAnchor.getPostData());
|
||||
params += CommonParams.get('arg_separator') + 'ajax_page_request=1';
|
||||
$.post(url, params, AJAX.responseHandler);
|
||||
});
|
||||
@ -298,14 +298,14 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
$(document).on('click', '#move_columns_anchor', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var columns = [];
|
||||
const columns = [];
|
||||
|
||||
$('#tablestructure').find('tbody tr').each(function () {
|
||||
var colName = ($(this).find('input:checkbox').eq(0).val() as string);
|
||||
var hiddenInput = $('<input>')
|
||||
const colName = ($(this).find('input:checkbox').eq(0).val() as string);
|
||||
const hiddenInput = $('<input>')
|
||||
.prop({
|
||||
name: 'move_columns[]',
|
||||
type: 'hidden'
|
||||
type: 'hidden',
|
||||
})
|
||||
.val(colName);
|
||||
columns[columns.length] = $('<li></li>')
|
||||
@ -314,9 +314,9 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
.append(hiddenInput);
|
||||
});
|
||||
|
||||
var colList = $('#move_columns_dialog').find('ul')
|
||||
const colList = $('#move_columns_dialog').find('ul')
|
||||
.find('li').remove().end();
|
||||
for (var i in columns) {
|
||||
for (let i in columns) {
|
||||
colList.append(columns[i]);
|
||||
}
|
||||
|
||||
@ -326,7 +326,7 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
tolerance: 'pointer'
|
||||
}).disableSelection();
|
||||
|
||||
var $form = $('#move_columns_dialog').find('form');
|
||||
const $form = $('#move_columns_dialog').find('form');
|
||||
$form.data('serialized-unmoved', $form.serialize());
|
||||
|
||||
const designerModalPreviewModal = document.getElementById('designerModalPreviewModal');
|
||||
@ -373,10 +373,10 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
$('#designerModalGoButton').off('click');// Unregister previous modals
|
||||
$('#designerModalGoButton').on('click', function () {
|
||||
event.preventDefault();
|
||||
var $msgbox = ajaxShowMessage();
|
||||
var $this = $('#moveColumnsModal');
|
||||
var $form = $this.find('form');
|
||||
var serialized = $form.serialize();
|
||||
const $msgbox = ajaxShowMessage();
|
||||
const $this = $('#moveColumnsModal');
|
||||
const $form = $this.find('form');
|
||||
const serialized = $form.serialize();
|
||||
// check if any columns were moved at all
|
||||
$('#moveColumnsModal').modal('hide');
|
||||
if (serialized === $form.data('serialized-unmoved')) {
|
||||
@ -388,27 +388,27 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
$.post($form.prop('action'), serialized + CommonParams.get('arg_separator') + 'ajax_request=true', function (data) {
|
||||
if (data.success === false) {
|
||||
ajaxRemoveMessage($msgbox);
|
||||
var errorModal = $('#moveColumnsErrorModal');
|
||||
const errorModal = $('#moveColumnsErrorModal');
|
||||
errorModal.modal('show');
|
||||
errorModal.find('.modal-body').first().html(data.error);
|
||||
} else {
|
||||
// sort the fields table
|
||||
var $fieldsTable = $('table#tablestructure tbody');
|
||||
const $fieldsTable = $('table#tablestructure tbody');
|
||||
// remove all existing rows and remember them
|
||||
var $rows = $fieldsTable.find('tr').remove();
|
||||
const $rows = $fieldsTable.find('tr').remove();
|
||||
// loop through the correct order
|
||||
for (var i in data.columns) {
|
||||
var theColumn = data.columns[i];
|
||||
var $theRow = $rows
|
||||
for (let i in data.columns) {
|
||||
const theColumn = data.columns[i];
|
||||
const $theRow = $rows
|
||||
.find('input:checkbox[value=' + $.escapeSelector(theColumn) + ']')
|
||||
.closest('tr');
|
||||
// append the row for this column to the table
|
||||
$fieldsTable.append($theRow);
|
||||
}
|
||||
|
||||
var $firstrow = $fieldsTable.find('tr').eq(0);
|
||||
const $firstrow = $fieldsTable.find('tr').eq(0);
|
||||
// Adjust the row numbers and colors
|
||||
for (var $row = $firstrow; $row.length > 0; $row = $row.next()) {
|
||||
for (let $row = $firstrow; $row.length > 0; $row = $row.next()) {
|
||||
$row
|
||||
.find('td').eq(1)
|
||||
.text($row.index() + 1)
|
||||
@ -428,9 +428,9 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
*/
|
||||
$('body').on('click', '#fieldsForm button.mult_submit', function (e) {
|
||||
e.preventDefault();
|
||||
var $form = $(this).parents('form');
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
|
||||
const $form = $(this).parents('form');
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
const submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
|
||||
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $form;
|
||||
@ -443,10 +443,10 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
*/
|
||||
$(document).on('click', 'a[id^=partition_action].ajax', function (e) {
|
||||
e.preventDefault();
|
||||
var $link = $(this);
|
||||
const $link = $(this);
|
||||
|
||||
function submitPartitionAction (url) {
|
||||
var params = 'ajax_request=true&ajax_page_request=true&' + $link.getPostData();
|
||||
const params = 'ajax_request=true&ajax_page_request=true&' + $link.getPostData();
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $link;
|
||||
$.post(url, params, AJAX.responseHandler);
|
||||
@ -470,12 +470,12 @@ AJAX.registerOnload('table/structure.js', function () {
|
||||
*/
|
||||
$(document).on('click', '#remove_partitioning.ajax', function (e) {
|
||||
e.preventDefault();
|
||||
var $link = $(this);
|
||||
var question = window.Messages.strRemovePartitioningWarning;
|
||||
const $link = $(this);
|
||||
const question = window.Messages.strRemovePartitioningWarning;
|
||||
$link.confirm(question, $link.attr('href'), function (url) {
|
||||
var params = getJsConfirmCommonParam({
|
||||
const params = getJsConfirmCommonParam({
|
||||
'ajax_request': true,
|
||||
'ajax_page_request': true
|
||||
'ajax_page_request': true,
|
||||
}, $link.getPostData());
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $link;
|
||||
|
||||
@ -57,13 +57,13 @@ AJAX.registerOnload('table/tracking.js', function () {
|
||||
*/
|
||||
$('body').on('click', '#versionsForm.ajax button[name="submit_mult"], #versionsForm.ajax input[name="submit_mult"]', function (e) {
|
||||
e.preventDefault();
|
||||
var $button = $(this);
|
||||
var $form = $button.parent('form');
|
||||
var argsep = CommonParams.get('arg_separator');
|
||||
var submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'submit_mult=' + $button.val();
|
||||
const $button = $(this);
|
||||
const $form = $button.parent('form');
|
||||
const argsep = CommonParams.get('arg_separator');
|
||||
const submitData = $form.serialize() + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'submit_mult=' + $button.val();
|
||||
|
||||
if ($button.val() === 'delete_version') {
|
||||
var question = window.Messages.strDeleteTrackingVersionMultiple;
|
||||
const question = window.Messages.strDeleteTrackingVersionMultiple;
|
||||
$button.confirm(question, $form.attr('action'), function (url) {
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $form;
|
||||
@ -81,13 +81,13 @@ AJAX.registerOnload('table/tracking.js', function () {
|
||||
*/
|
||||
$('body').on('click', 'a.delete_version_anchor.ajax', function (e) {
|
||||
e.preventDefault();
|
||||
var $anchor = $(this);
|
||||
var question = window.Messages.strDeleteTrackingVersion;
|
||||
const $anchor = $(this);
|
||||
const question = window.Messages.strDeleteTrackingVersion;
|
||||
$anchor.confirm(question, $anchor.attr('href'), function (url) {
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $anchor;
|
||||
var argSep = CommonParams.get('arg_separator');
|
||||
var params = getJsConfirmCommonParam(this, $anchor.getPostData());
|
||||
const argSep = CommonParams.get('arg_separator');
|
||||
let params = getJsConfirmCommonParam(this, $anchor.getPostData());
|
||||
params += argSep + 'ajax_page_request=1';
|
||||
$.post(url, params, AJAX.responseHandler);
|
||||
});
|
||||
@ -98,13 +98,13 @@ AJAX.registerOnload('table/tracking.js', function () {
|
||||
*/
|
||||
$('body').on('click', 'a.delete_entry_anchor.ajax', function (e) {
|
||||
e.preventDefault();
|
||||
var $anchor = $(this);
|
||||
var question = window.Messages.strDeletingTrackingEntry;
|
||||
const $anchor = $(this);
|
||||
const question = window.Messages.strDeletingTrackingEntry;
|
||||
$anchor.confirm(question, $anchor.attr('href'), function (url) {
|
||||
ajaxShowMessage();
|
||||
AJAX.source = $anchor;
|
||||
var argSep = CommonParams.get('arg_separator');
|
||||
var params = getJsConfirmCommonParam(this, $anchor.getPostData());
|
||||
const argSep = CommonParams.get('arg_separator');
|
||||
let params = getJsConfirmCommonParam(this, $anchor.getPostData());
|
||||
params += argSep + 'ajax_page_request=1';
|
||||
$.post(url, params, AJAX.responseHandler);
|
||||
});
|
||||
|
||||
@ -15,7 +15,7 @@ import { ajaxShowMessage } from '../modules/ajax-message.ts';
|
||||
* @return {false}
|
||||
**/
|
||||
function displayHelp () {
|
||||
var modal = $('#helpModal');
|
||||
const modal = $('#helpModal');
|
||||
modal.modal('show');
|
||||
modal.find('.modal-body').first().html(window.Messages.strDisplayHelp);
|
||||
$('#helpModalLabel').first().html(window.Messages.strHelpTitle);
|
||||
@ -58,7 +58,7 @@ function isNumeric (n) {
|
||||
* @return {boolean}
|
||||
**/
|
||||
function isEmpty (obj) {
|
||||
var name;
|
||||
let name;
|
||||
for (name in obj) {
|
||||
return false;
|
||||
}
|
||||
@ -122,16 +122,16 @@ AJAX.registerTeardown('table/zoom_search.js', function () {
|
||||
|
||||
AJAX.registerOnload('table/zoom_search.js', function () {
|
||||
let currentChart = null;
|
||||
var searchedDataKey = null;
|
||||
var xLabel = ($('#tableid_0').val() as string);
|
||||
var yLabel = ($('#tableid_1').val() as string);
|
||||
let searchedDataKey = null;
|
||||
let xLabel = ($('#tableid_0').val() as string);
|
||||
let yLabel = ($('#tableid_1').val() as string);
|
||||
// will be updated via Ajax
|
||||
var xType = $('#types_0').val();
|
||||
var yType = $('#types_1').val();
|
||||
var dataLabel = ($('#dataLabel').val() as string);
|
||||
let xType = $('#types_0').val();
|
||||
let yType = $('#types_1').val();
|
||||
const dataLabel = ($('#dataLabel').val() as string);
|
||||
|
||||
// Get query result
|
||||
var searchedData;
|
||||
let searchedData;
|
||||
try {
|
||||
searchedData = JSON.parse($('#querydata').html());
|
||||
} catch (err) {
|
||||
@ -139,8 +139,8 @@ AJAX.registerOnload('table/zoom_search.js', function () {
|
||||
}
|
||||
|
||||
// adding event listener on select after AJAX request
|
||||
var comparisonOperatorOnChange = function () {
|
||||
var tableRows = $('#inputSection select.column-operator');
|
||||
const comparisonOperatorOnChange = function () {
|
||||
const tableRows = $('#inputSection select.column-operator');
|
||||
$.each(tableRows, function (index, item) {
|
||||
$(item).on('change', function () {
|
||||
window.changeValueFieldType(this, index);
|
||||
@ -163,7 +163,7 @@ AJAX.registerOnload('table/zoom_search.js', function () {
|
||||
'db': CommonParams.get('db'),
|
||||
'table': CommonParams.get('table'),
|
||||
'field': $('#tableid_0').val(),
|
||||
'it': 0
|
||||
'it': 0,
|
||||
}, function (data) {
|
||||
$('#tableFieldsId').find('tr').eq(1).find('td').eq(0).html(data.field_type);
|
||||
$('#tableFieldsId').find('tr').eq(1).find('td').eq(1).html(data.field_collation);
|
||||
@ -188,7 +188,7 @@ AJAX.registerOnload('table/zoom_search.js', function () {
|
||||
'db': CommonParams.get('db'),
|
||||
'table': CommonParams.get('table'),
|
||||
'field': $('#tableid_1').val(),
|
||||
'it': 1
|
||||
'it': 1,
|
||||
}, function (data) {
|
||||
$('#tableFieldsId').find('tr').eq(2).find('td').eq(0).html(data.field_type);
|
||||
$('#tableFieldsId').find('tr').eq(2).find('td').eq(1).html(data.field_collation);
|
||||
@ -212,7 +212,7 @@ AJAX.registerOnload('table/zoom_search.js', function () {
|
||||
'db': CommonParams.get('db'),
|
||||
'table': CommonParams.get('table'),
|
||||
'field': $('#tableid_2').val(),
|
||||
'it': 2
|
||||
'it': 2,
|
||||
}, function (data) {
|
||||
$('#tableFieldsId').find('tr').eq(4).find('td').eq(0).html(data.field_type);
|
||||
$('#tableFieldsId').find('tr').eq(4).find('td').eq(1).html(data.field_collation);
|
||||
@ -234,7 +234,7 @@ AJAX.registerOnload('table/zoom_search.js', function () {
|
||||
'db': CommonParams.get('db'),
|
||||
'table': CommonParams.get('table'),
|
||||
'field': $('#tableid_3').val(),
|
||||
'it': 3
|
||||
'it': 3,
|
||||
}, function (data) {
|
||||
$('#tableFieldsId').find('tr').eq(5).find('td').eq(0).html(data.field_type);
|
||||
$('#tableFieldsId').find('tr').eq(5).find('td').eq(1).html(data.field_collation);
|
||||
@ -271,7 +271,7 @@ AJAX.registerOnload('table/zoom_search.js', function () {
|
||||
$('#togglesearchformlink')
|
||||
.html(window.Messages.strShowSearchCriteria)
|
||||
.on('click', function () {
|
||||
var $link = $(this);
|
||||
const $link = $(this);
|
||||
$('#zoom_search_form').slideToggle();
|
||||
if ($link.text() === window.Messages.strHideSearchCriteria) {
|
||||
$link.text(window.Messages.strShowSearchCriteria);
|
||||
@ -283,24 +283,29 @@ AJAX.registerOnload('table/zoom_search.js', function () {
|
||||
return false;
|
||||
});
|
||||
|
||||
let selectedRow;
|
||||
let yCord = [];
|
||||
let xCord = [];
|
||||
let series = [];
|
||||
|
||||
/**
|
||||
* Handle saving of a row in the editor
|
||||
*/
|
||||
var dataPointSave = function () {
|
||||
const dataPointSave = function () {
|
||||
// Find changed values by comparing form values with selectedRow Object
|
||||
var newValues = {};// Stores the values changed from original
|
||||
var sqlTypes = {};
|
||||
var it = 0;
|
||||
var xChange = false;
|
||||
var yChange = false;
|
||||
var key;
|
||||
var tempGetVal = function () {
|
||||
const newValues = {};// Stores the values changed from original
|
||||
const sqlTypes = {};
|
||||
let it = 0;
|
||||
let xChange = false;
|
||||
let yChange = false;
|
||||
let key;
|
||||
const tempGetVal = function () {
|
||||
return $(this).val();
|
||||
};
|
||||
|
||||
for (key in selectedRow) {
|
||||
var oldVal = selectedRow[key];
|
||||
var newVal = ($('#edit_fields_null_id_' + it).prop('checked')) ? null : $('#edit_fieldID_' + it).val();
|
||||
const oldVal = selectedRow[key];
|
||||
let newVal = ($('#edit_fields_null_id_' + it).prop('checked')) ? null : $('#edit_fieldID_' + it).val();
|
||||
if (newVal instanceof Array) { // when the column is of type SET
|
||||
newVal = $('#edit_fieldID_' + it).map(tempGetVal).get().join(',');
|
||||
}
|
||||
@ -317,7 +322,7 @@ AJAX.registerOnload('table/zoom_search.js', function () {
|
||||
}
|
||||
}
|
||||
|
||||
var $input = $('#edit_fieldID_' + it);
|
||||
const $input = $('#edit_fieldID_' + it);
|
||||
if ($input.hasClass('bit')) {
|
||||
sqlTypes[key] = 'bit';
|
||||
} else {
|
||||
@ -349,7 +354,7 @@ AJAX.registerOnload('table/zoom_search.js', function () {
|
||||
data: series[0].map(function (row: any[]) {
|
||||
return { x: row[0], y: row[1], row: row };
|
||||
}),
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
currentChart.update('none');
|
||||
@ -373,7 +378,7 @@ AJAX.registerOnload('table/zoom_search.js', function () {
|
||||
data: series[0].map(function (row: any[]) {
|
||||
return { x: row[0], y: row[1], row: row };
|
||||
}),
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
currentChart.update('none');
|
||||
@ -382,10 +387,10 @@ AJAX.registerOnload('table/zoom_search.js', function () {
|
||||
|
||||
// Generate SQL query for update
|
||||
if (! isEmpty(newValues)) {
|
||||
var sqlQuery = 'UPDATE `' + CommonParams.get('table') + '` SET ';
|
||||
let sqlQuery = 'UPDATE `' + CommonParams.get('table') + '` SET ';
|
||||
for (key in newValues) {
|
||||
sqlQuery += '`' + key + '`=';
|
||||
var value = newValues[key];
|
||||
const value = newValues[key];
|
||||
|
||||
// null
|
||||
if (value === null) {
|
||||
@ -422,7 +427,7 @@ AJAX.registerOnload('table/zoom_search.js', function () {
|
||||
'db': CommonParams.get('db'),
|
||||
'ajax_request': true,
|
||||
'sql_query': sqlQuery,
|
||||
'inline_edit': false
|
||||
'inline_edit': false,
|
||||
}, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
$('#sqlqueryresultsouter').html(data.sql_query);
|
||||
@ -463,23 +468,23 @@ AJAX.registerOnload('table/zoom_search.js', function () {
|
||||
.text(window.Messages.strShowSearchCriteria);
|
||||
|
||||
$('#togglesearchformdiv').show();
|
||||
var selectedRow;
|
||||
var series = [];
|
||||
var xCord = [];
|
||||
var yCord = [];
|
||||
var xVal;
|
||||
var yVal;
|
||||
var format;
|
||||
|
||||
var options = {
|
||||
series = [];
|
||||
xCord = [];
|
||||
yCord = [];
|
||||
let xVal;
|
||||
let yVal;
|
||||
let format;
|
||||
|
||||
const options = {
|
||||
series: [
|
||||
// for a scatter plot
|
||||
{ showLine: false }
|
||||
{ showLine: false },
|
||||
],
|
||||
grid: {
|
||||
drawBorder: false,
|
||||
shadow: false,
|
||||
background: 'rgba(0,0,0,0)'
|
||||
background: 'rgba(0,0,0,0)',
|
||||
},
|
||||
axes: {
|
||||
xaxis: {
|
||||
@ -487,20 +492,20 @@ AJAX.registerOnload('table/zoom_search.js', function () {
|
||||
},
|
||||
yaxis: {
|
||||
label: $('#tableid_1').val(),
|
||||
}
|
||||
},
|
||||
},
|
||||
highlighter: {
|
||||
show: true,
|
||||
tooltipAxes: 'y',
|
||||
yvalues: 2,
|
||||
// hide the first y value
|
||||
formatString: '<span class="hide">%s</span>%s'
|
||||
formatString: '<span class="hide">%s</span>%s',
|
||||
},
|
||||
cursor: {
|
||||
show: true,
|
||||
zoom: true,
|
||||
showTooltip: false
|
||||
}
|
||||
showTooltip: false,
|
||||
},
|
||||
};
|
||||
|
||||
// If data label is not set, do not show tooltips
|
||||
@ -515,8 +520,10 @@ AJAX.registerOnload('table/zoom_search.js', function () {
|
||||
// could have multiple series but we'll have just one
|
||||
series[0] = [];
|
||||
|
||||
let originalXType;
|
||||
let originalYType;
|
||||
if (xType === 'time') {
|
||||
var originalXType = $('#types_0').val();
|
||||
originalXType = $('#types_0').val();
|
||||
if (originalXType === 'date') {
|
||||
format = '%Y-%m-%d';
|
||||
}
|
||||
@ -535,7 +542,7 @@ AJAX.registerOnload('table/zoom_search.js', function () {
|
||||
}
|
||||
|
||||
if (yType === 'time') {
|
||||
var originalYType = $('#types_1').val();
|
||||
originalYType = $('#types_1').val();
|
||||
if (originalYType === 'date') {
|
||||
format = '%Y-%m-%d';
|
||||
}
|
||||
@ -640,24 +647,24 @@ AJAX.registerOnload('table/zoom_search.js', function () {
|
||||
const data = activeElements[0].element.$context.raw.row;
|
||||
|
||||
searchedDataKey = data[4]; // key from searchedData (global)
|
||||
var fieldId = 0;
|
||||
var postParams = {
|
||||
let fieldId = 0;
|
||||
const postParams = {
|
||||
'ajax_request': true,
|
||||
'get_data_row': true,
|
||||
'server': CommonParams.get('server'),
|
||||
'db': CommonParams.get('db'),
|
||||
'table': CommonParams.get('table'),
|
||||
'where_clause': data[3],
|
||||
'where_clause_sign': data[5]
|
||||
'where_clause_sign': data[5],
|
||||
};
|
||||
|
||||
$.post('index.php?route=/table/zoom-search', postParams, function (data) {
|
||||
// Row is contained in data.row_info,
|
||||
// now fill the displayResultForm with row values
|
||||
var key;
|
||||
let key;
|
||||
for (key in data.row_info) {
|
||||
var $field = $('#edit_fieldID_' + fieldId);
|
||||
var $fieldNull = $('#edit_fields_null_id_' + fieldId);
|
||||
const $field = $('#edit_fieldID_' + fieldId);
|
||||
const $fieldNull = $('#edit_fields_null_id_' + fieldId);
|
||||
if (data.row_info[key] === null) {
|
||||
$fieldNull.prop('checked', true);
|
||||
$field.val('');
|
||||
|
||||
@ -13,8 +13,8 @@ AJAX.registerOnload('transformations/image_upload.js', function () {
|
||||
$('input.image-upload').on('change', function () {
|
||||
const fileInput = this as HTMLInputElement;
|
||||
if (fileInput.files && fileInput.files[0]) {
|
||||
var reader = new FileReader();
|
||||
var $input = $(this);
|
||||
const reader = new FileReader();
|
||||
const $input = $(this);
|
||||
reader.onload = function (e) {
|
||||
$input.prevAll('img').attr('src', (e.target.result as string));
|
||||
};
|
||||
|
||||
@ -5,13 +5,13 @@ import { AJAX } from '../modules/ajax.ts';
|
||||
* XML syntax highlighting transformation plugin
|
||||
*/
|
||||
AJAX.registerOnload('transformations/xml.js', function () {
|
||||
var $elm = $('#page_content').find('code.xml');
|
||||
const $elm = $('#page_content').find('code.xml');
|
||||
$elm.each(function () {
|
||||
var $json = $(this);
|
||||
var $pre = $json.closest('pre');
|
||||
const $json = $(this);
|
||||
const $pre = $json.closest('pre');
|
||||
/* We only care about visible elements to avoid double processing */
|
||||
if ($json.is(':visible')) {
|
||||
var $highlight = $('<div class="xml-highlight cm-s-default"></div>');
|
||||
const $highlight = $('<div class="xml-highlight cm-s-default"></div>');
|
||||
$pre.append($highlight);
|
||||
// @ts-ignore
|
||||
window.CodeMirror.runMode($json.text(), 'application/xml', $highlight[0]);
|
||||
|
||||
@ -29,7 +29,7 @@ const DatabaseTriggers = {
|
||||
* @var $elm a jQuery object containing the reference
|
||||
* to an element that is being validated
|
||||
*/
|
||||
var $elm = null;
|
||||
let $elm = null;
|
||||
// Common validation. At the very least the name
|
||||
// and the definition must be provided for an item
|
||||
$elm = $('table.rte_table').last().find('input[name=item_name]');
|
||||
@ -69,21 +69,21 @@ const DatabaseTriggers = {
|
||||
}, // end validateCustom()
|
||||
|
||||
exportDialog: function ($this) {
|
||||
var $msg = ajaxShowMessage();
|
||||
const $msg = ajaxShowMessage();
|
||||
if ($this.attr('id') === 'bulkActionExportButton') {
|
||||
var combined = {
|
||||
const combined = {
|
||||
success: true,
|
||||
title: window.Messages.strExport,
|
||||
message: '',
|
||||
error: ''
|
||||
error: '',
|
||||
};
|
||||
// export anchors of all selected rows
|
||||
var exportAnchors = $('input.checkall:checked').parents('tr').find('.export_anchor');
|
||||
var count = exportAnchors.length;
|
||||
var returnCount = 0;
|
||||
var p: any = $.when();
|
||||
const exportAnchors = $('input.checkall:checked').parents('tr').find('.export_anchor');
|
||||
const count = exportAnchors.length;
|
||||
let returnCount = 0;
|
||||
let p: any = $.when();
|
||||
exportAnchors.each(function () {
|
||||
var h = $(this).attr('href');
|
||||
const h = $(this).attr('href');
|
||||
p = p.then(function () {
|
||||
return $.get(h, { 'ajax_request': true }, function (data) {
|
||||
returnCount++;
|
||||
@ -133,13 +133,13 @@ const DatabaseTriggers = {
|
||||
}
|
||||
},
|
||||
editorDialog: function (isNew, $this) {
|
||||
var that = this;
|
||||
const that = this;
|
||||
/**
|
||||
* @var $edit_row jQuery object containing the reference to
|
||||
* the row of the the item being edited
|
||||
* from the list of items
|
||||
*/
|
||||
var $editRow = null;
|
||||
let $editRow = null;
|
||||
if ($this.hasClass('edit_anchor')) {
|
||||
// Remember the row of the item being edited for later,
|
||||
// so that if the edit is successful, we can replace the
|
||||
@ -151,7 +151,7 @@ const DatabaseTriggers = {
|
||||
* @var $msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user
|
||||
*/
|
||||
var $msg = ajaxShowMessage();
|
||||
let $msg = ajaxShowMessage();
|
||||
$.get($this.attr('href'), { 'ajax_request': true }, function (data) {
|
||||
if (data.success !== true) {
|
||||
ajaxShowMessage(data.error, false);
|
||||
@ -179,12 +179,12 @@ const DatabaseTriggers = {
|
||||
/**
|
||||
* @var data Form data to be sent in the AJAX request
|
||||
*/
|
||||
var data = $('form.rte_form').last().serialize();
|
||||
const data = $('form.rte_form').last().serialize();
|
||||
$msg = ajaxShowMessage(
|
||||
window.Messages.strProcessingRequest
|
||||
);
|
||||
|
||||
var url = $('form.rte_form').last().attr('action');
|
||||
const url = $('form.rte_form').last().attr('action');
|
||||
$.post(url, data, function (data) {
|
||||
if (data.success !== true) {
|
||||
ajaxShowMessage(data.error, false);
|
||||
@ -215,12 +215,12 @@ const DatabaseTriggers = {
|
||||
* to find the correct location where
|
||||
* to insert a new row.
|
||||
*/
|
||||
var text = '';
|
||||
let text = '';
|
||||
/**
|
||||
* @var inserted Whether a new item has been
|
||||
* inserted in the list or not
|
||||
*/
|
||||
var inserted = false;
|
||||
let inserted = false;
|
||||
$('table.data').find('tr').each(function () {
|
||||
text = $(this)
|
||||
.children('td')
|
||||
@ -268,12 +268,12 @@ const DatabaseTriggers = {
|
||||
/**
|
||||
* @var ct Count of processed rows
|
||||
*/
|
||||
var ct = 0;
|
||||
let ct = 0;
|
||||
/**
|
||||
* @var rowclass Class to be attached to the row
|
||||
* that is being processed
|
||||
*/
|
||||
var rowclass = '';
|
||||
let rowclass = '';
|
||||
$('table.data').find('tr').has('td').each(function () {
|
||||
rowclass = (ct % 2 === 0) ? 'odd' : 'even';
|
||||
$(this).removeClass().addClass(rowclass);
|
||||
@ -328,8 +328,8 @@ const DatabaseTriggers = {
|
||||
* @var elm jQuery object containing the reference to
|
||||
* the Definition textarea.
|
||||
*/
|
||||
var $elm = $('textarea[name=item_definition]').last();
|
||||
var linterOptions = {
|
||||
const $elm = $('textarea[name=item_definition]').last();
|
||||
const linterOptions = {
|
||||
editorType: 'trigger',
|
||||
};
|
||||
that.syntaxHiglighter = getSqlEditor($elm, {}, 'vertical', linterOptions);
|
||||
@ -351,12 +351,12 @@ const DatabaseTriggers = {
|
||||
/**
|
||||
* @var $curr_row Object containing reference to the current row
|
||||
*/
|
||||
var $currRow = $this.parents('tr');
|
||||
const $currRow = $this.parents('tr');
|
||||
/**
|
||||
* @var question String containing the question to be asked for confirmation
|
||||
*/
|
||||
var question = $('<div></div>').text(
|
||||
$currRow.children('td').children('.drop_sql').html()
|
||||
const question = $('<div></div>').text(
|
||||
$currRow.children('td').children('.drop_sql').html(),
|
||||
);
|
||||
// We ask for confirmation first here, before submitting the ajax request
|
||||
$this.confirm(question, $this.attr('href'), function (url) {
|
||||
@ -364,8 +364,8 @@ const DatabaseTriggers = {
|
||||
* @var msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user
|
||||
*/
|
||||
var $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
var params = getJsConfirmCommonParam(this, $this.getPostData());
|
||||
const $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
const params = getJsConfirmCommonParam(this, $this.getPostData());
|
||||
$.post(url, params, function (data) {
|
||||
if (data.success !== true) {
|
||||
ajaxShowMessage(data.error, false);
|
||||
@ -377,7 +377,7 @@ const DatabaseTriggers = {
|
||||
* @var $table Object containing reference
|
||||
* to the main list of elements
|
||||
*/
|
||||
var $table = $currRow.parent();
|
||||
const $table = $currRow.parent();
|
||||
// Check how many rows will be left after we remove
|
||||
// the one that the user has requested us to remove
|
||||
if ($table.find('tr').length === 3) {
|
||||
@ -399,12 +399,12 @@ const DatabaseTriggers = {
|
||||
/**
|
||||
* @var ct Count of processed rows
|
||||
*/
|
||||
var ct = 0;
|
||||
let ct = 0;
|
||||
/**
|
||||
* @var rowclass Class to be attached to the row
|
||||
* that is being processed
|
||||
*/
|
||||
var rowclass = '';
|
||||
let rowclass = '';
|
||||
$table.find('tr').has('td').each(function () {
|
||||
rowclass = (ct % 2 === 1) ? 'odd' : 'even';
|
||||
$(this).removeClass().addClass(rowclass);
|
||||
@ -429,21 +429,21 @@ const DatabaseTriggers = {
|
||||
* @var msg jQuery object containing the reference to
|
||||
* the AJAX message shown to the user
|
||||
*/
|
||||
var $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
const $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
|
||||
|
||||
// drop anchors of all selected rows
|
||||
var dropAnchors = $('input.checkall:checked').parents('tr').find('.drop_anchor');
|
||||
var success = true;
|
||||
var count = dropAnchors.length;
|
||||
var returnCount = 0;
|
||||
const dropAnchors = $('input.checkall:checked').parents('tr').find('.drop_anchor');
|
||||
let success = true;
|
||||
const count = dropAnchors.length;
|
||||
let returnCount = 0;
|
||||
|
||||
dropAnchors.each(function () {
|
||||
var $anchor = $(this);
|
||||
const $anchor = $(this);
|
||||
/**
|
||||
* @var $curr_row Object containing reference to the current row
|
||||
*/
|
||||
var $currRow = $anchor.parents('tr');
|
||||
var params = getJsConfirmCommonParam(this, $anchor.getPostData());
|
||||
const $currRow = $anchor.parents('tr');
|
||||
const params = getJsConfirmCommonParam(this, $anchor.getPostData());
|
||||
$.post($anchor.attr('href'), params, function (data) {
|
||||
returnCount++;
|
||||
if (data.success !== true) {
|
||||
@ -460,7 +460,7 @@ const DatabaseTriggers = {
|
||||
* @var $table Object containing reference
|
||||
* to the main list of elements
|
||||
*/
|
||||
var $table = $currRow.parent();
|
||||
const $table = $currRow.parent();
|
||||
// Check how many rows will be left after we remove
|
||||
// the one that the user has requested us to remove
|
||||
if ($table.find('tr').length === 3) {
|
||||
@ -480,12 +480,12 @@ const DatabaseTriggers = {
|
||||
/**
|
||||
* @var ct Count of processed rows
|
||||
*/
|
||||
var ct = 0;
|
||||
let ct = 0;
|
||||
/**
|
||||
* @var rowclass Class to be attached to the row
|
||||
* that is being processed
|
||||
*/
|
||||
var rowclass = '';
|
||||
let rowclass = '';
|
||||
$table.find('tr').has('td').each(function () {
|
||||
rowclass = (ct % 2 === 1) ? 'odd' : 'even';
|
||||
$(this).removeClass().addClass(rowclass);
|
||||
|
||||
@ -3,13 +3,13 @@ import { AJAX } from './modules/ajax.ts';
|
||||
import { ajaxShowMessage } from './modules/ajax-message.ts';
|
||||
|
||||
AJAX.registerOnload('u2f.js', function () {
|
||||
var $inputReg = $('#u2f_registration_response');
|
||||
const $inputReg = $('#u2f_registration_response');
|
||||
if ($inputReg.length > 0) {
|
||||
var $formReg = $inputReg.parents('form');
|
||||
const $formReg = $inputReg.parents('form');
|
||||
$formReg.find('input[type=submit]').hide();
|
||||
setTimeout(function () {
|
||||
// A magic JS function that talks to the USB device. This function will keep polling for the USB device until it finds one.
|
||||
var request = JSON.parse($inputReg.attr('data-request'));
|
||||
const request = JSON.parse($inputReg.attr('data-request'));
|
||||
|
||||
if (!(window.u2f && typeof window.u2f.register === 'function')) {
|
||||
return;
|
||||
@ -46,14 +46,14 @@ AJAX.registerOnload('u2f.js', function () {
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
var $inputAuth = $('#u2f_authentication_response');
|
||||
const $inputAuth = $('#u2f_authentication_response');
|
||||
if ($inputAuth.length > 0) {
|
||||
var $formAuth = $inputAuth.parents('form');
|
||||
const $formAuth = $inputAuth.parents('form');
|
||||
$formAuth.find('input[type=submit]').hide();
|
||||
setTimeout(function () {
|
||||
// Magic JavaScript talking to your HID
|
||||
// appid, challenge, authenticateRequests
|
||||
var request = JSON.parse($inputAuth.attr('data-request'));
|
||||
const request = JSON.parse($inputAuth.attr('data-request'));
|
||||
|
||||
if (!(window.u2f && typeof window.u2f.sign === 'function')) {
|
||||
return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user