Re: [pgadmin-hackers] [pgAdmin4] [PATCH] History Tab rewrite in React

2017-06-12 Thread Shruti B Iyer
 [built]
> >  [175] /Users/dpage/git/pgadmin4/web/~/react/lib/ReactDOMFactories.js
> > 5.53 kB {0} [built]
> >  [176] /Users/dpage/git/pgadmin4/web/~/react/lib/ReactPropTypes.js
> > 15.8 kB {0} [built]
> >  [177] /Users/dpage/git/pgadmin4/web/~/react/lib/ReactPureComponent.js
> > 1.32 kB {0} [built]
> >  [178] /Users/dpage/git/pgadmin4/web/~/react/lib/ReactVersion.js 350
> > bytes {0} [built]
> > + 167 hidden modules
> >
> > ERROR in ./jsx/history/query_history_entry.jsx
> > Module not found: Error: Can't resolve 'immutability-helper' in
> > '/Users/dpage/git/pgadmin4/web/pgadmin/static/jsx/history'
> >  @ ./jsx/history/query_history_entry.jsx 13:26-56
> >  @ ./jsx/history/query_history.jsx
> >  @ ./jsx/components.jsx
> >
> > ERROR in ./jsx/history/query_history_entry.jsx
> > Module not found: Error: Can't resolve 'moment' in
> > '/Users/dpage/git/pgadmin4/web/pgadmin/static/jsx/history'
> >  @ ./jsx/history/query_history_entry.jsx 17:14-31
> >  @ ./jsx/history/query_history.jsx
> >  @ ./jsx/components.jsx
> > error Command failed with exit code 2.
> > info Visit https://yarnpkg.com/en/docs/cli/run for documentation about
> > this command.
> > error Command failed with exit code 1.
> > info Visit https://yarnpkg.com/en/docs/cli/run for documentation about
> > this command
> >
> >
> > - If I try to run pgAdmin, I get a script error in the UI, and console
> > output as attached (sorry for the screenshot, I've yet to find a good
> > way to copy/paste that info without losing the formatting).
> >
> > Thanks.
> >
> >
> > On Mon, Jun 12, 2017 at 3:53 PM, Shruti B Iyer <si...@pivotal.io> wrote:
> >> Hi Hackers,
> >>
> >> Attached are the updated patches that apply on top of master.
> >>
> >> Thanks,
> >> Shruti & Joao
> >>
> >>
> >> On Mon, Jun 12, 2017 at 10:44 AM Dave Page <dp...@pgadmin.org> wrote:
> >>>
> >>> Hi Shruti
> >>>
> >>> On Mon, Jun 12, 2017 at 3:24 PM, Shruti B Iyer <si...@pivotal.io>
> wrote:
> >>> >
> >>> > Hello Dave,
> >>> >
> >>> > Thanks for making those fixes and sharing them with us. We tried
> >>> > applying
> >>> > the patch and it looks like there are some missing file changes from
> >>> > your
> >>> > patch that were present in ours, like the Make.bat file changes. But
> we
> >>> > will
> >>> > add them when we send you the new patches.
> >>>
> >>> Hmm, I wonder if I missed them because I applied the patch in a sub
> >>> directory.
> >>>
> >>> > While trying to generate the new patches we realized some tests are
> >>> > failing
> >>> > in master branch due to an internal server error:
> >>> >
> >>> > 2017-06-12 10:04:11,938: INFO werkzeug: 127.0.0.1 - - [12/Jun/2017
> >>> > 10:04:11]
> >>> > "GET /browser/table/sql/1/1/12669/2200/81920 HTTP/1.1" 500 -
> >>> > Traceback (most recent call last):
> >>> >   File
> >>> >
> >>> >
> "/Users/pivotal/.pyenv/versions/2.7.10/envs/pgadmin/lib/python2.7/site-packages/flask/app.py",
> >>> > line 2000, in __call__
> >>> > return self.wsgi_app(environ, start_response)
> >>> >   File
> >>> >
> >>> >
> "/Users/pivotal/.pyenv/versions/2.7.10/envs/pgadmin/lib/python2.7/site-packages/flask/app.py",
> >>> > line 1991, in wsgi_app
> >>> > response = self.make_response(self.handle_exception(e))
> >>> >   File
> >>> >
> >>> >
> "/Users/pivotal/.pyenv/versions/2.7.10/envs/pgadmin/lib/python2.7/site-packages/flask/app.py",
> >>> > line 1567, in handle_exception
> >>> > reraise(exc_type, exc_value, tb)
> >>> >   File
> >>> >
> >>> >
> "/Users/pivotal/.pyenv/versions/2.7.10/envs/pgadmin/lib/python2.7/site-packages/flask/app.py",
> >>> > line 1988, in wsgi_app
> >>> > response = self.full_dispatch_request()
> >>> >   File
> >>> >
> >>> >
> "/Users/pivotal/.pyenv/versions/2.7.10/envs/pgadmin/lib/python2.7/site-packages/flask/app.py",
> >>> > line 1641, in full_dispatch_request
> >>> > rv = self.handle_user

