public inbox for [email protected]  
help / color / mirror / Atom feed
From: Surinder Kumar <[email protected]>
To: Dave Page <[email protected]>
Cc: Marc Linster <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: [pgAdmin4][Patch]: RM#1432 - File Browser - File does not exist error
Date: Wed, 13 Jul 2016 19:28:05 +0530
Message-ID: <CAM5-9D-4QEd+9Ac1W1i_6Oz7Ykz2c27rmvkhH8Xh3MjHU6hAPQ@mail.gmail.com> (raw)
In-Reply-To: <CAM5-9D_m6cym4rWP9AUjE0KqPGfehhbhS4HUcc1o01Uz+2e1Lg@mail.gmail.com>
References: <CAM5-9D_ebJh8VJfvhk2cR-w=QqkC2YTWhc8ft+v3a9qSTTotKw@mail.gmail.com>
	<CA+OCxoxNCNF9bgzJH7+-04o3-agSX8-Py4OgaKvfjfUt0vLi=w@mail.gmail.com>
	<CAM5-9D-MdMz=s4pLdf9E9P_pXfF4Dh49pzq3wbJjO3xV-h9WyQ@mail.gmail.com>
	<CAM5-9D_eeVg_=hPPTybEp2Traoqdj9jEnwTTAaJQQ-M5LiEo=A@mail.gmail.com>
	<CA+OCxoxCvvO6WSvqiJ9zgbynAYXyybtd=kkOCLMBPKU-0POBgQ@mail.gmail.com>
	<CAM5-9D-ZHXrQgYrTg5FOLNX+xSxR0gaGBmv4SK7Scqb4djhgUw@mail.gmail.com>
	<CA+OCxoxP9BYN=QTTLYWVzDuorvBYstzdCkf_U_CdNf=VFUGJrA@mail.gmail.com>
	<CAM5-9D8K-wwzhnhziQ7pBYivE5PmFFFJgKASr4kfh=KqCwjB3Q@mail.gmail.com>
	<CAM5-9D_m6cym4rWP9AUjE0KqPGfehhbhS4HUcc1o01Uz+2e1Lg@mail.gmail.com>
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

Please find updated patch.
This patch also includes the fix for issue  "File Browser - File does not
exist error".

On Wed, Jul 13, 2016 at 7:23 PM, Surinder Kumar <
[email protected]> wrote:

