Update for akanda->astara rename

This updates astara-horizon code for the project rename:

* References to Akanda/akanda changed to Astara/astara
* Refernces to RUG/Rug removed or replaced with astara
* RugClient -> AstaraClient
* Panel renamed RUG -> Astara

Also added copyright headers to all code files.

Change-Id: I78eeacda4f8ae16a61890d9cbfd41ddf037b9677
Partially-implements: blueprint astara-horizon-mitaka
This commit is contained in:
Adam Gandelman 2015-11-19 14:15:47 -08:00
parent 3a3f2617d5
commit c3234f70fb
45 changed files with 360 additions and 150 deletions

View File

@ -1,11 +1,11 @@
# Akanda Rug Horizon Extension # Akanda Rug Horizon Extension
1. Install module 1. Install module
``` ```
pip install akanda-horizon pip install astara-horizon
``` ```
2. Copy extension files from the project root folder to ```/etc/openstack_dashboard/local/enabled``` or to ```/opt/stack/horizon/openstack_dashboard/local/enabled``` folder 2. Copy extension files from the project root folder to ```/etc/openstack_dashboard/local/enabled``` or to ```/opt/stack/horizon/openstack_dashboard/local/enabled``` folder
``` ```

View File

@ -1,3 +0,0 @@
"""
Stub file to work around django bug: https://code.djangoproject.com/ticket/7198
"""

View File

@ -1,13 +0,0 @@
from django.utils.translation import ugettext_lazy as _
import horizon
from openstack_dashboard.dashboards.admin import dashboard
class Rugrouters(horizon.Panel):
name = _("Routers")
slug = "rugrouters"
dashboard.Admin.register(Rugrouters)

View File

@ -1,14 +0,0 @@
from django.conf.urls import patterns
from django.conf.urls import url
from akanda_horizon.rug_openstack_dashboard.dashboards.admin.rugrouters \
import views
ROUTERS = r'^(?P<router_id>[^/]+)/%s$'
urlpatterns = patterns(
'rug_openstack_dashboard.dashboards.admin.rugrouters.views',
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^poll$', views.PollView.as_view(), name='poll'),
url(ROUTERS % 'rebuild', views.RebuildView.as_view(), name='rebuild'),
)

View File

@ -1,3 +0,0 @@
"""
Stub file to work around django bug: https://code.djangoproject.com/ticket/7198
"""

View File

@ -1,13 +0,0 @@
from django.utils.translation import ugettext_lazy as _
import horizon
from openstack_dashboard.dashboards.admin import dashboard
class Rugtenants(horizon.Panel):
name = _("Tenants")
slug = "rugtenants"
dashboard.Admin.register(Rugtenants)

View File

@ -1,15 +0,0 @@
from django.conf.urls import patterns
from django.conf.urls import url
from akanda_horizon.rug_openstack_dashboard.dashboards.admin.rugtenants \
import views
TENANT = r'^(?P<tenant_id>[^/]+)/%s$'
urlpatterns = patterns(
'rug_openstack_dashboard.dashboards.admin.rugtenants.views',
url(r'^$', views.TenantIndexView.as_view(), name='index'),
url(TENANT % '$', views.TenantRouterIndexView.as_view(), name='tenant'),
url(r'^(?P<tenant_id>[^/]+)/(?P<router_id>[^/]+)/rebuild$',
views.RebuildView.as_view(), name='rebuild'),
)

View File

