Re: [pgAdmin4][Patch]: File Manager & Backform FileControl

From: Surinder Kumar <surinder(dot)kumar(at)enterprisedb(dot)com>
To: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [pgAdmin4][Patch]: File Manager & Backform FileControl
Date: 2016-05-11 18:48:27
Message-ID: CAM5-9D9jr0E9bsE-_exx-XGrmRq9LZSeA+emm8Sbc-jJR_Ny3Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi,

PFA updated patch with following issues fixed:
1. not listing files based on default file type selected.
2. load css file using 'get_own_stylesheets' method instead of loading from
'base.html'.
3. setting custom dialog title and button not working.

On Wed, May 11, 2016 at 3:03 PM, Surinder Kumar <
surinder(dot)kumar(at)enterprisedb(dot)com> wrote:

>
> ---------- Forwarded message ----------
> From: Surinder Kumar <surinder(dot)kumar(at)enterprisedb(dot)com>
> Date: Tue, May 10, 2016 at 11:43 PM
> Subject: Re: [pgadmin-hackers][pgAdmin4][Patch]: File Manager & Backform
> FileControl
> To: Neel Patel <neel(dot)patel(at)enterprisedb(dot)com>
> Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
>
>
> Hi,
>
> Please find updated path with couple of review comments given by Ashesh
> Vashi.
> 1. Add variable *STORAGE_DIR* in configuration settings which decides the
> directory to list when *File manager* is opens, previously
> we have provided this option in preferences which is removed due to
> security issues.
> 2. List all available Volumes by default when *STORAGE_DIR *is set to
> empty for *Windows* platform.
> 3. Also, added support to allow user to provide
> *Dialog title and custom name for primary(OK) button,*
>
> Usage:
>
> 1. Set variable *STORAGE_DIR *to some value in config.py.
> 2. Import it in your module as following:
> * import config*
> * config.**STORAGE_DIR*
>
> *Usage*: Backform FilleControl
>
> schema:[{
> id: 'select_file', label: '{{ _('Select File')}}',
> type: 'text', *control*: *Backform.FileControl*,
> *dialog_type: '*select_file*'*, *supp_types: [*'*', 'pdf', 'text',
> 'patch', 'py'*],*
> * dialog_title: '*Title to appear on dialog*", *
> * btn_primary: '*Save File*'*
> }]
>
> Please review the patch.
>
> On Wed, May 4, 2016 at 6:35 PM, Surinder Kumar <
> surinder(dot)kumar(at)enterprisedb(dot)com> wrote:
>
>> Hi
>>
>> PFA updated patch with resolved review comments.
>>
>> On Thu, Apr 28, 2016 at 6:39 PM, Neel Patel <neel(dot)patel(at)enterprisedb(dot)com>
>> wrote:
>>
>>> Hi Surinder,
>>>
>>> Please find additional comments as below.
>>>
>>> 1. In Windows OS, when we try to open the dialog with default
>>> preference value then it gives error as below.
>>>
>>> 2016-04-28 13:07:44,716: ERROR pgadmin: Exception on
>>> /file_manager/filemanager/2530270/ [POST]
>>> Traceback (most recent call last):
>>> File "C:\Projects\venv_python_2_7\Lib\site-packages\flask\app.py",
>>> line 1817, in wsgi_app
>>> response = self.full_dispatch_request()
>>> File "C:\Projects\venv_python_2_7\Lib\site-packages\flask\app.py",
>>> line 1477, in full_dispatch_request
>>> rv = self.handle_user_exception(e)
>>> File "C:\Projects\venv_python_2_7\Lib\site-packages\flask\app.py",
>>> line 1381, in handle_user_exception
>>> reraise(exc_type, exc_value, tb)
>>> File "C:\Projects\venv_python_2_7\Lib\site-packages\flask\app.py",
>>> line 1475, in full_dispatch_request
>>> rv = self.dispatch_request()
>>> File "C:\Projects\venv_python_2_7\Lib\site-packages\flask\app.py",
>>> line 1461, in dispatch_request
>>> return self.view_functions[rule.endpoint](**req.view_args)
>>> File "C:\Projects\venv_python_2_7\Lib\site-packages\flask_login.py",
>>> line 758, in decorated_view
>>> return func(*args, **kwargs)
>>> File "C:\Projects\pgadmin4\web\pgadmin\misc\file_manager\__init__.py",
>>> line 629, in file_manager
>>> return getattr(myFilemanager, mode)(**kwargs)
>>> File "C:\Projects\pgadmin4\web\pgadmin\misc\file_manager\__init__.py",
>>> line 421, in getfolder
>>> filelist = self.list_filesystem(dir, path, trans_data, file_type)
>>> File "C:\Projects\pgadmin4\web\pgadmin\misc\file_manager\__init__.py",
>>> line 331, in list_filesystem
>>> for f in sorted(os.listdir(orig_path)):
>>> WindowsError: [Error 161] The specified path is invalid: '//*.*'
>>>
>>> Now the default path will always be the users directory. I have used *os.path.expanduser('~')
>> *which prints user directory. It works for all operating systems.
>>
>>>
>>> 2. Folder having write only permission should not allow to read the
>>> directory. Same way read only permission folder should not allow to create
>>> the folder. Currently it gives below error.
>>>
>>> PermissionError: [Errno 13] Permission denied:
>>> '/home/neel/Projects/pgadmin4_file_manager/write_only_premission/'
>>>
>> Fixed.
>>
>>>
>>> 3. In Windows OS, when we open the file manager dialog, no directories
>>> listed though we have directories in the folder. Due to that we are not
>>> able to
>>> test all the functionality in windows. Once we fix this issue then
>>> we test all the functionality in windows OS.
>>>
>>> We debug the issue and found that issue is with the json response
>>> which includes the HTML tags.
>>>
>> Fixed. It still have issues in very older browsers. I will fix it.
>>
>>>
>>> 4. In Windows OS, file manager dialog have issue with layout. We are
>>> getting some margin at top before buttons.
>>>
>> Fixed.
>>
>>>
>>> 5. When we give any special characters to folder name that it gives
>>> error saying "Folder does not exist".
>>> Same is applicable when we give dialog_type to create_file
>>>
>> Fixed.
>>
>>>
>>> 6. In create_file mode, after giving the filename it should display the
>>> name of the file to text control.
>>>
>> Fixed.
>>
>>>
>>> 7. In create_file mode, when user gives the filename and click on the
>>> any blank area of dialog then name is getting cleared.
>>>
>> Fixed.
>>
>>>
>>> 8. When we upload the new file through file manager then it is not
>>> showing in the list though we have selected "All files" options.
>>>
>> Fixed.
>>
>>>
>>> 9. When we rename the folder in "Table mode" then font-family gets
>>> changed. It is not happened in "Grid" mode.
>>>
>> Fixed.
>>
>>>
>>> 10. When we try to download the file then it goes into loop and opens up
>>> 20-30 dialogs at the same time.
>>>
>> Fixed.
>>
>>>
>>> 11. "Rename" button is enabled even though we have not selected the
>>> files/folder to rename and when we click on the "Rename" button it gives
>>> below
>>> error.
>>>
>>> TypeError: orig_value is undefined
>>>
>> Fixed.
>>
>>> 12. "Delete" button is enabled even though we have not selected the
>>> files/folder to delete and when we click on the "Delete" button it gives
>>> below error.
>>> TypeError: path is undefined
>>>
>> Fixed.
>>
>>>
>>> Do let us know if you have queries.
>>>
>>> Thanks,
>>> Neel Patel
>>>
>>> On Wed, Apr 27, 2016 at 9:15 PM, Neel Patel <neel(dot)patel(at)enterprisedb(dot)com
>>> > wrote:
>>>
>>>> Hi Surinder,
>>>>
>>>> I have applied the patch file and below are some observations.
>>>>
>>>> - When we create the new folder and hit the enter then we are
>>>> getting the below error.
>>>>
>>>> TypeError: argument of type 'NoneType' is not iterable
>>>>
>>>> - I have just added the new control in "Import" dialog and observed
>>>> that new control is getting added in new tab called "General". I think it
>>>> should not create the new "General" tab.
>>>> - "Select" and "Cancel" buttons font is different then other
>>>> dialogs.
>>>>
>>>>
>>>> Thanks,
>>>> Neel Patel
>>>>
>>>> On Wed, Apr 27, 2016 at 6:18 PM, Surinder Kumar <
>>>> surinder(dot)kumar(at)enterprisedb(dot)com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> The patch is for *File Manager and Backform FileControl*.
>>>>>
>>>>> *File Manager:* It allows user to store their files at one place. The
>>>>> user can set path to this directory in preferences which file manger will
>>>>> use.
>>>>>
>>>>> It will be used by various modules of pgAdmin4 such as
>>>>> *import data from file, query tool, backup & recovery tool* so on..
>>>>> It allows user to perform various operations such as:
>>>>>
>>>>> - File deletion
>>>>> - File upload
>>>>> - Create new directory
>>>>> - File rename
>>>>> - File download and
>>>>> - List files & folders in list and grid view.
>>>>>
>>>>> *FileControl: *This control is used with *File Manager. *It can be
>>>>> used for:
>>>>>
>>>>> - File Selection
>>>>> - Folder Selection
>>>>> - File Creation
>>>>> - Storage Manager Dialog.( it supports all operations listed
>>>>> above).
>>>>>
>>>>>
>>>>> Usage*:*
>>>>>
>>>>> schema:[{
>>>>> id: 'select_file', label: '{{ _('Select File')}}',
>>>>> type: 'text', *control*: *Backform.FileControl*,
>>>>> *dialog_type: 'select_file'*, *supp_types: ['*', 'pdf', 'text',
>>>>> 'patch', 'py']*
>>>>> }
>>>>>
>>>>> Where:
>>>>>
>>>>> - *control* - It should be *Backform.FileControl*
>>>>> - *dialog_type *- the type of dialog to use.
>>>>> - options can be: *select_file, select_folder, create_file &
>>>>> storage_dialog*.
>>>>> - *supp_types(*not mandatory) - the types of files allowed to show
>>>>> and upload.
>>>>>
>>>>> Please review the patch and let me know for the review comments.
>>>>>
>>>>>
>>>>> Thanks
>>>>> Surinder Kumar
>>>>>
>>>>>
>>>>> --
>>>>> Sent via pgadmin-hackers mailing list (pgadmin-hackers(at)postgresql(dot)org)
>>>>> To make changes to your subscription:
>>>>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>>>>
>>>>>
>>>>
>>>
>>
>
>

Attachment Content-Type Size
FileManager_v3.patch application/octet-stream 204.8 KB

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Surinder Kumar 2016-05-11 19:53:51 [pgAdmin4][Patch]: Load/Save file in query tool
Previous Message Surinder Kumar 2016-05-11 17:28:43 Re: [pgAdmin4] [Patch]: Grant Wizard