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:
parent
699926413c
commit
a12d4391c4
@ -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)
|
||||||
|
@ -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"
|
||||||
|
@ -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"
|
||||||
|
@ -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>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user