feat: CPU & RAM as a device tab next to Disks
The CPU & RAM panel on the device page becomes its own tab with the total core count as badge. Besides CPU and RAM it shows the capacity of a virtualization host and the list of VMs running on it. Saving the form returns to the tab. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
8624ddb62f
commit
675574ee00
6 files changed
+124
-52
No files matched your search
@@ -0,0 +1,69 @@
|
||||
{% extends 'dcim/device/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
{% if not supported and not record %}
|
||||
<div class="alert alert-info">
|
||||
CPU & RAM werden für Geräte mit den konfigurierten Rollen (z. B. Server) und für Cluster-Hosts gepflegt.
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="row mb-3">
|
||||
<div class="col col-12 col-xl-6">
|
||||
<div class="card">
|
||||
<h2 class="card-header d-flex align-items-center">
|
||||
<span class="me-auto"><i class="mdi mdi-chip me-1" aria-hidden="true"></i>CPU & RAM</span>
|
||||
{% if record and can_change %}
|
||||
<a href="{% url 'plugins:netbox_utilities:devicehardware_edit' pk=record.pk %}?return_url={{ request.path|urlencode }}" class="btn btn-sm btn-outline-secondary">
|
||||
<i class="mdi mdi-pencil" aria-hidden="true"></i> Bearbeiten
|
||||
</a>
|
||||
{% elif not record and can_add %}
|
||||
<a href="{{ add_url }}" class="btn btn-sm btn-primary"><i class="mdi mdi-plus-thick" aria-hidden="true"></i> Erfassen</a>
|
||||
{% endif %}
|
||||
</h2>
|
||||
{% if record %}
|
||||
{% include 'netbox_utilities/inc/hardware_record.html' %}
|
||||
{% else %}
|
||||
<div class="card-body text-muted">Noch keine CPU und kein RAM erfasst.</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col col-12 col-xl-6">
|
||||
{% if capacity %}
|
||||
<div class="card">
|
||||
<h2 class="card-header d-flex align-items-center">
|
||||
<span class="me-auto"><i class="mdi mdi-server-network me-1" aria-hidden="true"></i>Virtualisierung</span>
|
||||
{% if object.cluster %}<a href="{{ object.cluster.get_absolute_url }}" class="btn btn-sm btn-outline-secondary">Cluster {{ object.cluster }}</a>{% endif %}
|
||||
</h2>
|
||||
{% include 'netbox_utilities/inc/hardware_capacity.html' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% if capacity %}
|
||||
<div class="card">
|
||||
<h2 class="card-header d-flex align-items-center">
|
||||
<span class="me-auto">VMs auf diesem Host <span class="badge text-bg-secondary">{{ vms|length }}</span></span>
|
||||
<a href="{{ vm_list_url }}" class="btn btn-sm btn-outline-secondary">In der VM-Liste öffnen</a>
|
||||
</h2>
|
||||
{% if vms %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-sm align-middle mb-0">
|
||||
<thead><tr><th>Name</th><th>Status</th><th>vCPUs</th><th>RAM</th><th>Mandant</th></tr></thead>
|
||||
<tbody>
|
||||
{% for vm in vms %}
|
||||
<tr>
|
||||
<td><a href="{{ vm.get_absolute_url }}">{{ vm }}</a></td>
|
||||
<td><span class="badge text-bg-{{ vm.get_status_color }}">{{ vm.get_status_display }}</span></td>
|
||||
<td>{{ vm.vcpus|floatformat:"-1"|default:"—" }}</td>
|
||||
<td>{% if vm.memory %}{{ vm.memory }} MB{% else %}—{% endif %}</td>
|
||||
<td>{% if vm.tenant %}<a href="{{ vm.tenant.get_absolute_url }}">{{ vm.tenant }}</a>{% else %}—{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="card-body text-muted">Keine VMs mit diesem Gerät als Host.</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
@@ -1,24 +0,0 @@
|
||||
<div class="card">
|
||||
<h2 class="card-header d-flex align-items-center">
|
||||
<span class="me-auto"><i class="mdi mdi-chip me-1" aria-hidden="true"></i>CPU & RAM</span>
|
||||
{% if record and can_change %}
|
||||
<a href="{% url 'plugins:netbox_utilities:devicehardware_edit' pk=record.pk %}?return_url={{ request.path|urlencode }}" class="btn btn-sm btn-outline-secondary">
|
||||
<i class="mdi mdi-pencil" aria-hidden="true"></i> Bearbeiten
|
||||
</a>
|
||||
{% elif not record and can_add %}
|
||||
<a href="{{ add_url }}" class="btn btn-sm btn-primary"><i class="mdi mdi-plus-thick" aria-hidden="true"></i> Erfassen</a>
|
||||
{% endif %}
|
||||
</h2>
|
||||
{% if record %}
|
||||
{% include 'netbox_utilities/inc/hardware_record.html' %}
|
||||
{% else %}
|
||||
<div class="card-body text-muted">Noch keine CPU und kein RAM erfasst.</div>
|
||||
{% endif %}
|
||||
{% if capacity %}
|
||||
<h3 class="card-header border-top h5 d-flex align-items-center">
|
||||
<span class="me-auto">Virtualisierung</span>
|
||||
<a href="{{ vm_list_url }}" class="btn btn-sm btn-outline-secondary">VMs anzeigen</a>
|
||||
</h3>
|
||||
{% include 'netbox_utilities/inc/hardware_capacity.html' %}
|
||||
{% endif %}
|
||||
</div>
|
||||
Reference in new issue
Block a user