Documentation on customizing tabs/tables/actions could be clearer

Bug #1210419 reported by Nicolas Simonds
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Wishlist
Nicolas Simonds

Bug Description

As far as I can tell, disabling pieces of functionality in Horizon leaves users with a few options:

They can use the customization_module functionality to smash dashboards and panels, but nothing more fine-grained than that (if I'm wrong, please disabuse me of this notion with an example of how to do it)

They can set permissions on various and sundry properties, and let the keystone service catalog work it out, but these aren't evenly distributed throughout the code (yet?) so there's no way to revoke permissions for, say, the "Access & Security -> Floating IPs" tab only (again, if I'm wrong on this one, please set me straight)

They can add allowed() methods to the classes that support them to deactivate pieces, but that is taking on technical debt if tracking upstream progress is a desired goal.

Since all functionality but tabs seems to have a way to control their visibility without altering code, I propose that the default tab allowed() method be altered to allow for overrides via config file.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/41041

Changed in horizon:
assignee: nobody → Nicolas Simonds (nicolas.simonds)
status: New → In Progress
Revision history for this message
Kieran Spear (kspear) wrote : Re: Disabling tabs could be easier

We actually have customization_module code for exactly your example from the commit message:

from openstack_dashboard.dashboards.project.access_and_security import tabs
from openstack_dashboard.dashboards.project.instances.tables import AssociateIP

# Disable associate floating IP button and table
AssociateIP.allowed = lambda self, request, instance: False
ast = list(tabs.AccessAndSecurityTabs.tabs)
ast.remove(tabs.FloatingIPsTab)
tabs.AccessAndSecurityTabs.tabs = tuple(ast)

I could have also done something like:

from openstack_dashboard.dashboards.project.access_and_security import tabs
tabs.FloatingIPsTab.allowed = lambda self, request: False

But I apparently didn't think of it at the time.

Neither option is pretty though, so +1 for a nicer method.

Revision history for this message
Nicolas Simonds (nicolas.simonds) wrote :

I've never been so happy to be so wrong about something. And beauty is in the eye of the beholder, a single module that can clobber everything that needs clobbering is better than a smattering of different configuration options and whatnot.

Since the documentation on customization seems focused on registering/unregistering components, I'll add an explicit example on overriding methods, since I couldn't figure out "how to get there from here" on my own.

summary: - Disabling tabs could be easier
+ Documentation on customizing tabs/tables/actions could be clearer
Kieran Spear (kspear)
Changed in horizon:
importance: Undecided → Wishlist
milestone: none → havana-3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/41041
Committed: http://github.com/openstack/horizon/commit/e1ab6c3d8c82dc47c111b35b7df79d62dfd0ab8d
Submitter: Jenkins
Branch: master

commit e1ab6c3d8c82dc47c111b35b7df79d62dfd0ab8d
Author: Nicolas Simonds <email address hidden>
Date: Fri Aug 9 00:35:47 2013 -0700

    Customization: Add an explicit example of disabling Floating IPs

    The current documentation on customizing focuses on
    registering/unregistering components. While this is simple and
    effective at a high-level, fine-grained customizations like overriding
    individual allowed() methods uses a different approach.

    This confuses n00bcakes like myself, so add an explicit example of
    dropping Floating IPs support to spell it out.

    Fixes Bug: 1210419

    Change-Id: Ib9b1579b33d48c7b2bd9bf3ad96cd303210a4420

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: havana-3 → 2013.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.