Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d1dfE-0005lU-2r for pgadmin-hackers@arkaria.postgresql.org; Fri, 21 Apr 2017 18:52:16 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d1dfC-0001BW-VT for pgadmin-hackers@arkaria.postgresql.org; Fri, 21 Apr 2017 18:52:15 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d1dfC-0001BK-98 for pgadmin-hackers@postgresql.org; Fri, 21 Apr 2017 18:52:14 +0000 Received: from mail-vk0-x231.google.com ([2607:f8b0:400c:c05::231]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1d1df4-0006bu-V8 for pgadmin-hackers@postgresql.org; Fri, 21 Apr 2017 18:52:12 +0000 Received: by mail-vk0-x231.google.com with SMTP id j127so15557181vkh.0 for ; Fri, 21 Apr 2017 11:52:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pivotal-io.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=Xzdb0fYyn/7xiIQX9TiUQfOflCIzBh8ODpqMjGK3sxk=; b=ocJSiMHWJ+s3VFzPDQZIi4hY1JRn2McUxi9cN5+PFYnDMO9Yt8o2nqH5M7YxSFqZzw SP5Vz9e/24NIAhL8MU/DAhPHWsoKBHHmaWAJQA14tNogWjDl+f5VNpvoEU+l3MYrmq/S mB+uCrWqQDdEuoiiM1m52y1oYqj2/XIFjQ0BT4tOGRaDRkPH3vnJlGyfIvDs+y83QgtJ n6e7hkxjw/LS+TPFcueU3o/BP78lQGdJ7CkBm2kshbu18eEerM14WVSBG6K1JN1NV1ML SASJzDv+82k77Sq3XRNHilfUhBFkC4tbhCcLt9SdEr3fS01MUoEjBGbCBXCAZ/y4wDrO B1zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=Xzdb0fYyn/7xiIQX9TiUQfOflCIzBh8ODpqMjGK3sxk=; b=XeoafTdGyZL70sSddv4zA5Xwwnrsgfx36/hfa5KlGRnNyYp0iSzdkbk/pi4Rgn76pz 8NucDX9PSlXZsFaNAzSRzG6M8xiZjVMzSaH2kWXwAJDk6dbjdfnRw4WEjp4F1QNg9Xse g/z0OfjsZOChN2odcGCEF6pU+NH73GgzRWOPka+fCJ573tipi54ViFBq96N3niAsHVKi rOULleQPrkNKeXqxroBMAKnheaabpVXAVtWnBBst/sJcHY6a77pZhS7/7QF2iMN+Y/DO vkn65Re/1BAhHLepn8mdWSsvL4BfHnHj5lW3zDx7y99adxtMoGE5AweqkXZ9s8jPBqS7 Reyg== X-Gm-Message-State: AN3rC/5RyfErkyZTpur7dwE0sDDlWOZByuqkfxWk3BmDsDSbTpqVHGmz AUQjipoGt17kpC2Os8zhHUzwwRKzFZaf X-Received: by 10.31.233.131 with SMTP id g125mr6492476vkh.34.1492800724454; Fri, 21 Apr 2017 11:52:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.10.199 with HTTP; Fri, 21 Apr 2017 11:52:03 -0700 (PDT) In-Reply-To: References: From: Joao Pedro De Almeida Pereira Date: Fri, 21 Apr 2017 14:52:03 -0400 Message-ID: Subject: Re: Pains and thoughts about refactoring the Tree Menu using React To: pgadmin-hackers Content-Type: multipart/mixed; boundary=94eb2c0940d2e75ef6054db1c0ae X-Pg-Spam-Score: -2.6 (--) 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 --94eb2c0940d2e75ef6054db1c0ae Content-Type: multipart/alternative; boundary=94eb2c0940d2e75ef0054db1c0ac --94eb2c0940d2e75ef0054db1c0ac Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Hackers, The attachment was missing in the previous email, so there you go. Note: We had to remove the extension of the file due to security reasons, just add a .js Thanks Joao & Oliver On Fri, Apr 21, 2017 at 2:47 PM, Joao Pedro De Almeida Pereira < jdealmeidapereira@pivotal.io> wrote: > 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 pl= aces > 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 fetc= h 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 > > --94eb2c0940d2e75ef0054db1c0ac Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Hackers,

The attachment was missing = in the previous email, so there you go.

Note:=C2= =A0
=C2=A0We had to remove the extension of the file due to secur= ity reasons, just add a .js

Thanks
Joao = & Oliver

On Fri, Apr 21, 2017 at 2:47 PM, Joao Pedro De Almeida Pereira <jdealmeidapereira@pivotal.io> wrote:

After a conversation with D= ave we believe that we need to provide more context on our pains and what w= e 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 wh= ere 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 ex= tract those from being templates so that we could test them. We started wit= h the generate_url function. The issue we ran into was that the generate_ur= l function is inherited by CollectionJS from NodeJS but then over writes so= me of the functionality that it inherits. In order to have one function tha= t our react component would delegate to, we have to consolidate these two c= lass methods. This turned out to be a non-trivial refactor due to the lack = of tests/documentation.


Ou= r proposal:


This diagram represents what we believe can be our first appr= oach to updating the tree. We can create a very basic tree that only does t= ree 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 o= f the current tree implementation, we need your help to extract these metho= ds from the places they are currently in. We believe that a good place to s= tart would be writing tests for and implementing the generation of URLs use= d 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.

<= p dir=3D"ltr" style=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt"><= span style=3D"font-size:9.5pt;font-family:arial;vertical-align:baseline;whi= te-space:pre-wrap">
<= /p>

Thanks

Rob, Oliver & Joao



--94eb2c0940d2e75ef0054db1c0ac-- --94eb2c0940d2e75ef6054db1c0ae Content-Type: application/octet-stream; name=node_url_generator_spec Content-Disposition: attachment; filename=node_url_generator_spec Content-Transfer-Encoding: base64 X-Attachment-Id: f_j1s6zlft0 ZGVzY3JpYmUoIm5vZGVfdXJsX2dlbmVyYXRvciIsIGZ1bmN0aW9uICgpIHsK ICBiZWZvcmVFYWNoKGZ1bmN0aW9uICgpIHsKICAgIGRvU29tZVNldHVwRm9y VGhlRm9sbG93aW5nRGVzY3JpYmVCbG9ja3MoKTsKICB9KTsKCiAgZGVzY3J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2Zvbyd9OyAvLyBNb2NrIG9iamVj dCBvZiBBY2lUcmVlIEl0ZW1EYXRhCiAgICAgIH0pOwoKICAgICAgaXQoInNo b3VsZCByZXR1cm4gdGhlIGNvcnJlY3QgVVJMIGZvciBzZXJ2ZXIiLCBmdW5j dGlvbiAoKSB7CiAgICAgICAgZXhwZWN0KGdlbmVyYXRlKHBnQnJvd3NlckZh a2UsIHNlcnZlck5vZGVGYWtlLCAyLCAnY2hpbGRyZW4nLCBjdXJyZW50Tm9k ZURhdGEsIHRydWUpKQogICAgICAgICAgLnRvRXF1YWwoJy9icm93c2VyL3Nl cnZlci9jaGlsZHJlbi8xLzInKTsKCiAgICAgIH0pOwogICAgfSk7CiAgfSk7 Cn0pOw== --94eb2c0940d2e75ef6054db1c0ae Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers --94eb2c0940d2e75ef6054db1c0ae--