Database patch and other minor patches and control documentation

From: Harshal Dhumal <harshal(dot)dhumal(at)enterprisedb(dot)com>
To: pgadmin-hackers(at)postgresql(dot)org
Subject: Database patch and other minor patches and control documentation
Date: 2016-01-22 07:41:41
Message-ID: CAFiP3vwb-m6GyZwBPvoXPvcLS94NyrLfeQfA04UwAeBiuGeDng@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi,

Please find the attached patches:

Database node patch (depends on privilege_macro, node_ui_typo, variable_js
patches)

*How to use controls:*

*1] Privilege control:*

*a]* Data expected from server in following format:
eg:

* {grantee: public, privileges: Tc* , grantor: postgres} should be
converted to below object*
(data parsing logic can be found in databases/__init__.py and
browser/utils.py)

"<model_key>": [{"grantor": "postgres",
"privileges": [
{"with_grant": false,
"privilege_type": "T",
"privilege": true
},
{"with_grant": true,
"privilege_type": "c",
"privilege": true
}],
"grantee": "public"
}]

*b]* Privilege control field schema:
When using this control extend PrivilegeRoleModel with actual
privileges you want to show in your control.
See privilege.js for all supported privileges and their mapping.

{
id: 'datacl', label: '{{ _('Privileges') }}', model:
pgAdmin.Browser.Node.PrivilegeRoleModel.extend(
{privileges: ['C', 'T', 'c']}), uniqueCol : ['grantee', 'grantor'],
editable: false, type: 'collection', group: '{{ _('Security') }}',
mode: ['properties', 'edit', 'create'],
canAdd: true, canDelete: true, control: 'unique-col-collection',
}

*2] Variable control:*
* a]* Data expected from server:

"variables": [{"database": "db", "value": "ser", "name":
"application_name", "role": "postgres"}, {"database": "db"
, "value": "on", "name": "enable_seqscan", "role": "postgres"}]

*b] Variable control field schema:*
Note: database and role fields are optional are not included in variable
control unless specified in field schema.
Use below flag to enable them

* hasDatabase: true and hasRole:true (both can not be used at same time)*
(In below example you can see hasRole:true as I need role field in variable
control for database node)

{
id: 'variables', label: '{{ _('Variables') }}', type: 'collection',
model: pgAdmin.Browser.Node.VariableModel, editable: false,
group: '{{ _('Security') }}', mode: ['properties', 'edit', 'create'],
canAdd: true, canEdit: false, canDelete: true, hasRole: true,
control: Backform.VariableCollectionControl, node: 'role'
}

Let me know if you have any queries regarding how to use above contorls.

--
*Harshal Dhumal*
*Software Engineer *

EenterpriseDB <http://www.enterprisedb.com>

Attachment Content-Type Size
privilege_js_minor_UX_enhancement_21_Jan.patch text/x-patch 551 bytes
privilege_macros_21_Jan.patch text/x-patch 1.7 KB
variable_js_21_Jan.patch text/x-patch 1.8 KB
node_ui_typo_21_Jan.patch text/x-patch 767 bytes
database_21_Jan.patch text/x-patch 88.3 KB

Browse pgadmin-hackers by date

  From Date Subject
Next Message Ashesh Vashi 2016-01-22 07:53:36 pgAdmin 4 commit: Resovled a typo in rendering the NodeAjaxOptionsCell
Previous Message Surinder Kumar 2016-01-22 06:55:06 Re: [pgAdmin4] [Patch]: Extension Module