From a7b8d77ed78cfddc626d04e42a2056e979983a67 Mon Sep 17 00:00:00 2001 From: Nikhil Mohite Date: Thu, 17 Dec 2020 11:37:03 +0530 Subject: [PATCH] Fixed an issue where the state of the Save File icon does not match the dirty editor indicator. Fixes #6046 --- docs/en_US/release_notes_4_30.rst | 1 + web/pgadmin/tools/sqleditor/static/js/sqleditor.js | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/en_US/release_notes_4_30.rst b/docs/en_US/release_notes_4_30.rst index e76f0e4d8..8ba5b8121 100644 --- a/docs/en_US/release_notes_4_30.rst +++ b/docs/en_US/release_notes_4_30.rst @@ -21,5 +21,6 @@ Bug fixes | `Issue #5875 `_ - Ensure that the 'template1' database should not be visible after pg_upgrade. | `Issue #5965 `_ - Ensure that the macro query result should be download properly. +| `Issue #6046 `_ - Fixed an issue where the state of the Save File icon does not match the dirty editor indicator. | `Issue #6047 `_ - Fixed an issue where the dirty indicator stays active even if all changes were undone. | `Issue #6058 `_ - Ensure that the rename panel should be disabled when the SQL file opened in the query tool. diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js index 47d4de44b..abd33a47b 100644 --- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js @@ -4286,7 +4286,14 @@ define('tools.querytool', [ $('#btn-explain-options-dropdown').prop('disabled', mode_disabled); $('#btn-edit-dropdown').prop('disabled', mode_disabled); $('#btn-load-file').prop('disabled', mode_disabled); - $('#btn-save-file').prop('disabled', mode_disabled); + if(this.gridView.current_file) { + if(this.gridView.query_tool_obj.file_data != this.gridView.query_tool_obj.getValue()) { + $('#btn-save-file').prop('disabled', mode_disabled); + } + } else { + $('#btn-save-file').prop('disabled', mode_disabled); + } + $('#btn-file-menu-dropdown').prop('disabled', mode_disabled); $('#btn-find').prop('disabled', mode_disabled); $('#btn-find-menu-dropdown').prop('disabled', mode_disabled);