Skip to content

Commit

Permalink
Renamed all user-facing cases of "tenant" to "project".
Browse files Browse the repository at this point in the history
This required a little more refactoring than expected because I
wanted to make the url slug also say "project", which required
changing the panel slug, which in turn required changing the name of
the panel directory, and then it seemed silly not to make the template
directory match.

Fixed bug 909495.

Change-Id: I9da3b544b46f507a223a44c256d0008c8674ab3b
  • Loading branch information
gabrielhurley committed Feb 7, 2012
1 parent 6892653 commit 87e6970
Show file tree
Hide file tree
Showing 43 changed files with 125 additions and 111 deletions.
13 changes: 13 additions & 0 deletions docs/source/contributing.rst
Expand Up @@ -126,3 +126,16 @@ Be sure to generate the documentation before submitting a patch for review.
Unexpected warnings often appear when building the documentation, and slight
reST syntax errors frequently cause links or cross-references not to work
correctly.

Conventions
-----------

Simply by convention, we have a few rules about naming:

* The term "project" is used in place of Keystone's "tenant" terminology
in all user-facing text. The term "tenant" is still used in API code to
make things more obvious for developers.

* The term "dashboard" refers to a top-level dashboard class, and "panel" to
the sub-items within a dashboard. Referring to a panel as a dashboard is
both confusing and incorrect.
5 changes: 5 additions & 0 deletions docs/source/glossary.rst
Expand Up @@ -17,3 +17,8 @@ Panel
A Python class representing a sub-navigation item (e.g. "instances")
which contains all the necessary logic (views, forms, tests, etc.) for
that interface.

Project

Used in user-facing text in place of the term "Tenant" which is Keystone's
word.
Expand Up @@ -31,7 +31,7 @@

class AllocateIP(tables.LinkAction):
name = "allocate"
verbose_name = _("Allocate IP To Tenant")
verbose_name = _("Allocate IP To Project")
attrs = {"class": "ajax-modal btn small"}
url = "horizon:nova:access_and_security:floating_ips:allocate"

Expand Down
2 changes: 1 addition & 1 deletion horizon/horizon/dashboards/nova/networks/tables.py
Expand Up @@ -39,7 +39,7 @@ class NetworksTable(tables.DataTable):
used = tables.Column('used', verbose_name=_('Used'))
available = tables.Column('available', verbose_name=_('Available'))
total = tables.Column('total', verbose_name=_('Total'))
#tenant = tables.Column('tenant', verbose_name=_('Tenant'))
#tenant = tables.Column('tenant', verbose_name=_('Project'))

def get_object_id(self, datum):
return datum['id']
Expand Down
Expand Up @@ -15,7 +15,7 @@
</div>
<div class="right">
<h3>{% trans "Description:" %}</h3>
<p>{% trans "Specify the details for launching an instance. Also please make note of the table below; all tenants have quotas which define the limit of resources they are allowed to provision." %}</p>
<p>{% trans "Specify the details for launching an instance. Also please make note of the table below; all projects have quotas which define the limit of resources they are allowed to provision." %}</p>
<table class="table table-striped table-bordered">
<tr>
<th>{% trans "Quota Name" %}</th>
Expand Down
4 changes: 2 additions & 2 deletions horizon/horizon/dashboards/settings/dashboard.py
Expand Up @@ -20,9 +20,9 @@


class Settings(horizon.Dashboard):
name = "Settings"
name = _("Settings")
slug = "settings"
panels = ('user', 'tenant')
panels = ('user', 'project')
default_panel = 'user'
nav = False

Expand Down
Expand Up @@ -32,7 +32,7 @@


class DownloadOpenRCForm(forms.SelfHandlingForm):
tenant = forms.ChoiceField(label=_("Select a Tenant"))
tenant = forms.ChoiceField(label=_("Select a Project"))

@classmethod
def _instantiate(cls, request, *args, **kwargs):
Expand All @@ -58,7 +58,7 @@ def handle(self, request, data):
'tenant_id': data['tenant']}

response = shortcuts.render(request,
'settings/tenant/openrc.sh.template',
'settings/project/openrc.sh.template',
context,
content_type="text/plain")
response['Content-Disposition'] = 'attachment; filename=openrc.sh'
Expand Down
Expand Up @@ -19,8 +19,8 @@


