Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kDi36-0005DT-EJ for pgadmin-hackers@arkaria.postgresql.org; Thu, 03 Sep 2020 05:44:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kDi35-0001mG-41 for pgadmin-hackers@arkaria.postgresql.org; Thu, 03 Sep 2020 05:44:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kDi34-0001m9-Ij for pgadmin-hackers@lists.postgresql.org; Thu, 03 Sep 2020 05:44:38 +0000 Received: from sonic316-13.consmr.mail.bf2.yahoo.com ([74.6.130.123]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kDi2z-0002ws-Ag for pgadmin-hackers@lists.postgresql.org; Thu, 03 Sep 2020 05:44:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com.au; s=s2048; t=1599111870; bh=3C9MYBaCE1wqiAZNbRMjkmRcMBLjj0Temi0rUSEO1DI=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From:Subject; b=B8GB8RwRKe9OJnkjhuXeGvrNPlNXfDnrxra7sFobWFI0dzzNNLw5vy8qdqU01VcyIIonKxvWigqMP3sF6Wv8719sqOI6K/qKio6hP/NpJQ30OVBLAu1HzJ9067e4q97S0K9L+xV5IoE3bhEjbyWnoT11zdlRBt9GfRLFX42kts6auC1MgI61RY7M9ZNlq1ZMnZWB4t4nNPyWE6V/fltM5rUIqIuwLjtzXfJ3dJXKH5vIY9TaDTPxf+VbmjGHUC1s+xdDO42pqRwijZGfHLBXV4iX0iqOqGHyDAf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C2E00_mxY.zL0.yLBu27aj6hdGi2xWDB1yFtbRUAxw4jZZt Eu1QS9.n5V4mpfScKhDMydiy0SlIlMj6dj606qY2pcfPCGfP0_CfJ8S0o.HhrrvQ5HseJbEGD44q KWiKTmCRgQEz6g7qKMTYw3dZ9xvEdxafF5wLZnAEtDR0BQHowY4tn2qEsH5ZghGkLctUERoFTEki VT9RnK6lTLXHlAaoyRlHmGr0PB.hxDl5irfLfKlTISJAm4NbNBc.7tqUmdTFIzHy2UoEuPbFayD. mXReR6pvSdZbz7TnnjLX5kWAB3nFDfJoSAI5p7BIMPIxgxytu9pM8pfjKwiiPpmu9NGzqFH.GYHX EmzTxsmwRDjQSyYQyDIjb5zgyGMaT3JyXPssgcq0ZKhFMPxYW4cFocuybdld82Tdyah9cQIY0b6u FSDFSAhM57401_aJCeAIjhGoZJkxq_XIwLox78sfREsEUkCXQZrgjreZgWH4FUlUOcQG9baDaFuY GTVs6wQ-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic316.consmr.mail.bf2.yahoo.com with HTTP; Thu, 3 Sep 2020 05:44:30 +0000 Date: Thu, 3 Sep 2020 05:44:25 +0000 (UTC) From: Warren Chan To: Aditya Toshniwal Cc: "pgadmin-hackers@lists.postgresql.org" Message-ID: <1472932300.1849038.1599111865981@mail.yahoo.com> In-Reply-To: References: <1872014587.1397537.1599020446172.ref@mail.yahoo.com> <1872014587.1397537.1599020446172@mail.yahoo.com> <1679514114.1817148.1599101971834@mail.yahoo.com> Subject: Re: pgAdmin4 - help adding new node to Browser Tree MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1849037_1079560557.1599111865977" X-Mailer: WebService/1.1.16565 YMailNorrin Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0 Content-Length: 31547 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_1849037_1079560557.1599111865977 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Aditya, thats it, I wasn't running yarn bundle after my modifications to the templa= tes. Thanks for tip to run webpack in continuous mode, that's great. Really appreciate the help in getting past this.=20 Best Regards,Warren Chan On Thursday, 3 September 2020, 2:43:56 pm AEST, Aditya Toshniwal wrote: =20 =20 Hi Warren, The patch works fine, just that replacing sequences with foos=C2=A0was miss= ing at 1-2 places. I guess you've not=C2=A0restarted the dev server after t= he changes. :)- Always restart the backend dev server if there is any chang= e in Python or any template files.- You can run webpack in continuous watch= mode with yarn run bundle:dev --watch. Always empty cache reload if there = is any change in JS files. You can enable chrome dev tools and right click = on the refresh button to get the option. Here's what I've changed in your patch: diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fo= os/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schema= s/foos/__init__.py index 3bc310d6f..52de71f0b 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foos/__in= it__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foos/__in= it__.py @@ -141,7 +141,7 @@ class FooView(PGChildNodeView, SchemaDiffObjectCompare)= : =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= if self.manager.db_info is not None and \ =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= kwargs['did'] in self.manager.db_info else 0 =C2=A0 -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.template_path= =3D 'sequences/sql/#{0}#'.format( +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.template_path= =3D 'foos/sql/#{0}#'.format( =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= self.manager.version =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ) =C2=A0=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.acl =3D = ['r', 'w', 'U'] diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fo= os/templates/foos/sql/default/stats.sql b/web/pgadmin/browser/server_groups= /servers/databases/schemas/foos/templates/foos/sql/default/stats.sql index cd9b0154a..91a2f9259 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foos/temp= lates/foos/sql/default/stats.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foos/temp= lates/foos/sql/default/stats.sql @@ -4,4 +4,4 @@ SELECT =C2=A0FROM =C2=A0=C2=A0 =C2=A0 pg_statio_all_sequences =C2=A0WHERE -=C2=A0 =C2=A0 relid =3D {{ seid }}::OID \ No newline at end of file +=C2=A0 =C2=A0 relid =3D {{ fooid }}::OID On Thu, Sep 3, 2020 at 8:29 AM Warren Chan wrote: Hi Aditya, thanks for helping, really appreciate you taking the time. I've attached a patch as requested and yes, when i expand the new Foo node = I've created, I get the following errors in the console: 2020-09-03 12:50:37,291: ERROR=C2=A0 flask.app:=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 404 Not Found: The requested URL was not found on the server. If you en= tered the URL manually please check your spelling and try again. Traceback (most recent call last): =C2=A0 File "C:\git\pgadmin4\pgadmin4\lib\site-packages\flask\app.py", line= 1813, in full_dispatch_request =C2=A0=C2=A0=C2=A0 rv =3D self.dispatch_request() =C2=A0 File "C:\git\pgadmin4\pgadmin4\lib\site-packages\flask\app.py", line= 1791, in dispatch_request =C2=A0=C2=A0=C2=A0 self.raise_routing_exception(req) =C2=A0 File "C:\git\pgadmin4\pgadmin4\lib\site-packages\flask\app.py", line= 1774, in raise_routing_exception =C2=A0=C2=A0=C2=A0 raise request.routing_exception =C2=A0 File "C:\git\pgadmin4\pgadmin4\lib\site-packages\flask\ctx.py", line= 336, in match_request =C2=A0=C2=A0=C2=A0 self.url_adapter.match(return_rule=3DTrue) =C2=A0 File "C:\git\pgadmin4\pgadmin4\lib\site-packages\werkzeug\routing.py= ", line 1945, in match =C2=A0=C2=A0=C2=A0 raise NotFound() werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not foun= d on the server. If you entered the URL manually please check your spelling= and try again. 2020-09-03 12:50:37,372: ERROR=C2=A0 flask.app:=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 404 Not Found: The requested URL was not found on the server. If you en= tered the URL manually please check your spelling and try again. Traceback (most recent call last): =C2=A0 File "C:\git\pgadmin4\pgadmin4\lib\site-packages\flask\app.py", line= 1813, in full_dispatch_request =C2=A0=C2=A0=C2=A0 rv =3D self.dispatch_request() =C2=A0 File "C:\git\pgadmin4\pgadmin4\lib\site-packages\flask\app.py", line= 1791, in dispatch_request =C2=A0=C2=A0=C2=A0 self.raise_routing_exception(req) =C2=A0 File "C:\git\pgadmin4\pgadmin4\lib\site-packages\flask\app.py", line= 1774, in raise_routing_exception =C2=A0=C2=A0=C2=A0 raise request.routing_exception =C2=A0 File "C:\git\pgadmin4\pgadmin4\lib\site-packages\flask\ctx.py", line= 336, in match_request =C2=A0=C2=A0=C2=A0 self.url_adapter.match(return_rule=3DTrue) =C2=A0 File "C:\git\pgadmin4\pgadmin4\lib\site-packages\werkzeug\routing.py= ", line 1945, in match =C2=A0=C2=A0=C2=A0 raise NotFound() werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not foun= d on the server. If you entered the URL manually please check your spelling= and try again. Please let me know if you need anything else. Best Regards,Warren Chan On Wednesday, 2 September 2020, 6:19:59 pm AEST, Aditya Toshniwal wrote: =20 =20 Hi Warren, Can you check the browser console if any errors ? Can you also share the pa= tch so that I can help you further by debugging at my end ? On Wed, Sep 2, 2020 at 9:51 AM Warren Chan wrote: Hi,=20 I'm trying to learn about the pgAdmin4 project and am hoping to make some c= ontributions sometime in the future. I'm new to Flask and python but am keen to learn. While trying to familiarize myself with the application and the way it work= s, I've tried to create a 'test' node under the schema node, I want to list= test items under this node - not listing anything particular at the moment= but wanted to get an understanding of how the application ties together). = In order to just get a new node added under schema, I've copied the sequenc= e folder under \web\pgadmin\browser\server_groups\servers\databases\schemas= and renamed the applicable folders to tests (I want a test node to appear = under schema). I've updated the \tests\_init_.py file so that the SequenceModule has been = changed to TestModule (updated the NODE_TYPE etc). I've also updated the Se= quenceView to become TestView and other parts of the view like the template= path etc.=20 In addition to this I've changed the name in the \tests\static\js\sequence.= js file to \tests\static\js\test.js and have also updated the test.js file = so that any references to sequence has been changed to test and have added = 'pgadmin.node.tests' to the webpack.config.js and 'pgadmin.node.test': path= .join(__dirname, './pgadmin/browser/server_groups/servers/databases/schemas= /tests/static/js/test') to the webpack.shim.js file Doing this I was hoping that a new 'Test' node would appear under the schem= a directory and opening this node, would render all the sequences (as I hav= en't changed any of the sql). However I only get the new 'Test' node being = rendered, and when I open this, I get a Server Node with the server I'm con= nected to being added, not the list of sequences I was hoping for.=20 Is there an additional setting / steps I need to add somewhere in order to = get the TestView to render under the TestModule node? I'd appreciate any pointers to get this working as the next thing I'd like,= would be to start modifying the sql and getting different database objects= being listed. Best regards,Warren Chan --=20 Thanks,Aditya Toshniwal pgAdmin hacker=C2=A0| Sr. Software Engineer | edbpostgres.com"Don't Complai= n about Heat, Plant a TREE" =20 --=20 Thanks,Aditya Toshniwal pgAdmin hacker=C2=A0| Sr. Software Engineer | edbpostgres.com"Don't Complai= n about Heat, Plant a TREE" =20 ------=_Part_1849037_1079560557.1599111865977 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Aditya,

thats it, I wasn't running yarn bundle after my modifications to the templ= ates. Thanks for tip to run webpack in continuous mode, that's great.

Really appreciate the help in getting past this.

Best Regards,
War= ren Chan

=20
=20
On Thursday, 3 September 2020, 2:43:56 pm AEST, Aditya = Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:


Hi Warren,

The patch = works fine, just that replacing sequences with foos was missing at 1-2= places. I guess you've not restarted the dev server after the changes= . :)
- Always restart the backend dev server if there is any= change in Python or any template files.
- You can run webpa= ck in continuous watch mode with yarn run bundle:dev --watch. Always empty = cache reload if there is any change in JS files. You can enable chrome dev = tools and right click on the refresh button to get the option.

Here's what I've changed in your patc= h:

diff --git a/web/pgadmin/browse= r/server_groups/servers/databases/schemas/foos/__init__.py b/web/pgadmin/br= owser/server_groups/servers/databases/schemas/foos/__init__.py

index 3bc310d6f..52de71f0b 100644

--- a/web/pgadmin/browser/server_groups/se= rvers/databases/schemas/foos/__init__.py

+++ b/web/pgadmin/browser/server_groups/se= rvers/databases/schemas/foos/__init__.py

@@ -141,7 +141,7 @@ class FooView(PGChildN= odeView, SchemaDiffObjectCompare):

                 &= nbsp;   if self.manager.db_info is not None and \

                 &= nbsp;   kwargs['did'] in self.manager.db_info else 0

 

-                self.template_path =3D 'sequences/sql/#{0}#'.format(

+                self.template_path =3D 'foos/sql/#{0}#'.format(

                 &= nbsp;   self.manager.version

                 <= /span>)

                 <= /span>self.acl =3D ['r', 'w', 'U']

diff --git a/web/pgadmin/browser/server_gr= oups/servers/databases/schemas/foos/templates/foos/sql/default/stats.sql b/= web/pgadmin/browser/server_groups/servers/databases/schemas/foos/templates/= foos/sql/default/stats.sql

index cd9b0154a..91a2f9259 100644

--- a/web/pgadmin/browser/server_groups/se= rvers/databases/schemas/foos/templates/foos/sql/default/stats.sql

+++ b/web/pgadmin/browser/server_groups/se= rvers/databases/schemas/foos/templates/foos/sql/default/stats.sql

@@ -4,4 +4,4 @@ SELECT

 FROM

     pg_statio_all_sequences

 WHERE

-    relid =3D {{ seid }}::OID

\ No newline at end of file

+    relid =3D {{ fooid }}::OID=



On Thu, Sep 3, 2020 at 8:29 AM Warren Chan <wchan_syd@yahoo.com.au>= wrote:
Hi Aditya,

thanks for helping, really appreciate you taking t= he time.

I'= ve attached a patch as requested and yes, when i expand the new Foo node I'= ve created, I get the following errors in the console:

2020-09-03 12:50:37,291: = ERROR  flask.app:      404 Not Found: The req= uested URL was not found on the server. If you entered the URL manually ple= ase check your spelling and try again.
Traceback (most re= cent call last):
  File "C:\git\pgadmin4\pgadmin4\li= b\site-packages\flask\app.py", line 1813, in full_dispatch_request
    rv =3D self.dispatch_request()
  File "C:\git\pgadmin4\pgadmin4\lib\site-packages\flask\app.py", l= ine 1791, in dispatch_request
    self.rai= se_routing_exception(req)
  File "C:\git\pgadmin4\pg= admin4\lib\site-packages\flask\app.py", line 1774, in raise_routing_excepti= on
    raise request.routing_exception
  File "C:\git\pgadmin4\pgadmin4\lib\site-packages\flas= k\ctx.py", line 336, in match_request
    = self.url_adapter.match(return_rule=3DTrue)
  File "C= :\git\pgadmin4\pgadmin4\lib\site-packages\werkzeug\routing.py", line 1945, = in match
    raise NotFound()
werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was no= t found on the server. If you entered the URL manually please check your sp= elling and try again.
2020-09-03 12:50:37,372: ERROR = ; flask.app:      404 Not Found: The requested URL= was not found on the server. If you entered the URL manually please check = your spelling and try again.
Traceback (most recent call = last):
  File "C:\git\pgadmin4\pgadmin4\lib\site-pac= kages\flask\app.py", line 1813, in full_dispatch_request
=     rv =3D self.dispatch_request()
  = File "C:\git\pgadmin4\pgadmin4\lib\site-packages\flask\app.py", line 1791, = in dispatch_request
    self.raise_routing= _exception(req)
  File "C:\git\pgadmin4\pgadmin4\lib= \site-packages\flask\app.py", line 1774, in raise_routing_exception
    raise request.routing_exception
  File "C:\git\pgadmin4\pgadmin4\lib\site-packages\flask\ctx.py",= line 336, in match_request
    self.url_a= dapter.match(return_rule=3DTrue)
  File "C:\git\pgad= min4\pgadmin4\lib\site-packages\werkzeug\routing.py", line 1945, in match    raise NotFound()
werk= zeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on= the server. If you entered the URL manually please check your spelling and= try again.

Please let = me know if you need anything else.

Best Regards,
Warren Chan
=20
On Wednesday, 2 September 2020, 6:19:59 pm AEST, Aditya= Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:


Hi Warren,
Can y= ou check the browser console if any errors ? Can you also share the patch s= o that I can help you further by debugging at my end ?

On Wed, Sep 2, 2020 at 9:51 AM Warren Chan = <wchan_syd@ya= hoo.com.au> wrote:
Hi,

I'm trying to learn about the pgAdmin4 project and am hoping to ma= ke some contributions sometime in the future.

I'm new to Flask and python but am keen = to learn.

W= hile trying to familiarize myself with the application and the way it works= , I've tried to create a 'test' node under the schema node, I want to list = test items under this node - not listing anything particular at the moment = but wanted to get an understanding of how the application ties together). I= n order to just get a new node added under schema, I've copied the se= quence folder under=20 \web\pgadmin\browser\server_groups\servers\databases\schemas and=20 renamed the applicable folders to tests (I want a test node to appear under= schema).

I've updated the \tests\_init_.py file so that the= SequenceModule has been changed to TestModule (updated the NODE_TYPE etc).= I've also updated the SequenceView to become TestView and other parts of t= he view like the template path etc.

In a= ddition to this I've changed the name in the \tests\static\js\sequence.js f= ile to \tests\static\js\test.js and have also updated the test.= js file so that any references to sequence has been changed to test and hav= e added 'pgadmin.node.tests' to the webpack.config.js and 'pgadmin.no= de.test': path.join(__dirname, './pgadmin/browser/server_groups/servers/dat= abases/schemas/tests/static/js/test') to the webpack.shim.js file

Doing this I was hoping that a new 'Test' node would appear under= the schema directory and opening this node, would render all the sequences= (as I haven't changed any of the sql). However I only get the new 'Test' n= ode being rendered, and when I open this, I get a Server Node with the serv= er I'm connected to being added, not the list of sequences I was hoping for= .

<= div dir=3D"ltr">Is there an additional setting / st= eps I need to add somewhere in order to get the TestView to render under th= e TestModule node?

I'd appreciate any = pointers to get this working as the next thing I'd like, would be to start = modifying the sql and getting different database objects being listed.

Best regards,
Warren Chan

=
<= /div>

--
=
Thanks,
= Aditya Toshniwal
pgAdmin hacker | Sr. Software Engineer | edbpostgres.com<= /b>
"Don't Complain about Heat, Plant a TREE"


--
Thanks,
Aditya Toshniwal
pgAdmin hacker | Sr. Software Engineer | = edbpostgres= .com
"Don't Complain about Heat, Plant a TREE"
------=_Part_1849037_1079560557.1599111865977--