Merge "Add column "Uptime" to instances overview"

This commit is contained in:
Jenkins 2013-07-29 14:42:00 +00:00 committed by Gerrit Code Review
commit a840479787
4 changed files with 15 additions and 1 deletions

View File

@ -75,7 +75,7 @@ class Server(APIResourceWrapper):
'image_name', 'VirtualInterfaces', 'flavor', 'key_name', 'image_name', 'VirtualInterfaces', 'flavor', 'key_name',
'tenant_id', 'user_id', 'OS-EXT-STS:power_state', 'tenant_id', 'user_id', 'OS-EXT-STS:power_state',
'OS-EXT-STS:task_state', 'OS-EXT-SRV-ATTR:instance_name', '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): def __init__(self, apiresource, request):
super(Server, self).__init__(apiresource) super(Server, self).__init__(apiresource)

View File

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

View File

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

View File

@ -13,6 +13,10 @@
<dd>{{ instance.id }}</dd> <dd>{{ instance.id }}</dd>
<dt>{% trans "Status" %}</dt> <dt>{% trans "Status" %}</dt>
<dd>{{ instance.status|title }}</dd> <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> </dl>
</div> </div>