From f65ac4da1b48d94596dc43b69e6e542d7bec3243 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?=
Date: Sun, 11 May 2025 17:32:26 -0300
Subject: [PATCH 1/8] Replace trigger editor jQuery UI's dialog with a modal
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Maurício Meneghini Fauth
---
resources/js/src/database/routines.ts | 2 +-
resources/js/src/triggers.ts | 142 +++++++-----------
resources/templates/triggers/list.twig | 20 +++
.../Triggers/IndexControllerTest.php | 40 +++++
4 files changed, 118 insertions(+), 86 deletions(-)
diff --git a/resources/js/src/database/routines.ts b/resources/js/src/database/routines.ts
index 55383fef94..572e589a0b 100644
--- a/resources/js/src/database/routines.ts
+++ b/resources/js/src/database/routines.ts
@@ -176,7 +176,7 @@ const DatabaseRoutines = {
// Move the data from the codemirror editor back to the
// textarea, where it can be used in the form submission.
if (typeof window.CodeMirror !== 'undefined') {
- that.syntaxHiglighter?.save();
+ that.syntaxHiglighter.save();
}
// Validate editor and submit request, if passed.
diff --git a/resources/js/src/triggers.ts b/resources/js/src/triggers.ts
index 0b910fcde9..aab697228c 100644
--- a/resources/js/src/triggers.ts
+++ b/resources/js/src/triggers.ts
@@ -14,11 +14,6 @@ AJAX.registerTeardown('triggers.js', function () {
});
const DatabaseTriggers = {
- /**
- * @var $ajaxDialog Query object containing the reference to the
- * dialog that contains the editor
- */
- $ajaxDialog: null,
/**
* @var syntaxHiglighter Reference to the codemirror editor
*/
@@ -185,22 +180,12 @@ const DatabaseTriggers = {
return;
}
- var buttonOptions = {
- [window.Messages.strGo]: {
- text: window.Messages.strGo,
- class: 'btn btn-primary',
- },
- [window.Messages.strClose]: {
- text: window.Messages.strClose,
- class: 'btn btn-secondary',
- },
- };
// We have successfully fetched the editor form
ajaxRemoveMessage($msg);
- // Now define the function that is called when
- // the user presses the "Go" button
- // @ts-ignore
- buttonOptions[window.Messages.strGo].click = function () {
+
+ let isEditMode = false;
+
+ function triggersEditorModalSaveEventHandler () {
// Move the data from the codemirror editor back to the
// textarea, where it can be used in the form submission.
if (typeof window.CodeMirror !== 'undefined') {
@@ -231,10 +216,10 @@ const DatabaseTriggers = {
// Item created successfully
ajaxRemoveMessage($msg);
slidingMessage(data.message);
- that.$ajaxDialog.dialog('close');
+ window.bootstrap.Modal.getOrCreateInstance('#triggersEditorModal').hide();
// If we are in 'edit' mode, we must
// remove the reference to the old row.
- if (mode === 'edit' && $editRow !== null) {
+ if (isEditMode && $editRow !== null) {
$editRow.remove();
}
@@ -328,72 +313,59 @@ const DatabaseTriggers = {
Navigation.reload();
}); // end $.post()
- }; // end of function that handles the submission of the Editor
-
- // @ts-ignore
- buttonOptions[window.Messages.strClose].click = function () {
- $(this).dialog('close');
- };
-
- /**
- * Display the dialog to the user
- */
- that.$ajaxDialog = $('
' + data.message + '
').dialog({
- classes: {
- 'ui-dialog-titlebar-close': 'btn-close'
- },
- width: '70%',
- minWidth: 500,
- // @ts-ignore
- buttons: buttonOptions,
- // Issue #15810 - use button titles for modals (eg: new procedure)
- // Respect the order: title on href tag, href content, title sent in response
- title: $this.attr('title') || $this.text() || $(data.title).text(),
- modal: true,
- open: function () {
- $('#rteDialog').dialog('option', 'max-height', $(window).height());
- if ($('#rteDialog').parents('.ui-dialog').height() > $(window).height()) {
- $('#rteDialog').dialog('option', 'height', $(window).height());
- }
-
- $(this).find('input[name=item_name]').trigger('focus');
- $(this).find('input.datefield').each(function () {
- addDatepicker($(this).css('width', '95%'), 'date');
- });
-
- $(this).find('input.datetimefield').each(function () {
- addDatepicker($(this).css('width', '95%'), 'datetime');
- });
-
- // @ts-ignore
- $.datepicker.initialized = false;
- },
- close: function () {
- $(this).remove();
- }
- });
-
- /**
- * @var mode Used to remember whether the editor is in
- * "Edit" or "Add" mode
- */
- var mode = 'add';
- if ($('input[name=editor_process_edit]').length > 0) {
- mode = 'edit';
}
- // Attach syntax highlighted editor to the definition
- /**
- * @var elm jQuery object containing the reference to
- * the Definition textarea.
- */
- var $elm = $('textarea[name=item_definition]').last();
- var linterOptions = {
- editorType: 'trigger',
- };
- that.syntaxHiglighter = getSqlEditor($elm, {}, 'vertical', linterOptions);
- window.codeMirrorEditor = that.syntaxHiglighter;
- }); // end $.get()
+ const triggersEditorModal = document.getElementById('triggersEditorModal');
+
+ triggersEditorModal.addEventListener('shown.bs.modal', function () {
+ /**
+ * Issue #15810 - use button titles for modals (eg: new procedure)
+ * Respect the order: title on href tag, href content, title sent in response
+ */
+ triggersEditorModal.querySelector('.modal-title').textContent = $this.attr('title') || $this.text() || $(data.title).text();
+ triggersEditorModal.querySelector('.modal-body').innerHTML = data.message;
+
+ const triggersEditorModalSaveButton = document.getElementById('triggersEditorModalSaveButton');
+ triggersEditorModalSaveButton?.addEventListener('click', triggersEditorModalSaveEventHandler);
+
+ $(this).find('input[name=item_name]').trigger('focus');
+ $(this).find('input.datefield').each(function () {
+ addDatepicker($(this).css('width', '95%'), 'date');
+ });
+
+ $(this).find('input.datetimefield').each(function () {
+ addDatepicker($(this).css('width', '95%'), 'datetime');
+ });
+
+ // @ts-ignore
+ $.datepicker.initialized = false;
+
+ if ($('input[name=editor_process_edit]').length > 0) {
+ isEditMode = true;
+ }
+
+ // Attach syntax highlighted editor to the definition
+ /**
+ * @var elm jQuery object containing the reference to
+ * the Definition textarea.
+ */
+ var $elm = $('textarea[name=item_definition]').last();
+ var linterOptions = {
+ editorType: 'trigger',
+ };
+ that.syntaxHiglighter = getSqlEditor($elm, {}, 'vertical', linterOptions);
+ window.codeMirrorEditor = that.syntaxHiglighter;
+ });
+
+ triggersEditorModal.addEventListener('hidden.bs.modal', function () {
+ const triggersEditorModalSaveButton = document.getElementById('triggersEditorModalSaveButton');
+ triggersEditorModalSaveButton?.removeEventListener('click', triggersEditorModalSaveEventHandler);
+ document.getElementById('triggersEditorModal').querySelector('.modal-body').innerHTML = '
diff --git a/src/Controllers/JavaScriptMessagesController.php b/src/Controllers/JavaScriptMessagesController.php
index f0fdf431a5..2b00a923b0 100644
--- a/src/Controllers/JavaScriptMessagesController.php
+++ b/src/Controllers/JavaScriptMessagesController.php
@@ -391,6 +391,7 @@ final class JavaScriptMessagesController implements InvocableController
'strExport' => __('Export'),
'NoExportable' => __('No routine is exportable. Required privileges may be lacking.'),
'strRoutine' => __('Routine'),
+ 'strTrigger' => __('Trigger'),
/* For ENUM/SET editor*/
'enum_columnVals' => __('Values for column %s'),
diff --git a/tests/unit/Controllers/Triggers/IndexControllerTest.php b/tests/unit/Controllers/Triggers/IndexControllerTest.php
index 32df242fc4..7a4b93222a 100644
--- a/tests/unit/Controllers/Triggers/IndexControllerTest.php
+++ b/tests/unit/Controllers/Triggers/IndexControllerTest.php
@@ -169,6 +169,21 @@ final class IndexControllerTest extends AbstractTestCase
+
+
+
+
+
+
Export trigger
+
+
+
+
+
+
+
HTML;
@@ -277,6 +292,21 @@ HTML;
+
+
+
+
+
+
Export trigger
+
+
+
+
+
+
+
HTML;
From dd0c8a4c8801151dd1b971b96c59f88afa3dcd35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?=
Date: Wed, 14 May 2025 12:42:53 -0300
Subject: [PATCH 3/8] Replace events editor jQuery UI's dialog with a modal
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Maurício Meneghini Fauth
---
resources/js/src/database/events.ts | 154 +++++++-----------
.../templates/database/events/index.twig | 20 +++
.../Database/EventsControllerTest.php | 40 +++++
3 files changed, 121 insertions(+), 93 deletions(-)
diff --git a/resources/js/src/database/events.ts b/resources/js/src/database/events.ts
index 8123e937c4..50598aee52 100644
--- a/resources/js/src/database/events.ts
+++ b/resources/js/src/database/events.ts
@@ -15,11 +15,6 @@ AJAX.registerTeardown('database/events.js', function () {
});
const DatabaseEvents = {
- /**
- * @var $ajaxDialog Query object containing the reference to the
- * dialog that contains the editor
- */
- $ajaxDialog: null,
/**
* @var syntaxHiglighter Reference to the codemirror editor
*/
@@ -176,24 +171,10 @@ const DatabaseEvents = {
// We have successfully fetched the editor form
ajaxRemoveMessage($msg);
- /**
- * @var buttonOptions Object containing options
- * for jQueryUI dialog buttons
- */
- var buttonOptions = {
- [window.Messages.strGo]: {
- text: window.Messages.strGo,
- class: 'btn btn-primary',
- },
- [window.Messages.strClose]: {
- text: window.Messages.strClose,
- class: 'btn btn-secondary',
- },
- };
- // Now define the function that is called when
- // the user presses the "Go" button
- // @ts-ignore
- buttonOptions[window.Messages.strGo].click = function () {
+
+ let isEditMode = false;
+
+ function eventsEditorModalSaveEventHandler () {
// Move the data from the codemirror editor back to the
// textarea, where it can be used in the form submission.
if (typeof window.CodeMirror !== 'undefined') {
@@ -221,10 +202,10 @@ const DatabaseEvents = {
// Item created successfully
ajaxRemoveMessage($msg);
slidingMessage(data.message);
- that.$ajaxDialog.dialog('close');
+ window.bootstrap.Modal.getOrCreateInstance('#eventsEditorModal').hide();
// If we are in 'edit' mode, we must
// remove the reference to the old row.
- if (mode === 'edit' && $editRow !== null) {
+ if (isEditMode && $editRow !== null) {
$editRow.remove();
}
@@ -317,75 +298,61 @@ const DatabaseEvents = {
}
Navigation.reload();
- }); // end $.post()
- } // end "if (that.validate())"
- }; // end of function that handles the submission of the Editor
-
- // @ts-ignore
- buttonOptions[window.Messages.strClose].click = function () {
- $(this).dialog('close');
- };
-
- /**
- * Display the dialog to the user
- */
- that.$ajaxDialog = $('
' + data.message + '
').dialog({
- classes: {
- 'ui-dialog-titlebar-close': 'btn-close'
- },
- height: 500,
- width: '70%',
- minWidth: 500,
- // @ts-ignore
- buttons: buttonOptions,
- // Issue #15810 - use button titles for modals (eg: new procedure)
- // Respect the order: title on href tag, href content, title sent in response
- title: $this.attr('title') || $this.text() || $(data.title).text(),
- modal: true,
- open: function () {
- $('#rteDialog').dialog('option', 'max-height', $(window).height());
- if ($('#rteDialog').parents('.ui-dialog').height() > $(window).height()) {
- $('#rteDialog').dialog('option', 'height', $(window).height());
- }
-
- $(this).find('input[name=item_name]').trigger('focus');
- $(this).find('input.datefield').each(function () {
- addDatepicker($(this).css('width', '95%'), 'date');
});
-
- $(this).find('input.datetimefield').each(function () {
- addDatepicker($(this).css('width', '95%'), 'datetime');
- });
-
- // @ts-ignore
- $.datepicker.initialized = false;
- },
- close: function () {
- $(this).remove();
}
- });
-
- /**
- * @var mode Used to remember whether the editor is in
- * "Edit" or "Add" mode
- */
- var mode = 'add';
- if ($('input[name=editor_process_edit]').length > 0) {
- mode = 'edit';
}
- // Attach syntax highlighted editor to the definition
- /**
- * @var elm jQuery object containing the reference to
- * the Definition textarea.
- */
- var $elm = $('textarea[name=item_definition]').last();
- var linterOptions = {
- editorType: 'event',
- };
- that.syntaxHiglighter = getSqlEditor($elm, {}, 'vertical', linterOptions);
- window.codeMirrorEditor = that.syntaxHiglighter;
- }); // end $.get()
+ const eventsEditorModal = document.getElementById('eventsEditorModal');
+
+ eventsEditorModal.addEventListener('shown.bs.modal', function () {
+ /**
+ * Issue #15810 - use button titles for modals (eg: new procedure)
+ * Respect the order: title on href tag, href content, title sent in response
+ */
+ eventsEditorModal.querySelector('.modal-title').textContent = $this.attr('title') || $this.text() || $(data.title).text();
+ eventsEditorModal.querySelector('.modal-body').innerHTML = data.message;
+
+ const eventsEditorModalSaveButton = document.getElementById('eventsEditorModalSaveButton');
+ eventsEditorModalSaveButton?.addEventListener('click', eventsEditorModalSaveEventHandler);
+
+ $(this).find('input[name=item_name]').trigger('focus');
+ $(this).find('input.datefield').each(function () {
+ addDatepicker($(this).css('width', '95%'), 'date');
+ });
+
+ $(this).find('input.datetimefield').each(function () {
+ addDatepicker($(this).css('width', '95%'), 'datetime');
+ });
+
+ // @ts-ignore
+ $.datepicker.initialized = false;
+
+ if ($('input[name=editor_process_edit]').length > 0) {
+ isEditMode = true;
+ }
+
+ // Attach syntax highlighted editor to the definition
+ /**
+ * @var elm jQuery object containing the reference to
+ * the Definition textarea.
+ */
+ var $elm = $('textarea[name=item_definition]').last();
+ var linterOptions = {
+ editorType: 'event',
+ };
+ that.syntaxHiglighter = getSqlEditor($elm, {}, 'vertical', linterOptions);
+ window.codeMirrorEditor = that.syntaxHiglighter;
+ });
+
+ eventsEditorModal.addEventListener('hidden.bs.modal', function () {
+ const eventsEditorModalSaveButton = document.getElementById('eventsEditorModalSaveButton');
+ eventsEditorModalSaveButton?.removeEventListener('click', eventsEditorModalSaveEventHandler);
+ document.getElementById('eventsEditorModal').querySelector('.modal-body').innerHTML = '
' +
+ '' + window.Messages.strLoading + '
';
+ });
+
+ window.bootstrap.Modal.getOrCreateInstance(eventsEditorModal).show();
+ });
},
dropDialog: function ($this) {
@@ -561,9 +528,10 @@ const DatabaseEvents = {
* to an element that is being validated
*/
var $elm = null;
- if (this.$ajaxDialog.find('select[name=item_type]').find(':selected').val() === 'RECURRING') {
+ const eventsEditorModal = $('#eventsEditorModal');
+ if (eventsEditorModal.find('select[name=item_type]').find(':selected').val() === 'RECURRING') {
// The interval field must not be empty for recurring events
- $elm = this.$ajaxDialog.find('input[name=item_interval_value]');
+ $elm = eventsEditorModal.find('input[name=item_interval_value]');
if ($elm.val() === '') {
$elm.trigger('focus');
alert(window.Messages.strFormEmpty);
@@ -572,7 +540,7 @@ const DatabaseEvents = {
}
} else {
// The execute_at field must not be empty for "once off" events
- $elm = this.$ajaxDialog.find('input[name=item_execute_at]');
+ $elm = eventsEditorModal.find('input[name=item_execute_at]');
if ($elm.val() === '') {
$elm.trigger('focus');
alert(window.Messages.strFormEmpty);
diff --git a/resources/templates/database/events/index.twig b/resources/templates/database/events/index.twig
index 8626bd09df..c91000b465 100644
--- a/resources/templates/database/events/index.twig
+++ b/resources/templates/database/events/index.twig
@@ -153,4 +153,24 @@
+
+
+
+
+
+
{{ t('Event editor') }}
+
+
+
+
+ {{ t('Loading…') }}
+
+
+
+
+
+
diff --git a/tests/unit/Controllers/Database/EventsControllerTest.php b/tests/unit/Controllers/Database/EventsControllerTest.php
index b377e9d7bf..87bbbe27e1 100644
--- a/tests/unit/Controllers/Database/EventsControllerTest.php
+++ b/tests/unit/Controllers/Database/EventsControllerTest.php
@@ -181,6 +181,26 @@ final class EventsControllerTest extends AbstractTestCase
+
+
- {{ t("The phpMyAdmin Monitor can assist you in optimizing the server configuration and track down time intensive queries. For the latter you will need to set log_output to 'TABLE' and have either the slow_query_log or general_log enabled. Note however, that the general_log produces a lot of data and increases server load by up to 15%.") }}
-
-
+
+
+
+
+
{{ t('System monitor instructions') }}
+
+
+
+
+ {{ t("The phpMyAdmin Monitor can assist you in optimizing the server configuration and track down time intensive queries. For the latter you will need to set log_output to 'TABLE' and have either the slow_query_log or general_log enabled. Note however, that the general_log produces a lot of data and increases server load by up to 15%.") }}
+
+
-
-
+
-
-
{{ t('Using the monitor:') }}
-
- {{ t("Your browser will refresh all displayed charts in a regular interval. You may add charts and change the refresh rate under 'Settings', or remove any chart using the cog icon on each respective chart.") }}
-
-
- {{ t('To display queries from the logs, click on any chart. Once confirmed, this will load a table of grouped queries, there you may click on any occurring SELECT statements to further analyze them.') }}
-
- {{ t('Enabling the general_log may increase the server load by 5-15%. Also be aware that generating statistics from the logs is a load intensive task, so it is advisable to select only a small time span and to disable the general_log and empty its table once monitoring is not required any more.') }}
-
+
+
{{ t('Using the monitor:') }}
+
+ {{ t("Your browser will refresh all displayed charts in a regular interval. You may add charts and change the refresh rate under 'Settings', or remove any chart using the cog icon on each respective chart.") }}
+
+
+ {{ t('To display queries from the logs, click on any chart. Once confirmed, this will load a table of grouped queries, there you may click on any occurring SELECT statements to further analyze them.') }}
+
+ {{ t('Enabling the general_log may increase the server load by 5-15%. Also be aware that generating statistics from the logs is a load intensive task, so it is advisable to select only a small time span and to disable the general_log and empty its table once monitoring is not required any more.') }}
+
- {{ t('Choose from which log you want the statistics to be generated from.') }}
-
-
- {{ t('Results are grouped by query text.') }}
-
+
+ {{ t('Choose from which log you want the statistics to be generated from.') }}
+
+
+ {{ t('Results are grouped by query text.') }}
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
{{ t('Query analyzer') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ t('Analysing logs') }}
+
+
+
+
{{ t('Analysing and loading logs. This may take a while.') }}
+
+ {{ t('Loading…') }}
+
+
+
+
+
+
+
+
+
+
+
+
{{ t('No data found') }}
+
+
+
+ {{ t('Log analysed, but no data found in this time span.') }}
+
+
+
+
+
+
+
+
+
+
+
{{ t('Loading logs') }}
+
+
+
+
{{ t('Log data loaded. Queries executed in this time span:') }}
+
+
+
+
+
+
+
+
+
+
+
+
{{ t('Monitor refresh failed') }}
+
+
+
+ {{ get_image('s_attention') }}
+ {{ t('While requesting new chart data the server returned an invalid response. This is most likely because your session expired. Reloading the page and reentering your credentials should help.') }}
+
+ {{ get_image('s_attention') }}
+ {{ t('The chart arrangement configuration in your browsers local storage is not compatible anymore to the newer version of the monitor dialog. It is very likely that your current configuration will not work anymore. Please reset your configuration to default in the [em]Settings[/em] menu.')|sanitize }}
+
+
+
+
diff --git a/src/Controllers/JavaScriptMessagesController.php b/src/Controllers/JavaScriptMessagesController.php
index f0f46090ab..dfb8af9da1 100644
--- a/src/Controllers/JavaScriptMessagesController.php
+++ b/src/Controllers/JavaScriptMessagesController.php
@@ -172,15 +172,6 @@ final class JavaScriptMessagesController implements InvocableController
'numberOfStatements' => __('Number of statements'),
- /* server status monitor */
- 'strIncompatibleMonitorConfig' => __('Local monitor configuration incompatible!'),
- 'strIncompatibleMonitorConfigDescription' => __(
- 'The chart arrangement configuration in your browsers local storage is not '
- . 'compatible anymore to the newer version of the monitor dialog. It is very '
- . 'likely that your current configuration will not work anymore. Please reset '
- . 'your configuration to default in the Settings menu.',
- ),
-
'strQueryCacheEfficiency' => __('Query cache efficiency'),
'strQueryCacheUsage' => __('Query cache usage'),
'strQueryCacheUsed' => __('Query cache used'),
@@ -265,12 +256,7 @@ final class JavaScriptMessagesController implements InvocableController
'strDividedBy' => __('Divided by %s'),
'strUnit' => __('Unit'),
- 'strFromSlowLog' => __('From slow log'),
- 'strFromGeneralLog' => __('From general log'),
'strServerLogError' => __('The database name is not known for this query in the server\'s logs.'),
- 'strAnalysingLogsTitle' => __('Analysing logs'),
- 'strAnalysingLogs' => __('Analysing & loading logs. This may take a while.'),
- 'strCancelRequest' => __('Cancel request'),
'strCountColumnExplanation' => __(
'This column shows the amount of identical queries that are grouped together. '
. 'However only the SQL query itself has been used as a grouping criteria, so '
@@ -281,11 +267,6 @@ final class JavaScriptMessagesController implements InvocableController
. 'same table are also being grouped together, disregarding of the inserted '
. 'data.',
),
- 'strLogDataLoaded' => __('Log data loaded. Queries executed in this time span:'),
-
- 'strJumpToTable' => __('Jump to Log table'),
- 'strNoDataFoundTitle' => __('No data found'),
- 'strNoDataFound' => __('Log analysed, but no data found in this time span.'),
'strAnalyzing' => __('Analyzing…'),
'strExplainOutput' => __('Explain output'),
@@ -309,15 +290,6 @@ final class JavaScriptMessagesController implements InvocableController
'strSumRows' => __('Sum of grouped rows:'),
'strTotal' => __('Total:'),
- 'strLoadingLogs' => __('Loading logs'),
- 'strRefreshFailed' => __('Monitor refresh failed'),
- 'strInvalidResponseExplanation' => __(
- 'While requesting new chart data the server returned an invalid response. This '
- . 'is most likely because your session expired. Reloading the page and '
- . 'reentering your credentials should help.',
- ),
- 'strReloadPage' => __('Reload page'),
-
'strAffectedRows' => __('Affected rows:'),
'strFailedParsingConfig' => __('Failed parsing config file. It doesn\'t seem to be valid JSON code.'),
@@ -329,8 +301,6 @@ final class JavaScriptMessagesController implements InvocableController
'strDBNameDialogMessage' => __('Please enter a valid database name.'),
'strNoImportFile' => __('No files available on server for import!'),
- 'strAnalyzeQuery' => __('Analyse query'),
-
/* For query editor */
'strFormatting' => __('Formatting SQL…'),
'strNoParam' => __('No parameters found!'),
From 5238dffc9b44ea7d0f118ead6c698f8595566fa4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?=
Date: Fri, 16 May 2025 11:32:10 -0300
Subject: [PATCH 8/8] Remove usage of jQuery UI's dialog component
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Maurício Meneghini Fauth
---
public/themes/bootstrap/scss/_common.scss | 37 ------------
public/themes/metro/scss/_common.scss | 49 ----------------
public/themes/original/scss/_common.scss | 58 -------------------
public/themes/pmahomme/scss/_common.scss | 26 ---------
resources/js/src/export.ts | 1 -
resources/js/src/modules/functions.ts | 41 +------------
.../js/src/modules/navigation/event-loader.ts | 6 --
resources/js/src/table/structure.ts | 5 --
tests/end-to-end/Database/EventsTest.php | 13 +----
tests/end-to-end/TriggersTest.php | 4 +-
10 files changed, 6 insertions(+), 234 deletions(-)
diff --git a/public/themes/bootstrap/scss/_common.scss b/public/themes/bootstrap/scss/_common.scss
index b66a3e6a98..6842df44eb 100644
--- a/public/themes/bootstrap/scss/_common.scss
+++ b/public/themes/bootstrap/scss/_common.scss
@@ -1550,10 +1550,6 @@ div#page_content div {
}
}
-.ui-dialog {
- position: fixed;
-}
-
.small_font {
font-size: smaller;
}
@@ -2274,34 +2270,6 @@ th {
// end of styles of sortable tables
-// styles for jQuery-ui to support rtl languages
-body .ui-dialog {
- .ui-dialog-titlebar-close {
- right: 0.3em;
- left: initial;
- }
-
- .ui-dialog-title {
- float: left;
- }
-
- .ui-dialog-buttonpane .ui-dialog-buttonset {
- float: right;
- }
-
- .ui-dialog-buttonpane .ui-dialog-buttonset button {
- color: $white;
- background: none;
- background-color: #6c757d !important;
- border-color: #6c757d;
- }
-
- .ui-dialog-buttonpane .ui-dialog-buttonset button:hover {
- background-color: #5a6268 !important;
- }
-}
-// end of styles for jQuery-ui to support rtl languages
-
// templates/database/designer
// side menu
#name-panel {
@@ -2350,11 +2318,6 @@ body .ui-dialog {
min-width: 100%;
}
}
-
- .ui-dialog {
- margin: 1%;
- width: 95% !important;
- }
}
#tooltip_editor {
diff --git a/public/themes/metro/scss/_common.scss b/public/themes/metro/scss/_common.scss
index 0e762b627a..f7da47e9e9 100644
--- a/public/themes/metro/scss/_common.scss
+++ b/public/themes/metro/scss/_common.scss
@@ -2468,21 +2468,6 @@ meter {
/* styles for jQuery-ui to support rtl languages */
body {
- .ui-dialog {
- .ui-dialog-titlebar-close {
- right: 0.3em;
- left: initial;
- }
-
- .ui-dialog-title {
- float: left;
- }
-
- .ui-dialog-buttonpane .ui-dialog-buttonset {
- float: right;
- }
- }
-
.ui-corner-all,
.ui-corner-top,
.ui-corner-left,
@@ -2510,40 +2495,6 @@ body {
.ui-corner-br {
border-bottom-right-radius: 0;
}
-
- .ui-dialog {
- padding: 0;
-
- .ui-widget-header {
- color: $button-color;
- border: none;
- background-color: var(--navi-background);
- background-image: none;
- }
-
- .ui-dialog-title {
- padding: 5px;
- font-weight: normal;
- }
-
- .ui-dialog-buttonpane button {
- font-family: $font-family-base;
- color: $button-color;
- background-color: var(--navi-background);
- background-image: none;
- border: 1px solid var(--button-background);
-
- &.ui-state-hover {
- background-color: var(--button-hover);
- border: 1px solid var(--button-hover);
- }
-
- &.ui-state-active {
- background-color: #333;
- border: 1px solid #333;
- }
- }
- }
}
#tooltip_editor {
diff --git a/public/themes/original/scss/_common.scss b/public/themes/original/scss/_common.scss
index 3be7de1598..671d0a27c9 100644
--- a/public/themes/original/scss/_common.scss
+++ b/public/themes/original/scss/_common.scss
@@ -1584,10 +1584,6 @@ div#page_content div {
}
}
-.ui-dialog {
- position: fixed;
-}
-
.small_font {
font-size: smaller;
}
@@ -2227,21 +2223,6 @@ span.drag_icon {
/* styles for jQuery-ui to support rtl languages */
body {
- .ui-dialog {
- .ui-dialog-titlebar-close {
- right: 0.3em;
- left: initial;
- }
-
- .ui-dialog-title {
- float: left;
- }
-
- .ui-dialog-buttonpane .ui-dialog-buttonset {
- float: right;
- }
- }
-
.ui-corner-all,
.ui-corner-top,
.ui-corner-left,
@@ -2269,40 +2250,6 @@ body {
.ui-corner-br {
border-bottom-right-radius: 0;
}
-
- .ui-dialog {
- padding: 0;
- border-color: #000;
-
- .ui-dialog-titlebar {
- padding: 0.3em 0.5em;
- border: none;
- border-bottom: 1px solid #000;
-
- button {
- border: 1px solid #999;
- }
- }
-
- .ui-dialog-content {
- padding: 0.2em 0.4em;
- }
-
- .ui-dialog-buttonpane {
- background: #d3dce3;
- border-top: 1px solid #000;
-
- button {
- margin: 0.1em 0 0.1em 0.4em;
- border: 1px solid #999;
- color: #000;
- }
- }
-
- .ui-button-text-only .ui-button-text {
- padding: 0.2em 0.6em;
- }
- }
}
/* templates/database/designer */
@@ -2349,11 +2296,6 @@ body {
}
}
- .ui-dialog {
- margin: 1%;
- width: 95% !important;
- }
-
#server-breadcrumb .item {
margin: 4px;
}
diff --git a/public/themes/pmahomme/scss/_common.scss b/public/themes/pmahomme/scss/_common.scss
index 3554adecfc..b9d2958e51 100644
--- a/public/themes/pmahomme/scss/_common.scss
+++ b/public/themes/pmahomme/scss/_common.scss
@@ -1775,10 +1775,6 @@ div#page_content div {
}
}
-.ui-dialog {
- position: fixed;
-}
-
.small_font {
font-size: smaller;
}
@@ -2433,23 +2429,6 @@ meter {
// end of styles of sortable tables
-// styles for jQuery-ui to support rtl languages
-body .ui-dialog {
- .ui-dialog-titlebar-close {
- right: 0.3em;
- left: initial;
- }
-
- .ui-dialog-title {
- float: left;
- }
-
- .ui-dialog-buttonpane .ui-dialog-buttonset {
- float: right;
- }
-}
-// end of styles for jQuery-ui to support rtl languages
-
// templates/database/designer
// side menu
#name-panel {
@@ -2492,11 +2471,6 @@ body .ui-dialog {
min-width: 100%;
}
}
-
- .ui-dialog {
- margin: 1%;
- width: 95% !important;
- }
}
#tooltip_editor {
diff --git a/resources/js/src/export.ts b/resources/js/src/export.ts
index f0404b4dee..b3969eb968 100644
--- a/resources/js/src/export.ts
+++ b/resources/js/src/export.ts
@@ -825,7 +825,6 @@ function createAliasModal (event): void {
var modal = $('#renameExportModal');
modal.modal('show');
modal.on('shown.bs.modal', function () {
- modal.closest('.ui-dialog').find('.ui-button').addClass('btn btn-secondary');
var db = CommonParams.get('db');
if (db) {
var option = $('');
diff --git a/resources/js/src/modules/functions.ts b/resources/js/src/modules/functions.ts
index 79b62213a2..5f14a0e566 100644
--- a/resources/js/src/modules/functions.ts
+++ b/resources/js/src/modules/functions.ts
@@ -853,10 +853,6 @@ export function onloadIdleEvent () {
if (! $('#modalOverlay').length) {
$('fieldset').not(':disabled').attr('disabled', 'disabled').addClass('disabled_for_expiration');
$('body').append(data.error);
- $('.ui-dialog').each(function () {
- $('#' + $(this).attr('aria-describedby')).dialog('close');
- });
-
$('#input_username').trigger('focus');
} else {
Navigation.update(CommonParams.set('token', data.new_token));
@@ -1776,11 +1772,6 @@ export function onloadCreateTableEvents (): void {
.html('');
ajaxShowMessage(data.message);
- // Only if the create table dialog (distinct panel) exists
- var $createTableDialog = $('#create_table_dialog');
- if ($createTableDialog.length > 0) {
- $createTableDialog.dialog('close').remove();
- }
$('#tableslistcontainer').before(data.formatted_sql);
@@ -2077,10 +2068,8 @@ export function onloadChangePasswordEvents (): void {
var $pageContent = $('#page_content');
$pageContent.prepend(data.message);
highlightSql($pageContent);
- $('#change_password_dialog').hide().remove();
- $('#edit_user_dialog').dialog('close').remove();
ajaxRemoveMessage($msgbox);
- }); // end $.post()
+ });
$('#changePasswordModal').modal('hide');
};
@@ -2116,15 +2105,7 @@ export function onloadChangePasswordEvents (): void {
$('#fieldset_change_password_footer').hide();
ajaxRemoveMessage($msgbox);
displayPasswordGenerateButton();
- $('#change_password_form').on('submit', function (e) {
- e.preventDefault();
- $(this)
- .closest('.ui-dialog')
- .find('.ui-dialog-buttonpane .ui-button')
- .first()
- .trigger('click');
- });
- }); // end $.get()
+ });
});
}
@@ -3311,24 +3292,6 @@ export function onloadCreateView () {
return false;
});
- /**
- * Attach Ajax event handlers for input fields in the editor
- * and used to submit the Ajax request when the ENTER key is pressed.
- */
- if ($('#createViewModal').length !== 0) {
- $(document).on('keydown', '#createViewModal input, #createViewModal select', function (e) {
- if (e.which === 13) { // 13 is the ENTER key
- e.preventDefault();
-
- // with preventing default, selection by