Horizon wizard customization

asked 2015-08-21 06:08:01 -0600

anonymous user


updated 2015-08-24 01:36:25 -0600

Cloud elements in up popping wizards (f.e. the "create instance" wizard) be as easily manipulated like shown for tables in:

Quote: You can also override existing methods with your own versions:

To disable Floating IPs:

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

NO = lambda *x: False

tabs.FloatingIPsTab.allowed = NO
tables.AssociateIP.allowed = NO
tables.SimpleAssociateIP.allowed = NO
tables.SimpleDisassociateIP.allowed = NO

You could also customize what columns are displayed in an existing table, by redefining the columns attribute of its Meta class. This can be achieved in 3 steps:

  • Extend the table that you wish to modify
  • Redefine the columns attribute under the Meta class for this new table
  • Modify the table_class attribute for the related view so that it points to the new table

For example, if you wish to remove the Admin State column from the NetworksTable, you could do the following:

from openstack_dashboard.dashboards.project.networks import tables
from openstack_dashboard.dashboards.project.networks import views

class MyNetworksTable(tables.NetworksTable):

    class Meta(tables.NetworksTable.Meta):
        columns = ('name', 'subnets', 'shared', 'status')

views.IndexView.table_class = MyNetworksTable

If you want to add a column you can override the parent table in a similar way, add the new column definition and then use the Meta columns attribute to control the column order as needed.


edit retag flag offensive close merge delete