commit
78ba2387ec
|
@ -12,25 +12,25 @@
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<ul class="nav nav-tabs nav-tabs-bordered">
|
<ul class="nav nav-tabs nav-tabs-bordered">
|
||||||
<li class="nav-items">
|
<li class="nav-items">
|
||||||
<button class="nav-link active" data-bs-toggle="tab" data-bs-target="#details">General details</button>
|
<a href="#details" class="nav-link active" data-bs-toggle="tab" data-bs-target="#details">General details</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-items">
|
<li class="nav-items">
|
||||||
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#annotations">User annotations</button>
|
<a href="#annotations" class="nav-link" data-bs-toggle="tab" data-bs-target="#annotations">User annotations</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-items">
|
<li class="nav-items">
|
||||||
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#documents">Documents</button>
|
<a href="#documents" class="nav-link" data-bs-toggle="tab" data-bs-target="#documents">Documents</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-items">
|
<li class="nav-items">
|
||||||
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#lots">Lots</button>
|
<a href="#lots" class="nav-link" data-bs-toggle="tab" data-bs-target="#lots">Lots</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-items">
|
<li class="nav-items">
|
||||||
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#components">Components</button>
|
<a href="#components" class="nav-link" data-bs-toggle="tab" data-bs-target="#components">Components</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-items">
|
<li class="nav-items">
|
||||||
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#evidences">Evidences</button>
|
<a href="#evidences" class="nav-link" data-bs-toggle="tab" data-bs-target="#evidences">Evidences</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-items">
|
<li class="nav-items">
|
||||||
<a class="nav-link" href="">Web</a>
|
<a href="#web" class="nav-link" href="">Web</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -214,3 +214,25 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block extrascript %}
|
||||||
|
<script>
|
||||||
|
document.addEventListener("DOMContentLoaded", function() {
|
||||||
|
// Obtener el hash de la URL (ejemplo: #components)
|
||||||
|
const hash = window.location.hash;
|
||||||
|
|
||||||
|
// Verificar si hay un hash en la URL
|
||||||
|
if (hash) {
|
||||||
|
// Buscar el botón o enlace que corresponde al hash y activarlo
|
||||||
|
const tabTrigger = document.querySelector(`[data-bs-target="${hash}"]`);
|
||||||
|
|
||||||
|
if (tabTrigger) {
|
||||||
|
// Crear una instancia de tab de Bootstrap para activar el tab
|
||||||
|
const tab = new bootstrap.Tab(tabTrigger);
|
||||||
|
tab.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -158,10 +158,13 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||||
|
|
||||||
LANGUAGE_CODE = "en-us"
|
LANGUAGE_CODE = "en-us"
|
||||||
|
|
||||||
TIME_ZONE = "UTC"
|
TIME_ZONE = config("TIME_ZONE", default="UTC")
|
||||||
|
|
||||||
USE_I18N = True
|
USE_I18N = True
|
||||||
|
|
||||||
|
USE_TZ = False
|
||||||
|
|
||||||
|
if TIME_ZONE == "UTC":
|
||||||
USE_TZ = True
|
USE_TZ = True
|
||||||
|
|
||||||
USE_L10N = True
|
USE_L10N = True
|
||||||
|
|
|
@ -127,7 +127,7 @@ class Evidence:
|
||||||
owner=user.institution,
|
owner=user.institution,
|
||||||
type=Annotation.Type.SYSTEM,
|
type=Annotation.Type.SYSTEM,
|
||||||
key="hidalgo1",
|
key="hidalgo1",
|
||||||
).order_by("-created").values_list("uuid", flat=True).distinct()
|
).order_by("-created").values_list("uuid", "created").distinct()
|
||||||
|
|
||||||
def set_components(self):
|
def set_components(self):
|
||||||
snapshot = ParseSnapshot(self.doc).snapshot_json
|
snapshot = ParseSnapshot(self.doc).snapshot_json
|
||||||
|
|
|
@ -5,6 +5,8 @@ import hashlib
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from dmidecode import DMIParse
|
from dmidecode import DMIParse
|
||||||
|
from json_repair import repair_json
|
||||||
|
|
||||||
from evidence.models import Annotation
|
from evidence.models import Annotation
|
||||||
from evidence.xapian import index
|
from evidence.xapian import index
|
||||||
from utils.constants import ALGOS, CHASSIS_DH
|
from utils.constants import ALGOS, CHASSIS_DH
|
||||||
|
@ -20,7 +22,12 @@ def get_network_cards(child, nets):
|
||||||
def get_mac(lshw):
|
def get_mac(lshw):
|
||||||
nets = []
|
nets = []
|
||||||
try:
|
try:
|
||||||
get_network_cards(json.loads(lshw), nets)
|
hw = json.loads(lshw)
|
||||||
|
except json.decoder.JSONDecodeError:
|
||||||
|
hw = json.loads(repair_json(lshw))
|
||||||
|
|
||||||
|
try:
|
||||||
|
get_network_cards(hw, nets)
|
||||||
except Exception as ss:
|
except Exception as ss:
|
||||||
print("WARNING!! {}".format(ss))
|
print("WARNING!! {}".format(ss))
|
||||||
return
|
return
|
||||||
|
|
|
@ -3,6 +3,8 @@ import numpy as np
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from dmidecode import DMIParse
|
from dmidecode import DMIParse
|
||||||
|
from json_repair import repair_json
|
||||||
|
|
||||||
from utils.constants import CHASSIS_DH, DATASTORAGEINTERFACE
|
from utils.constants import CHASSIS_DH, DATASTORAGEINTERFACE
|
||||||
|
|
||||||
|
|
||||||
|
@ -160,6 +162,7 @@ class ParseSnapshot:
|
||||||
continue
|
continue
|
||||||
model = sm.get('model_name')
|
model = sm.get('model_name')
|
||||||
manufacturer = None
|
manufacturer = None
|
||||||
|
hours = sm.get("power_on_time", {}).get("hours", 0)
|
||||||
if model and len(model.split(" ")) > 1:
|
if model and len(model.split(" ")) > 1:
|
||||||
mm = model.split(" ")
|
mm = model.split(" ")
|
||||||
model = mm[-1]
|
model = mm[-1]
|
||||||
|
@ -175,6 +178,7 @@ class ParseSnapshot:
|
||||||
"size": self.get_data_storage_size(sm),
|
"size": self.get_data_storage_size(sm),
|
||||||
"variant": sm.get("firmware_version"),
|
"variant": sm.get("firmware_version"),
|
||||||
"interface": self.get_data_storage_interface(sm),
|
"interface": self.get_data_storage_interface(sm),
|
||||||
|
"hours": hours,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -478,7 +482,11 @@ class ParseSnapshot:
|
||||||
def loads(self, x):
|
def loads(self, x):
|
||||||
if isinstance(x, str):
|
if isinstance(x, str):
|
||||||
try:
|
try:
|
||||||
return json.loads(x)
|
try:
|
||||||
|
hw = json.loads(lshw)
|
||||||
|
except json.decoder.JSONDecodeError:
|
||||||
|
hw = json.loads(repair_json(lshw))
|
||||||
|
return hw
|
||||||
except Exception as ss:
|
except Exception as ss:
|
||||||
print("WARNING!! {}".format(ss))
|
print("WARNING!! {}".format(ss))
|
||||||
return {}
|
return {}
|
||||||
|
|
|
@ -14,10 +14,13 @@
|
||||||
{% for ev in evidences %}
|
{% for ev in evidences %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="{% url 'evidence:details' ev %}">{{ ev }}</a>
|
<a href="{% url 'evidence:details' ev.0 %}">{{ ev.0 }}</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{# url 'evidence:delete' ev #}"><i class="bi bi-trash text-danger"></i></a>
|
<small class="text-muted">{{ ev.1 }}</small>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="{# url 'evidence:delete' ev.0 #}"><i class="bi bi-trash text-danger"></i></a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -10,4 +10,4 @@ pandas==2.2.2
|
||||||
xlrd==2.0.1
|
xlrd==2.0.1
|
||||||
odfpy==1.4.1
|
odfpy==1.4.1
|
||||||
pytz==2024.2
|
pytz==2024.2
|
||||||
|
json-repair==0.30.0
|
||||||
|
|
Loading…
Reference in New Issue