add details in dashboard for placeholder
This commit is contained in:
parent
f39cdefc75
commit
e96afda483
|
@ -131,14 +131,14 @@ class Device:
|
||||||
def is_websnapshot(self):
|
def is_websnapshot(self):
|
||||||
if not self.last_evidence:
|
if not self.last_evidence:
|
||||||
self.get_last_evidence()
|
self.get_last_evidence()
|
||||||
return self.last_evidence.doc['type'] == "WebSnapshot"
|
return self.last_evidence.doc['type'] == "WebSnapshot"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def last_user_evidence(self):
|
def last_user_evidence(self):
|
||||||
if not self.last_evidence:
|
if not self.last_evidence:
|
||||||
self.get_last_evidence()
|
self.get_last_evidence()
|
||||||
return self.last_evidence.doc['kv'].items()
|
return self.last_evidence.doc['kv'].items()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def manufacturer(self):
|
def manufacturer(self):
|
||||||
if not self.last_evidence:
|
if not self.last_evidence:
|
||||||
|
@ -147,6 +147,9 @@ class Device:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def type(self):
|
def type(self):
|
||||||
|
if self.last_evidence.doc['type'] == "WebSnapshot":
|
||||||
|
return self.last_evidence.doc.get("device", {}).get("type", "")
|
||||||
|
|
||||||
if not self.last_evidence:
|
if not self.last_evidence:
|
||||||
self.get_last_evidence()
|
self.get_last_evidence()
|
||||||
return self.last_evidence.get_chassis()
|
return self.last_evidence.get_chassis()
|
||||||
|
@ -162,5 +165,3 @@ class Device:
|
||||||
if not self.last_evidence:
|
if not self.last_evidence:
|
||||||
self.get_last_evidence()
|
self.get_last_evidence()
|
||||||
return self.last_evidence.get_components()
|
return self.last_evidence.get_components()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -83,12 +83,24 @@ class Evidence:
|
||||||
return self.components
|
return self.components
|
||||||
|
|
||||||
def get_manufacturer(self):
|
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":
|
if self.doc.get("software") != "EreuseWorkbench":
|
||||||
return self.doc['device']['manufacturer']
|
return self.doc['device']['manufacturer']
|
||||||
|
|
||||||
return self.dmi.manufacturer().strip()
|
return self.dmi.manufacturer().strip()
|
||||||
|
|
||||||
def get_model(self):
|
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":
|
if self.doc.get("software") != "EreuseWorkbench":
|
||||||
return self.doc['device']['model']
|
return self.doc['device']['model']
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue