Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions resources/js/codemirror/addon/lint/sql-lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
44 changes: 22 additions & 22 deletions resources/js/database/central_columns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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();
Expand All @@ -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');
});
Expand All @@ -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();
Expand All @@ -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()
Expand All @@ -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',
Expand Down Expand Up @@ -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 !== '') {
Expand All @@ -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();
Expand All @@ -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 {
Expand Down
80 changes: 40 additions & 40 deletions resources/js/database/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]');
Expand Down Expand Up @@ -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++;
Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -342,21 +342,21 @@ 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) {
/**
* @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);
Expand All @@ -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) {
Expand All @@ -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);
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down
Loading
Loading