Card refinements
This commit is contained in:
@@ -897,10 +897,16 @@ def dashboard_active():
|
||||
out = []
|
||||
for row in rows:
|
||||
notificationtype = getattr(row, 'notificationtype', None)
|
||||
text = (row.notification or '').strip()
|
||||
out.append({
|
||||
'notificationid': row.notificationid,
|
||||
'message': (row.notification or '').strip()[:120],
|
||||
'typename': notificationtype.typename if notificationtype else None,
|
||||
# Trimmed for the card, whole text for the tooltip. A notification
|
||||
# is prose written for the floor, so the first hundred characters
|
||||
# are usually enough to recognise which one it is, and the rest is
|
||||
# there when it is not.
|
||||
'message': text[:100] + ('...' if len(text) > 100 else ''),
|
||||
'fullmessage': text,
|
||||
'typename': notificationtype.typename if notificationtype else 'Notification',
|
||||
'endtime': row.endtime.isoformat() + 'Z' if row.endtime else None,
|
||||
})
|
||||
return success_response(out)
|
||||
|
||||
@@ -211,11 +211,15 @@ class NotificationsPlugin(BasePlugin):
|
||||
'severity': 'info',
|
||||
'empty': 'hide',
|
||||
'position': 60,
|
||||
# Stacked, not inline: the type is a label and the message is
|
||||
# prose. On one line the type gets truncated to make room for
|
||||
# text that then gets truncated anyway, and neither is
|
||||
# readable.
|
||||
'layout': 'stacked',
|
||||
'map': {
|
||||
'title': 'typename',
|
||||
'detail': 'message',
|
||||
'meta': [{'key': 'endtime', 'label': 'until',
|
||||
'format': 'date'}],
|
||||
'detailtooltip': 'fullmessage',
|
||||
'link': '/notifications/{notificationid}',
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user