update device and computer details to bootstrap4

This commit is contained in:
Andreas Zweili 2020-02-25 21:17:59 +01:00
parent ac4ff86ea9
commit 9cbf760ef3
5 changed files with 197 additions and 184 deletions

View File

@ -1,7 +1,7 @@
{% extends "core/base.html" %} {% extends "core/base.html" %}
{% block section_title %}{{ device }}{% endblock %} {% block section_title %}{{ device }}{% endblock %}
{% block content %} {% block content %}
<div class="row"> <div class="row row-cols-3">
<div class="col"> <div class="col">
{% block device_details %} {% block device_details %}
{% include "devices/device_details_block.html" %} {% include "devices/device_details_block.html" %}
@ -19,123 +19,125 @@
{% include "devices/ip_block.html" %} {% include "devices/ip_block.html" %}
{% endblock %} {% endblock %}
</div> </div>
</div>
<div class="row">
{% if device.os or software_relations or backup_relations or license_list or device.host %} {% if device.os or software_relations or backup_relations or license_list or device.host %}
<div class="col"> <div class="col">
{% if device.host %} <div class="card">
<h2>Host</h2> <div class="card-body">
<ul> {% if device.host %}
<li><a href="{% url 'device' device.host.id %}">{{ device.host }}</a></li> <h2>Host</h2>
</ul> <ul>
{% endif %} <li><a href="{% url 'device' device.host.id %}">{{ device.host }}</a></li>
</ul>
{% endif %}
{% if device.os %}
<h2>Operating System</h2>
<ul>
<li>{{ device.os }}</li>
</ul>
{% endif %}
{% if device.os %} {% if software_relations %}
<h2>Operating System</h2> <h2>Software</h2>
<ul> <ul>
<li>{{ device.os }}</li> {% for relation in software_relations %}
</ul> <li>{{ relation.software }}</li>
{% endif %} {% endfor %}
</ul>
{% endif %}
{% if software_relations %} {% if license_list %}
<h2>Software</h2> {% block license %}
<ul> {% include "licenses/license_block.html" %}
{% for relation in software_relations %} {% endblock %}
<li>{{ relation.software }}</li> {% endif %}
{% endfor %}
</ul>
{% endif %}
{% if license_list %} {% if backup_relations %}
{% block license %} <h2>Backup</h2>
{% include "licenses/license_block.html" %} <ul>
{% endblock %} {% for backup in backup_relations %}
{% endif %} <li><a href="{% url 'backup' backup.id %}">{{ backup }}</a></li>
{% endfor %}
{% if backup_relations %} </ul>
<h2>Backup</h2> {% endif %}
<ul> </div>
{% for backup in backup_relations %} </div>
<li><a href="{% url 'backup' backup.id %}">{{ backup }}</a></li>
{% endfor %}
</ul>
{% endif %}
</div> </div>
{% endif %} {% endif %}
{% if cpu_relations or ram_relations or disks_relations or raid_disk_pairs %} {% if cpu_relations or ram_relations or disks_relations or raid_disk_pairs %}
<div class="col"> <div class="col">
{% if cpu_relations or ram_relations or disks_relations or device.host %} <div class="card">
<h2>Hardware</h2> <h2 class="card-header">Hardware</h2>
<table class="table table-bordered"> <div class="card-body">
{% if cpu_relations or ram_relations or disks_relations or device.host %}
<table class="table table-bordered">
{% if cpu_relations %}
<tr>
<td><b>CPUs:</b></td>
<td>
{% for cpu in cpu_relations %}
{{ cpu.amount }}x {{ cpu.cpu }}<br>
{% endfor %}
</td>
</tr>
{% endif %}
{% if cpu_relations %} {% if ram_relations %}
<tr> <tr>
<td><b>CPUs:</b></td> <td><b>RAM Modules:</b></td>
<td> <td>
{% for cpu in cpu_relations %} {% for module in ram_relations %}
{{ cpu.amount }}x {{ cpu.cpu }}<br> {{ module.amount }}x {{ module.ram }}<br>
{% endfor %} {% endfor %}
</td> </td>
</tr> </tr>
{% endif %} {% endif %}
{% if ram_relations %} {% if disks_relations %}
<tr> <tr>
<td><b>RAM Modules:</b></td> <td><b>Disks:</b></td>
<td> <td>
{% for module in ram_relations %} {% for disk in disks_relations %}
{{ module.amount }}x {{ module.ram }}<br> {{ disk.amount }}x {{ disk.disk }}<br>
{% endfor %} {% endfor %}
</td> </td>
</tr> </tr>
{% endif %} {% endif %}
</table>
{% if disks_relations %} {% endif %}
<tr>
<td><b>Disks:</b></td>
<td>
{% for disk in disks_relations %}
{{ disk.amount }}x {{ disk.disk }}<br>
{% endfor %}
</td>
</tr>
{% endif %}
</table>
{% endif %}
{% if raid_disk_pairs %}
<h2>RAID</h2>
{% for raid, disks in raid_disk_pairs.items %}
<table class="table table-bordered">
<tr>
<td><b>Type:</b></td>
<td>{{ raid.raid_type }}</td>
</tr>
<tr>
<td><b>Usable Space</b></td>
<td>{{ raid.usable_space }}</td>
</tr>
{% if disks %}
{% for disk in disks %}
<tr>
<td><b>Disk Type</b></td>
<td>{{ disk.disk }}</td>
</tr>
<tr>
<td><b>Amount</b></td>
<td>{{ disk.disk_amount }}</td>
</tr>
{% endfor %}
{% endif %}
</table>
{% endfor %}
{% endif %}
{% if raid_disk_pairs %}
<h3>RAID</h3>
{% for raid, disks in raid_disk_pairs.items %}
<table class="table table-bordered">
<tr>
<td><b>Type:</b></td>
<td>{{ raid.raid_type }}</td>
</tr>
<tr>
<td><b>Usable Space</b></td>
<td>{{ raid.usable_space }}</td>
</tr>
{% if disks %}
{% for disk in disks %}
<tr>
<td><b>Disk Type</b></td>
<td>{{ disk.disk }}</td>
</tr>
<tr>
<td><b>Amount</b></td>
<td>{{ disk.disk_amount }}</td>
</tr>
{% endfor %}
{% endif %}
</table>
{% endfor %}
{% endif %}
</div>
</div>
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -1,37 +1,41 @@
<h2>Description</h2> <div class="card">
<div class="description"><p>{{ device.description }}</p></div> <div class="card-body">
<table class="table table-bordered"> <h4>Description</h4>
<tr> <div class="card-text"><p>{{ device.description }}</p></div>
<td><b>Serial Number:</b></td> <table class="table table-bordered">
<td><code>{{ device.serialnumber }}</code></td> <tr>
</tr> <td><b>Serial Number:</b></td>
<tr> <td><code>{{ device.serialnumber }}</code></td>
<td><b>Category:</b></td> </tr>
<td>{{ device.category }}</td> <tr>
</tr> <td><b>Category:</b></td>
<tr> <td>{{ device.category }}</td>
<td><b>Owner:</b></td> </tr>
<td>{{ device.owner }}</td> <tr>
</tr> <td><b>Owner:</b></td>
<tr> <td>{{ device.owner }}</td>
<td><b>Customer:</b></td> </tr>
<td><a href="{% url 'customer' device.customer.id %}">{{ device.customer }}</a></td> <tr>
</tr> <td><b>Customer:</b></td>
<tr> <td><a href="{% url 'customer' device.customer.id %}">{{ device.customer }}</a></td>
<td><b>Manufacturer:</b></td> </tr>
<td>{{ device.manufacturer }}</td> <tr>
</tr> <td><b>Manufacturer:</b></td>
<tr> <td>{{ device.manufacturer }}</td>
<td><b>Model:</b></td> </tr>
<td>{{ device.model }}</td> <tr>
</tr> <td><b>Model:</b></td>
<td>{{ device.model }}</td>
</tr>
<tr> <tr>
<td><b>Location:</b></td> <td><b>Location:</b></td>
<td>{{ device.location }}</td> <td>{{ device.location }}</td>
</tr> </tr>
<tr> <tr>
<td><b>Installation Date:</b></td> <td><b>Installation Date:</b></td>
<td>{{ device.installation_date }}</td> <td>{{ device.installation_date }}</td>
</tr> </tr>
</table> </table>
</div>
</div>

View File

@ -1,19 +1,21 @@
{% if device.nets %} {% if device.nets %}
<div class="col"> <div class="card">
<h2>IPs</h2> <h2 class="card-header">IPs</h2>
<table class="table table-bordered"> <div class="card-body">
{% regroup device.nets by name as nets_list %} <table class="table table-bordered">
{% for net in nets_list %} {% regroup device.nets by name as nets_list %}
<tr> {% for net in nets_list %}
<td><b>{{ net.grouper }}</b></td> <tr>
<td> <td><b>{{ net.grouper }}</b></td>
{% for ip in net.list %} <td>
<a href="{% url 'net' ip.net_id %}">{{ ip.ip }}</a><br> {% for ip in net.list %}
{% endfor %} <a href="{% url 'net' ip.net_id %}">{{ ip.ip }}</a><br>
</td> {% endfor %}
</tr> </td>
{% endfor %} </tr>
</table> {% endfor %}
</table>
</div> </div>
</div>
{% endif %} {% endif %}

View File

@ -1,30 +1,35 @@
{% if warranty_relations %} {% if warranty_relations %}
<div class="col"> <div class="card">
<h2>Warranty</h2> <h2 class="card-header">Warranty</h2>
<div class="card-body">
{% for warranty in warranty_relations %} {% for warranty in warranty_relations %}
<table class="table table-bordered"> <table class="table table-bordered">
<tr> <tr>
<td><b>Valid From:</b></td> <td><b>Valid From:</b></td>
<td> <td>
{{ warranty.valid_from }}<br> {{ warranty.valid_from }}<br>
</td> </td>
<tr> </tr>
<td><b>Valid Until:</b></td> <tr>
<td> <td><b>Valid Until:</b></td>
{{ warranty.valid_until }}<br> <td>
</td> {{ warranty.valid_until }}<br>
<tr> </td>
<td><b>Duration:</b></td> </tr>
<td> <tr>
{{ warranty.duration_in_years }}<br> <td><b>Duration:</b></td>
</td> <td>
<tr> {{ warranty.duration_in_years }}<br>
<td><b>Type:</b></td> </td>
<td> </tr>
{{ warranty.warranty_type }}<br> <tr>
</td> <td><b>Type:</b></td>
</tr> <td>
{{ warranty.warranty_type }}<br>
</td>
</tr>
</table> </table>
{% endfor %} {% endfor %}
</div> </div>
{% endif %} </div>
{% endif %}

View File

@ -1,9 +1,9 @@
<h2>Licenses</h2> <h2>Licenses</h2>
<table class="table table-bordered"> <table class="table table-bordered">
{% for license in license_list %} {% for license in license_list %}
<tr> <tr>
<td>{{ license.license.software }}</td> <td>{{ license.license.software }}</td>
<td><code>{{ license.license.key }}</code></td> <td><code>{{ license.license.key }}</code></td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>