class TenantPanel(horizon.Panel):
name = "Tenant Settings"
slug = 'tenant'
name = "Project Settings"
slug = 'project'


dashboard.Settings.register(TenantPanel)
Expand Up @@ -17,5 +17,5 @@
from django.conf.urls.defaults import patterns, url


urlpatterns = patterns('horizon.dashboards.settings.tenant.views',
urlpatterns = patterns('horizon.dashboards.settings.project.views',
url(r'^$', 'index', name='index'))
Expand Up @@ -15,7 +15,7 @@
# under the License.

from django import shortcuts
from horizon.dashboards.settings.tenant.forms import DownloadOpenRCForm
from .forms import DownloadOpenRCForm


def index(request):
Expand All @@ -26,4 +26,4 @@ def index(request):

context = {'form': form}

return shortcuts.render(request, 'settings/tenant/settings.html', context)
return shortcuts.render(request, 'settings/project/settings.html', context)
Expand Up @@ -2,7 +2,7 @@
{% load i18n %}

{% block form_id %}openrc_download_form{% endblock %}
{% block form_action %}{% url horizon:settings:tenant:index %}{% endblock %}
{% block form_action %}{% url horizon:settings:project:index %}{% endblock %}

{% block modal_id %}language_settings_modal{% endblock %}
{% block modal-header %}{% trans "Download RC File" %}{% endblock %}
Expand All @@ -15,12 +15,12 @@
</div>
<div class="right">
<h3>{% trans "Description:" %}</h3>
<p>{% trans 'Download the RC file for the selected tenant, then type "source openrc" in the terminal to configure your environment to communicate with OpenStack.' %}</p>
<p>{% trans 'Download the RC file for the selected project, then type "source openrc" in the terminal to configure your environment to communicate with OpenStack.' %}</p>
</div>
{% endblock %}

{% block modal-footer %}
<input class="btn primary pull-right" type="submit" value="{% trans "Download RC File" %}" />
{% if hide %}<a href="{% url horizon:settings:tenant:index %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>{% endif %}
{% if hide %}<a href="{% url horizon:settings:project:index %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>{% endif %}
{% endblock %}

Expand Up @@ -3,9 +3,9 @@
{% block title %}OpenRC Download{% endblock %}

{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Tenant Settings") %}
{% include "horizon/common/_page_header.html" with title=_("Project Settings") %}
{% endblock page_header %}

{% block settings_main %}
{% include "settings/tenant/_openrc.html" %}
{% include "settings/project/_openrc.html" %}
{% endblock %}
1 change: 0 additions & 1 deletion horizon/horizon/dashboards/settings/user/views.py
Expand Up @@ -15,7 +15,6 @@
# under the License.

from django import shortcuts
from horizon.dashboards.settings.tenant.forms import DownloadOpenRCForm


def index(request):
Expand Down
2 changes: 1 addition & 1 deletion horizon/horizon/dashboards/syspanel/dashboard.py
Expand Up @@ -23,7 +23,7 @@ class Syspanel(horizon.Dashboard):
name = "Admin" # Appears in navigation
slug = "syspanel"
panels = {_("System Panel"): ('overview', 'instances', 'services',
'flavors', 'images', 'tenants', 'users',
'flavors', 'images', 'projects', 'users',
'quotas',)}
default_panel = 'overview'
roles = ('admin',)
Expand Down
Expand Up @@ -52,7 +52,7 @@ def handle(self, request, data):
messages.success(request, _('Successfully added user to tenant.'))
except:
exceptions.handle(request, _('Unable to add user to tenant.'))
return shortcuts.redirect('horizon:syspanel:tenants:users',
return shortcuts.redirect('horizon:syspanel:projects:users',
tenant_id=data['tenant_id'])


Expand All @@ -76,7 +76,7 @@ def handle(self, request, data):
% data['name'])
except:
exceptions.handle(request, _('Unable to create tenant.'))
return shortcuts.redirect('horizon:syspanel:tenants:index')
return shortcuts.redirect('horizon:syspanel:projects:index')


class UpdateTenant(forms.SelfHandlingForm):
Expand All @@ -102,7 +102,7 @@ def handle(self, request, data):
% data['name'])
except:
exceptions.handle(request, _('Unable to update tenant.'))
return shortcuts.redirect('horizon:syspanel:tenants:index')
return shortcuts.redirect('horizon:syspanel:projects:index')


class UpdateQuotas(forms.SelfHandlingForm):
Expand Down Expand Up @@ -138,4 +138,4 @@ def handle(self, request, data):
% data['tenant_id'])
except:
exceptions.handle(request, _('Unable to update quotas.'))
return shortcuts.redirect('horizon:syspanel:tenants:index')
return shortcuts.redirect('horizon:syspanel:projects:index')
Expand Up @@ -23,8 +23,8 @@


