On Thu, Apr 16, 2015 at 3:49 PM, Ronan Dunklau <ronan.dunk...@dalibo.com> wrote:
> Le jeudi 16 avril 2015 15:46:51 Ashesh Vashi a écrit : > > Hi Ronan, > > > > On Thu, Apr 16, 2015 at 2:49 PM, Ronan Dunklau <ronan.dunk...@dalibo.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. > > Is there a public branch where I can see this WIP ? > Unfortunately, I don't have any. > As for the other proposals regarding the structure of the javascript code > and > the module / hooks API, do you have any comment ? > I would wait for Dave to answer that. -- 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> > > Thank you. > > > > > -- > > > > 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 > > -- > Ronan Dunklau > http://dalibo.com - http://dalibo.org >