Skip to content

Commit

Permalink
Add floating ip status to table
Browse files Browse the repository at this point in the history
There is missing ability to see Floating IP status in Horizon
The ability exist in CLI and was enhanced by
https://blueprints.launchpad.net/neutron/+spec/fip-op-status
This patch add the missing attribute to the floating ip table.

Change-Id: Ic64624422a6e1dce828b329eac9938bafabb84bf
Closes-bug: #1323604
  • Loading branch information
liyingjun committed Oct 14, 2014
1 parent 4a94247 commit ad13b6f
Showing 1 changed file with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from django.core.urlresolvers import reverse
from django import shortcuts
from django.utils.http import urlencode
from django.utils.translation import pgettext_lazy
from django.utils.translation import string_concat # noqa
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
Expand Down Expand Up @@ -174,7 +175,19 @@ def get_instance_link(datum):
return None


STATUS_DISPLAY_CHOICES = (
("active", pgettext_lazy("Current status of a Floating IP", u"Active")),
("down", pgettext_lazy("Current status of a Floating IP", u"Down")),
("error", pgettext_lazy("Current status of a Floating IP", u"Error")),
)


class FloatingIPsTable(tables.DataTable):
STATUS_CHOICES = (
("active", True),
("down", True),
("error", False)
)
ip = tables.Column("ip",
verbose_name=_("IP Address"),
attrs={'data-type': "ip"})
Expand All @@ -183,8 +196,20 @@ class FloatingIPsTable(tables.DataTable):
verbose_name=_("Mapped Fixed IP Address"),
empty_value="-")
pool = tables.Column("pool_name",
verbose_name=_("Floating IP Pool"),
verbose_name=_("Pool"),
empty_value="-")
status = tables.Column("status",
verbose_name=_("Status"),
status=True,
status_choices=STATUS_CHOICES,
display_choices=STATUS_DISPLAY_CHOICES)

def __init__(self, request, data=None, needs_form_wrapper=None, **kwargs):
super(FloatingIPsTable, self).__init__(
request, data=data, needs_form_wrapper=needs_form_wrapper,
**kwargs)
if not api.base.is_service_enabled(request, 'network'):
del self.columns['status']

def sanitize_id(self, obj_id):
return filters.get_int_or_uuid(obj_id)
Expand Down

0 comments on commit ad13b6f

Please sign in to comment.