class Tenants(horizon.Panel):
name = "Tenants"
slug = 'tenants'
name = "Projects"
slug = 'projects'


dashboard.Syspanel.register(Tenants)
Expand Up @@ -15,39 +15,39 @@
class ModifyQuotasLink(tables.LinkAction):
name = "quotas"
verbose_name = _("Modify Quotas")
url = "horizon:syspanel:tenants:quotas"
url = "horizon:syspanel:projects:quotas"
attrs = {"class": "ajax-modal"}


class ViewMembersLink(tables.LinkAction):
name = "users"
verbose_name = _("Modify Users")
url = "horizon:syspanel:tenants:users"
url = "horizon:syspanel:projects:users"


class UsageLink(tables.LinkAction):
name = "usage"
verbose_name = _("View Usage")
url = "horizon:syspanel:tenants:usage"
url = "horizon:syspanel:projects:usage"


class EditLink(tables.LinkAction):
name = "update"
verbose_name = _("Edit Tenant")
url = "horizon:syspanel:tenants:update"
verbose_name = _("Edit Project")
url = "horizon:syspanel:projects:update"
attrs = {"class": "ajax-modal"}


class CreateLink(tables.LinkAction):
name = "create"
verbose_name = _("Create New Tenant")
url = "horizon:syspanel:tenants:create"
verbose_name = _("Create New Project")
url = "horizon:syspanel:projects:create"
attrs = {"class": "ajax-modal btn small"}


class DeleteTenantsAction(tables.DeleteAction):
data_type_singular = _("Tenant")
data_type_plural = _("Tenants")
data_type_singular = _("Project")
data_type_plural = _("Projects")

def delete(self, request, obj_id):
api.keystone.tenant_delete(request, obj_id)
Expand Down Expand Up @@ -76,7 +76,7 @@ class TenantsTable(tables.DataTable):

class Meta:
name = "tenants"
verbose_name = _("Tenants")
verbose_name = _("Projects")
row_actions = (EditLink, UsageLink, ViewMembersLink, ModifyQuotasLink,
DeleteTenantsAction)
table_actions = (TenantFilterAction, CreateLink, DeleteTenantsAction)
Expand All @@ -98,15 +98,15 @@ def action(self, request, user_id):
class TenantUsersTable(UsersTable):
class Meta:
name = "tenant_users"
verbose_name = _("Users For Tenant")
verbose_name = _("Users For Project")
table_actions = (RemoveUserAction,)
row_actions = (RemoveUserAction,)


class AddUserAction(tables.LinkAction):
name = "add_user"
verbose_name = _("Add To Tenant")
url = "horizon:syspanel:tenants:add_user"
verbose_name = _("Add To Project")
url = "horizon:syspanel:projects:add_user"
classes = ('ajax-modal',)

def get_link_url(self, user):
Expand Down
Expand Up @@ -22,7 +22,7 @@
from horizon import test


INDEX_URL = reverse('horizon:syspanel:tenants:index')
INDEX_URL = reverse('horizon:syspanel:projects:index')


class FakeResource(object):
Expand Down Expand Up @@ -60,7 +60,7 @@ def test_index(self):

res = self.client.get(INDEX_URL)

self.assertTemplateUsed(res, 'syspanel/tenants/index.html')
self.assertTemplateUsed(res, 'syspanel/projects/index.html')
self.assertItemsEqual(res.context['table'].data, self.tenants)

def test_modify_quota(self):
Expand All @@ -78,7 +78,7 @@ def test_modify_quota(self):

self.mox.ReplayAll()

url = reverse('horizon:syspanel:tenants:quotas',
url = reverse('horizon:syspanel:projects:quotas',
args=(self.TEST_TENANT,))
data = {"method": "UpdateQuotas",
"tenant_id": self.TEST_TENANT,
Expand Down

0 comments on commit 87e6970

Please sign in to comment.