backups panels show only when the asset has data
This commit is contained in:
@@ -59,8 +59,13 @@ class BackupKind:
|
||||
displayname = None
|
||||
storagebackend = 'shopdb'
|
||||
assettypes = ['*']
|
||||
# Human note shown on the panel when there is nothing yet.
|
||||
emptytext = 'No backups on record.'
|
||||
# Text shown when the kind has no revisions for an asset. None means the
|
||||
# panel HIDES entirely instead (the generic list renderer shows a panel
|
||||
# only when it has rows or declares empty text). Default to hiding: a kind
|
||||
# applies to an asset TYPE, but whether a given asset ever has this kind of
|
||||
# backup is a property of the individual machine. A part marker panel on
|
||||
# every one of 144 machines is noise, not information.
|
||||
emptytext = None
|
||||
|
||||
def parse(self, raw):
|
||||
"""Opaque kinds return None; parseable kinds return the projection."""
|
||||
@@ -118,7 +123,6 @@ class NtlarsKind(BackupKind):
|
||||
displayname = 'NTLARS / DNC Settings'
|
||||
storagebackend = 'shopdb'
|
||||
assettypes = ['machine']
|
||||
emptytext = 'No NTLARS settings captured yet.'
|
||||
|
||||
@staticmethod
|
||||
def embeddedmachineno(projection):
|
||||
@@ -176,8 +180,10 @@ class NtlarsKind(BackupKind):
|
||||
'title': 'DNC Info',
|
||||
'assettypes': ['machine'],
|
||||
'endpoint': '/api/backups/asset/{assetid}/info?kind=ntlars',
|
||||
# No 'empty' key: the keyvalue renderer decides visibility purely on
|
||||
# field count and never displays empty text, so a machine with no
|
||||
# NTLARS revision simply has no DNC Info card at all.
|
||||
'render': 'keyvalue',
|
||||
'empty': 'No NTLARS settings captured for this machine yet.',
|
||||
# Above the history panels: this answers the question a tech
|
||||
# arrives with, while history is for the rarer restore case.
|
||||
'position': 38,
|
||||
@@ -214,7 +220,6 @@ class PartMarkerKind(BackupKind):
|
||||
displayname = 'Part Marker Configuration'
|
||||
storagebackend = 'share'
|
||||
assettypes = ['machine', 'measuring_tool']
|
||||
emptytext = 'No part marker backups on record.'
|
||||
|
||||
def resolveassetid(self, payload):
|
||||
from shopdb.api import db, Asset
|
||||
|
||||
Reference in New Issue
Block a user