Merge branch 'master' into dashboard-quantum-integration
Conflicts: django-openstack/django_openstack/urls.py
This commit is contained in:
commit
e010a494b3
32
django-openstack/django_openstack/signals.py
Normal file
32
django-openstack/django_openstack/signals.py
Normal file
@ -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: (<dash_apps_ping>,
|
||||
{'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)
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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 }
|
||||
|
@ -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
|
||||
|
@ -1,3 +1,5 @@
|
||||
{% load sidebar_modules %}
|
||||
|
||||
<div id='sidebar'>
|
||||
<h3>Manage Compute</h3>
|
||||
<ul class='sub_nav'>
|
||||
@ -16,4 +18,7 @@
|
||||
<li><a {% if current_sidebar == "containers" %} class="active" {% endif %} href="{% url dash_containers request.user.tenant %}">Containers</a></li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% dash_sidebar_modules request %}
|
||||
|
||||
</div>
|
||||
|
10
openstack-dashboard/dashboard/templates/_sidebar_module.html
Normal file
10
openstack-dashboard/dashboard/templates/_sidebar_module.html
Normal file
@ -0,0 +1,10 @@
|
||||
{% for module in modules %}
|
||||
<h3>{{module.title}}</h3>
|
||||
|
||||
<ul class="sub_nav">
|
||||
{% for link in module.links %}
|
||||
<li><a {% if request.get_full_path == link.url %} class="active" {% endif %} href="{{link.url}}">{{link.text}}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endfor %}
|
||||
|
@ -1,3 +1,5 @@
|
||||
{% load sidebar_modules %}
|
||||
|
||||
<div id='sidebar'>
|
||||
<h3>System Panel</h3>
|
||||
<ul class='sub_nav'>
|
||||
@ -10,4 +12,7 @@
|
||||
<li><a {% if current_sidebar == "users" %} class="active" {% endif %} href="{% url syspanel_users %}">Users</a></li>
|
||||
<li><a {% if current_sidebar == "quotas" %} class="active" {% endif %} href="{% url syspanel_quotas %}">Quotas</a></li>
|
||||
</ul>
|
||||
|
||||
{% syspanel_sidebar_modules request %}
|
||||
|
||||
</div>
|
||||
|
@ -25,21 +25,40 @@
|
||||
|
||||
{% block footer_js %}
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(function(){
|
||||
function loadInstances(){
|
||||
$(function(){
|
||||
function loadInstances(){
|
||||
if ($("#ajax_option_box").is(':checked')) {
|
||||
$('.refresh').addClass("refreshing");
|
||||
$('#instances').load('{% url dash_instances_refresh request.user.tenant %}', function(){
|
||||
$('.refresh').removeClass("refreshing");
|
||||
});
|
||||
}
|
||||
setInterval(function(){
|
||||
loadInstances();
|
||||
}, 15000);
|
||||
|
||||
$("a.refresh").click(function(e){
|
||||
e.preventDefault()
|
||||
loadInstances();
|
||||
})
|
||||
};
|
||||
}
|
||||
setInterval(function(){
|
||||
loadInstances();
|
||||
}, 15000);
|
||||
|
||||
loadOptionsWidget();
|
||||
|
||||
$("a.refresh").click(function(e){
|
||||
e.preventDefault()
|
||||
loadInstances();
|
||||
})
|
||||
|
||||
function loadOptionsWidget(){
|
||||
checkbox = document.createElement("input");
|
||||
cb = $(checkbox);
|
||||
cb.attr('id', 'ajax_option_box');
|
||||
cb.attr('class', 'refreshOption');
|
||||
cb.attr('type', 'checkbox');
|
||||
checkbox_label = document.createElement("label");
|
||||
cbl = $(checkbox_label);
|
||||
cbl.attr('class', 'refreshOption');
|
||||
cbl.text('auto refresh');
|
||||
cbl.attr('for', 'ajax_option_box');
|
||||
$('.right').append(cb);
|
||||
$('.right').append(cbl);
|
||||
}
|
||||
})
|
||||
</script>
|
||||
{% endblock footer_js %}
|
||||
|
@ -27,19 +27,38 @@
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(function(){
|
||||
function loadInstances(){
|
||||
$('.refresh').addClass("refreshing");
|
||||
$('#instances').load('{% url dash_instances_refresh request.user.tenant %}', function(){
|
||||
$('.refresh').removeClass("refreshing");
|
||||
});
|
||||
if ($("#ajax_option_box").is(':checked')) {
|
||||
$('.refresh').addClass("refreshing");
|
||||
$('#instances').load('{% url syspanel_instances_refresh %}', function(){
|
||||
$('.refresh').removeClass("refreshing");
|
||||
});
|
||||
};
|
||||
}
|
||||
setInterval(function(){
|
||||
loadInstances();
|
||||
}, 15000);
|
||||
|
||||
loadOptionsWidget();
|
||||
|
||||
$("a.refresh").click(function(e){
|
||||
e.preventDefault()
|
||||
loadInstances();
|
||||
})
|
||||
|
||||
function loadOptionsWidget(){
|
||||
checkbox = document.createElement("input");
|
||||
cb = $(checkbox);
|
||||
cb.attr('id', 'ajax_option_box');
|
||||
cb.attr('class', 'refreshOption');
|
||||
cb.attr('type', 'checkbox');
|
||||
checkbox_label = document.createElement("label");
|
||||
cbl = $(checkbox_label);
|
||||
cbl.attr('class', 'refreshOption');
|
||||
cbl.text('auto refresh');
|
||||
cbl.attr('for', 'ajax_option_box');
|
||||
$('.right').append(cb);
|
||||
$('.right').append(cbl);
|
||||
}
|
||||
})
|
||||
</script>
|
||||
{% endblock footer_js %}
|
||||
|
@ -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<path>.*)$' % settings.MEDIA_URL[1:],
|
||||
'django.views.static.serve',
|
||||
|
@ -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;
|
||||
|
@ -15,6 +15,7 @@ PasteDeploy
|
||||
sqlalchemy-migrate
|
||||
eventlet
|
||||
xattr
|
||||
kombu
|
||||
|
||||
bzr+https://launchpad.net/glance#egg=glance
|
||||
bzr+https://launchpad.net/quantum#egg=quantum
|
||||
|
Loading…
x
Reference in New Issue
Block a user