Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dHwRS-0007U3-P0 for pgadmin-hackers@arkaria.postgresql.org; Mon, 05 Jun 2017 18:09:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dHwRR-0003f1-5X for pgadmin-hackers@arkaria.postgresql.org; Mon, 05 Jun 2017 18:09:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dHwRC-00039n-Ha for pgadmin-hackers@postgresql.org; Mon, 05 Jun 2017 18:09:10 +0000 Received: from mail-qt0-x22d.google.com ([2607:f8b0:400d:c0d::22d]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dHwR5-0004fD-W8 for pgadmin-hackers@postgresql.org; Mon, 05 Jun 2017 18:09:08 +0000 Received: by mail-qt0-x22d.google.com with SMTP id c10so42529286qtd.1 for ; Mon, 05 Jun 2017 11:09:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pivotal-io.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gKuY/5qkrfCNpuWZ+wf4LHUa/Bfg4e5PXhe8W14AhyM=; b=fa2MFSCJfek1UNCuucZ/QRnopIfanV19SaRFjImqzhaeOUzO+TOMpi15E6lAScDYQT ydz5NSRI5SiIqwI7ttJCyrgfJ+2y6BJLU1sM8pBIEvl9EFmpcsw9/6bmugFVOy5Cv4c7 ZUZMAIMi0hzpF1QTmSqIKYJ/GLy+NycB3OEoNw7VUCNqmFrGHNN+x7ZopjQpLvWw9yVi 1lluvPUV9pFg7OslilA2edgleAVC1T572esHzV/Z3EZXCsLv7iBOABXa6lbRrFhkGjMn 9aF836HOe51w5s5ZH3cAuBDcBOHC0xurlaU0GU3Zi72ym8L43a79LgeglzmBaXqmCt70 Lflw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gKuY/5qkrfCNpuWZ+wf4LHUa/Bfg4e5PXhe8W14AhyM=; b=eBlA7Qxy8ybdnp3UHE36d5kFZ3Y6LRwseoUSjkrTMU+PwEMPMoS9YKke98xY6PU6ZJ Usl0Q6tXhK/wBIbNC5e6hV/F3t6Q1Dd/OgVoUG24anI1TqM8pZpGQPdQcuZaUSEempJi 058vuT3BmQo0GCeP4bSxIoze1H2pBNt5CYZjxPK3PmOtXKBk9SKQaqE5exb8vgZNTDRP zkvU2JPTNuPC6DqwUG3nkxemewXCExvoeRuExzhyVnsznuR+9WT20Nsla5Fr/OPQyf37 ix09nx57fvVdWJYamK102g0eumaQ9/0uJUxBbBOu2dPGXFwxrnQPKSIHURWvLyFahS6y N6bA== X-Gm-Message-State: AKS2vOzMb5Lzf8+cyRZ35/Wcf4Blo9dZC5p7AyxCyEonCDwIUjTcEHKN RTQUh/hz5fbCqBErog8xOTr49cLQxhxr X-Received: by 10.55.131.198 with SMTP id f189mr25776115qkd.187.1496686140379; Mon, 05 Jun 2017 11:09:00 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Shruti B Iyer Date: Mon, 05 Jun 2017 18:08:49 +0000 Message-ID: Subject: Re: Re: [pgAdmin4][Patch][Feature #1971]: Remember column sizes between executions of the same query in the query tool To: Surinder Kumar , pgadmin-hackers Cc: Matthew Kleiman Content-Type: multipart/alternative; boundary="94eb2c073b5ebcef0a05513a6588" X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgadmin-hackers Precedence: bulk Sender: pgadmin-hackers-owner@postgresql.org --94eb2c073b5ebcef0a05513a6588 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 u= ser >> 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 >> >> =E2=80=8Bit =E2=80=8B >> displays 3 columns >> =E2=80=8Bbut 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 ?=E2=80=8B >> >> 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 > --94eb2c073b5ebcef0a05513a6588 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Surinder!

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

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 functio= ns, getHash and ca= lculate_column_width.=C2=A0

Also, we sugges= t that you rename calculate_column_width to calculateColumnWidth for consis= tency with javascript code style.

Thanks,
Shruti and Matt
On M= on, 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 h= eader 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 t= he content of column should be displayed.

Now the width of column is decided using the text length o= f column name or column type so that the column takes exact width it requir= ed and it don't appears cut.

2)=C2=A0Remember c= olumn size after re-running a query.

=
The approach is to extract table name fr= om the query executed and use it to store its columns width.
Whenever the column(s) width of a table is adjusted, th= e 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

=E2=80=8Bit =E2=80=8B
displays 3 columns
=E2=80=8Bbut don'= ;t have any table name. In that case,
=C2=A0i 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 ?=E2= =80=8B

Also, Moved utilities functions into pgadmin/static/utils.js=C2=A0

Pleas= e find attached patch and review.

Thanks,
S= urinder Kumar


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