> I forgot to merge the fix for issue "File Browser - File does not exist
> error" in the patch.
> Please ignore this patch.
>
> On Wed, Jul 13, 2016 at 7:20 PM, Surinder Kumar <
> [email protected]> wrote:
>
>> Please find updated patch with following changes/enhancements:
>>
>>    1. Double click on file/folder icon or name will navigate to the
>>    folder/file.
>>    2. Selected file/folder can be renamed by Rename button only. Double
>>    click rename is removed.
>>    3. Filename text box will not hide on smaller screen. Setting minimum
>>    width of File Browser fixed it.
>>    4. Path at top will only show directory name, not the file name and
>>    it is greyed out.
>>
>> *Issue not fixed:*
>> Icons and fonts of Query tool and File Browser looks blurred in Runtime
>> environment.
>> I tried debugging it. while debugging, It gets fixed on my ubuntu
>> runtime. but I don't know how it gets fixed without changing css styles. It
>> needs more time to debug.
>>
>> Please review.
>>
>> On Wed, Jul 13, 2016 at 5:15 PM, Dave Page <[email protected]> wrote:
>>
>>> On Tue, Jul 12, 2016 at 7:10 AM, Surinder Kumar
>>> <[email protected]> wrote:
>>> > On Mon, Jul 11, 2016 at 6:41 PM, Dave Page <[email protected]> wrote:
>>> >>
>>> >> On Thu, Jul 7, 2016 at 1:50 PM, Surinder Kumar
>>> >> <[email protected]> wrote:
>>> >> > On Wed, Jul 6, 2016 at 7:02 PM, Surinder Kumar
>>> >> > <[email protected]> wrote:
>>> >> >>
>>> >> >> On Wed, Jul 6, 2016 at 5:40 PM, Dave Page <[email protected]>
>>> wrote:
>>> >> >>>
>>> >> >>> Hi,
>>> >> >>>
>>> >> >>> I think we need more changes than just that;
>>> >> >>>
>>> >> >>> - The path at the top should not be editable (it should be greyed
>>> in
>>> >> >>> fact)
>>> >> >>
>>> >> >> Ok
>>> >> >>>
>>> >> >>>
>>> >> >>> - The path at the top should only show the directory path. The
>>> >> >>> filename should never be appended.
>>> >> >>
>>> >> >> Ok
>>> >> >>>
>>> >> >>>
>>> >> >>> - The CSS needs to be fixed so the filename textbox at the bottom
>>> is
>>> >> >>> never hidden (as it is now if the dialogue opens at a small size).
>>> >> >>
>>> >> >> Ok
>>> >> >>>
>>> >> >>>
>>> >> >>> - Double-click to navigate vs. rename should be modified to work
>>> in
>>> >> >>> part like it does on Mac - Double-click on either the icon or the
>>> name
>>> >> >>> should open the item (browser into a folder, or select and "OK"
>>> on a
>>> >> >>> file), and Click then Enter should rename. I'm hesitant to try to
>>> >> >>> implement "slow double click to rename" as that would likely need
>>> to
>>> >> >>> be tunable for accessibility reasons.
>>> >> >>
>>> >> >> Ok, I will fix it.
>>> >> >
>>> >> > In the current scenario, the Enter Key is bound to the OK button by
>>> >> > default
>>> >> > in Alertify dialog which servers the purpose of closing the dialog.
>>> >> > Should we de-attach Enter Key event bound to OK button and use it
>>> for
>>> >> > rename
>>> >> > file?
>>> >> > please suggest what should I do?
>>> >>
>>> >> Hmm, good point.
>>> >>
>>> >> How hard would it be to look for 2 consecutive single-clicks (but not
>>> >> a double-click) for rename? If we can do that, it avoids timing
>>> >> considerations for double-clicks (which would be defined by the OS).
>>> >
>>> >
>>> > I tried to implement slow double click, here is Fiddle
>>> > There are two events 1) double click (it will be used for folder
>>> navigation)
>>> > 2) Slow double click(For rename), It is a simple click event, when
>>> clicked
>>> > twice after delay we consider it a slow double click.
>>> >
>>> > But it is not working smoothly, double click and single click events
>>> are
>>> > conflicting.
>>>
>>> Yeah, so I see.
>>>
>>> > Also, we have rename button in navigation for rename operation,
>>> > Can we skip slow double click because it is very confusing?
>>>
>>> OK, I must have been having a brain failure moment or something. Yes,
>>> skip it - we obviously don't need it with the rename button.
>>>
>>> So we have:
>>>
>>> - Click to select
>>> - Double click to open a folder
>>> - Button to rename the select file/folder
>>>
>>> Sorry!
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>
>>
>


-- 
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] RM#1432_v3.patch (8.2K, 3-RM%231432_v3.patch)
  download | inline diff:
diff --git a/web/pgadmin/misc/file_manager/static/css/file_manager.css b/web/pgadmin/misc/file_manager/static/css/file_manager.css
index 0f188d8..ea502ac 100755
--- a/web/pgadmin/misc/file_manager/static/css/file_manager.css
+++ b/web/pgadmin/misc/file_manager/static/css/file_manager.css
@@ -24,11 +24,15 @@
   float: left;
   text-align: left;
   line-height:1.9em;
-  text-shadow:1px 1px 0px #ffffff;
+  max-width: 367px;
+  text-overflow: ellipsis;
+  overflow: hidden;
+  color: #999;
 }

 #uploader h1 b {
   font-weight: normal;
