This commit is contained in:
Takeus committed 2025-02-12 12:01:08 +01:00
1 parent e5fbf15828
commit 4628df54e1
8 files changed
+163 -16

No files matched your search

+3 -1
View File
@@ -9,11 +9,13 @@
</div>
<div class="modal-body">
<p>
{{ modal.body|safe }}<br><br>
{{ modal.body|safe }}<hr>
{% for entry in form %}
{% if entry.id != 'csrf_token' %}
<div class="mb-3">
{{ entry.label(class="form-label") }}<br>
{{ entry(class="form-control") }}
</div>
{% endif %}
{% endfor %}
</p>
+49
View File
@@ -0,0 +1,49 @@
{% for allocation in db_alloc %}
<tr>
<td><b>{{allocation.ipv4}}</b></td>
<td>{{allocation.hostname}}</td>
<td>{{allocation.description}}</td>
<td>
{% if Inventory.query.filter_by(id=allocation.device_id).first() %}
<a href="{{Inventory.query.filter_by(id=allocation.device_id).first().id}}" style="text-decoration:none;">link</a>
{% else %}
N/A
{% endif %}
</td>
<td>
{% if allocation.is_used %}
<button
hx-get="{{ url_for('base.allocation_edit_modal',net_id=network.id,ipv4=allocation.ipv4) }}?page={{active_page}}"
hx-trigger="click"
hx-target="#modal-edit"
data-bs-toggle="modal"
data-bs-target="#modal-edit"
class="btn btn-sm btn-outline-info"
style="padding-top:1px;padding-bottom:1px"
> Edit
</button>
<button
hx-get="{{ url_for('base.allocation_del_modal',net_id=network.id,ipv4=allocation.ipv4) }}?page={{active_page}}"
hx-trigger="click"
hx-target="#modal-del"
data-bs-toggle="modal"
data-bs-target="#modal-del"
class="btn btn-sm btn-outline-warning"
style="padding-top:1px;padding-bottom:1px"
> Unallocate
</button>
{% else %}
<button
hx-get="{{ url_for('base.allocation_edit_modal',net_id=network.id,ipv4=allocation.ipv4) }}?page={{active_page}}"
hx-trigger="click"
hx-target="#modal-edit"
data-bs-toggle="modal"
data-bs-target="#modal-edit"
class="btn btn-sm btn-outline-success"
style="padding-top:1px;padding-bottom:1px"
> Allocate
</button>
{% endif %}
</td>
</tr>
{% endfor %}
+31 -6
View File
@@ -4,8 +4,20 @@
{% include 'panel/_flash.html' %}
<div class="container" style="margin-top:5vh;">
<div class="row">
<!-- Search BAR -->
<div class="col-12">
<div class="mb-3">
<input class="form-control" type="search"
name="search" placeholder="Begin Typing To Search Users..."
hx-post="{{ url_for('base.allocation_search',net_id=network.id) }}"
hx-trigger="input changed delay:500ms, keyup[key=='Enter']"
hx-target="#search-results"
hx-indicator=".htmx-indicator"
>
</div>
</div>
<!-- IPV4 TABLE -->
<div class="col-9">
<div class="col-12">
<table class="table table-striped table-hover table-sm">
<thead>
<tr>
@@ -16,7 +28,7 @@
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
<tbody id="search-results">
{% for allocation in allocations %}
<tr>
<td><b>{{allocation.ipv4}}</b></td>
@@ -30,6 +42,7 @@
{% endif %}
</td>
<td>
{% if allocation.is_used %}
<button
hx-get="{{ url_for('base.allocation_edit_modal',net_id=network.id,ipv4=allocation.ipv4) }}?page={{active_page}}"
hx-trigger="click"
@@ -46,17 +59,29 @@
hx-target="#modal-del"
data-bs-toggle="modal"
data-bs-target="#modal-del"
class="btn btn-sm btn-outline-danger"
class="btn btn-sm btn-outline-warning"
style="padding-top:1px;padding-bottom:1px"
> Delete
> Unallocate
</button>
{% else %}
<button
hx-get="{{ url_for('base.allocation_edit_modal',net_id=network.id,ipv4=allocation.ipv4) }}?page={{active_page}}"
hx-trigger="click"
hx-target="#modal-edit"
data-bs-toggle="modal"
data-bs-target="#modal-edit"
class="btn btn-sm btn-outline-success"
style="padding-top:1px;padding-bottom:1px"
> Allocate
</button>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- IPV4 FORM -->
<!-- IPV4 FORM
<div class="col-3">
<div class="card p-4 shadow rounded-3">
<h2 class="text-center mb-4">Add IPv4</h2>
@@ -77,7 +102,7 @@
<button type="submit" class="btn btn-secondary w-100">Submit</button>
</form>
</div>
</div>
</div> -->
</div>
<div class="d-flex justify-content-between">
<nav>
+1 -1
View File
@@ -26,7 +26,7 @@
<td>{{Allocation.query.filter_by(net_id=network.id,is_used=True).count()}} / {{network.hosts}} </td>
<td><b>{{network.description}}</b></td>
<td>
<a href="{{ url_for('base.allocations',net_id=network.id) }}" class="btn btn-sm btn-outline-info" style="padding-top:1px;padding-bottom:1px">Allocations</a>
<a href="{{ url_for('base.allocations',net_id=network.id) }}?page=1" class="btn btn-sm btn-outline-info" style="padding-top:1px;padding-bottom:1px">Allocations</a>
<button
hx-get="{{ url_for('base.network_del_modal',net_id=network.id) }}"
hx-trigger="click"