diff --git a/django-openstack/src/django_openstack/auth/__init__.py b/django-openstack/src/django_openstack/auth/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/django-openstack/src/django_openstack/auth/urls.py b/django-openstack/src/django_openstack/auth/urls.py new file mode 100644 index 000000000..374a14f33 --- /dev/null +++ b/django-openstack/src/django_openstack/auth/urls.py @@ -0,0 +1,11 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +from django.conf.urls.defaults import * +from django.conf import settings + + +urlpatterns = patterns('django_openstack.auth.views', + url(r'login/$', 'login', name='auth_login'), + url(r'logout/$', 'logout', name='auth_logout'), +) + diff --git a/django-openstack/src/django_openstack/nova/views/auth.py b/django-openstack/src/django_openstack/auth/views.py similarity index 93% rename from django-openstack/src/django_openstack/nova/views/auth.py rename to django-openstack/src/django_openstack/auth/views.py index 127494f57..9a2675940 100644 --- a/django-openstack/src/django_openstack/nova/views/auth.py +++ b/django-openstack/src/django_openstack/auth/views.py @@ -8,7 +8,7 @@ from django_openstack.nova import forms as nova_forms from openstackx.api import exceptions as api_exceptions -def token(request): +def login(request): if request.method == 'POST': form = nova_forms.Login(request.POST) if form.is_valid(): @@ -24,9 +24,9 @@ def token(request): request.session['admin'] = info['admin'] if request.session['admin']: - return shortcuts.redirect('syspanel_overview') + return shortcuts.redirect('admin_overview') else: - return shortcuts.redirect('nova_overview') + return shortcuts.redirect('user_overview') except api_exceptions.Unauthorized as e: messages.error(request, 'Error authenticating: %s' % e.message) @@ -61,7 +61,7 @@ def switch_tenants(request, tenant_id): },context_instance=template.RequestContext(request)) -def destroy_token(request): +def logout(request): request.session.clear() return shortcuts.redirect('novaO_instances') diff --git a/django-openstack/src/django_openstack/dash/__init__.py b/django-openstack/src/django_openstack/dash/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/django-openstack/src/django_openstack/dash/urls.py b/django-openstack/src/django_openstack/dash/urls.py new file mode 100644 index 000000000..40e6c4722 --- /dev/null +++ b/django-openstack/src/django_openstack/dash/urls.py @@ -0,0 +1,18 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +from django.conf.urls.defaults import * +from django.conf import settings + +urlpatterns = patterns('django_openstack.dash.views.instances', + url(r'^(?P[^/]+)/instances', 'index', name='dash_instances'), +) + +urlpatterns += patterns('django_openstack.dash.views.images', + url(r'^(?P[^/]+)/images/$', 'index', name='dash_images'), + url(r'^(?P[^/]+)/images/upload/$', + 'upload', + name='dash_images_upload'), + url(r'^(?P[^/]+)/images/(?P[^/]+)/launch/$', + 'launch', + name='dash_images_launch'), +) diff --git a/django-openstack/src/django_openstack/dash/views/__init__.py b/django-openstack/src/django_openstack/dash/views/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/django-openstack/src/django_openstack/nova/views/images.py b/django-openstack/src/django_openstack/dash/views/images.py similarity index 96% rename from django-openstack/src/django_openstack/nova/views/images.py rename to django-openstack/src/django_openstack/dash/views/images.py index 5f8f2fb96..ee9c07877 100644 --- a/django-openstack/src/django_openstack/nova/views/images.py +++ b/django-openstack/src/django_openstack/dash/views/images.py @@ -63,14 +63,9 @@ def _image_lists(images, tenant_id): @handle_nova_error def index(request, tenant_id): tenant = api.get_tenant(request, request.user.tenant) - logging.info('TENANT: %s', tenant) - #project = shortcuts.get_project_or_404(request, project_id) images = api.glance_api(request).get_images_detailed() - logging.info('IMAGES: %s', images) - return render_to_response('django_openstack/nova/images/index.html', { - 'form': nova_forms.LaunchForm(), - #'region': project.region, + return render_to_response('dash_images.html', { 'tenant': tenant, 'image_lists': _image_lists(images, request.user.tenant), }, context_instance=template.RequestContext(request)) @@ -138,6 +133,18 @@ def detail(request, tenant_id, image_id): 'image': image, }, context_instance=template.RequestContext(request)) +@login_required +@handle_nova_error +def upload(request, tenant_id): + tenant = api.get_tenant(request, request.user.tenant) + return render_to_response('dash_upload.html', { + 'form': None, #nova_forms.UploadForm(), + 'tenant': tenant, + }, context_instance=template.RequestContext(request)) + + + pass + # TODO(termie): below = NotImplemented diff --git a/django-openstack/src/django_openstack/nova/views/instances.py b/django-openstack/src/django_openstack/dash/views/instances.py similarity index 97% rename from django-openstack/src/django_openstack/nova/views/instances.py rename to django-openstack/src/django_openstack/dash/views/instances.py index 5e6de5203..033da4474 100644 --- a/django-openstack/src/django_openstack/nova/views/instances.py +++ b/django-openstack/src/django_openstack/dash/views/instances.py @@ -47,12 +47,8 @@ LOG = logging.getLogger('django_openstack.nova') def index(request, tenant_id): tenant = api.get_tenant(request, request.user.tenant) instances = api.compute_api(request).servers.list() - logging.info('instances: %s', instances) - #instances = sorted(project.get_instances(), - # key=lambda k: k.public_dns_name) - return render_to_response('django_openstack/nova/instances/index.html', { - #'region': project.region, + return render_to_response('dash_instances.html', { 'tenant': tenant, 'instances': instances, 'detail': False, diff --git a/django-openstack/src/django_openstack/templates/django_openstack/auth/_login.html b/django-openstack/src/django_openstack/templates/django_openstack/auth/_login.html index 0e063e9d8..f726fd97f 100644 --- a/django-openstack/src/django_openstack/templates/django_openstack/auth/_login.html +++ b/django-openstack/src/django_openstack/templates/django_openstack/auth/_login.html @@ -1,4 +1,4 @@ -
+ {% csrf_token %}
{% for hidden in form.hidden_fields %} diff --git a/django-openstack/src/django_openstack/urls.py b/django-openstack/src/django_openstack/urls.py new file mode 100644 index 000000000..36283e1c9 --- /dev/null +++ b/django-openstack/src/django_openstack/urls.py @@ -0,0 +1,10 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +from django.conf.urls.defaults import * +from django.conf import settings + +urlpatterns = patterns('', + url(r'^auth/', include('django_openstack.auth.urls')), + url(r'^dash/', include('django_openstack.dash.urls')), +) diff --git a/openstack-dashboard/dashboard/templates/_dash_sidebar.html b/openstack-dashboard/dashboard/templates/_dash_sidebar.html new file mode 100644 index 000000000..38e79e669 --- /dev/null +++ b/openstack-dashboard/dashboard/templates/_dash_sidebar.html @@ -0,0 +1,3 @@ +SIDEBAR +instances +images diff --git a/openstack-dashboard/dashboard/templates/_footer.html b/openstack-dashboard/dashboard/templates/_footer.html new file mode 100644 index 000000000..3aad1ddc1 --- /dev/null +++ b/openstack-dashboard/dashboard/templates/_footer.html @@ -0,0 +1 @@ +FOOTER diff --git a/openstack-dashboard/dashboard/templates/_header.html b/openstack-dashboard/dashboard/templates/_header.html new file mode 100644 index 000000000..a5bcc79c1 --- /dev/null +++ b/openstack-dashboard/dashboard/templates/_header.html @@ -0,0 +1 @@ +HEADER diff --git a/openstack-dashboard/dashboard/templates/_image_list.html b/openstack-dashboard/dashboard/templates/_image_list.html new file mode 100644 index 000000000..1fa7a3066 --- /dev/null +++ b/openstack-dashboard/dashboard/templates/_image_list.html @@ -0,0 +1 @@ +IMAGE_LIST diff --git a/openstack-dashboard/dashboard/templates/_instance_list.html b/openstack-dashboard/dashboard/templates/_instance_list.html new file mode 100644 index 000000000..de0d35672 --- /dev/null +++ b/openstack-dashboard/dashboard/templates/_instance_list.html @@ -0,0 +1 @@ +INSTANCE_LIST diff --git a/openstack-dashboard/dashboard/templates/_launch.html b/openstack-dashboard/dashboard/templates/_launch.html new file mode 100644 index 000000000..e69de29bb diff --git a/openstack-dashboard/dashboard/templates/_topbar.html b/openstack-dashboard/dashboard/templates/_topbar.html new file mode 100644 index 000000000..b5360b98d --- /dev/null +++ b/openstack-dashboard/dashboard/templates/_topbar.html @@ -0,0 +1 @@ +TOPBAR diff --git a/openstack-dashboard/dashboard/templates/_upload.html b/openstack-dashboard/dashboard/templates/_upload.html new file mode 100644 index 000000000..e061c7914 --- /dev/null +++ b/openstack-dashboard/dashboard/templates/_upload.html @@ -0,0 +1 @@ +UPLOAD_FORM diff --git a/openstack-dashboard/dashboard/templates/admin_base.html b/openstack-dashboard/dashboard/templates/admin_base.html new file mode 100644 index 000000000..ad5c109a2 --- /dev/null +++ b/openstack-dashboard/dashboard/templates/admin_base.html @@ -0,0 +1,6 @@ +{% extends 'base.html' %} + +{% block topbar %}{% endblock %} +{% block sidebar %}{% endblock %} +{% block main %}{% endblock %} + diff --git a/openstack-dashboard/dashboard/templates/admin_overview.html b/openstack-dashboard/dashboard/templates/admin_overview.html new file mode 100644 index 000000000..9343607bb --- /dev/null +++ b/openstack-dashboard/dashboard/templates/admin_overview.html @@ -0,0 +1,4 @@ +{% extends 'admin_base.html' %} + +{# default landing page for a admin user #} +{# nav bar on top, sidebar, overview info in main #} diff --git a/openstack-dashboard/dashboard/templates/base-root.html b/openstack-dashboard/dashboard/templates/base-root.html index ca96b43db..d70dd3ddf 100644 --- a/openstack-dashboard/dashboard/templates/base-root.html +++ b/openstack-dashboard/dashboard/templates/base-root.html @@ -1,59 +1,83 @@ -{% load branding i18n %} - + - - - {% site_branding %} Dashboard{% block title %}{% endblock %}{% block subtitle %}{% endblock %} - - - {% block headercss %}{% endblock %} - - - - - - + + OpenStack Dashboard{% block title %}{% endblock %} + + + + + + + {% block headerjs %}{% endblock %} + {% block headercss %}{% endblock %} -
- +
+