+  color: #999;
 }

 .uploadresponse {
@@ -346,6 +350,7 @@ button.list span {
   -moz-border-radius: 5px;
   float: left;
   margin-right: 10px;
+  background: #EEE;
 }

 .file_manager #uploader .btn-group .btn[disabled] {
@@ -528,7 +533,9 @@ button.list span {
   -moz-border-radius: 3px;
   height: 22px;
   font-size: 13px;
+  font-weight: normal;
   display: inline;
+  width: 150px;
 }

 .allowed_file_types .change_file_types {
diff --git a/web/pgadmin/misc/file_manager/templates/file_manager/js/file_manager.js b/web/pgadmin/misc/file_manager/templates/file_manager/js/file_manager.js
index 7d6eb3b..9e8a080 100644
--- a/web/pgadmin/misc/file_manager/templates/file_manager/js/file_manager.js
+++ b/web/pgadmin/misc/file_manager/templates/file_manager/js/file_manager.js
@@ -94,6 +94,7 @@ define([
               $container.find('.storage_content').remove();
               $container.append("<div class='storage_content'></div>");
               renderStoragePanel(params);
+              this.elements.dialog.style.minWidth = '630px';
               this.show();
             },
             settings: {
@@ -203,6 +204,7 @@ define([
               $container.find('.storage_content').remove();
               $container.append("<div class='storage_content'></div>");
               renderStoragePanel(params);
+              this.elements.dialog.style.minWidth = '630px';
               this.show();
             },
             settings: {
@@ -314,6 +316,7 @@ define([
               $container.find('.storage_content').remove();
               $container.append("<div class='storage_content'></div>");
               renderStoragePanel(params);
+              this.elements.dialog.style.minWidth = '630px';
               this.show();
             },
             settings: {
@@ -425,6 +428,7 @@ define([
               $container.find('.storage_content').remove();
               $container.append("<div class='storage_content'></div>");
               renderStoragePanel(params);
+              this.elements.dialog.style.minWidth = '630px';
               this.show();
             },
             settings: {
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 8e9c42e..baa71b1 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
@@ -195,7 +195,7 @@ var setUploader = function(path) {
   path = decodeURI(path);

   var display_string = path,
-      mypath = '';
+      file_path = '';

   // split path
   var split_path = display_string.split('/');
@@ -203,29 +203,17 @@ var setUploader = function(path) {

   // set empty path if it is windows
   if (config.options.platform_type === "win32" && config.options.show_volumes) {
-      mypath = "";
+      file_path = "";
   } else if (split_path.length === 0) {
-    mypath = $('<b>/</b>');
+    file_path = '/';
   } else {
-    mypath = $('<a class="breadcrumbs" href="#" data-path="/">/</a>');
+    file_path = '/';
   }
-  $(mypath).appendTo($('.storage_dialog #uploader h1'));

   Object.keys(split_path).forEach(function (i) {
-    if (i < split_path.length - 1) {
-      mypath = $(
-        '<a class="breadcrumbs" href="#" data-path="' +
-        display_string.replace(split_path[i+1], '') +
-        '">' + split_path[i] + '/</a>'
-      );
-      $(mypath).appendTo($('.storage_dialog #uploader h1'));
-    } else {
-      mypath = $('<b>' + split_path[i] + '/</b>');
-      $(mypath).appendTo(
-        $('.storage_dialog #uploader h1')
-      );
-    }
+    file_path += split_path[i] + '/';
   });
+  $('.storage_dialog #uploader h1').html(file_path);

   $('.currentpath').val(path);
   if ($('.storage_dialog #uploader h1 span').length === 0) {
@@ -908,28 +896,6 @@ var getFolderInfo = function(path, file_type) {
         }
       });

-      $('.fileinfo #contents li p').on('dblclick',function(e) {
-        e.stopPropagation();
-        var $this = $(this);
-        var orig_value = decodeURI($this.find('span').attr('title')),
-            newvalue = orig_value.substring(0, orig_value.indexOf('.'));
-
-        if (newvalue === '') {
-          newvalue = orig_value;
-        }
-
-        $this.find('input').toggle().val(newvalue).focus();
-        $this.find('span').toggle();
-
-        // Rename folder/file on pressing enter key
-        $('.file_manager').unbind().on('keyup', function(e) {
-          if (e.keyCode == 13) {
-            e.stopPropagation();
-            $this.find('input').trigger('blur');
-          }
-        });
-      });
-
       // Rename UI handling
       $('.fileinfo #contents li p').on('blur dblclick','input', function(e) {
         e.stopPropagation();
@@ -1008,30 +974,6 @@ var getFolderInfo = function(path, file_type) {
         }
       });

-      $('.fileinfo table#contents tr td p').on('dblclick', function(e) {
-        e.stopPropagation();
-        var $this = $(this),
-            orig_value = decodeURI(
-              $this.find('span').attr('title')
-            );
-
-        var newvalue = orig_value.substring(0, orig_value.lastIndexOf('.'));
-        if (orig_value.lastIndexOf('/') == orig_value.length - 1 || newvalue === '') {
-          newvalue = orig_value;
-        }
-
-        $this.find('input').toggle().val(newvalue).focus();
-        $this.find('span').toggle();
-
-        // Rename folder/file on pressing enter key
-        $('.file_manager').unbind().on('keyup', function(e) {
-          if (e.keyCode == 13) {
-            e.stopPropagation();
-            $this.find('input').trigger('blur');
-          }
-        });
-      });
-
       $('.fileinfo table#contents tr td p').on(
         'blur dblclick', 'input', function(e) {
         var old_name = decodeURI($(this).siblings('span').attr('title')),
@@ -1148,11 +1090,7 @@ var getFolderInfo = function(path, file_type) {
                 'disabled'
               );
               // set selected folder name in breadcrums
-              $('.file_manager #uploader h1').hide();
               $('.file_manager #uploader .show_selected_file').remove();
-              $('<span class="show_selected_file">'+path+'</span>').appendTo(
-                '.file_manager #uploader .filemanager-path-group'
-              );
             }

             if (
@@ -1200,11 +1138,7 @@ var getFolderInfo = function(path, file_type) {
                 'disabled'
               );
               // set selected folder name in breadcrums
-              $('.file_manager #uploader h1').hide();
               $('.file_manager #uploader .show_selected_file').remove();
-              $('<span class="show_selected_file">' + path + '</span>').appendTo(
-                '.file_manager #uploader .filemanager-path-group'
-              );
             }
             if (
               config.options.dialog_type == 'create_file' &&
diff --git a/web/pgadmin/tools/sqleditor/__init__.py b/web/pgadmin/tools/sqleditor/__init__.py
index c713fb5..92e4b17 100644
--- a/web/pgadmin/tools/sqleditor/__init__.py
+++ b/web/pgadmin/tools/sqleditor/__init__.py
@@ -1121,16 +1121,13 @@ def load_file():
     if request.data:
         file_data = json.loads(request.data.decode())

+    file_path = unquote(file_data['file_name'])
     # retrieve storage directory path
     storage_manager_path = get_storage_directory()
-    if storage_manager_path is None:
-        storage_manager_path = ""
+    if storage_manager_path:
+        # generate full path of file
+        file_path = os.path.join(storage_manager_path, file_path.lstrip('/'))

-    # generate full path of file
-    file_path = os.path.join(
-        storage_manager_path,
-        unquote(file_data['file_name'].lstrip('/'))
-    )
     file_data = None

     # check if file type is text or binary


view thread (12+ 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], [email protected], [email protected]
  Subject: Re: [pgAdmin4][Patch]: RM#1432 - File Browser - File does not exist error
  In-Reply-To: <CAM5-9D-4QEd+9Ac1W1i_6Oz7Ykz2c27rmvkhH8Xh3MjHU6hAPQ@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