public inbox for [email protected]  
help / color / mirror / Atom feed
From: Aditya Toshniwal <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin][RM4856] Saving the contents of the "Query Editor"
Date: Tue, 7 Apr 2020 13:46:30 +0530
Message-ID: <CAM9w-_=nbtt5pd4VKOkOtog2ZZ5EZwWUYcyDiAwFHr4giHUDHg@mail.gmail.com> (raw)

Hi Hackers,

Attached is the patch to enable the save button by default when a query
tool is opened with CREATE or other scripts.
Code is changed to consider it as a change when the script text is set.
This will enable the save button automatically.

-- 
Thanks and Regards,
Aditya Toshniwal
pgAdmin Hacker | Sr. Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"


Attachments:

  [application/octet-stream] RM4856.patch (1.5K, 3-RM4856.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 4fc4f329b..f76bdbc7a 100644
--- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
@@ -2279,6 +2279,7 @@ define('tools.querytool', [
           }
         });
 
+        self.init_events();
         if (self.is_query_tool) {
           // Fetch the SQL for Scripts (eg: CREATE/UPDATE/DELETE/SELECT)
           // Call AJAX only if script type url is present
@@ -2292,11 +2293,9 @@ define('tools.querytool', [
                 if (res && res !== '') {
                   self.gridView.query_tool_obj.setValue(res);
                 }
-                self.init_events();
               })
               .fail(function(jqx) {
                 let msg = '';
-                self.init_events();
 
                 msg = httpErrorHandler.handleQueryToolAjaxError(
                   pgAdmin, self, jqx, null, [], false
@@ -2306,13 +2305,10 @@ define('tools.querytool', [
                   gettext('Error fetching SQL for script: %s.', msg)
                 );
               });
-          } else {
-            self.init_events();
           }
         }
         else {
           // Disable codemirror by setting readOnly option to true, background to dark, and cursor, hidden.
-          self.init_events();
           self.gridView.query_tool_obj.setOption('readOnly', true);
           var cm = self.gridView.query_tool_obj.getWrapperElement();
           if (cm) {


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][RM4856] Saving the contents of the "Query Editor"
  In-Reply-To: <CAM9w-_=nbtt5pd4VKOkOtog2ZZ5EZwWUYcyDiAwFHr4giHUDHg@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