public inbox for [email protected]  
help / color / mirror / Atom feed
From: Surinder Kumar <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch]: RM1592 - Download as CSV should be supported for DDL
Date: Mon, 19 Sep 2016 19:33:35 +0530
Message-ID: <CAM5-9D-ZEfmyouAYrrM8V00AccPup0Uu_6vw48GQaDvWk_jW8Q@mail.gmail.com> (raw)
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

Hi

Please find attached patch with fix.

> ​Download as CSV
>  button should be enabled only for SELECT queries.


​Please review.

Thanks,
Surinder Kumar​


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [application/octet-stream] RM1592.patch (1.6K, 3-RM1592.patch)
  download | inline diff:
diff --git a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
index 74502c7..8f33459 100644
--- a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
@@ -1593,10 +1593,17 @@ define(
                 $("#btn-file-menu-dropdown").prop('disabled', true);
                 $("#btn-copy-row").prop('disabled', true);
                 $("#btn-paste-row").prop('disabled', true);
+                $("#btn-download").prop('disabled', false);

                 // Set the combo box value
                 $(".limit").val(res.data.limit);

+                var editor_query = self.query;
+                if (editor_query && _.isNull(editor_query.toLowerCase().
+                    match('^select'))) {
+                  $("#btn-download").prop('disabled', true);
+                }
+
                 // If status is True then poll the result.
                 self._poll();
               }
@@ -2963,6 +2970,15 @@ define(
           self.disable_tool_buttons(true);
           $("#btn-cancel-query").prop('disabled', false);

+          var editor_query = sql;
+          if (editor_query && _.isNull(editor_query.toLowerCase().
+              match('^select'))) {
+            $("#btn-download").prop('disabled', true);
+          }
+          else {
+            $("#btn-download").prop('disabled', false);
+          }
+
           $.ajax({
             url: "{{ url_for('sqleditor.index') }}" + "query_tool/start/" + self.transId,
             method: 'POST',


view thread (7+ 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: [pgAdmin4][Patch]: RM1592 - Download as CSV should be supported for DDL
  In-Reply-To: <CAM5-9D-ZEfmyouAYrrM8V00AccPup0Uu_6vw48GQaDvWk_jW8Q@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