Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d1db1-0005Dd-Op for pgadmin-hackers@arkaria.postgresql.org; Fri, 21 Apr 2017 18:47:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d1db1-0003Gs-8I for pgadmin-hackers@arkaria.postgresql.org; Fri, 21 Apr 2017 18:47:55 +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 1d1db0-0003Ge-MH for pgadmin-hackers@postgresql.org; Fri, 21 Apr 2017 18:47:54 +0000 Received: from mail-ua0-x22c.google.com ([2607:f8b0:400c:c08::22c]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1d1dax-0001fu-0w for pgadmin-hackers@postgresql.org; Fri, 21 Apr 2017 18:47:54 +0000 Received: by mail-ua0-x22c.google.com with SMTP id f10so85815149uaa.2 for ; Fri, 21 Apr 2017 11:47:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pivotal-io.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=mXcis4XQfdq4lqW+jYPWPiPPdcllcE3uoo53lfrthxY=; b=uUzB2lnUnPd6Jf6j3lwYPF3EJYOl4+1B9VSyd7HwzEKnn66HFLJrWc0oKDCkTZuXRa T9l9j2zF+8L5VLiJ1C99YrtG/w1Ytm7TkGJ5WfaLS/v/hSP9kJ4ACcX2BhbPxJdM2sYg Ydj+h3CI26CmA0I0gCHDsX9ytLw8MMimf7A6FmI0mZfCrU445Lz0xzvlMPt63HfQzFRx vXI45RqpvHhgm+2jfj8k6Jv1ABoyJL9lcikS3O/snqlZe8EcY4IDv/66LGuZ4pTcSVi/ NxQzhbf5o5Ns2byLfbX7pLq8+3O+CxVsrUMkAc8jV1eDd9U9iYh3oDeCdeYLrrH//Hyd Ec0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=mXcis4XQfdq4lqW+jYPWPiPPdcllcE3uoo53lfrthxY=; b=UY4upExCljfvIgii71XxB0nNu4xgMplRWfqYC9OsAwRu6Lpq0aA0ltWx7Pt1Ovr/Gl kL/+bUunR4XU1Tj+VA5WYjYz8/eozACQsb1HqF7t55HfY6NPNv6TX3fGtLC+FGg+t4HT S5tp743pdhAT7fhLbYhX8tnd6BBG6NF0m/gTwCiugjhtNOfilz9jx3A4a1RT1sbheXqM RDFYVqIiTJw9sfeqfTo7yDjoaFGKYwGZdT0UZMXGdlcR++xKWgUTdqg5s18zz9s9qdE4 syXLlGCCh3UHDv1NMHwnOZFll3mecavmhqy1wKcRvsoiTn9/IEXYQ1fRekAB9jtzyrTs poyA== X-Gm-Message-State: AN3rC/40gDSUUUfXlED2G5XW1h9ajr2Y0swD7VVqYV3BKp07U96M6X+Q GdHuuegW73NU/+sRHRyhyA8wdTh7btjgbrM= X-Received: by 10.159.54.205 with SMTP id p71mr6953640uap.67.1492800467162; Fri, 21 Apr 2017 11:47:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.10.199 with HTTP; Fri, 21 Apr 2017 11:47:46 -0700 (PDT) From: Joao Pedro De Almeida Pereira Date: Fri, 21 Apr 2017 14:47:46 -0400 Message-ID: Subject: Pains and thoughts about refactoring the Tree Menu using React To: pgadmin-hackers Content-Type: multipart/alternative; boundary=94eb2c03d92a90ea28054db1b1b7 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 --94eb2c03d92a90ea28054db1b1b7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Hackers, After a conversation with Dave we believe that we need to provide more context on our pains and what we propose as a first step for implementing the Tree Menu using React. The pain: Here is a quick description of what we think we understand and where we got stuck while doing our refactor. If you look at the above image, both the NodeJS and CollectionJS classes are templates. Our goal was to extract those from being templates so that we could test them. We started with the generate_url function. The issue we ran into was that the generate_url function is inherited by CollectionJS from NodeJS but then over writes some of the functionality that it inherits. In order to have one function that our react component would delegate to, we have to consolidate these two class methods. This turned out to be a non-trivial refactor due to the lack of tests/documentation. Our proposal: This diagram represents what we believe can be our first approach to updating the tree. We can create a very basic tree that only does tree stuff (Open Node, Close Nodes) and then delegates to other adapters to execute all the business logic functionality (Generate URLs to get the node, Right Click menu, =E2=80=A6) Asks: - Are there any more operation that currently are being triggered by the tree? If so we need to add them to the Adapter List. - Because we lack the context and knowledge of the current tree implementation, we need your help to extract these methods from the plac= es they are currently in. We believe that a good place to start would be writing tests for and implementing the generation of URLs used to fetch = the child nodes. Attached you can find an example of the JavaScript tests that we have been writing that can be applied to this extracted method. Thanks Rob, Oliver & Joao --94eb2c03d92a90ea28054db1b1b7 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Hi Hackers,


After a conversation with Dave we believe that we need to provide = more context on our pains and what we propose as a first step for implement= ing the Tree Menu using React.


The pain:

Here is a quick description o= f what we think we understand and where we got stuck while doing our refact= or.


If you look at the above image, both the No= deJS and CollectionJS classes are templates. Our goal was to extract those = from being templates so that we could test them. We started with the genera= te_url function. The issue we ran into was that the generate_url function i= s inherited by CollectionJS from NodeJS but then over writes some of the fu= nctionality that it inherits. In order to have one function that our react = component would delegate to, we have to consolidate these two class methods= . This turned out to be a non-trivial refactor due to the lack of tests/doc= umentation.


Our proposal:<= /span>

<= /p>

This diagram represents what we believe can be o= ur first approach to updating the tree. We can create a very basic tree tha= t only does tree stuff (Open Node, Close Nodes) and then delegates to other= adapters to execute all the business logic functionality (Generate URLs to= get the node, Right Click menu, =E2=80=A6)


Asks:

  • Are there any more operation that currently are be= ing triggered by the tree? If so we need to add them to the Adapter List.

  • Because we lack the context a= nd knowledge of the current tree implementation, we need your help to extra= ct these methods from the places they are currently in. We believe that a g= ood place to start would be writing tests for and implementing the generati= on of URLs used to fetch the child nodes.

Attached you can find an example of the JavaScript = tests that we have been writing that can be applied to this extracted metho= d.

=


Thanks

Rob, Oliver & Joao


--94eb2c03d92a90ea28054db1b1b7--