Re: [pgadmin4] Hide tabs in create table

From: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
To: Joao De Almeida Pereira <jdealmeidapereira(at)pivotal(dot)io>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [pgadmin4] Hide tabs in create table
Date: 2018-02-08 03:03:35
Message-ID: CAG7mmoxA7R4OsbkKSKn2xiiCmmLFeHUs30tM8qwe7w3sYAs7vg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

On Thu, Feb 8, 2018 at 4:01 AM, Joao De Almeida Pereira <
jdealmeidapereira(at)pivotal(dot)io> wrote:

> Hi hackers,
> We are trying to hide the advanced tab in the Create Table screen, and we
> were looking into table.js file, but cannot find a way to hide it .
>
> Does anyone have an idea on how to do this?
>
Please take a look at the code in foreign_data_wrapper.js (line #151),
where we've defined 'group' as:

>
> *{ id: 'security', label: gettext('Security'), type: 'group',},*

You can also define 'visible' parameter for this type of schema.
i.e.

>
> *{*
> * id: 'advanced', label: gettext('Advanced'), type: 'group',
> visible: function() { ... }**},*

And, replace "group: gettext('Advanced')" with "group: 'advanced'" in all
control schema in table.js.

e.g.
*---
a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js*
*+++
b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/static/js/table.js*
*@@ -501,12 +501,22 @@ define('pgadmin.node.table', [*
* return tbl_oid;*
* },*
* }),*
*+ },{*
*+ id: 'advanced', label: gettext('Advanced'), type: 'group',*
*+ visible: function(m) {*
*+ if(!_.isUndefined(m.node_info) &&
!_.isUndefined(m.node_info.server)*
*+ && !_.isUndefined(m.node_info.server.version) &&*
*+ m.node_info.server.version > 100000)*
*+ return true;*
*+*
*+ return false;*
*+ },*
* },{*
* id: 'coll_inherits', label: gettext('Inherited from table(s)'),*
*- type: 'text', group: gettext('Advanced'), mode: ['properties'],*
*+ type: 'text', group: 'advanced', mode: ['properties'],*
* },{*
* id: 'inherited_tables_cnt', label: gettext('Inherited tables
count'),*
*- type: 'text', mode: ['properties'], group: gettext('Advanced'),*
*+ type: 'text', mode: ['properties'], group: 'advanced',*
* disabled: 'inSchema',*
* }*

The example patch - it has defined the 'advanced' group, and hide advanced
group for server_version < 10, and then used it for 'coll_inherits', and
'inherited_tables_cnt'.

-- Thanks, Ashesh

>
> Thanks
> Joao
>

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Khushboo Vashi 2018-02-08 07:08:23 [pgAdmin4][Patch]: RM #2899: Provide access keys/shortcuts to all commonly used menu options in the main window.
Previous Message Joao De Almeida Pereira 2018-02-07 22:32:10 Re: [pgadmin][patch] [GreenPlum] When user press Explain Plan and Explain analyze plan an error is displayed