Fixed an issue where the dirty indicator stays active even if all changes were undone. Fixes #6047

This commit is contained in:
Nikhil Mohite 2020-12-14 12:02:02 +05:30 committed by Akshay Joshi
parent 6475a70514
commit 52780079f3
2 changed files with 16 additions and 0 deletions

View File

@ -18,4 +18,5 @@ Bug fixes
*********
| `Issue #5965 <https://redmine.postgresql.org/issues/5965>`_ - Ensure that the macro query result should be download properly.
| `Issue #6047 <https://redmine.postgresql.org/issues/6047>`_ - Fixed an issue where the dirty indicator stays active even if all changes were undone.
| `Issue #6058 <https://redmine.postgresql.org/issues/6058>`_ - Ensure that the rename panel should be disabled when the SQL file opened in the query tool.

View File

@ -3783,6 +3783,7 @@ define('tools.querytool', [
.done(function(res) {
self.gridView.query_tool_obj.setValue(res);
self.gridView.current_file = e;
self.gridView.query_tool_obj.file_data = res;
self.setTitle(self.gridView.current_file.split('\\').pop().split('/').pop(), true);
self.trigger('pgadmin-sqleditor:loading-icon:hide');
// hide cursor
@ -3817,6 +3818,7 @@ define('tools.querytool', [
'file_name': decodeURI(e),
'file_content': self.gridView.query_tool_obj.getValue(),
};
var file_data = self.gridView.query_tool_obj.getValue();
self.trigger(
'pgadmin-sqleditor:loading-icon:show',
gettext('Saving the queries in the file...')
@ -3834,6 +3836,7 @@ define('tools.querytool', [
alertify.success(gettext('File saved successfully.'));
self.gridView.current_file = e;
self.setTitle(self.gridView.current_file.replace(/^.*[\\\/]/g, ''), true);
self.gridView.query_tool_obj.file_data = file_data;
// disable save button on file save
$('#btn-save-file').prop('disabled', true);
$('#btn-file-menu-save').css('display', 'none');
@ -3892,6 +3895,18 @@ define('tools.querytool', [
$('#btn-save-file').prop('disabled', false);
$('#btn-file-menu-save').css('display', 'block');
$('#btn-file-menu-dropdown').prop('disabled', false);
} else {
if(self.gridView.current_file) {
if (self.gridView.query_tool_obj.file_data == self.gridView.query_tool_obj.getValue()) {
title = self.gridView.current_file.replace(/^.*[\\\/]/g, '');
is_dirty_editor = false;
} else {
title = self.gridView.current_file.replace(/^.*[\\\/]/g, '') + ' *';
is_dirty_editor = true;
}
self.setTitle(title, true, is_dirty_editor);
}
}
},