Fix empty Create/Update column in cluster/profile... tables

we use the filter parse_isotime
(https://github.com/openstack/horizon/blob/master/horizon/utils/filters.py#L32),
the function except string rather than datetime object.

But the python-openstack
(https://github.com/openstack/python-openstacksdk/blob/master/openstack/cluster/v1/profile.py#L44)
return datetime object parsed from ISO 8601 formatted string,
so we could remove the filter.

Change-Id: I55832284ef8716e7ea8f17ec34edc9ef9f5d02b7
Closes-Bug: #1566349
(cherry picked from commit e809df5b0a)
This commit is contained in:
Liuqing Jing 2016-04-05 23:16:14 -04:00
parent 44dbeeab02
commit 610cc0e4d7
10 changed files with 20 additions and 40 deletions

View File

@ -17,7 +17,6 @@ from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import tables
from horizon.utils import filters
from senlin_dashboard import api
from senlin_dashboard import exceptions
@ -46,7 +45,7 @@ def get_profile_link(cluster):
def get_updated_time(object):
return filters.parse_isotime(object.updated_at) or None
return object.updated_at or None
class DeleteCluster(tables.DeleteAction):
@ -126,9 +125,6 @@ class ClustersTable(tables.DataTable):
created = tables.Column(
"created_at",
verbose_name=_("Created"),
filters=(
filters.parse_isotime,
)
)
updated = tables.Column(
get_updated_time,

View File

@ -1,4 +1,4 @@
{% load i18n parse_date nbsp %}
{% load i18n nbsp %}
<div class="detail">
<h4>{% trans "Information" %}</h4>
@ -13,10 +13,10 @@
<dt>{% trans "Status" %}</dt>
<dd>{{ cluster.status }}</dd>
<dt>{% trans "Created" context "Created time" %}</dt>
<dd>{{ cluster.created_at|parse_date }}</dd>
<dd>{{ cluster.created_at }}</dd>
{% if cluster.updated_at %}
<dt>{% trans "Updated" context "Updated time" %}</dt>
<dd>{{ cluster.updated_at|parse_date }}</dd>
<dd>{{ cluster.updated_at }}</dd>
{% endif %}
</dl>
</div>

View File

@ -16,7 +16,6 @@ from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import tables
from horizon.utils import filters
from senlin_dashboard import api
from senlin_dashboard import exceptions
@ -82,7 +81,7 @@ def get_cluster_link(node):
def get_updated_time(object):
return filters.parse_isotime(object.updated_at) or None
return object.updated_at or None
class NodesTable(tables.DataTable):
@ -130,9 +129,6 @@ class NodesTable(tables.DataTable):
created = tables.Column(
"created_at",
verbose_name=_("Created"),
filters=(
filters.parse_isotime,
)
)
updated = tables.Column(
get_updated_time,

View File

@ -1,4 +1,4 @@
{% load i18n parse_date nbsp %}
{% load i18n nbsp %}
<div class="detail">
<h4>{% trans "Information" %}</h4>
@ -19,10 +19,10 @@
<dd>{{ node.role }}</dd>
{% endif %}
<dt>{% trans "Created" context "Created time" %}</dt>
<dd>{{ node.created_at|parse_date }}</dd>
<dd>{{ node.created_at }}</dd>
{% if node.updated_at %}
<dt>{% trans "Updated" context "Updated time" %}</dt>
<dd>{{ node.updated_at|parse_date }}</dd>
<dd>{{ node.updated_at }}</dd>
{% endif %}
</dl>

View File

@ -14,7 +14,6 @@ from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import tables
from horizon.utils import filters
from senlin_dashboard import api
from senlin_dashboard.cluster.policies import forms as policies_forms
@ -51,7 +50,7 @@ class DeletePolicy(tables.DeleteAction):
def get_updated_time(object):
return filters.parse_isotime(object.updated_at) or None
return object.updated_at or None
class PoliciesTable(tables.DataTable):
@ -61,9 +60,6 @@ class PoliciesTable(tables.DataTable):
created = tables.Column(
"created_at",
verbose_name=_("Created"),
filters=(
filters.parse_isotime,
)
)
updated = tables.Column(
get_updated_time,

View File

@ -1,4 +1,4 @@
{% load i18n parse_date nbsp %}
{% load i18n nbsp %}
<div class="detail">
<h4>{% trans "Information" %}</h4>
@ -11,10 +11,10 @@
<dt>{% trans "Spec" %}</dt>
<dd>{{ policy.policy_spec|force_escape|nbsp|linebreaksbr }}</dd>
<dt>{% trans "Created" context "Created time" %}</dt>
<dd>{{ policy.created_at|parse_date }}</dd>
<dd>{{ policy.created_at }}</dd>
{% if node.updated_at %}
<dt>{% trans "Updated" context "Updated time" %}</dt>
<dd>{{ policy.updated_at|parse_date }}</dd>
<dd>{{ policy.updated_at }}</dd>
{% endif %}
</dl>
</div>

View File

@ -14,7 +14,6 @@ from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import tables
from horizon.utils import filters
from senlin_dashboard import api
from senlin_dashboard.cluster.profiles import forms as profiles_forms
@ -59,7 +58,7 @@ class DeleteProfile(tables.DeleteAction):
def get_updated_time(object):
return filters.parse_isotime(object.updated_at) or None
return object.updated_at or None
class ProfilesTable(tables.DataTable):
@ -69,9 +68,6 @@ class ProfilesTable(tables.DataTable):
created = tables.Column(
"created_at",
verbose_name=_("Created"),
filters=(
filters.parse_isotime,
)
)
updated = tables.Column(
get_updated_time,

View File

@ -1,4 +1,4 @@
{% load i18n parse_date nbsp %}
{% load i18n nbsp %}
<div class="detail">
<h4>{% trans "Information" %}</h4>
@ -17,10 +17,10 @@
<dd>{{ profile.permission }}</dd>
{% endif %}
<dt>{% trans "Created" context "Created time" %}</dt>
<dd>{{ profile.created_at|parse_date }}</dd>
<dd>{{ profile.created_at }}</dd>
{% if profile.updated_at %}
<dt>{% trans "Updated" context "Updated time" %}</dt>
<dd>{{ profile.updated_at|parse_date }}</dd>
<dd>{{ profile.updated_at }}</dd>
{% endif %}
</dl>

View File

@ -14,7 +14,6 @@ from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import tables
from horizon.utils import filters
from senlin_dashboard import api
@ -51,7 +50,7 @@ class DeleteReceiver(tables.DeleteAction):
def get_updated_time(object):
return filters.parse_isotime(object.updated_at) or None
return object.updated_at or None
class ReceiversTable(tables.DataTable):
@ -63,9 +62,6 @@ class ReceiversTable(tables.DataTable):
created = tables.Column(
"created_at",
verbose_name=_("Created"),
filters=(
filters.parse_isotime,
)
)
updated = tables.Column(
get_updated_time,

View File

@ -1,4 +1,4 @@
{% load i18n parse_date %}
{% load i18n %}
<div class="detail">
<h4>{% trans "Information" %}</h4>
@ -15,10 +15,10 @@
<dt>{% trans "Channel" %}</dt>
<dd>{{ receiver.channel }}</dd>
<dt>{% trans "Created" context "Created time" %}</dt>
<dd>{{ receiver.created_at|parse_date }}</dd>
<dd>{{ receiver.created_at }}</dd>
{% if profile.updated_at %}
<dt>{% trans "Updated" context "Updated time" %}</dt>
<dd>{{ receiver.updated_at|parse_date }}</dd>
<dd>{{ receiver.updated_at }}</dd>
{% endif %}
</dl>
</div>