@ -1,3 +1,17 @@
# Copyright (c) 2015 Akanda, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from datetime import datetime from datetime import datetime
from django.conf import settings from django.conf import settings
from horizon.utils import functions as utils from horizon.utils import functions as utils
@ -41,7 +55,7 @@ class Router(object):
setattr(self, k, v) setattr(self, k, v)
class RugClient(object): class AstaraClient(object):
def __init__(self): def __init__(self):
self.host = ( self.host = (
_get_local_service_ip(settings.RUG_MANAGEMENT_PREFIX) _get_local_service_ip(settings.RUG_MANAGEMENT_PREFIX)

View File

@ -1,3 +1,17 @@
# Copyright (c) 2015 Akanda, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import filesizeformat from django.template.defaultfilters import filesizeformat
@ -7,10 +21,10 @@ from horizon import messages
from openstack_dashboard.dashboards.project.images import utils from openstack_dashboard.dashboards.project.images import utils
from akanda_horizon.rug_openstack_dashboard.api.rug import RugClient from astara_horizon.astara_openstack_dashboard.api.astara import AstaraClient
rc = RugClient() rc = AstaraClient()
def _image_choice_title(img): def _image_choice_title(img):

View File

@ -0,0 +1,17 @@
# Copyright (c) 2015 Akanda, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
Stub file to work around django bug: https://code.djangoproject.com/ticket/7198
"""

View File

@ -0,0 +1,27 @@
# Copyright (c) 2015 Akanda, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from django.utils.translation import ugettext_lazy as _
import horizon
from openstack_dashboard.dashboards.admin import dashboard
class AstaraRouters(horizon.Panel):
name = _("Routers")
slug = "astararouters"
dashboard.Admin.register(AstaraRouters)

View File

@ -1,13 +1,27 @@
# Copyright (c) 2015 Akanda, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy from django.utils.translation import ungettext_lazy
from horizon import exceptions from horizon import exceptions
from horizon import tables from horizon import tables
from akanda_horizon.rug_openstack_dashboard.api.rug import RugClient from astara_horizon.astara_openstack_dashboard.api.astara import AstaraClient
rc = RugClient() rc = AstaraClient()
class ManageAction(tables.BatchAction): class ManageAction(tables.BatchAction):
@ -109,14 +123,14 @@ class UpdateAction(tables.BatchAction):
class PollAction(tables.LinkAction): class PollAction(tables.LinkAction):
name = "poll" name = "poll"
verbose_name = _("Poll Routers") verbose_name = _("Poll Routers")
url = "horizon:admin:rugrouters:poll" url = "horizon:admin:astararouters:poll"
classes = ("ajax-modal",) classes = ("ajax-modal",)
class RebuildAction(tables.LinkAction): class RebuildAction(tables.LinkAction):
name = "rebuild" name = "rebuild"
verbose_name = _("Rebuild Router") verbose_name = _("Rebuild Router")
url = "horizon:admin:rugrouters:rebuild" url = "horizon:admin:astararouters:rebuild"
classes = ("ajax-modal",) classes = ("ajax-modal",)

View File

@ -2,10 +2,10 @@
{% load i18n %} {% load i18n %}
{% load url from future %} {% load url from future %}
{% block form_id %}poll_rugrouters_form{% endblock %} {% block form_id %}poll_astararouters_form{% endblock %}
{% block form_action %}{% url 'horizon:admin:rugrouters:poll' %}{% endblock %} {% block form_action %}{% url 'horizon:admin:astararouters:poll' %}{% endblock %}
{% block modal_id %}poll_rugrouters_modal{% endblock %} {% block modal_id %}poll_astararouters_modal{% endblock %}
{% block modal-header %}{% trans "Poll Routers" %}{% endblock %} {% block modal-header %}{% trans "Poll Routers" %}{% endblock %}
@ -17,5 +17,5 @@
{% block modal-footer %} {% block modal-footer %}
<input class="btn btn-primary" type="submit" value="{% trans "Poll Routers" %}" /> <input class="btn btn-primary" type="submit" value="{% trans "Poll Routers" %}" />
<a href="{% url 'horizon:admin:rugrouters:index' %}" class="btn btn-default cancel">{% trans "Cancel" %}</a> <a href="{% url 'horizon:admin:astararouters:index' %}" class="btn btn-default cancel">{% trans "Cancel" %}</a>
{% endblock %} {% endblock %}

View File

@ -2,10 +2,10 @@
{% load i18n %} {% load i18n %}
{% load url from future %} {% load url from future %}
{% block form_id %}rebuild_rugrouters_form{% endblock %} {% block form_id %}rebuild_astararouters_form{% endblock %}
{% block form_action %}{% url 'horizon:admin:rugrouters:rebuild' router_id %}{% endblock %} {% block form_action %}{% url 'horizon:admin:astararouters:rebuild' router_id %}{% endblock %}
{% block modal_id %}rebuild_rugrouters_modal{% endblock %} {% block modal_id %}rebuild_astararouters_modal{% endblock %}
{% block modal-header %}{% trans "Rebuild Router" %}{% endblock %} {% block modal-header %}{% trans "Rebuild Router" %}{% endblock %}
@ -23,5 +23,5 @@
{% block modal-footer %} {% block modal-footer %}
<input class="btn btn-primary" type="submit" value="{% trans "Rebuild Router" %}" /> <input class="btn btn-primary" type="submit" value="{% trans "Rebuild Router" %}" />
<a href="{% url 'horizon:admin:rugrouters:index' %}" class="btn btn-default cancel">{% trans "Cancel" %}</a> <a href="{% url 'horizon:admin:astararouters:index' %}" class="btn btn-default cancel">{% trans "Cancel" %}</a>
{% endblock %} {% endblock %}

View File

@ -7,5 +7,5 @@
{% endblock page_header %} {% endblock page_header %}
{% block main %} {% block main %}
{% include "admin/rugrouters/_poll.html" %} {% include "admin/astararouters/_poll.html" %}
{% endblock %} {% endblock %}

View File

@ -7,5 +7,5 @@
{% endblock page_header %} {% endblock page_header %}
{% block main %} {% block main %}
{% include "admin/rugrouters/_rebuild.html" %} {% include "admin/astararouters/_rebuild.html" %}
{% endblock %} {% endblock %}

View File

@ -0,0 +1,28 @@
# Copyright (c) 2015 Akanda, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from django.conf.urls import patterns
from django.conf.urls import url
from astara_horizon.astara_openstack_dashboard.dashboards.admin.astararouters \
import views
ROUTERS = r'^(?P<router_id>[^/]+)/%s$'
urlpatterns = patterns(
'rug_openstack_dashboard.dashboards.admin.astararouters.views',
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^poll$', views.PollView.as_view(), name='poll'),
url(ROUTERS % 'rebuild', views.RebuildView.as_view(), name='rebuild'),
)

View File

@ -1,3 +1,17 @@
# Copyright (c) 2015 Akanda, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.core.urlresolvers import reverse_lazy from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
@ -8,19 +22,19 @@ from horizon import exceptions
from openstack_dashboard import api from openstack_dashboard import api
from akanda_horizon.rug_openstack_dashboard.dashboards.admin.rugrouters import \ from astara_horizon.astara_openstack_dashboard.dashboards.admin.astararouters import \
tables as router_tables tables as router_tables
from akanda_horizon.rug_openstack_dashboard.dashboards.admin.rugrouters import \ from astara_horizon.astara_openstack_dashboard.dashboards.admin.astararouters import \
forms as rugrouters_forms forms as astararouters_forms
from akanda_horizon.rug_openstack_dashboard.api.rug import RugClient from astara_horizon.astara_openstack_dashboard.api.astara import AstaraClient
rc = RugClient() rc = AstaraClient()
class IndexView(tables.DataTableView): class IndexView(tables.DataTableView):
table_class = router_tables.RouterTable table_class = router_tables.RouterTable
template_name = 'admin/rugrouters/index.html' template_name = 'admin/astararouters/index.html'
def has_prev_data(self, table): def has_prev_data(self, table):
return getattr(self, "_prev", False) return getattr(self, "_prev", False)
@ -33,22 +47,22 @@ class IndexView(tables.DataTableView):
routers, self._more = rc.get_routers(self.request) routers, self._more = rc.get_routers(self.request)
return routers return routers
except Exception: except Exception:
url = reverse('horizon:admin:rugrouters:index') url = reverse('horizon:admin:astararouters:index')
exceptions.handle(self.request, exceptions.handle(self.request,
_('Unable to retrieve routers\' details.'), _('Unable to retrieve routers\' details.'),
redirect=url) redirect=url)
class PollView(forms.ModalFormView): class PollView(forms.ModalFormView):
form_class = rugrouters_forms.PollForm form_class = astararouters_forms.PollForm
template_name = 'admin/rugrouters/poll.html' template_name = 'admin/astararouters/poll.html'
success_url = reverse_lazy('horizon:admin:rugrouters:index') success_url = reverse_lazy('horizon:admin:astararouters:index')
class RebuildView(forms.ModalFormView): class RebuildView(forms.ModalFormView):
form_class = rugrouters_forms.RebuildForm form_class = astararouters_forms.RebuildForm
template_name = 'admin/rugrouters/rebuild.html' template_name = 'admin/astararouters/rebuild.html'
success_url = reverse_lazy('horizon:admin:rugrouters:index') success_url = reverse_lazy('horizon:admin:astararouters:index')
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
self.router = api.neutron.router_get(self.request, self.router = api.neutron.router_get(self.request,

View File

@ -0,0 +1,17 @@
# Copyright (c) 2015 Akanda, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
Stub file to work around django bug: https://code.djangoproject.com/ticket/7198
"""

View File

@ -0,0 +1,27 @@
# Copyright (c) 2015 Akanda, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from django.utils.translation import ugettext_lazy as _
import horizon
from openstack_dashboard.dashboards.admin import dashboard
class AstaraTenants(horizon.Panel):
name = _("Tenants")
slug = "astaratenants"
dashboard.Admin.register(AstaraTenants)

View File

@ -1,3 +1,17 @@
# Copyright (c) 2015 Akanda, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy from django.utils.translation import ungettext_lazy
@ -5,10 +19,10 @@ from django.utils.translation import ungettext_lazy
from horizon import tables from horizon import tables
from horizon import exceptions from horizon import exceptions
from akanda_horizon.rug_openstack_dashboard.api.rug import RugClient from astara_horizon.astara_openstack_dashboard.api.astara import AstaraClient
rc = RugClient() rc = AstaraClient()
class TenantFilterAction(tables.FilterAction): class TenantFilterAction(tables.FilterAction):
@ -89,7 +103,7 @@ class TenantDebugAction(tables.BatchAction):
class TenantsTable(tables.DataTable): class TenantsTable(tables.DataTable):
name = tables.Column('name', verbose_name=_('Name'), name = tables.Column('name', verbose_name=_('Name'),
link="horizon:admin:rugtenants:tenant") link="horizon:admin:astaratenants:tenant")
description = tables.Column(lambda obj: getattr(obj, 'description', None), description = tables.Column(lambda obj: getattr(obj, 'description', None),
verbose_name=_('Description')) verbose_name=_('Description'))
id = tables.Column('id', verbose_name=_('Project ID')) id = tables.Column('id', verbose_name=_('Project ID'))
@ -205,7 +219,7 @@ class RouterRebuildAction(tables.LinkAction):
classes = ("ajax-modal",) classes = ("ajax-modal",)
def get_link_url(self, datum=None): def get_link_url(self, datum=None):
return reverse("horizon:admin:rugtenants:rebuild", return reverse("horizon:admin:astaratenants:rebuild",
kwargs={'tenant_id': datum.tenant_id, kwargs={'tenant_id': datum.tenant_id,
'router_id': datum.id}) 'router_id': datum.id})

View File

@ -2,10 +2,10 @@
{% load i18n %} {% load i18n %}
{% load url from future %} {% load url from future %}
{% block form_id %}rebuild_rugtenants_form{% endblock %} {% block form_id %}rebuild_astaratenants_form{% endblock %}
{% block form_action %}{% url 'horizon:admin:rugtenants:rebuild' router_id=router_id tenant_id=tenant_id %}{% endblock %} {% block form_action %}{% url 'horizon:admin:astaratenants:rebuild' router_id=router_id tenant_id=tenant_id %}{% endblock %}
{% block modal_id %}rebuild_rugtenants_modal{% endblock %} {% block modal_id %}rebuild_astaratenants_modal{% endblock %}
{% block modal-header %}{% trans "Rebuild Router" %}{% endblock %} {% block modal-header %}{% trans "Rebuild Router" %}{% endblock %}
@ -23,5 +23,5 @@
{% block modal-footer %} {% block modal-footer %}
<input class="btn btn-primary" type="submit" value="{% trans "Rebuild Router" %}" /> <input class="btn btn-primary" type="submit" value="{% trans "Rebuild Router" %}" />
<a href="{% url 'horizon:admin:rugtenants:index' %}" class="btn btn-default cancel">{% trans "Cancel" %}</a> <a href="{% url 'horizon:admin:astaratenants:index' %}" class="btn btn-default cancel">{% trans "Cancel" %}</a>
{% endblock %} {% endblock %}

View File

@ -7,5 +7,5 @@
{% endblock page_header %} {% endblock page_header %}
{% block main %} {% block main %}
{% include "admin/rugtenants/_rebuild.html" %} {% include "admin/astaratenants/_rebuild.html" %}
{% endblock %} {% endblock %}

View File

@ -0,0 +1,29 @@
# Copyright (c) 2015 Akanda, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from django.conf.urls import patterns
from django.conf.urls import url
from astara_horizon.astara_openstack_dashboard.dashboards.admin.astaratenants \
import views
TENANT = r'^(?P<tenant_id>[^/]+)/%s$'
urlpatterns = patterns(
'astara_openstack_dashboard.dashboards.admin.astaratenants.views',
url(r'^$', views.TenantIndexView.as_view(), name='index'),
url(TENANT % '$', views.TenantRouterIndexView.as_view(), name='tenant'),
url(r'^(?P<tenant_id>[^/]+)/(?P<router_id>[^/]+)/rebuild$',
views.RebuildView.as_view(), name='rebuild'),
)

View File

@ -1,3 +1,17 @@
# Copyright (c) 2015 Akanda, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.core.urlresolvers import reverse_lazy from django.core.urlresolvers import reverse_lazy
@ -10,19 +24,19 @@ from horizon import forms
from openstack_dashboard import api from openstack_dashboard import api
from openstack_dashboard import policy from openstack_dashboard import policy
from akanda_horizon.rug_openstack_dashboard.dashboards.admin.rugtenants \ from astara_horizon.astara_openstack_dashboard.dashboards.admin.astaratenants \
import tables as tenant_tables import tables as tenant_tables
from akanda_horizon.rug_openstack_dashboard.dashboards.admin.rugrouters \ from astara_horizon.astara_openstack_dashboard.dashboards.admin.astararouters \
import forms as rugrouters_forms import forms as astararouters_forms
from akanda_horizon.rug_openstack_dashboard.api.rug import RugClient from astara_horizon.astara_openstack_dashboard.api.astara import AstaraClient
rc = RugClient() rc = AstaraClient()
class TenantIndexView(tables.DataTableView): class TenantIndexView(tables.DataTableView):
table_class = tenant_tables.TenantsTable table_class = tenant_tables.TenantsTable
template_name = 'admin/rugtenants/index.html' template_name = 'admin/astaratenants/index.html'
def has_more_data(self, table): def has_more_data(self, table):
return self._more return self._more
@ -66,7 +80,7 @@ class TenantIndexView(tables.DataTableView):
class TenantRouterIndexView(tables.DataTableView): class TenantRouterIndexView(tables.DataTableView):
table_class = tenant_tables.TenantRouterTable table_class = tenant_tables.TenantRouterTable
template_name = 'admin/rugtenants/router-index.html' template_name = 'admin/astaratenants/router-index.html'
def has_prev_data(self, table): def has_prev_data(self, table):
return getattr(self, "_prev", False) return getattr(self, "_prev", False)
@ -91,19 +105,19 @@ class TenantRouterIndexView(tables.DataTableView):
) )
return routers return routers
except Exception: except Exception:
url = reverse('horizon:admin:rugtenants:index') url = reverse('horizon:admin:astaratenants:index')
exceptions.handle(self.request, exceptions.handle(self.request,
_('Unable to retrieve routers\' details.'), _('Unable to retrieve routers\' details.'),
redirect=url) redirect=url)
class RebuildView(forms.ModalFormView): class RebuildView(forms.ModalFormView):
form_class = rugrouters_forms.RebuildForm form_class = astararouters_forms.RebuildForm
template_name = 'admin/rugtenants/rebuild.html' template_name = 'admin/astaratenants/rebuild.html'
success_url = reverse_lazy('horizon:admin:rugtenants:index') success_url = reverse_lazy('horizon:admin:astaratenants:index')
def get_success_url(self): def get_success_url(self):
return reverse("horizon:admin:rugtenants:tenant", return reverse("horizon:admin:astaratenants:tenant",
args=(self.kwargs['tenant_id'],)) args=(self.kwargs['tenant_id'],))
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):

