Re: pgAdmin4 PATCH: Domain Module - Mailing list pgadmin-hackers

From Dave Page
Subject Re: pgAdmin4 PATCH: Domain Module
Date
Msg-id CA+OCxozpzStRAm=rm3s2ZdtehMt6WfQTVEFT3fssorNc5M2UHQ@mail.gmail.com
Whole thread Raw
In response to Re: pgAdmin4 PATCH: Domain Module  (Khushboo Vashi <khushboo.vashi@enterprisedb.com>)
Responses Re: pgAdmin4 PATCH: Domain Module
List pgadmin-hackers
Hi

On Wed, Feb 24, 2016 at 9:24 AM, Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi,

I have updated the Domain module as below:

- Used 'NodeByListControl' to get schemas, in domains.js file as suggested by Ashesh to avoid code redundancy.

- Applied 'Security Label Macro'  Patch (Implemented by Harshal) and removed same changes from the Domain Patch.
  To test Domain patch, 'Security Label Macro' patch must be applied first as that is not committed yet.

Please find attached Domain Module Patch.

Initial feedback:

- Owner and schema should be allowed to be left blank (and then default to the current user/schema)

- Length and Precision fields should only be enabled if appropriate for the data type.

- SQL generation for new Domains doesn't work:

- When adding constraints, I should be able to type directly into the grid. Expanding the row should be optional.

- The comment column on the constraints grid expands when the text reaches ~50% of the width. It should be a fixed size (and use 100% of the space available, less appropriate margins).

- Backend support checks should not special-case Slony schemas.

- 4 character indentation not used consistently in SQL templates.

- Error seen when saving a domain: "macros/schemas/security.macros"

016-02-25 11:55:10,728: INFO werkzeug: 127.0.0.1 - - [25/Feb/2016 11:55:10] "GET /browser/domain/msql/1/1/24587/2200/?name=email&owner=postgres&basensp=public&description=This+is+an+email+data+type&basetype=text&typlen=&precision=&typdefault=&typnotnull=true&collname=&constraints=%5B%5D&seclabels=%5B%5D&_=1456401124386 HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/flask/views.py", line 84, in view
    return self.dispatch_request(*args, **kwargs)
  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/utils.py", line 248, in dispatch_request
    return method(*args, **kwargs)
  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py", line 277, in wrap
    return f(*args, **kwargs)
  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py", line 232, in wrap
    return f(self, **kwargs)
  File "/Users/dpage/git/pgadmin4/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py", line 700, in msql
    status=200
  File "/Users/dpage/git/pgadmin4/web/pgadmin/utils/ajax.py", line 41, in make_json_response
    response=json.dumps(doc, cls=DataTypeJSONEncoder),
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/simplejson/__init__.py", line 386, in dumps
    **kw).encode(obj)
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/simplejson/encoder.py", line 269, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/simplejson/encoder.py", line 348, in iterencode
    return _iterencode(o, 0)
  File "/Users/dpage/git/pgadmin4/web/pgadmin/utils/ajax.py", line 26, in default
    return json.JSONEncoder.default(self, obj)
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/simplejson/encoder.py", line 246, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: TemplateNotFound() is not JSON serializable 


--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

pgadmin-hackers by date:

Previous
From: Dave Page
Date:
Subject: pgAdmin 4 commit: Improve warning message
Next
From: Dave Page
Date:
Subject: Re: pgAdmin4 PATCH: Domain Module