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

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
Attachment
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.kumar@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

Attachment
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.kumar@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.kumar@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
Hi All,

Please find updated patch which includes Jasmine test cases for functions getHash and calculateColumnWidth

Thanks,
Surinder

On Mon, Jun 5, 2017 at 11:38 PM, Shruti B Iyer <siyer@pivotal.io> wrote:
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.kumar@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.kumar@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

Attachment
Hi,

Could you rebase this please?

Thanks.

On Tue, Jun 6, 2017 at 9:22 AM, Surinder Kumar
<surinder.kumar@enterprisedb.com> wrote:
> Hi All,
>
> Please find updated patch which includes Jasmine test cases for functions
> getHash and calculateColumnWidth
>
> Thanks,
> Surinder
>
> On Mon, Jun 5, 2017 at 11:38 PM, Shruti B Iyer <siyer@pivotal.io> wrote:
>>
>> 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.kumar@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.kumar@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
>
>
>
>
> --
> 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


Hi

Please find rebased patch.

On Wed, Jun 7, 2017 at 6:15 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi,

Could you rebase this please?

Thanks.

On Tue, Jun 6, 2017 at 9:22 AM, Surinder Kumar
<surinder.kumar@enterprisedb.com> wrote:
> Hi All,
>
> Please find updated patch which includes Jasmine test cases for functions
> getHash and calculateColumnWidth
>
> Thanks,
> Surinder
>
> On Mon, Jun 5, 2017 at 11:38 PM, Shruti B Iyer <siyer@pivotal.io> wrote:
>>
>> 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.kumar@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.kumar@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
>
>
>
>
> --
> 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

Attachment
PFA patch after rebase

On Wed, Jun 7, 2017 at 6:26 PM, Surinder Kumar <surinder.kumar@enterprisedb.com> wrote:
Hi

Please find rebased patch.

On Wed, Jun 7, 2017 at 6:15 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi,

Could you rebase this please?

Thanks.

On Tue, Jun 6, 2017 at 9:22 AM, Surinder Kumar
<surinder.kumar@enterprisedb.com> wrote:
> Hi All,
>
> Please find updated patch which includes Jasmine test cases for functions
> getHash and calculateColumnWidth
>
> Thanks,
> Surinder
>
> On Mon, Jun 5, 2017 at 11:38 PM, Shruti B Iyer <siyer@pivotal.io> wrote:
>>
>> 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.kumar@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.kumar@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
>
>
>
>
> --
> 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


Attachment
Nice! Thanks, patch applied.

On Wed, Jun 7, 2017 at 4:03 PM, Surinder Kumar
<surinder.kumar@enterprisedb.com> wrote:
> PFA patch after rebase
>
> On Wed, Jun 7, 2017 at 6:26 PM, Surinder Kumar
> <surinder.kumar@enterprisedb.com> wrote:
>>
>> Hi
>>
>> Please find rebased patch.
>>
>> On Wed, Jun 7, 2017 at 6:15 PM, Dave Page <dpage@pgadmin.org> wrote:
>>>
>>> Hi,
>>>
>>> Could you rebase this please?
>>>
>>> Thanks.
>>>
>>> On Tue, Jun 6, 2017 at 9:22 AM, Surinder Kumar
>>> <surinder.kumar@enterprisedb.com> wrote:
>>> > Hi All,
>>> >
>>> > Please find updated patch which includes Jasmine test cases for
>>> > functions
>>> > getHash and calculateColumnWidth
>>> >
>>> > Thanks,
>>> > Surinder
>>> >
>>> > On Mon, Jun 5, 2017 at 11:38 PM, Shruti B Iyer <siyer@pivotal.io>
>>> > wrote:
>>> >>
>>> >> 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.kumar@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.kumar@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
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> > 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
>>
>>
>



--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Hi

As the patch "Improvements to Query Results"
​ is merged, the columns width in edit grid needs some adjustments as 'checkboxes' are removed from columns.

​PFA patch.​

On Thu, Jun 8, 2017 at 5:12 PM, Dave Page <dpage@pgadmin.org> wrote:
Nice! Thanks, patch applied.

On Wed, Jun 7, 2017 at 4:03 PM, Surinder Kumar
<surinder.kumar@enterprisedb.com> wrote:
> PFA patch after rebase
>
> On Wed, Jun 7, 2017 at 6:26 PM, Surinder Kumar
> <surinder.kumar@enterprisedb.com> wrote:
>>
>> Hi
>>
>> Please find rebased patch.
>>
>> On Wed, Jun 7, 2017 at 6:15 PM, Dave Page <dpage@pgadmin.org> wrote:
>>>
>>> Hi,
>>>
>>> Could you rebase this please?
>>>
>>> Thanks.
>>>
>>> On Tue, Jun 6, 2017 at 9:22 AM, Surinder Kumar
>>> <surinder.kumar@enterprisedb.com> wrote:
>>> > Hi All,
>>> >
>>> > Please find updated patch which includes Jasmine test cases for
>>> > functions
>>> > getHash and calculateColumnWidth
>>> >
>>> > Thanks,
>>> > Surinder
>>> >
>>> > On Mon, Jun 5, 2017 at 11:38 PM, Shruti B Iyer <siyer@pivotal.io>
>>> > wrote:
>>> >>
>>> >> 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.kumar@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.kumar@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
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> > 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
>>
>>
>



--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment
Thanks, applied.

On Fri, Jun 9, 2017 at 8:39 AM, Surinder Kumar
<surinder.kumar@enterprisedb.com> wrote:
> Hi
>
> As the patch "Improvements to Query Results"
> is merged, the columns width in edit grid needs some adjustments as
> 'checkboxes' are removed from columns.
>
> PFA patch.
>
> On Thu, Jun 8, 2017 at 5:12 PM, Dave Page <dpage@pgadmin.org> wrote:
>>
>> Nice! Thanks, patch applied.
>>
>> On Wed, Jun 7, 2017 at 4:03 PM, Surinder Kumar
>> <surinder.kumar@enterprisedb.com> wrote:
>> > PFA patch after rebase
>> >
>> > On Wed, Jun 7, 2017 at 6:26 PM, Surinder Kumar
>> > <surinder.kumar@enterprisedb.com> wrote:
>> >>
>> >> Hi
>> >>
>> >> Please find rebased patch.
>> >>
>> >> On Wed, Jun 7, 2017 at 6:15 PM, Dave Page <dpage@pgadmin.org> wrote:
>> >>>
>> >>> Hi,
>> >>>
>> >>> Could you rebase this please?
>> >>>
>> >>> Thanks.
>> >>>
>> >>> On Tue, Jun 6, 2017 at 9:22 AM, Surinder Kumar
>> >>> <surinder.kumar@enterprisedb.com> wrote:
>> >>> > Hi All,
>> >>> >
>> >>> > Please find updated patch which includes Jasmine test cases for
>> >>> > functions
>> >>> > getHash and calculateColumnWidth
>> >>> >
>> >>> > Thanks,
>> >>> > Surinder
>> >>> >
>> >>> > On Mon, Jun 5, 2017 at 11:38 PM, Shruti B Iyer <siyer@pivotal.io>
>> >>> > wrote:
>> >>> >>
>> >>> >> 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.kumar@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.kumar@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
>> >>> >
>> >>> >
>> >>> >
>> >>> >
>> >>> > --
>> >>> > 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
>> >>
>> >>
>> >
>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>
>



--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company