View File

@ -0,0 +1,20 @@
# Copyright (c) 2015 Akanda, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# The name of the panel group to be added to HORIZON_CONFIG. Required.
PANEL_GROUP = 'astara'
# The display name of the PANEL_GROUP. Required.
PANEL_GROUP_NAME = 'Astara'
# The name of the dashboard the PANEL_GROUP associated with. Required.
PANEL_GROUP_DASHBOARD = 'admin'

View File

@ -1,6 +0,0 @@
# The name of the panel group to be added to HORIZON_CONFIG. Required.
PANEL_GROUP = 'rug'
# The display name of the PANEL_GROUP. Required.
PANEL_GROUP_NAME = 'RUG'
# The name of the dashboard the PANEL_GROUP associated with. Required.
PANEL_GROUP_DASHBOARD = 'admin'

View File

@ -0,0 +1,24 @@
# Copyright (c) 2015 Akanda, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# The name of the panel to be added to HORIZON_CONFIG. Required.
PANEL = 'astararouters'
# The name of the dashboard the PANEL associated with. Required.
PANEL_DASHBOARD = 'admin'
# The name of the panel group the PANEL is associated with.
PANEL_GROUP = 'astara'
# Python panel class of the PANEL to be added.
ADD_PANEL = \
'astara_horizon.astara_openstack_dashboard.dashboards.admin.astararouters.panel.AstaraRouters'

