Clean unused code for supports_tenants

It seems that the `supports_tenants` attr is unused now,
the patch clean up some code related to `supports_tenants`
so that the code can be more readable for devs:)

Closes-Bug: 1417841
Change-Id: Ia3def66b34bf91a4a4e2d7bcb61c5f3be1d16abb
This commit is contained in:
lawrancejing 2015-02-02 21:00:41 +08:00 committed by jing.liuqing
parent 1bff6943a7
commit fed29ee138
4 changed files with 30 additions and 42 deletions

View File

@ -243,7 +243,6 @@ process::
# ObjectStorePanels
panels = (BasePanels, NetworkPanels, ObjectStorePanels)
default_panel = 'overview'
supports_tenants = True
...
horizon.register(Project)

View File

@ -412,13 +412,6 @@ class Dashboard(Registry, HorizonComponent):
to control whether or not this dashboard should appear in
automatically-generated navigation. Default: ``True``.
.. attribute:: supports_tenants
Optional boolean that indicates whether or not this dashboard includes
support for projects/tenants. If set to ``True`` this dashboard's
navigation will include a UI element that allows the user to select
project/tenant. Default: ``False``.
.. attribute:: public
Boolean value to determine whether this dashboard can be viewed
@ -432,7 +425,6 @@ class Dashboard(Registry, HorizonComponent):
panels = []
default_panel = None
nav = True
supports_tenants = False
public = False
def __repr__(self):

View File

@ -4,39 +4,37 @@
<dl class="nav_accordion">
{% for dashboard, panel_info in components %}
{% if user|has_permissions:dashboard %}
{% if dashboard.supports_tenants and request.user.authorized_tenants or not dashboard.supports_tenants %}
<dt {% if current.slug == dashboard.slug %}class="active"{% endif %}>
{{ dashboard.name }}
<span class="glyphicon pull-right"></span>
</dt>
{% if current.slug == dashboard.slug %}
<dd>
{% else %}
<dd style="display:none;">
{% endif %}
{% for heading, panels in panel_info.iteritems %}
{% with panels|has_permissions_on_list:user as filtered_panels %}
{% if filtered_panels %}
{% if heading %}
<div>
<h4>
{{ heading }}
<span class="glyphicon pull-right"></span>
</h4>
{% endif %}
<ul>
{% for panel in filtered_panels %}
<li><a href="{{ panel.get_absolute_url }}" {% if current.slug == dashboard.slug and current_panel == panel.slug %}class="active"{% endif %} tabindex="{{ forloop.counter }}" >{{ panel.name }}</a></li>
{% endfor %}
</ul>
{% if heading %}
</div>
{% endif %}
{% endif %}
{% endwith %}
{% endfor %}
</dd>
<dt {% if current.slug == dashboard.slug %}class="active"{% endif %}>
{{ dashboard.name }}
<span class="glyphicon pull-right"></span>
</dt>
{% if current.slug == dashboard.slug %}
<dd>
{% else %}
<dd style="display:none;">
{% endif %}
{% for heading, panels in panel_info.iteritems %}
{% with panels|has_permissions_on_list:user as filtered_panels %}
{% if filtered_panels %}
{% if heading %}
<div>
<h4>
{{ heading }}
<span class="glyphicon pull-right"></span>
</h4>
{% endif %}
<ul>
{% for panel in filtered_panels %}
<li><a href="{{ panel.get_absolute_url }}" {% if current.slug == dashboard.slug and current_panel == panel.slug %}class="active"{% endif %} tabindex="{{ forloop.counter }}" >{{ panel.name }}</a></li>
{% endfor %}
</ul>
{% if heading %}
</div>
{% endif %}
{% endif %}
{% endwith %}
{% endfor %}
</dd>
{% endif %}
{% endfor %}
</dl>

View File

@ -83,7 +83,6 @@ class Project(horizon.Dashboard):
DatabasePanels,
DataProcessingPanels,)
default_panel = 'overview'
supports_tenants = True
horizon.register(Project)