Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add facebook login to essex #1

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pylint.txt
reports
horizon.egg-info
openstack_dashboard/local/local_settings.py
openstack_dashboard/test/.secret_key_store
doc/build/
doc/source/sourcecode
/static/
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
recursive-include bin *.js
recursive-include doc *.py *.rst *.css *.js *.html *.conf *.jpg *.gif *.png *.css_t
recursive-include horizon *.html *.css *.js *.csv *.template *.tmpl *.mo *.po
recursive-include openstack_dashboard *.html *.js *.css *.less *.csv *.template *.mo *.po *.example *.eot *.svg *.ttf *.woff *.png *.gif *.ico *.wsgi
recursive-include openstack_dashboard *.html *.js *.less *.mo *.po *.example *.eot *.svg *.ttf *.woff *.png *.ico *.wsgi
recursive-include tools *.py *.sh

include AUTHORS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def get_instance_info(instance):


def get_instance_link(datum):
view = "horizon:nova:instances_and_volumes:instances:detail"
view = "horizon:nova:instances:detail"
if datum.instance_id:
return urlresolvers.reverse(view, args=(datum.instance_id,))
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def test_associate_post_with_redirect(self):
form_data = {'instance_id': server.id,
'ip_id': floating_ip.id}
url = reverse('%s:associate' % NAMESPACE)
next = reverse("horizon:nova:instances_and_volumes:index")
next = reverse("horizon:nova:instances:index")
res = self.client.post("%s?next=%s" % (url, next), form_data)
self.assertRedirectsNoFollow(res, next)

Expand Down
9 changes: 4 additions & 5 deletions horizon/dashboards/nova/containers/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,14 @@ def sanitize_name(name):
return name.split("/")[-1]


def get_size(obj):
return filesizeformat(obj.size)


class ObjectsTable(tables.DataTable):
name = tables.Column("name",
verbose_name=_("Object Name"),
filters=(sanitize_name,))
size = tables.Column(get_size, verbose_name=_('Size'))
size = tables.Column("size",
verbose_name=_('Size'),
filters=(filesizeformat,),
summation="sum")

def get_object_id(self, obj):
return obj.name
Expand Down
3 changes: 2 additions & 1 deletion horizon/dashboards/nova/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class BasePanels(horizon.PanelGroup):
slug = "compute"
name = _("Manage Compute")
panels = ('overview',
'instances_and_volumes',
'instances',
'volumes',
'images_and_snapshots',
'access_and_security')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
class LaunchImage(tables.LinkAction):
name = "launch_image"
verbose_name = _("Launch")
url = "horizon:nova:instances_and_volumes:instances:launch"
url = "horizon:nova:instances:launch"
classes = ("btn-launch", "ajax-modal")

def get_link_url(self, datum):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def handle(self, request, data):
return shortcuts.redirect('horizon:nova:images_and_snapshots:'
'index')
except:
redirect = reverse("horizon:nova:instances_and_volumes:index")
redirect = reverse("horizon:nova:instances:index")
exceptions.handle(request,
_('Unable to create snapshot.'),
redirect=redirect)
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
class LaunchSnapshot(tables.LinkAction):
name = "launch_snapshot"
verbose_name = _("Launch")
url = "horizon:nova:instances_and_volumes:instances:launch"
url = "horizon:nova:instances:launch"
classes = ("btn-launch", "ajax-modal")

def get_link_url(self, datum):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_create_snapshot_get_with_invalid_status(self):
url = reverse('horizon:nova:images_and_snapshots:snapshots:create',
args=[server.id])
res = self.client.get(url)
redirect = reverse("horizon:nova:instances_and_volumes:index")
redirect = reverse("horizon:nova:instances:index")
self.assertRedirectsNoFollow(res, redirect)

def test_create_get_server_exception(self):
Expand All @@ -64,7 +64,7 @@ def test_create_get_server_exception(self):
url = reverse('horizon:nova:images_and_snapshots:snapshots:create',
args=[server.id])
res = self.client.get(url)
redirect = reverse("horizon:nova:instances_and_volumes:index")
redirect = reverse("horizon:nova:instances:index")
self.assertRedirectsNoFollow(res, redirect)

def test_create_snapshot_post(self):
Expand Down Expand Up @@ -107,5 +107,5 @@ def test_create_snapshot_post_exception(self):
url = reverse('horizon:nova:images_and_snapshots:snapshots:create',
args=[server.id])
res = self.client.post(url, formData)
redirect = reverse("horizon:nova:instances_and_volumes:index")
redirect = reverse("horizon:nova:instances:index")
self.assertRedirectsNoFollow(res, redirect)
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CreateView(forms.ModalFormView):
template_name = 'nova/images_and_snapshots/snapshots/create.html'