View File

@ -1,10 +0,0 @@
# The name of the panel to be added to HORIZON_CONFIG. Required.
PANEL = 'rugrouters'
# The name of the dashboard the PANEL associated with. Required.
PANEL_DASHBOARD = 'admin'
# The name of the panel group the PANEL is associated with.
PANEL_GROUP = 'rug'
# Python panel class of the PANEL to be added.
ADD_PANEL = \
'akanda_horizon.rug_openstack_dashboard.dashboards.admin.rugrouters.panel.Rugrouters'

View File

@ -0,0 +1,26 @@
# Copyright (c) 2015 Akanda, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# The name of the panel to be added to HORIZON_CONFIG. Required.
PANEL = 'astaratenants'
# The name of the dashboard the PANEL associated with. Required.
PANEL_DASHBOARD = 'admin'
# The name of the panel group the PANEL is associated with.
PANEL_GROUP = 'astara'
# Python panel class of the PANEL to be added.
ADD_PANEL = (
'astara_horizon.astara_openstack_dashboard.dashboards.admin.astaratenants.'
'panel.AstaraTenants')

View File

@ -1,12 +0,0 @@
# The name of the panel to be added to HORIZON_CONFIG. Required.
PANEL = 'rugtenants'
# The name of the dashboard the PANEL associated with. Required.
PANEL_DASHBOARD = 'admin'
# The name of the panel group the PANEL is associated with.
PANEL_GROUP = 'rug'
# Python panel class of the PANEL to be added.
ADD_PANEL = (
'akanda_horizon.rug_openstack_dashboard.dashboards.admin.rugtenants.'
'panel.Rugtenants')

