Re: [Patch] PGAdmin 4 JSON Handling

From: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
To: Ronan Dunklau <ronan(dot)dunklau(at)dalibo(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [Patch] PGAdmin 4 JSON Handling
Date: 2015-04-16 10:16:51
Message-ID: CAG7mmowqMKzsLSuOUsLYEejSTffYVj63JfDXh-NXP_0wK9Remw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi Ronan,

On Thu, Apr 16, 2015 at 2:49 PM, Ronan Dunklau <ronan(dot)dunklau(at)dalibo(dot)com>
wrote:

> Hello.
>
> I'm trying to dive into the PGAdmin 4 codebase, and one low hanging fruit
> that
> I saw was the handling of JSON data.
>
> The first patch is really trivial, and allows PgAdmin4 to run on system
> with
> case sensitive filesystems.
>
> JSON data should be returned to the client using an application/json MIME-
> TYPE. Flask already provides an easy way to generate JSON response, with
> its
> jsonify function.
>
> This patch does not change anything architecturally, it just ensure that
> the
> get_nodes method of each hook returns JSONizable objects, instead of
> building
> them manually.
>
> Moreover, there was a function already in place to return JSON document
> according to a certain layout (everything under "data", with metadata
> attached
> along the way), which was not used by the ACi tree. This patch also changes
> this format to ensure the json responses returned by the application are
> consistent.
>
Thanks for the patches.
These changes are already been done in my current development work, which
is still a WIP. (Hence - it has not been checked-in/shared.)

Thanks any way.

--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company
<http://www.enterprisedb.com>

*http://www.linkedin.com/in/asheshvashi*
<http://www.linkedin.com/in/asheshvashi>

>
>
> On a side note, I have a few questions about the architecture of the
> application.
>
> - the "hooks" function should really implement a common class, instead of
> relying on testing the presence of attributes to find a function.
> Essentially,
> hooks modules are classes in disguise right now. I think it may be cleaner
> to
> define our own Blueprint subclass to add those methods.
> - regarding the jsonification, I feel like the NODE_TYPE should be a part
> of
> the model itself, via a class attribute. A common method should be
> implemented
> for all nodes, such as to eliminate duplicated code like the one which can
> be
> found in the servers/hooks et server_groups/hooks get_nodes implementation
>
> What are your thought on this ?
>
> Sorry for the noise in the patch, but my vim configuration automatically
> removes extraneous white spaces. If you'd prefer a separate patch for
> that, I
> can try to generate one.
>
> As for the Javascript, did you consider using a rich application
> framework ?
> For such a massive application as PgAdmin, I feel like developing each
> component from a jquery plugin and some glue might not scale well with the
> size of the app, and could lead to unmaintainable code. By Rich
> Application
> Framework, I'm thinking about something like Dojo or ExtJS.
>
> --
> Ronan Dunklau
> http://dalibo.com - http://dalibo.org

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Ronan Dunklau 2015-04-16 10:19:55 Re: [Patch] PGAdmin 4 JSON Handling
Previous Message Ronan Dunklau 2015-04-16 09:19:14 [Patch] PGAdmin 4 JSON Handling