Re: [pgAdmin4][Patch]: Fixed RM #2315 : Sorting by size is broken

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Joao Pedro De Almeida Pereira <jdealmeidapereira(at)pivotal(dot)io>
Cc: Khushboo Vashi <khushboo(dot)vashi(at)enterprisedb(dot)com>, pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>, Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
Subject: Re: [pgAdmin4][Patch]: Fixed RM #2315 : Sorting by size is broken
Date: 2017-04-25 15:53:44
Message-ID: CA+OCxox-5cSiObuSMdtd+OFATDaMtgCFfuqThO_Ow3V8EhC5mQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

On Tue, Apr 25, 2017 at 4:04 PM, Joao Pedro De Almeida Pereira <
jdealmeidapereira(at)pivotal(dot)io> wrote:

> Hello Khushboo,
>
> We reviewed the this patch and have some suggestions:
>
> *Python:*
> ​
> The functionality for adding the "can_prettify" is repeated in multiple
> places. Maybe this could be extracted into a function.
>
> *Javascript:*
> ​
>
> - The class Backgrid.SizeFormatter doesn't seem to have any tests.
>
>
>
> - The function pg_size_pretty displays bytes and Kilobytes
> differently.
> - Is it possible to add PB as well?
>
> Good idea. I'd also like to see a unit test added please Khushboo.

>
> -
> - The function is a little bit hard to read, is it possible to
> refactor using private functions like:
>
> fromRaw: function (rawData, model) {
> var unitIdx = findDataUnitIndex(rawData);
> if (unitIdx == 0) {
> return rawData + ' ' + this.dataUnits[i];
> }
> return formatOutput(rawData, unitIdx);
> },
>
> ​
>
>
> - In statistics.js:326 we believe it would make the code more readable
> if we change the variable "c" to "rawColumn" and "col" to "column".
>
>
>
> *SQL Files:*
> ​
>
> - Is there a way to avoid conditionals here?
> - Maybe we can use the same javascript function to prettify all the
> sizes
>
>
>
> Visually we saw a difference between "Databases" statistics and a specific
> database statistics. In "Databases" statistics the "Size" is "7.4 MB" but
> when you are in the specific database the "Size" is "7420 kB".
> Is this the intended behavior?
>
>
>
> Thanks
> Joao & Sarah
>
> On Tue, Apr 25, 2017 at 7:58 AM, Dave Page <dpage(at)pgadmin(dot)org> wrote:
>
>> Ashesh, can you review/commit this please?
>>
>> Thanks.
>>
>> On Tue, Apr 25, 2017 at 10:18 AM, Khushboo Vashi <
>> khushboo(dot)vashi(at)enterprisedb(dot)com> wrote:
>>
>>> Hi,
>>>
>>> Fixed RM #2315 : Sorting by size is broken.
>>>
>>> Removed the pg_size_pretty function from query for the collection and
>>> introduced the client side function to convert size into human readable
>>> format. So, the sorting issue is fixed as the algorithm will get the actual
>>> value of size instead of formatted value.
>>>
>>>
>>> Thanks,
>>> Khushboo
>>>
>>>
>>>
>>>
>>> --
>>> 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
>>>
>>>
>>
>>
>> --
>> 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

In response to

Browse pgadmin-hackers by date

  From Date Subject
Next Message Shirley Wang 2017-04-25 20:33:05 Re: [Design update] Style guide for pgAdmin4
Previous Message Josh Berkus 2017-04-25 15:24:22 Re: Install of pgadmin4 from package fails ...