public inbox for [email protected]  
help / color / mirror / Atom feed
From: Nikhil Mohite <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin][RM-6047]: [Query Tool] dirty indicator stays active although all changes were undone
Date: Fri, 11 Dec 2020 16:16:26 +0530
Message-ID: <CAOBg0APEDOYm1EdRrgOuQN=8Eg_BCLqosYFWVmkjE1NR8XeaOQ@mail.gmail.com> (raw)

Hi Team,

Please find the patch for RM-6047:
<https://redmine.postgresql.org/issues/6047; [Query Tool] dirty indicator
stays active although all changes were undone.


-- 
*Thanks & Regards,*
*Nikhil Mohite*
*Software Engineer.*
*EDB Postgres* <https://www.enterprisedb.com/;
*Mob.No: +91-7798364578.*


Attachments:

  [application/octet-stream] RM_6047.patch (2.3K, 3-RM_6047.patch)
  download | inline diff:
diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
index c8d3cbc..e2d7666 100644
--- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
@@ -3772,6 +3772,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
@@ -3806,6 +3807,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...')
@@ -3823,6 +3825,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');
@@ -3881,6 +3884,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);
+          }
         }
       },
 


view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [pgAdmin][RM-6047]: [Query Tool] dirty indicator stays active although all changes were undone
  In-Reply-To: <CAOBg0APEDOYm1EdRrgOuQN=8Eg_BCLqosYFWVmkjE1NR8XeaOQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox