public inbox for [email protected]  
help / color / mirror / Atom feed
From: Surinder Kumar <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch]: RM1739 - Don't show Upload File icon unless it is not in capabilities [Storage Manager]
Date: Fri, 7 Oct 2016 11:33:26 +0530
Message-ID: <CAM5-9D81MtwXQWCfx+EY7Qj5NPuSOb4g9XP8zOsy7MjsWA20Jg@mail.gmail.com> (raw)
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

Hi,

*Issue:*
When clicked on upload icon while saving a file prompt user to leave page.
It is because the icon is a button and its type is set to submit which
makes it to prompt, instead it should be 'button'

Storage Manager's menu items depends on capabilities list set by the module
using it. If capabilities doesn't have 'upload' in it, It won't work.
Upload button is bound to click event only when it is in capabilities.

*Solution:*
As upload button is being added only when it is in capabilities, so upload
button html is removed from html file. It will not shown on UI untill it is
in capabilities list.

Please find attached patch and 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] RM1739.patch (1.7K, 3-RM1739.patch)
  download | inline diff:
diff --git a/web/pgadmin/misc/file_manager/templates/file_manager/index.html b/web/pgadmin/misc/file_manager/templates/file_manager/index.html
index 396e950..197386f 100755
--- a/web/pgadmin/misc/file_manager/templates/file_manager/index.html
+++ b/web/pgadmin/misc/file_manager/templates/file_manager/index.html
@@ -18,8 +18,6 @@
             <input class="mode" name="mode" type="hidden" value="add"/>
             <input class="currentpath" name="currentpath" type="hidden"/>
             <button type="button" title="Refresh" class="btn fa fa-refresh refresh"></button>
-            <button type="submit" title="Upload File" value="Upload" class="btn fa fa-upload upload"><span></span>
-            </button>
             <button type="button" title="Download File" class="btn fa fa-download download" disabled><span></span>
             </button>
             <button name="delete" type="button" title="Delete File/Folder" class="btn fa fa-trash delete" disabled>
diff --git a/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js b/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js
index 8d891fd..1bf7cd6 100755
--- a/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js
+++ b/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js
@@ -1418,7 +1418,7 @@ if (has_capability(data, 'upload')) {
   $('.upload').remove();
   $( ".create" ).before( '<button value="Upload" type="button" title="Upload File" name="upload" id="upload" class="btn fa fa-upload upload"><span></span></button> ' );

-  $('.upload').unbind().click(function() {
+  $('#uploader .upload').unbind().click(function() {
     // we create prompt
     var msg  = '<div id="dropzone-container">' +
           '<button class="fa fa-times dz_cross_btn"></button>' +


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: [pgAdmin4][Patch]: RM1739 - Don't show Upload File icon unless it is not in capabilities [Storage Manager]
  In-Reply-To: <CAM5-9D81MtwXQWCfx+EY7Qj5NPuSOb4g9XP8zOsy7MjsWA20Jg@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