add placeholder datas

This commit is contained in:
Cayo Puigdefabregas 2022-08-09 17:52:18 +02:00
parent c55dbc3c8c
commit 6687898784
1 changed files with 28 additions and 2 deletions

View File

@ -181,7 +181,6 @@ class BaseDeviceRow(OrderedDict):
self['Test DataStorage 3 Power cycle count'] = '' self['Test DataStorage 3 Power cycle count'] = ''
self['Test DataStorage 3 Lifetime (days)'] = '' self['Test DataStorage 3 Lifetime (days)'] = ''
self['Test DataStorage 3 Power on hours'] = '' self['Test DataStorage 3 Power on hours'] = ''
self['DHID'] = ''
self['DataStorage 4'] = '' self['DataStorage 4'] = ''
self['DataStorage 4 Manufacturer'] = '' self['DataStorage 4 Manufacturer'] = ''
self['DataStorage 4 Model'] = '' self['DataStorage 4 Model'] = ''
@ -251,12 +250,24 @@ class BaseDeviceRow(OrderedDict):
self['Data Storage Rate'] = '' self['Data Storage Rate'] = ''
self['Data Storage Range'] = '' self['Data Storage Range'] = ''
self['Benchmark RamSysbench (points)'] = '' self['Benchmark RamSysbench (points)'] = ''
# Placeholder
self['PHID'] = ''
self['Is Abstract'] = ''
self['Pallet'] = ''
self['id Supplier'] = ''
self['Real Info'] = ''
self['Real Components'] = ''
self['Real Type'] = ''
self['Real Serial Number'] = ''
self['Real Model'] = ''
self['Real Manufacturer'] = ''
class DeviceRow(BaseDeviceRow): class DeviceRow(BaseDeviceRow):
def __init__(self, device: d.Device, document_ids: dict) -> None: def __init__(self, device: d.Device, document_ids: dict) -> None:
super().__init__() super().__init__()
self.device = device self.placeholder = device.binding or device.placeholder
self.device = self.placeholder.binding or self.placeholder.device
self.document_id = document_ids.get(device.id, '') self.document_id = document_ids.get(device.id, '')
snapshot = get_action(device, 'Snapshot') snapshot = get_action(device, 'Snapshot')
software = '' software = ''
@ -325,6 +336,8 @@ class DeviceRow(BaseDeviceRow):
if benchram: if benchram:
self['Benchmark RamSysbench (points)'] = none2str(benchram.rate) self['Benchmark RamSysbench (points)'] = none2str(benchram.rate)
self.get_placeholder_datas()
def components(self): def components(self):
"""Function to get all components information of a device.""" """Function to get all components information of a device."""
assert isinstance(self.device, d.Computer) assert isinstance(self.device, d.Computer)
@ -489,6 +502,19 @@ class DeviceRow(BaseDeviceRow):
if component: if component:
self['{} {} Memory (MB)'.format(ctype, i)] = none2str(component.memory) self['{} {} Memory (MB)'.format(ctype, i)] = none2str(component.memory)
def get_placeholder_datas(self):
# Placeholder
self['PHID'] = none2str(self.placeholder.phid)
self['Is Abstract'] = none2str(self.device.is_abstract())
self['Pallet'] = none2str(self.placeholder.pallet)
self['id Supplier'] = none2str(self.placeholder.id_device_supplier)
self['Real Info'] = none2str(self.placeholder.info)
self['Real Components'] = none2str(self.placeholder.components)
self['Real Type'] = none2str(self.placeholder.device.type)
self['Real Manufacturer'] = none2str(self.placeholder.device.manufacturer)
self['Real Model'] = none2str(self.placeholder.device.model)
self['Real Serial Number'] = none2str(self.placeholder.device.serial_number)
class StockRow(OrderedDict): class StockRow(OrderedDict):
def __init__(self, device: d.Device) -> None: def __init__(self, device: d.Device) -> None: