diff --git a/django-openstack/django_openstack/signals.py b/django-openstack/django_openstack/signals.py new file mode 100644 index 000000000..b2c7e0681 --- /dev/null +++ b/django-openstack/django_openstack/signals.py @@ -0,0 +1,32 @@ +import django.dispatch +from django.dispatch import receiver + +dash_apps_ping = django.dispatch.Signal() +dash_apps_urls = django.dispatch.Signal() + + +def dash_apps_detect(): + """ + Sends a pinging signal to the app, all listening modules will reply with + items for the sidebar. + + The response is a tuple of the Signal object instance, and a dictionary. + The values within the dictionary containing links and a title which should + be added to the sidebar navigation. + + Example: (, + {'title': 'Nixon', + 'links': [{'url':'/syspanel/nixon/google', + 'text':'Google', 'active_text': 'google'}], + 'type': syspanel}) + """ + return dash_apps_ping.send(sender=dash_apps_ping) + + +def dash_app_setup_urls(): + """ + Adds urls from modules + """ + return dash_apps_urls.send(sender=dash_apps_urls) + + diff --git a/django-openstack/django_openstack/syspanel/views/images.py b/django-openstack/django_openstack/syspanel/views/images.py index d3478f952..d0f082c68 100644 --- a/django-openstack/django_openstack/syspanel/views/images.py +++ b/django-openstack/django_openstack/syspanel/views/images.py @@ -160,7 +160,7 @@ def update(request, image_id): exc_info=True) messages.error(request, "Image could not be updated, please try again.") - + return redirect('syspanel_images_update', image_id) else: LOG.error('Image "%s" failed to update' % image['name'], exc_info=True) diff --git a/django-openstack/django_openstack/syspanel/views/instances.py b/django-openstack/django_openstack/syspanel/views/instances.py index 4f6f8cd3b..e797fb846 100644 --- a/django-openstack/django_openstack/syspanel/views/instances.py +++ b/django-openstack/django_openstack/syspanel/views/instances.py @@ -206,7 +206,7 @@ def refresh(request): instances = [] try: - instances = api.server_list(request) + instances = api.admin_server_list(request) except Exception as e: messages.error(request, 'Unable to get instance list: %s' % e.message) diff --git a/django-openstack/django_openstack/templatetags/templatetags/sidebar_modules.py b/django-openstack/django_openstack/templatetags/templatetags/sidebar_modules.py new file mode 100644 index 000000000..244a4f1f4 --- /dev/null +++ b/django-openstack/django_openstack/templatetags/templatetags/sidebar_modules.py @@ -0,0 +1,18 @@ +from django import template +from django_openstack import signals + +register = template.Library() + + +@register.inclusion_tag('_sidebar_module.html') +def dash_sidebar_modules(request): + if signals.dash_apps_detect()[0][1]['type'] == "dash": + return {'modules': [module[1] for module in signals.dash_apps_detect()], + 'request': request } + +@register.inclusion_tag('_sidebar_module.html') +def syspanel_sidebar_modules(request): + if signals.dash_apps_detect()[0][1]['type'] == "syspanel": + return {'modules': [module[1] for module in signals.dash_apps_detect()], + 'request': request } + diff --git a/django-openstack/django_openstack/urls.py b/django-openstack/django_openstack/urls.py index 92dfa2fc4..8031eb8bd 100644 --- a/django-openstack/django_openstack/urls.py +++ b/django-openstack/django_openstack/urls.py @@ -20,6 +20,7 @@ from django.conf.urls.defaults import * from django.conf import settings +from django_openstack.signals import * urlpatterns = patterns('', url(r'^auth/', include('django_openstack.auth.urls')), @@ -27,3 +28,6 @@ urlpatterns = patterns('', url(r'^syspanel/', include('django_openstack.syspanel.urls')), ) +# import urls from modules +for module_urls in dash_apps_urls.send(sender=dash_apps_urls): + urlpatterns += module_urls[1].urlpatterns diff --git a/openstack-dashboard/dashboard/templates/_dash_sidebar.html b/openstack-dashboard/dashboard/templates/_dash_sidebar.html index d356ebe14..af56e455a 100644 --- a/openstack-dashboard/dashboard/templates/_dash_sidebar.html +++ b/openstack-dashboard/dashboard/templates/_dash_sidebar.html @@ -1,3 +1,5 @@ +{% load sidebar_modules %} + diff --git a/openstack-dashboard/dashboard/templates/_sidebar_module.html b/openstack-dashboard/dashboard/templates/_sidebar_module.html new file mode 100644 index 000000000..a472725e5 --- /dev/null +++ b/openstack-dashboard/dashboard/templates/_sidebar_module.html @@ -0,0 +1,10 @@ +{% for module in modules %} +

{{module.title}}

+ + +{% endfor %} + diff --git a/openstack-dashboard/dashboard/templates/_syspanel_sidebar.html b/openstack-dashboard/dashboard/templates/_syspanel_sidebar.html index 45883f786..e152e4df8 100644 --- a/openstack-dashboard/dashboard/templates/_syspanel_sidebar.html +++ b/openstack-dashboard/dashboard/templates/_syspanel_sidebar.html @@ -1,3 +1,5 @@ +{% load sidebar_modules %} + diff --git a/openstack-dashboard/dashboard/templates/dash_instances.html b/openstack-dashboard/dashboard/templates/dash_instances.html index f6b1d9195..7d7d20190 100644 --- a/openstack-dashboard/dashboard/templates/dash_instances.html +++ b/openstack-dashboard/dashboard/templates/dash_instances.html @@ -25,21 +25,40 @@ {% block footer_js %} {% endblock footer_js %} diff --git a/openstack-dashboard/dashboard/templates/syspanel_instances.html b/openstack-dashboard/dashboard/templates/syspanel_instances.html index 684b5189c..31dfc4565 100644 --- a/openstack-dashboard/dashboard/templates/syspanel_instances.html +++ b/openstack-dashboard/dashboard/templates/syspanel_instances.html @@ -27,19 +27,38 @@ {% endblock footer_js %} diff --git a/openstack-dashboard/dashboard/urls.py b/openstack-dashboard/dashboard/urls.py index 1eee8fa53..b3f552f80 100644 --- a/openstack-dashboard/dashboard/urls.py +++ b/openstack-dashboard/dashboard/urls.py @@ -29,7 +29,6 @@ import django.views.i18n from django_openstack import urls as django_openstack_urls - urlpatterns = patterns('', url(r'^$', 'dashboard.views.splash', name='splash'), url(r'^dash/$', 'django_openstack.dash.views.instances.usage', name='dash_overview'), @@ -40,7 +39,6 @@ urlpatterns = patterns('', # NOTE(termie): just append them since we want the routes at the root urlpatterns += django_openstack_urls.urlpatterns - urlpatterns += patterns('', (r'^%s(?P.*)$' % settings.MEDIA_URL[1:], 'django.views.static.serve', diff --git a/openstack-dashboard/media/dashboard/css/style.css b/openstack-dashboard/media/dashboard/css/style.css index de6681916..f7b3a22eb 100644 --- a/openstack-dashboard/media/dashboard/css/style.css +++ b/openstack-dashboard/media/dashboard/css/style.css @@ -317,6 +317,19 @@ a.refresh.refreshing { background: url(../images/spinner.gif) top left no-repeat; } +input.refreshOption { + margin: 10px 0 0 0; + float: right; + clear: both; +} + +label.refreshOption { + font-size: 11px; + margin: -17px 20px 0 0; + float: right; + clear: both; +} + #monitoring { background: #f8f8f8; font-size: 14px; diff --git a/openstack-dashboard/tools/pip-requires b/openstack-dashboard/tools/pip-requires index 46e05429c..fbfc40ce1 100644 --- a/openstack-dashboard/tools/pip-requires +++ b/openstack-dashboard/tools/pip-requires @@ -15,6 +15,7 @@ PasteDeploy sqlalchemy-migrate eventlet xattr +kombu bzr+https://launchpad.net/glance#egg=glance bzr+https://launchpad.net/quantum#egg=quantum