public inbox for [email protected]  
help / color / mirror / Atom feed
From: Surinder Kumar <[email protected]>
To: Dave Page <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: [pgAdmin4][Patch] - Disable PrivilegeControl for nodes visible under catalog
Date: Mon, 11 Apr 2016 13:11:40 +0530
Message-ID: <CAM5-9D8RNZXRG0ygvuRqf2wQAEnye-rqBHSrwcr34dnLCemy3w@mail.gmail.com> (raw)
In-Reply-To: <CA+OCxowE1CAm-ReDu4d2h1uXUNvqopMDB_=pKqkRDYH=YgfqJQ@mail.gmail.com>
References: <CAM5-9D98_=ZS2K42VGqH69GiZ+ozv0Yu8vkQK3rzeZ-0LFGpNw@mail.gmail.com>
	<CA+OCxozu55OFo13kr_3K4DbCbGMCQ-NapvuX+zuFWNx08j0E=g@mail.gmail.com>
	<CA+OCxowE1CAm-ReDu4d2h1uXUNvqopMDB_=pKqkRDYH=YgfqJQ@mail.gmail.com>
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

Hi Dave,

Please ignore the above patch because instead of disabling fields, now we
are hiding the control.

As per my conversation with Ashesh, In some cases we need not to show
"Group Tab" if its all fields are set to visible = false.
For example: In case of view, "privilege info and security labels" need not
to show under catalogs. so Its group tab "Security" should also disappear.

Please find attached patch and review it.


On Thu, Apr 7, 2016 at 3:53 PM, Dave Page <[email protected]> wrote:

> This time, with the screenshot...
>
> On Thu, Apr 7, 2016 at 11:14 AM, Dave Page <[email protected]> wrote:
> > Hi
> >
> > On Thu, Apr 7, 2016 at 8:45 AM, Surinder Kumar
> > <[email protected]> wrote:
> >> Hi,
> >>
> >> PFA minor patch for PrivilegeRoleModel
> >>
> >> Change: Add check to disable PrivilegeRoleModel fields for nodes visible
> >> under catalog.
> >>
> >> Please review the patch.
> >
> > I'm unclear what this is supposed to do:
> >
> > - Those fields already seem to be disabled under catalog nodes (though
> > - the Add button on subnode grids is still active, but doesn't do
> > anything)
> >
> > - Shouldn't we just hide privilege info on those nodes directly? Why
> > break modularity for this?
>

Yes instead of disabling privilege info, it is better to hide privilege
info.
I have attached the patch for it.


> >
> > - I'm seeing weird effects after applying this patch - see the
> > attached screenshot. However, that issue remains even after I remove
> > it again (and restart the server, and hard-reload). It does seem to
> > fix itself eventually, but I'm not sure what causes that. If I try to
> > refresh the Functions node, I get:
> >
> > jquery.contextMenu.js:309 No items specified to show in
> > contextMenuhandle.contextmenu @
> > jquery.contextMenu.js:309jQuery.event.dispatch @
> > jquery-1.11.2.js:4665elemData.handle @ jquery-1.11.2.js:4333
> > jquery.contextMenu.js:312 Uncaught Error: No Items
> > specifiedhandle.contextmenu @
> > jquery.contextMenu.js:312jQuery.event.dispatch @
> > jquery-1.11.2.js:4665elemData.handle @ jquery-1.11.2.js:4333
> >
>
I have applied the same patch but functions node under schema and catalogs
are working fine.

> > --
> > Dave Page
> > Blog: http://pgsnake.blogspot.com
> > Twitter: @pgsnake
> >
> > EnterpriseDB UK: http://www.enterprisedb.com
> > The Enterprise PostgreSQL Company
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [application/octet-stream] hide_group_tab.patch (1.6K, 3-hide_group_tab.patch)
  download | inline diff:
diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js
index e30a278..263c6a9 100644
--- a/web/pgadmin/static/js/backform.pgadmin.js
+++ b/web/pgadmin/static/js/backform.pgadmin.js
@@ -1606,13 +1606,18 @@
               (_.isUndefined(s.min_version) ? true :
                (server_info.version >= s.min_version)) &&
               (_.isUndefined(s.max_version) ? true :
-               (server_info.version <= s.max_version))));
+               (server_info.version <= s.max_version)))),
+              visible = true;
+
+          if (s.mode && _.isObject(s.mode))
+            visible = (_.indexOf(s.mode, mode) > -1);
+          if (visible)
+            visible = evalASFunc(s.visible);
+
           groupInfo[s.id] = {
             label: s.label || s.id,
             version_compatible: ver_in_limit,
-            visible: !s.mode || (
-              s && s.mode && _.isObject(s.mode) &&
-                _.indexOf(s.mode, mode) != -1) && evalASFunc(s.visible) || true
+            visible: visible
           };
           return;
         }
@@ -1706,9 +1711,13 @@
       // Create an array from the dictionary with proper required
       // structure.
       _.each(groups, function(val, key) {
-        fields.push(_.extend({
-          label: key, fields: val
-        }, (groupInfo[key] || {version_compatible: true, visible: true})));
+        fields.push(
+          _.extend(
+            _.defaults(
+              groupInfo[key] || {label: key},
+              {version_compatible: true, visible: true}
+            ), {fields: val})
+          );
       });
     }
 


view thread (5+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: [pgAdmin4][Patch] - Disable PrivilegeControl for nodes visible under catalog
  In-Reply-To: <CAM5-9D8RNZXRG0ygvuRqf2wQAEnye-rqBHSrwcr34dnLCemy3w@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox