dashboard: convert the last dead widgets, and delete the one that had nothing
Three plugins still declared widgets naming Vue components nobody wrote. Converting them honestly meant three different answers, not one. notifications gets a real card: the active notifications themselves, not a count. "4 active" tells an admin nothing; knowing WHICH message the shop is looking at is the point, and it is how a stale one gets noticed and taken down. machines gets machines out of service - anything not In Use, excluding Inventory, because a spare on a shelf is stock rather than a problem. Someone is supposed to be chasing each of those and today they are visible only to whoever thinks to filter the list by status. network gets NOTHING, and its declaration is deleted rather than converted. Network devices carry no live status - no polling, no reachability check, nothing that can be wrong - so the only possible card is a count of how many exist, which is precisely the always-true number this dashboard exists to get away from. A comment records that, so the next person does not re-add it. If reachability is ever collected, that is the card. Also adds a contract test over every declared card: no component names, a valid renderer and severity, and - the one that matters - the endpoint must be a REAL route. A declaration pointing at a route nobody wrote is exactly how the old widgets rotted unnoticed for months, and now it fails the build instead.
This commit is contained in:
@@ -193,14 +193,30 @@ class NotificationsPlugin(BasePlugin):
|
||||
return [notifications_cli]
|
||||
|
||||
def get_dashboard_widgets(self) -> List[Dict]:
|
||||
"""Return dashboard widget definitions."""
|
||||
"""Dashboard card: what the floor is being shown right now.
|
||||
|
||||
The items, not a count. "4 active notifications" tells an admin
|
||||
nothing; knowing WHICH message is on the boards is the point, and it is
|
||||
how a stale one gets noticed and taken down.
|
||||
|
||||
Replaces a declaration naming a component nobody wrote.
|
||||
"""
|
||||
return [
|
||||
{
|
||||
'name': 'Active Notifications',
|
||||
'component': 'NotificationsWidget',
|
||||
'endpoint': '/api/notifications/dashboard/summary',
|
||||
'size': 'small',
|
||||
'position': 1,
|
||||
'id': 'notifications-active',
|
||||
'title': 'Active notifications',
|
||||
'endpoint': '/api/notifications/dashboard/active',
|
||||
'render': 'list',
|
||||
'severity': 'info',
|
||||
'empty': 'hide',
|
||||
'position': 60,
|
||||
'map': {
|
||||
'title': 'typename',
|
||||
'detail': 'message',
|
||||
'meta': [{'key': 'endtime', 'label': 'until',
|
||||
'format': 'date'}],
|
||||
'link': '/notifications/{notificationid}',
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user