[pgadmin-hackers] [pgAdmin4] [PATCH] Translatable Text in Query Results Header

2017-06-12 Thread Shruti B Iyer
Hi Hackers!

Attached is a minor patch that wraps with gettext() the "Select/Deselect
All" text in the top left corner of the query results grid.

Thanks,
Matt and Shruti


query_results_gettext.diff
Description: Binary data

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


Re: [pgadmin-hackers] [pgAdmin4] [PATCH] History Tab rewrite in React

2017-06-12 Thread Shruti B Iyer
Hello Dave,

Thanks for making those fixes and sharing them with us. We tried applying
the patch and it looks like there are some missing file changes from your
patch that were present in ours, like the Make.bat file changes. But we
will add them when we send you the new patches.

While trying to generate the new patches we realized some tests are failing
in master branch due to an internal server error:

2017-06-12 10:04:11,938: INFO werkzeug: 127.0.0.1 - - [12/Jun/2017
10:04:11] "GET /browser/table/sql/1/1/12669/2200/81920 HTTP/1.1" 500 -
Traceback (most recent call last):
  File
"/Users/pivotal/.pyenv/versions/2.7.10/envs/pgadmin/lib/python2.7/site-packages/flask/app.py",
line 2000, in __call__
return self.wsgi_app(environ, start_response)
  File
"/Users/pivotal/.pyenv/versions/2.7.10/envs/pgadmin/lib/python2.7/site-packages/flask/app.py",
line 1991, in wsgi_app
response = self.make_response(self.handle_exception(e))
  File
"/Users/pivotal/.pyenv/versions/2.7.10/envs/pgadmin/lib/python2.7/site-packages/flask/app.py",
line 1567, in handle_exception
reraise(exc_type, exc_value, tb)
  File
"/Users/pivotal/.pyenv/versions/2.7.10/envs/pgadmin/lib/python2.7/site-packages/flask/app.py",
line 1988, in wsgi_app
response = self.full_dispatch_request()
  File
"/Users/pivotal/.pyenv/versions/2.7.10/envs/pgadmin/lib/python2.7/site-packages/flask/app.py",
line 1641, in full_dispatch_request
rv = self.handle_user_exception(e)
  File
"/Users/pivotal/.pyenv/versions/2.7.10/envs/pgadmin/lib/python2.7/site-packages/flask/app.py",
line 1544, in handle_user_exception
reraise(exc_type, exc_value, tb)
  File
"/Users/pivotal/.pyenv/versions/2.7.10/envs/pgadmin/lib/python2.7/site-packages/flask/app.py",
line 1639, in full_dispatch_request
rv = self.dispatch_request()
  File
"/Users/pivotal/.pyenv/versions/2.7.10/envs/pgadmin/lib/python2.7/site-packages/flask/app.py",
line 1625, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
  File
"/Users/pivotal/.pyenv/versions/2.7.10/envs/pgadmin/lib/python2.7/site-packages/flask/views.py",
line 84, in view
return self.dispatch_request(*args, **kwargs)
  File "/Users/pivotal/workspace/pgadmin4/web/pgadmin/browser/utils.py",
line 235, in dispatch_request
return method(*args, **kwargs)
  File
"/Users/pivotal/workspace/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py",
line 315, in wrap
return f(*args, **kwargs)
  File
"/Users/pivotal/workspace/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py",
line 2555, in sql
data = self._formatter(did, scid, tid, data)
  File
"/Users/pivotal/workspace/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py",
line 1081, in _formatter
data = self._columns_formatter(tid, data)
  File
"/Users/pivotal/workspace/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py",
line 663, in _columns_formatter
column['attlen'] = matchObj.group(1)
AttributeError: 'NoneType' object has no attribute 'group'

Was this introduced in a previous patch?

We will recreate the patches and send them ASAP.

Thanks
Shruti & Joao

On Mon, Jun 12, 2017 at 6:59 AM Dave Page  wrote:

