Commit 4a295cba authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Display age of the message at the report

parent f6df7e60
Pipeline #7474 failed with stage
in 0 seconds
...@@ -417,6 +417,14 @@ ...@@ -417,6 +417,14 @@
<string>message</string> <string>message</string>
<string>Error Message</string> <string>Error Message</string>
</tuple> </tuple>
<tuple>
<string>created_at</string>
<string>Date</string>
</tuple>
<tuple>
<string>age</string>
<string>Age</string>
</tuple>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -33,6 +33,9 @@ if aggregate_portal_type == "Hosting Subscription": ...@@ -33,6 +33,9 @@ if aggregate_portal_type == "Hosting Subscription":
if instance.getPortalType() == "Software Instance" and \ if instance.getPortalType() == "Software Instance" and \
instance.getSlapState() == "start_requested" and \ instance.getSlapState() == "start_requested" and \
instance.SoftwareInstance_hasReportedError(): instance.SoftwareInstance_hasReportedError():
m, create_at, since = instance.SoftwareInstance_hasReportedError(include_message=True,
include_created_at=True,
include_since=True)
message_list.append(newTempDocument( message_list.append(newTempDocument(
document, instance.getRelativeUrl(), **{ document, instance.getRelativeUrl(), **{
"uid": instance.getUid(), "uid": instance.getUid(),
...@@ -41,12 +44,15 @@ if aggregate_portal_type == "Hosting Subscription": ...@@ -41,12 +44,15 @@ if aggregate_portal_type == "Hosting Subscription":
"software_release": instance.getUrlString(), "software_release": instance.getUrlString(),
"computer_reference": computer.getReference(), "computer_reference": computer.getReference(),
"allocation_scope": computer.getAllocationScope(), "allocation_scope": computer.getAllocationScope(),
"message" : instance.SoftwareInstance_hasReportedError(include_message=True)})) "message" : m,
"created_at": create_at,
"since": since,
"age": "%s m ago" % (int((DateTime()-DateTime(since))*24*60))}))
else: else:
message_list.append(newTempDocument( message_list.append(newTempDocument(
document, instance.getRelativeUrl(), **{ document, instance.getRelativeUrl(), **{
"uid": instance.getUid(), "uid": instance.getUid(),
"title": instance.title(), "title": instance.getTitle(),
"specialise_title": hosting_subscription.getTitle(), "specialise_title": hosting_subscription.getTitle(),
"software_release": instance.getUrlString(), "software_release": instance.getUrlString(),
"computer_reference": "", "computer_reference": "",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment