add details in dashboard for placeholder

This commit is contained in:
Cayo Puigdefabregas 2024-09-26 13:09:55 +02:00
parent f39cdefc75
commit e96afda483
2 changed files with 18 additions and 5 deletions

View File

@ -147,6 +147,9 @@ class Device:
@property
def type(self):
if self.last_evidence.doc['type'] == "WebSnapshot":
return self.last_evidence.doc.get("device", {}).get("type", "")
if not self.last_evidence:
self.get_last_evidence()
return self.last_evidence.get_chassis()
@ -162,5 +165,3 @@ class Device:
if not self.last_evidence:
self.get_last_evidence()
return self.last_evidence.get_components()

View File

@ -83,12 +83,24 @@ class Evidence:
return self.components
def get_manufacturer(self):
if self.doc.get("type") == "WebSnapshot":
kv = self.doc.get('kv', {})
if len(kv) < 1:
return ""
return list(self.doc.get('kv').values())[0]
if self.doc.get("software") != "EreuseWorkbench":
return self.doc['device']['manufacturer']
return self.dmi.manufacturer().strip()
def get_model(self):
if self.doc.get("type") == "WebSnapshot":
kv = self.doc.get('kv', {})
if len(kv) < 2:
return ""
return list(self.doc.get('kv').values())[1]
if self.doc.get("software") != "EreuseWorkbench":
return self.doc['device']['model']