def get_initial(self):
redirect = reverse('horizon:nova:instances_and_volumes:index')
redirect = reverse('horizon:nova:instances:index')
instance_id = self.kwargs["instance_id"]
try:
self.instance = api.server_get(self.request, instance_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from horizon import api
from horizon import tables
from ...instances_and_volumes.volumes import tables as volume_tables
from ...volumes import tables as volume_tables


LOG = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@
class VolumeSnapshotsViewTests(test.TestCase):
def test_create_snapshot_get(self):
volume = self.volumes.first()
res = self.client.get(reverse('horizon:nova:instances_and_volumes:'
'volumes:create_snapshot',
res = self.client.get(reverse('horizon:nova:volumes:create_snapshot',
args=[volume.id]))

self.assertTemplateUsed(res, 'nova/instances_and_volumes/'
'volumes/create_snapshot.html')
self.assertTemplateUsed(res, 'nova/volumes/create_snapshot.html')

def test_create_snapshot_post(self):
volume = self.volumes.first()
Expand All @@ -56,7 +54,6 @@ def test_create_snapshot_post(self):
'volume_id': volume.id,
'name': snapshot.display_name,
'description': snapshot.display_description}
url = reverse('horizon:nova:instances_and_volumes:volumes:'
'create_snapshot', args=[volume.id])
url = reverse('horizon:nova:volumes:create_snapshot', args=[volume.id])
res = self.client.post(url, formData)
self.assertRedirectsNoFollow(res, INDEX_URL)
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,4 @@ def handle(self, request, data):
except:
exceptions.handle(request, _('Unable to update instance.'))

return shortcuts.redirect(
'horizon:nova:instances_and_volumes:index')
return shortcuts.redirect('horizon:nova:instances:index')
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
from horizon.dashboards.nova import dashboard


class InstancesAndVolumes(horizon.Panel):
name = _("Instances & Volumes")
slug = 'instances_and_volumes'
class Instances(horizon.Panel):
name = _("Instances")
slug = 'instances'


dashboard.Nova.register(InstancesAndVolumes)
dashboard.Nova.register(Instances)
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ def action(self, request, obj_id):
class LaunchLink(tables.LinkAction):
name = "launch"
verbose_name = _("Launch Instance")
url = "horizon:nova:instances_and_volumes:instances:launch"
url = "horizon:nova:instances:launch"
classes = ("btn-launch", "ajax-modal")


class EditInstance(tables.LinkAction):
name = "edit"
verbose_name = _("Edit Instance")
url = "horizon:nova:instances_and_volumes:instances:update"
url = "horizon:nova:instances:update"
classes = ("ajax-modal", "btn-edit")


Expand All @@ -170,7 +170,7 @@ def allowed(self, request, instance=None):
class ConsoleLink(tables.LinkAction):
name = "console"
verbose_name = _("VNC Console")
url = "horizon:nova:instances_and_volumes:instances:detail"
url = "horizon:nova:instances:detail"
classes = ("btn-console",)

def allowed(self, request, instance=None):
Expand All @@ -185,7 +185,7 @@ def get_link_url(self, datum):
class LogLink(tables.LinkAction):
name = "log"
verbose_name = _("View Log")
url = "horizon:nova:instances_and_volumes:instances:detail"
url = "horizon:nova:instances:detail"
classes = ("btn-log",)

def allowed(self, request, instance=None):
Expand All @@ -205,7 +205,7 @@ class AssociateIP(tables.LinkAction):

def get_link_url(self, datum):
base_url = urlresolvers.reverse(self.url)
next = urlresolvers.reverse("horizon:nova:instances_and_volumes:index")
next = urlresolvers.reverse("horizon:nova:instances:index")
params = {"instance_id": self.table.get_object_id(datum),
IPAssociationWorkflow.redirect_param_name: next}
params = urlencode(params)
Expand All @@ -222,21 +222,23 @@ def get_data(self, request, instance_id):


def get_ips(instance):
template_name = 'nova/instances_and_volumes/instances/_instance_ips.html'
template_name = 'nova/instances/_instance_ips.html'
context = {"instance": instance}
return template.loader.render_to_string(template_name, context)


def get_size(instance):
if hasattr(instance, "full_flavor"):
size_string = _("%(name)s | %(RAM)s RAM | %(VCPU)s VCPU | %(disk)s Disk")
size_string = _("%(name)s | %(RAM)s RAM | %(VCPU)s VCPU "
"| %(disk)s Disk")
vals = {'name': instance.full_flavor.name,
'RAM': sizeformat.mbformat(instance.full_flavor.ram),
'VCPU': instance.full_flavor.vcpus,
'disk': sizeformat.diskgbformat(instance.full_flavor.disk)}
return size_string % vals
return _("Not available")


def get_keyname(instance):
if hasattr(instance, "key_name"):
keyname = instance.key_name
Expand All @@ -263,8 +265,7 @@ class InstancesTable(tables.DataTable):
("image_snapshot", "Snapshotting"),
)
name = tables.Column("name",
link=("horizon:nova:instances_and_volumes:"
"instances:detail"),
link=("horizon:nova:instances:detail"),
verbose_name=_("Instance Name"))
ip = tables.Column(get_ips, verbose_name=_("IP Address"))
size = tables.Column(get_size, verbose_name=_("Size"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
class OverviewTab(tabs.Tab):
name = _("Overview")
slug = "overview"
template_name = ("nova/instances_and_volumes/instances/"
template_name = ("nova/instances/"
"_detail_overview.html")

def get_context_data(self, request):
Expand All @@ -34,7 +34,7 @@ def get_context_data(self, request):
class LogTab(tabs.Tab):
name = _("Log")
slug = "log"
template_name = "nova/instances_and_volumes/instances/_detail_log.html"
template_name = "nova/instances/_detail_log.html"
preload = False

def get_context_data(self, request):
Expand All @@ -53,7 +53,7 @@ def get_context_data(self, request):
class VNCTab(tabs.Tab):
name = _("VNC")
slug = "vnc"
template_name = "nova/instances_and_volumes/instances/_detail_vnc.html"
template_name = "nova/instances/_detail_vnc.html"
preload = False

def get_context_data(self, request):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<div class="clearfix">
<h3 class="pull-left">Instance Console Log</h3>
<p class="pull-right">
{% url horizon:nova:instances_and_volumes:instances:console instance.id as console_url %}
{% url horizon:nova:instances:console instance.id as console_url %}
<a class="btn btn-small" target="_blank" href="{{ console_url }}">{% trans "View Full Log" %}</a>
</p>

<form id="tail_length" action="{% url horizon:nova:instances_and_volumes:instances:console instance.id %}" class="span3 pull-right">
<form id="tail_length" action="{% url horizon:nova:instances:console instance.id %}" class="span3 pull-right">
<label class="pull-left log-length" for="tail_length_select">Log Length</label>
<input class="span1" type="text" name="length" value="35" />
<input value="Go" class="btn-small btn-primary" type="submit" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ <h4>{% trans "Volumes Attached" %}</h4>
{% for volume in instance.volumes %}
<dt>{% trans "Attached To" %}</dt>
<dd>
<a href="{% url horizon:nova:instances_and_volumes:volumes:detail volume.volumeId %}">{{ volume.name }}</a><span> {% trans "on" %} {{ volume.device }}</span>
<a href="{% url horizon:nova:volumes:detail volume.volumeId %}">{{ volume.name }}</a><span> {% trans "on" %} {{ volume.device }}</span>
</dd>
{% empty %}
<dt>{% trans "Volume" %}</dt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ <h3>{% trans "Instance VNC Console" %}</h3>
<iframe src="{{ vnc_url }}" width="728" height="436"></iframe>
{% else %}
<p class='alert alert-error'>{% blocktrans %}VNC console is currently unavailabe. Please try again later.{% endblocktrans %}
<a class='btn btn-mini' href="{% url horizon:nova:instances_and_volumes:instances:detail instance_id %}">{% trans "Reload" %}</a></p>
{% endif %}
<a class='btn btn-mini' href="{% url horizon:nova:instances:detail instance_id %}">{% trans "Reload" %}</a></p>
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% load i18n %}

{% block form_id %}update_instance_form{% endblock %}
{% block form_action %}{% url horizon:nova:instances_and_volumes:instances:update instance.id %}{% endblock %}
{% block form_action %}{% url horizon:nova:instances:update instance.id %}{% endblock %}

{% block modal-header %}{% trans "Edit Instance" %}{% endblock %}

Expand All @@ -20,5 +20,5 @@ <h3>{% trans "Description:" %}</h3>

{% block modal-footer %}
<input class="btn btn-primary pull-right" type="submit" value="{% trans "Save Changes" %}" />
<a href="{% url horizon:nova:instances_and_volumes:index %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
<a href="{% url horizon:nova:instances:index %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
{% endblock %}
11 changes: 11 additions & 0 deletions horizon/dashboards/nova/instances/templates/instances/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% extends 'nova/base.html' %}
{% load i18n %}
{% block title %}{% trans "Instances" %}{% endblock %}

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

{% block dash_main %}
{{ table.render }}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
{% endblock page_header %}

{% block dash_main %}
{% include 'nova/instances_and_volumes/instances/_update.html' %}
{% include 'nova/instances/_update.html' %}
{% endblock %}
Loading