View File

@ -6,7 +6,7 @@ description-file =
README.md README.md
author = OpenStack author = OpenStack
author-email = openstack-dev@lists.openstack.org author-email = openstack-dev@lists.openstack.org
home-page = http://github.com/openstack/akanda-horizon home-page = http://github.com/openstack/astara-horizon
classifier = classifier =
Environment :: OpenStack Environment :: OpenStack
Intended Audience :: Developers Intended Audience :: Developers
@ -22,10 +22,10 @@ classifier =
[files] [files]
packages = packages =
akanda_horizon astara_horizon
akanda_horizon.rug_openstack_dashboard astara_horizon.astara_openstack_dashboard
namespace_packages = namespace_packages =
akanda_horizon astara_horizon
[global] [global]
setup-hooks = setup-hooks =
@ -40,4 +40,4 @@ source-dir = doc/source
where = test where = test
verbosity = 2 verbosity = 2
detailed-errors = 1 detailed-errors = 1
cover-package = akanda_horizon cover-package = astara_horizon

View File

@ -5,7 +5,7 @@ envlist = py27,pep8
distribute = False distribute = False
setenv = VIRTUAL_ENV={envdir} setenv = VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/test-requirements.txt deps = -r{toxinidir}/test-requirements.txt
commands = nosetests --with-coverage --cover-package=akanda.rug {posargs} commands = nosetests --with-coverage {posargs}
sitepackages = False sitepackages = False
[tox:jenkins] [tox:jenkins]
@ -13,7 +13,7 @@ sitepackages = False
[testenv:style] [testenv:style]
deps = flake8 deps = flake8
setuptools_git>=0.4 setuptools_git>=0.4
commands = flake8 akanda_horizon setup.py commands = flake8 astara_horizon setup.py
[testenv:pep8] [testenv:pep8]
deps = {[testenv:style]deps} deps = {[testenv:style]deps}