Dashboard cards: rebuild deployable dists
This commit is contained in:
@@ -114,6 +114,49 @@ class WarrantyPlugin(BasePlugin):
|
||||
},
|
||||
]
|
||||
|
||||
def get_dashboard_widgets(self) -> List[Dict]:
|
||||
"""Dashboard card: warranties running out, and ones already expired.
|
||||
|
||||
Expired stays listed rather than dropping off. A machine out of
|
||||
warranty is a purchasing decision someone still has to make, and
|
||||
removing it the day it lapses is how it gets missed entirely.
|
||||
"""
|
||||
return [
|
||||
{
|
||||
'id': 'warranty-expiring',
|
||||
'title': 'Warranties expiring',
|
||||
'endpoint': '/api/warranty/dashboard/expiring',
|
||||
'render': 'exceptions',
|
||||
'severity': 'info',
|
||||
'permission': 'warranty.view',
|
||||
'empty': 'hide',
|
||||
'position': 50,
|
||||
'map': {
|
||||
'title': 'assetnumber',
|
||||
'detail': 'state',
|
||||
'meta': [
|
||||
{'key': 'enddate', 'label': 'ends', 'format': 'date'},
|
||||
{'key': 'provider'},
|
||||
],
|
||||
'link': '/assets/{assetid}',
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
def get_settings_defaults(self) -> List[Dict]:
|
||||
"""Settings this plugin owns."""
|
||||
return [
|
||||
{
|
||||
'key': 'warranty_expiringdays',
|
||||
'value': '90',
|
||||
'valuetype': 'integer',
|
||||
'category': 'warranty',
|
||||
'description': 'Days ahead to list an expiring warranty on the '
|
||||
'dashboard. Already-expired warranties are always '
|
||||
'listed.',
|
||||
},
|
||||
]
|
||||
|
||||
def get_permissions(self) -> List:
|
||||
"""Return the RBAC permissions this plugin owns."""
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user