> Hi
>
> OK, so Ashesh and I spend much of the morning on this.
>
> Patch 01 - Applied.
> Patch 02:
>
> - karma.conf.js wouldn't patch; I've manually handled that.
> - test-main.js wouldn't patch. The diff looked like it was trying to
> empty it; I have removed it instead.
> - The imports in pgAdmin4.py need to be made after the app root is
> added to the path.
> - The JS bundler should be in pgadmin/utils, not pgadmin/tools (which
> is intended for plugin modules)
> - The tests were failing following some changes Ashesh pushed earlier
> to add a client-side url_for function.
> - pgAdmin4.py was attempting to run the bundler on every startup. I've
> wrapped those called in "if config.DEBUG:" conditionals, as typically
> an installation for an end-user will be in a read-only directory.
>
> We've fixed all of that in the attached patch. I'm not sure why it's
> so much bigger than yours.
>
> The following issues are outstanding; please take a look at them:
>
> - There is no update to the Windows installer generation code (needed
> in 2 places unfortunately; Make.bat and Make-MinGW.bat).
>
> - The updates to the other packages call "yarn run webpacker" which is
> an undefined target.
>
> I haven't looked at patch 03 yet, but Ashesh did tell me it won't
> apply for him. Patch 4 is also untested at this stage.
>
> If the issues above can be fixed, we can get patch 2 applied then move
> on from there.
>
> I'll hold off on Harshal's patch for the Query Tool's load on demand
> to give you a chance to get this done.
>
> Thanks.
>
> On Sat, Jun 10, 2017 at 2:52 AM, George Gelashvili
>  wrote:
> > Hi Dave,
> >
> > Our patch touches code also changed by 

Re: [pgadmin-hackers] Re: [pgAdmin4][Patch][Feature #1971]: Remember column sizes between executions of the same query in the query tool

2017-06-05 Thread Shruti B Iyer
Hi Surinder!

We reviewed this patch. The changes look good and we especially like that
you have extracted out the new utility functions and the epicRandomString
function too.

This patch will likely affect the Query Results patch that is currently
under review
.
In order to assist either us or yourself when making a merge between these
patches, it would help to have jasmine unit testing for the two new
functions, getHash and calculate_column_width.

Also, we suggest that you rename calculate_column_width to
calculateColumnWidth for consistency with javascript code style.

Thanks,
Shruti and Matt

On Mon, Jun 5, 2017 at 9:16 AM Surinder Kumar <
surinder.ku...@enterprisedb.com> wrote:

> Staged changes are missed in previous patch, so please ignore.
> Please find attached updated patch.
>
> On Mon, Jun 5, 2017 at 4:29 PM, Surinder Kumar <
> surinder.ku...@enterprisedb.com> wrote:
>
>> Hi
>>
>> This patch contains two fixes:
>>
>> 1) In Query/tool or Edit grid, the width of table column header is fixed
>> depending on the column type(int, boolean, char etc.) due to which the
>> column name or type appears cut from right and doesn't looks good from user
>> point of view. The main concern was to display as much as the content of
>> column should be displayed.
>>
>> Now the width of column is decided using the text length of column name
>> or column type so that the column takes exact width it required and it
>> don't appears cut.
>>
>> 2) Remember column size after re-running a query.
>>
>> The approach is to extract table name from the query executed and use it
>> to store its columns width.
>> Whenever the column(s) width of a table is adjusted, the corresponding
>> values are updated into the object and used every time the same query is
>> executed.
>>
>> If a query is executed for e.g:
>>
>> SELECT generate_series(1, 1000) as id, generate_series(1, 1000) as name,
>> generate_series(1, 1000) as age
>>
>> ​it ​
>> displays 3 columns
>> ​but don't have any table name. In that case,
>>  i use a hash generator function which returns unique hash for a query
>> written in query editor and adjusted column(s) width are stored against
>> that hash in object.
>>
>> Is there any way to get temporary table name(avoiding unique hash) for
>> such queries ?​
>>
>> Also, Moved utilities functions into pgadmin/static/utils.js
>>
>> Please find attached patch and review.
>>
>> Thanks,
>> Surinder Kumar
>>
>
>
> --
> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>


[pgadmin-hackers] Process for Creating Translations

2017-06-01 Thread Shruti B Iyer
Hi Hackers,

In the patches we sent recently, we added text to the User Interface. We
know that calling getText translates it but currently we don't have
translations for any of the new text.

Is there a process for getting these text translated to other languages?

Thanks,
Shruti & Joao


Re: [pgadmin-hackers] [pgAdmin4][PATCH] Improvements to Query Results Grid User Experience

