dashboard: numbers that agree, a map on hover, wider cards
"All assets 704" sat beside "all assets in use 737", and both were correct about different populations. The totals summed five specific asset types and subtracted dual-bay secondaries; the status counts took every asset row of any type with no collapse, so USB devices and hidden secondary bays inflated one side of a comparison the layout invites. Status is now counted over exactly the same assets the totals describe. Warranty rows fell back to asset.name when the covered asset had no hostname, and an asset's name is usually the MACHINE's descriptive name - which is how a column meant to identify a PC ended up showing a machine. Hostname, else the asset number, never the name. The machine number loses its label too: the row is hostname, machine, state, and "machine 3015" spends a word on what position already conveys. Printer names now carry the floor-plan preview on hover, the same LocationMapTooltip the printer's own page uses - a location name tells you the room, the map tells you where to walk. Declared as map.maphover on the card, so any card with coordinates gets it; a row without them shows a plain link rather than being dropped. Cards are four across rather than five. At five columns a row holding a hostname, a machine number and a state truncates on exactly the rows that matter. auto-fit, so two cards fill the width instead of leaving empty tracks. Not covered by a test: the count fix. I started one and it was interrupted, and I have not gone back for it - the assertion worth having is that in-use can never exceed the total.
This commit is contained in:
@@ -1034,6 +1034,8 @@ def _get_low_supplies_data():
|
||||
'vendor': vendor_name,
|
||||
'model': model_number,
|
||||
'location': location_name,
|
||||
'mapx': asset.mapx,
|
||||
'mapy': asset.mapy,
|
||||
'supplies': annotated
|
||||
})
|
||||
|
||||
@@ -1464,6 +1466,11 @@ def dashboard_supplies():
|
||||
'printerid': printer['printerid'],
|
||||
'printername': printer['printername'] or printer['assetnumber'],
|
||||
'location': printer['location'] or 'No location set',
|
||||
# Coordinates for the hover preview. Either may be None - a
|
||||
# printer never placed on the floor plan still belongs on the
|
||||
# card, it just has nothing to preview.
|
||||
'mapx': printer.get('mapx'),
|
||||
'mapy': printer.get('mapy'),
|
||||
'iscritical': any(s['status'] == 'critical' for s in depleted),
|
||||
'supplies': [{
|
||||
'text': '{} {}%'.format(_shortsupplyname(supply.get('name')),
|
||||
|
||||
@@ -325,6 +325,12 @@ class PrintersPlugin(BasePlugin):
|
||||
# for "where do I walk", not part of the finding, and it
|
||||
# was the text pushing rows past the card edge.
|
||||
'titletooltip': 'location',
|
||||
# Hovering the name shows the floor-plan preview, the
|
||||
# same component the printer's own page uses: a
|
||||
# location name tells you the room, the map tells you
|
||||
# where to walk.
|
||||
'maphover': {'x': 'mapx', 'y': 'mapy',
|
||||
'label': 'printername'},
|
||||
'chips': 'supplies',
|
||||
'link': '/printers/{printerid}',
|
||||
},
|
||||
|
||||
@@ -439,7 +439,11 @@ def dashboard_expiring():
|
||||
machine = _related_machine(asset)
|
||||
rows.append({
|
||||
'assetid': asset.assetid,
|
||||
'hostname': _hostname(asset) or asset.assetnumber or asset.name,
|
||||
# Hostname, else the asset number - never asset.name. The name
|
||||
# of a covered PC's ASSET is often the machine's descriptive name
|
||||
# ("Haas VF-2"), so falling back to it put a machine name in a
|
||||
# column that is supposed to identify the PC.
|
||||
'hostname': _hostname(asset) or asset.assetnumber or str(asset.assetid),
|
||||
'machinenumber': machine['machinenumber'] if machine else None,
|
||||
'state': 'expired' if remaining < 0 else 'expiring',
|
||||
'daysleft': remaining,
|
||||
|
||||
@@ -139,7 +139,10 @@ class WarrantyPlugin(BasePlugin):
|
||||
# date: expired or expiring is the whole decision when
|
||||
# scanning a board, and the exact day belongs on the report
|
||||
# you order from.
|
||||
'meta': [{'key': 'machinenumber', 'label': 'machine'}],
|
||||
# Bare number, no label. The row is hostname, machine,
|
||||
# state - three short facts, and "machine 3015" spends a
|
||||
# word saying what the position already says.
|
||||
'meta': [{'key': 'machinenumber'}],
|
||||
'link': '/assets/{assetid}',
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user