feature/90-implement-public-website-for-device #17

Merged
cayop merged 32 commits from feature/90-implement-public-website-for-device into main 2024-10-30 15:02:18 +00:00
1 changed files with 94 additions and 156 deletions
Showing only changes of commit 2636e80ece - Show all commits

View File

@ -2,13 +2,13 @@
{% load i18n %} {% load i18n %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<h3>{{ object.shortid }}</h3> <h3>{{ object.shortid }}</h3>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<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-item"> <li class="nav-item">
@ -34,11 +34,11 @@
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
<div class="tab-content pt-2">
<div class="tab-content pt-2">
<div class="tab-pane fade show active" id="details"> <div class="tab-pane fade show active" id="details">
<h5 class="card-title">{% trans "Details" %}</h5> <h5 class="card-title">{% trans 'Details' %}</h5>
<div class="row mb-3"> <div class="row mb-3">
<div class="col-lg-3 col-md-4 label ">Phid</div> <div class="col-lg-3 col-md-4 label ">Phid</div>
<div class="col-lg-9 col-md-8">{{ object.id }}</div> <div class="col-lg-9 col-md-8">{{ object.id }}</div>
@ -46,145 +46,83 @@
{% if object.is_eraseserver %} {% if object.is_eraseserver %}
<div class="row mb-3"> <div class="row mb-3">
<div class="col-lg-3 col-md-4 label">{% trans "Is a erase server" %}</div> <div class="col-lg-3 col-md-4 label">
{% trans 'Is a erase server' %}
</div>
<div class="col-lg-9 col-md-8"></div> <div class="col-lg-9 col-md-8"></div>
</div> </div>
{% endif %} {% endif %}
<div class="row">
<div class="col-lg-3 col-md-4 label ">{% trans "Type" %}</div>
<div class="col-lg-9 col-md-8">{{ object.type }}</div>
</div>
{% if object.is_websnapshot %}
{% for k, v in object.last_user_evidence %}
<div class="row">
<div class="col-lg-3 col-md-4 label">{{ k }}</div>
<div class="col-lg-9 col-md-8">{{ v|default:"" }}</div>
</div>
{% endfor %}
{% else %}
<div class="row">
<div class="col-lg-3 col-md-4 label">Manufacturer</div>
<div class="col-lg-9 col-md-8">{{ object.manufacturer|default:"" }}</div>
</div>
<div class="row">
<div class="col-lg-3 col-md-4 label">Model</div>
<div class="col-lg-9 col-md-8">{{ object.model|default:"" }}</div>
</div>
<div class="row">
<div class="col-lg-3 col-md-4 label">Serial Number</div>
<div class="col-lg-9 col-md-8">{{ object.last_evidence.doc.device.serialNumber|default:"" }}</div>
</div>
{% endif %}
<div class="row">
<div class="col-lg-3 col-md-4 label">Identifiers</div>
</div>
{% for chid in object.hids %}
<div class="row">
<div class="col">{{ chid |default:"" }}</div>
</div>
{% endfor %}
</div>
<div class="tab-pane fade profile-overview" id="annotations">
<div class="btn-group dropdown ml-1 mt-1" uib-dropdown="">
<a href="{% url 'device:add_annotation' object.pk %}" class="btn btn-primary">
<i class="bi bi-plus"></i>
{% trans "Add new annotation" %}
<span class="caret"></span>
</a>
</div>
<h5 class="card-title mt-2">{% trans "Annotations" %}</h5>
<table class="table table-striped">
<thead>
<tr>
<th scope="col">Key</th>
<th scope="col">Value</th>
<th scope="col" data-type="date" data-format="YYYY-MM-DD hh:mm">Created on</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{% for a in object.get_user_annotations %}
<tr>
<td>{{ a.key }}</td>
<td>{{ a.value }}</td>
<td>{{ a.created }}</td>
<td></td>
<td></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="tab-content pt-2">
<div class="tab-pane fade show active" id="details">
<h5 class="card-title">Details</h5>
<div class="row mb-3"> <div class="row mb-3">
<div class="col-lg-3 col-md-4 label">Phid</div> <div class="col-lg-3 col-md-4 label">Phid</div>
<div class="col-lg-9 col-md-8">{{ object.id }}</div> <div class="col-lg-9 col-md-8">{{ object.id }}</div>
</div> </div>
<div class="row">
<div class="col-lg-3 col-md-4 label">Type</div>
<div class="col-lg-9 col-md-8">{{ object.type }}</div> <div class="col-lg-9 col-md-8">{{ object.type }}</div>
</div> </div>
{% if object.is_websnapshot %} {% if object.is_websnapshot %}
{% for k, v in object.last_user_evidence %} {% for k, v in object.last_user_evidence %}
<div class="row"> <div class="row mb-3">
<div class="col-lg-3 col-md-4 label">{{ k }}</div> <div class="col-lg-3 col-md-4 label">{{ k }}</div>
<div class="col-lg-9 col-md-8">{{ v|default:'' }}</div> <div class="col-lg-9 col-md-8">{{ v|default:'' }}</div>
</div> </div>
{% endfor %} {% endfor %}
{% else %} {% else %}
<div class="row"> <div class="row mb-3">
<div class="col-lg-3 col-md-4 label">Manufacturer</div> <div class="col-lg-3 col-md-4 label">
{% trans 'Manufacturer' %}
</div>
<div class="col-lg-9 col-md-8">{{ object.manufacturer|default:'' }}</div> <div class="col-lg-9 col-md-8">{{ object.manufacturer|default:'' }}</div>
</div> </div>
<div class="row"> <div class="row mb-3">
<div class="col-lg-3 col-md-4 label">Model</div> <div class="col-lg-3 col-md-4 label">
{% trans 'Model' %}
</div>
<div class="col-lg-9 col-md-8">{{ object.model|default:'' }}</div> <div class="col-lg-9 col-md-8">{{ object.model|default:'' }}</div>
</div> </div>
<div class="row"> <div class="row mb-3">
<div class="col-lg-3 col-md-4 label">Serial Number</div> <div class="col-lg-3 col-md-4 label">
{% trans 'Serial Number' %}
</div>
<div class="col-lg-9 col-md-8">{{ object.last_evidence.doc.device.serialNumber|default:'' }}</div> <div class="col-lg-9 col-md-8">{{ object.last_evidence.doc.device.serialNumber|default:'' }}</div>
</div> </div>
{% endif %} {% endif %}
<div class="row">
<div class="col-lg-3 col-md-4 label">Identifiers</div> <div class="row mb-3">
<div class="col-lg-3 col-md-4 label">
{% trans 'Identifiers' %}
</div>
</div> </div>
{% for chid in object.hids %} {% for chid in object.hids %}
<div class="row"> <div class="row mb-3">
<div class="col">{{ chid|default:'' }}</div> <div class="col">{{ chid|default:'' }}</div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
<div class="tab-pane fade profile-overview" id="annotations"> <div class="tab-pane fade" id="annotations">
<div class="btn-group dropdown ml-1 mt-1" uib-dropdown=""> <div class="btn-group mt-1 mb-3">
<a href="{% url 'device:add_annotation' object.pk %}" class="btn btn-primary"> <a href="{% url 'device:add_annotation' object.pk %}" class="btn btn-primary">
<i class="bi bi-plus"></i> <i class="bi bi-plus"></i>
Add new annotation {% trans 'Add new annotation' %}
<span class="caret"></span>
</a> </a>
</div> </div>
<h5 class="card-title mt-2">Annotations</h5> <h5 class="card-title">{% trans 'Annotations' %}</h5>
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th scope="col">Key</th> <th scope="col">
<th scope="col">Value</th> {% trans 'Key' %}
<th scope="col" data-type="date" data-format="YYYY-MM-DD hh:mm">Created on</th> </th>
<th scope="col">
{% trans 'Value' %}
</th>
<th scope="col" data-type="date" data-format="YYYY-MM-DD HH:mm">
{% trans 'Created on' %}
</th>
<th></th> <th></th>
<th></th> <th></th>
</tr> </tr>
@ -203,38 +141,27 @@
</table> </table>
</div> </div>
<div class="tab-pane fade profile-overview" id="lots"> <div class="tab-pane fade" id="documents">
{% for tag in lot_tags %} <div class="btn-group mt-1 mb-3">
<h5 class="card-title">{{ tag }}</h5>
{% for lot in object.lots %}
{% if lot.type == tag %}
<div class="row">
<div class="col">
<a href="{% url 'dashboard:lot' lot.id %}">{{ lot.name }}</a>
</div>
</div>
{% endif %}
{% endfor %}
{% endfor %}
</div>
<div class="tab-pane fade profile-overview" id="documents">
<div class="btn-group dropdown ml-1 mt-1" uib-dropdown="">
<a href="{% url 'device:add_document' object.pk %}" class="btn btn-primary"> <a href="{% url 'device:add_document' object.pk %}" class="btn btn-primary">
<i class="bi bi-plus"></i> <i class="bi bi-plus"></i>
Add new document {% trans 'Add new document' %}
<span class="caret"></span>
</a> </a>
</div> </div>
<h5 class="card-title mt-2">Documents</h5> <h5 class="card-title">{% trans 'Documents' %}</h5>
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th scope="col">Key</th> <th scope="col">
<th scope="col">Value</th> {% trans 'Key' %}
<th scope="col" data-type="date" data-format="YYYY-MM-DD hh:mm">Created on</th> </th>
<th scope="col">
{% trans 'Value' %}
</th>
<th scope="col" data-type="date" data-format="YYYY-MM-DD HH:mm">
{% trans 'Created on' %}
</th>
<th></th> <th></th>
<th></th> <th></th>
</tr> </tr>
@ -253,8 +180,23 @@
</table> </table>
</div> </div>
<div class="tab-pane fade profile-overview" id="components"> <div class="tab-pane fade" id="lots">
<h5 class="card-title">Components last evidence</h5> {% for tag in lot_tags %}
<h5 class="card-title">{{ tag }}</h5>
{% for lot in object.lots %}
{% if lot.type == tag %}
<div class="row mb-3">
<div class="col">
<a href="{% url 'dashboard:lot' lot.id %}">{{ lot.name }}</a>
</div>
</div>
{% endif %}
{% endfor %}
{% endfor %}
</div>
<div class="tab-pane fade" id="components">
<h5 class="card-title">{% trans 'Components last evidence' %}</h5>
<div class="list-group col-6"> <div class="list-group col-6">
{% for c in object.components %} {% for c in object.components %}
<div class="list-group-item"> <div class="list-group-item">
@ -268,27 +210,23 @@
{{ k }}: {{ v }}<br /> {{ k }}: {{ v }}<br />
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<br />
</p> </p>
<small class="text-muted"></small>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
<div class="tab-pane fade profile-overview" id="evidences"> <div class="tab-pane fade" id="evidences">
<h5 class="card-title">List of evidences</h5> <h5 class="card-title">{% trans 'List of evidences' %}</h5>
<div class="list-group col-6"> <div class="list-group col-6">
{% for snap in object.evidences %} {% for snap in object.evidences %}
<div class="list-group-item"> <div class="list-group-item">
<div class="d-flex w-100 justify-content-between"> <div class="d-flex w-100 justify-content-between">
<h5 class="mb-1"></h5>
<small class="text-muted">{{ snap.created }}</small> <small class="text-muted">{{ snap.created }}</small>
</div> </div>
<p class="mb-1"> <p class="mb-1">
<a href="{% url 'evidence:details' snap.uuid %}">{{ snap.uuid }}</a> <a href="{% url 'evidence:details' snap.uuid %}">{{ snap.uuid }}</a>
</p> </p>
<small class="text-muted"></small>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>