2017-05-23 Thread Shruti B Iyer
Hi Dave,

git am is also helpful to apply a patch that was created using git
format-patch, which is how we created these four patches. git am will apply
the diff in the patch and also make a commit using the commit message
stored in the patch. Could you try it again using git am? If it still
doesn't work for you, we can try creating the diff files.

Thanks,
Shruti & Matt

On Tue, May 23, 2017 at 5:28 PM, Dave Page <dp...@pgadmin.org> wrote:

> Hi
>
> git am is for applying patches from mailbox files:
>
> Splits mail messages in a mailbox into commit log message, authorship
> information and patches, and applies them to the current branch.
>
> That doesn't seem like it'll help me as a gmail user. Can you fix the
> patches to apply with git apply please?
>
> On Tuesday, May 23, 2017, Shruti B Iyer <si...@pivotal.io> wrote:
>
>> Hi Dave,
>>
>> We see the same errors when doing *git apply* for each patch. However,
>> if you do *git am* for each patch, it should proceed.
>>
>> Thanks,
>> Shruti & Matt
>>
>> On Tue, May 23, 2017 at 4:55 PM, Dave Page <dp...@pgadmin.org> wrote:
>>
>>> Hi!
>>>
>>> Looks great! I found a few issues which I think should be addressed
>>> before we continue too far. Note that I haven't reviewed the code at
>>> this stage:
>>>
>>> - When dragging a selection, the bounding box doesn't line up with the
>>> bottom of the grid rows. Note that I couldn't screen shot this
>>> unfortunately. It's not broken as such - just looks wrong.
>>>
>>> - If I copy one or more rows, I'm unable to paste them in as new rows
>>> when editing table data.
>>>
>>> - The 0004 patch doesn't apply:
>>>
>>> (pgadmin4)snake:web dpage$ git apply
>>> ~/Downloads/0004-Introduces-XCellSelectionModel.patch
>>> /Users/dpage/Downloads/0004-Introduces-XCellSelectionModel.patch:640:
>>> trailing whitespace.
>>> function scrollColumnIntoView(columnIndex) {
>>> /Users/dpage/Downloads/0004-Introduces-XCellSelectionModel.patch:641:
>>> trailing whitespace.
>>>   var colspan = getColspan(row, columnIndex);
>>> /Users/dpage/Downloads/0004-Introduces-XCellSelectionModel.patch:642:
>>> trailing whitespace.
>>>
>>> /Users/dpage/Downloads/0004-Introduces-XCellSelectionModel.patch:643:
>>> trailing whitespace.
>>>   var left = columnPosLeft[columnIndex],
>>> /Users/dpage/Downloads/0004-Introduces-XCellSelectionModel.patch:644:
>>> trailing whitespace.
>>> right = columnPosRight[columnIndex + (colspan > 1 ? colspan - 1
>>> : 0)],
>>> error: patch failed: web/pgadmin/static/vendor/slic
>>> kgrid/slick.grid.js:2794
>>> error: web/pgadmin/static/vendor/slickgrid/slick.grid.js: patch does
>>> not apply
>>>
>>> Thanks, Dave.
>>>
>>>
>>> On Tue, May 23, 2017 at 12:11 PM, Matthew Kleiman <mklei...@pivotal.io>
>>> wrote:
>>> > Hi Hackers!
>>> >
>>> > Attached are the updates to the query results grid, broken up into four
>>> > patches.
>>> >
>>> >
>>> > Description of the Completed Functionality After Applying All Four
>>> Patches
>>> > Currently the designed behavior is somewhere between excel like
>>> behavior and
>>> > not. As such we can describe the behavior as follows:
>>> >
>>> > Select columns by clicking on the header
>>> > Select rows by clicking on the row header (column 0)
>>> > You can drag and select with the mouse
>>> > You can select all with ctrl+a or by clicking the upper left cell
>>> > You can copy with ctrl+c or with the copy icon
>>> > you can increase or decrease the size of the selected area with
>>> shift+arrow
>>> > shift+arrow understands directionality, e.g. drag select from left to
>>> right
>>> > differs from drag select from right to left
>>> > Clicking anywhere outside of the selected area deselects the area and
>>> > reselects the new cell(s) clicked on
>>> >
>>> > Current potentially awkward but intentional functionality
>>> >
>>> > When you select multiple columns/rows by clicking on the header, then
>>> press
>>> > shift+arrow all but the last selected columns/rows are deselected
>>> >
>>> > Includes fixes for:
>>> > RM Bug #2348 - On resize of first/any column in "Query Tool/View Data"
>

Re: [pgadmin-hackers] [pgAdmin4][PATCH] Improvements to Query Results Grid User Experience

2017-05-23 Thread Shruti B Iyer
Hi Dave,

We see the same errors when doing *git apply* for each patch. However, if
you do *git am* for each patch, it should proceed.

Thanks,
Shruti & Matt

On Tue, May 23, 2017 at 4:55 PM, Dave Page  wrote:

> Hi!
>
> Looks great! I found a few issues which I think should be addressed
> before we continue too far. Note that I haven't reviewed the code at
> this stage:
>
> - When dragging a selection, the bounding box doesn't line up with the
> bottom of the grid rows. Note that I couldn't screen shot this
> unfortunately. It's not broken as such - just looks wrong.
>
> - If I copy one or more rows, I'm unable to paste them in as new rows
> when editing table data.
>
> - The 0004 patch doesn't apply:
>
> (pgadmin4)snake:web dpage$ git apply
> ~/Downloads/0004-Introduces-XCellSelectionModel.patch
> /Users/dpage/Downloads/0004-Introduces-XCellSelectionModel.patch:640:
> trailing whitespace.
> function scrollColumnIntoView(columnIndex) {
> /Users/dpage/Downloads/0004-Introduces-XCellSelectionModel.patch:641:
> trailing whitespace.
>   var colspan = getColspan(row, columnIndex);
> /Users/dpage/Downloads/0004-Introduces-XCellSelectionModel.patch:642:
> trailing whitespace.
>
> /Users/dpage/Downloads/0004-Introduces-XCellSelectionModel.patch:643:
> trailing whitespace.
>   var left = columnPosLeft[columnIndex],
> /Users/dpage/Downloads/0004-Introduces-XCellSelectionModel.patch:644:
> trailing whitespace.
> right = columnPosRight[columnIndex + (colspan > 1 ? colspan - 1 :
> 0)],
> error: patch failed: web/pgadmin/static/vendor/
> slickgrid/slick.grid.js:2794
> error: web/pgadmin/static/vendor/slickgrid/slick.grid.js: patch does not
> apply
>
> Thanks, Dave.
>
>
> On Tue, May 23, 2017 at 12:11 PM, Matthew Kleiman 
> wrote:
> > Hi Hackers!
> >
> > Attached are the updates to the query results grid, broken up into four
> > patches.
> >
> >
> > Description of the Completed Functionality After Applying All Four
> Patches
> > Currently the designed behavior is somewhere between excel like behavior
> and
> > not. As such we can describe the behavior as follows:
> >
> > Select columns by clicking on the header
> > Select rows by clicking on the row header (column 0)
> > You can drag and select with the mouse
> > You can select all with ctrl+a or by clicking the upper left cell
> > You can copy with ctrl+c or with the copy icon
> > you can increase or decrease the size of the selected area with
> shift+arrow
> > shift+arrow understands directionality, e.g. drag select from left to
> right
> > differs from drag select from right to left
> > Clicking anywhere outside of the selected area deselects the area and
> > reselects the new cell(s) clicked on
> >
> > Current potentially awkward but intentional functionality
> >
> > When you select multiple columns/rows by clicking on the header, then
> press
> > shift+arrow all but the last selected columns/rows are deselected
> >
> > Includes fixes for:
> > RM Bug #2348 - On resize of first/any column in "Query Tool/View Data"
> will
> > select/deselect all the rows/columns.
> > RM Bug #2344 - ctrl+v and ctrl+c need to work
> >
> >
> > Detailed Description of Each Patch
> >
> > 0001-Improves-user-s-ability-to-select-cells-in-query-res.patch -
> >
> >   - user can select columns
> >
> >   - user can modify column or row selection with shift+arrow
> >
> >   - user can select entire grid with ctrl+A or cmd+A
> >
> >   - user can copy from grid using keyboard shortcuts
> >
> > 0002-Drag-and-select-from-data-grid.patch -
> >
> > 0003-Removes-checkboxes-from-the-grid.patch -
> >
> > -  Changes header color to grey
> >
> > 0004-Introduces-XCellSelectionModel.patch -
> >
> > - header styles depend on the selection
> >
> > - show the correct row/column when scrolling up or left
> >
> > - fixes drag and drop when drop is done outside the grid
> >
> >
> > Thanks,
> >
> > Matt & Shruti
> >
> >
> >
> >
> >
> > --
> > Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgadmin-hackers
> >
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>