Add column "Uptime" to instances overview

Add column "Uptime" to instances overview
in project and admin panels. Add "Created"
and "Uptime" to instance details view.

fixes bug 1202889

Change-Id: I84559da6ca9ed750a9073dbb6203b49932df34fc
This commit is contained in:
Tatiana Mazur 2013-07-19 15:38:02 +04:00
parent 699926413c
commit a12d4391c4
4 changed files with 15 additions and 1 deletions

View File

@ -75,7 +75,7 @@ class Server(APIResourceWrapper):
'image_name', 'VirtualInterfaces', 'flavor', 'key_name',
'tenant_id', 'user_id', 'OS-EXT-STS:power_state',
'OS-EXT-STS:task_state', 'OS-EXT-SRV-ATTR:instance_name',
'OS-EXT-SRV-ATTR:host']
'OS-EXT-SRV-ATTR:host', 'created']
def __init__(self, apiresource, request):
super(Server, self).__init__(apiresource)

View File

@ -17,10 +17,12 @@
import logging
from django.template.defaultfilters import timesince
from django.template.defaultfilters import title
from django.utils.translation import ugettext_lazy as _
from horizon import tables
from horizon.utils.filters import parse_isotime
from horizon.utils.filters import replace_underscores
from openstack_dashboard import api
@ -152,6 +154,9 @@ class AdminInstancesTable(tables.DataTable):
state = tables.Column(get_power_state,
filters=(title, replace_underscores),
verbose_name=_("Power State"))
created = tables.Column("created",
verbose_name=_("Uptime"),
filters=(parse_isotime, timesince))
class Meta:
name = "instances"

View File

@ -18,6 +18,7 @@
from django.core import urlresolvers
from django import shortcuts
from django import template
from django.template.defaultfilters import timesince
from django.template.defaultfilters import title
from django.utils.http import urlencode
from django.utils.translation import string_concat
@ -28,6 +29,7 @@ from horizon import exceptions
from horizon import messages
from horizon import tables
from horizon.templatetags import sizeformat
from horizon.utils.filters import parse_isotime
from horizon.utils.filters import replace_underscores
import logging
@ -548,6 +550,9 @@ class InstancesTable(tables.DataTable):
state = tables.Column(get_power_state,
filters=(title, replace_underscores),
verbose_name=_("Power State"))
created = tables.Column("created",
verbose_name=_("Uptime"),
filters=(parse_isotime, timesince))
class Meta:
name = "instances"

View File

@ -13,6 +13,10 @@
<dd>{{ instance.id }}</dd>
<dt>{% trans "Status" %}</dt>
<dd>{{ instance.status|title }}</dd>
<dt>{% trans "Created" %}</dt>
<dd>{{ instance.created|parse_isotime }}</dd>
<dt>{% trans "Uptime" %}</dt>
<dd>{{ instance.created|parse_isotime|timesince }}</dd>
</dl>
</div>