Skip to content

Commit 0c435ab

Browse files
committed
Replace Simulate Query dialog with a modal
Signed-off-by: Saksham Gupta <shucontech@gmail.com>
1 parent c90affe commit 0c435ab

2 files changed

Lines changed: 21 additions & 16 deletions

File tree

js/src/sql.js

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -780,22 +780,11 @@ AJAX.registerOnload('sql.js', function () {
780780
}
781781
dialogContent += '</div>';
782782
var $dialogContent = $(dialogContent);
783-
var buttonOptions = {};
784-
buttonOptions[Messages.strClose] = function () {
785-
$(this).dialog('close');
786-
};
787-
$('<div></div>').append($dialogContent).dialog({
788-
minWidth: 540,
789-
maxHeight: 400,
790-
modal: true,
791-
buttons: buttonOptions,
792-
title: Messages.strSimulateDML,
793-
open: function () {
794-
Functions.highlightSql($(this));
795-
},
796-
close: function () {
797-
$(this).remove();
798-
}
783+
var modal = $('#simulateDmlModal');
784+
modal.modal('show');
785+
modal.find('.modal-body').first().html($dialogContent);
786+
modal.on('shown.bs.modal', function () {
787+
Functions.highlightSql(modal);
799788
});
800789
} else {
801790
Functions.ajaxShowMessage(response.error);

templates/sql/query.twig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,3 +211,19 @@
211211
</form>
212212

213213
<div id="sqlqueryresultsouter"></div>
214+
215+
<div class="modal fade" id="simulateDmlModal" tabindex="-1" aria-labelledby="simulateDmlModalLabel" aria-hidden="false">
216+
<div class="modal-dialog">
217+
<div class="modal-content">
218+
<div class="modal-header">
219+
<h5 class="modal-title" id="simulateDmlModalLabel">{% trans 'Simulate query' %}</h5>
220+
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{% trans 'Close' %}"></button>
221+
</div>
222+
<div class="modal-body">
223+
</div>
224+
<div class="modal-footer">
225+
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans 'Close' %}</button>
226+
</div>
227+
</div>
228+
</div>
229+
</div>

0 commit comments

Comments
 (0)