This commit is contained in:
Takeus committed 2025-02-04 15:28:39 +01:00
1 parent a8d9727527
commit 602bb7d706
8 files changed
+174 -21

No files matched your search

+1
View File
@@ -17,6 +17,7 @@
<body>
{% block content %}{% endblock %}
<!-- JAVASCRIPT -->
<script src="{{ url_for('static',filename='js/htmx.min.js') }}"></script>
<script src="{{ url_for('static',filename='js/bootstrap.bundle.min.js') }}"></script>
</body>
</html>
+19
View File
@@ -0,0 +1,19 @@
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title text-{{modal.color}}">{{ modal.title }}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>{{ modal.body|safe }}</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
{% if modal.action == 'delete' %}
<a href="{{modal.action_url}}" class="btn btn-{{modal.color}}">{{modal.action_text}}</a>
{% else %}
<button type="button" class="btn btn-primary">Save changes</button>
{% endif %}
</div>
</div>
</div>
+33 -6
View File
@@ -13,6 +13,7 @@
<th scope="col">IPv4</th>
<th scope="col">Hostname</th>
<th scope="col">Description</th>
<th scope="col">Device</th>
<th scope="col">Actions</th>
</tr>
</thead>
@@ -23,9 +24,25 @@
<td>{{allocation.ipv4}}</td>
<td>{{allocation.hostname}}</td>
<td><b>{{allocation.description}}</b></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>
<a href="" class="btn btn-sm btn-outline-info" style="padding-top:1px;padding-bottom:1px">edit</a>
<button class="btn btn-sm btn-outline-danger"style="padding-top:1px;padding-bottom:1px">delete</button>
<button
hx-get="{{ url_for('base.allocation_del_modal',net_id=network.id,ipv4=allocation.ipv4) }}"
hx-trigger="click"
hx-target="#modal-get"
data-bs-toggle="modal"
data-bs-target="#modal-get"
class="btn btn-sm btn-outline-danger"
style="padding-top:1px;padding-bottom:1px"
> Delete
</button>
</td>
</tr>
{% endfor %}
@@ -39,16 +56,16 @@
<form method="POST">
{{ form.csrf_token }}
<div class="mb-3">
<label for="ipv4" class="form-label">IPv4</label>
<label class="form-label">IPv4</label>
{{ form.ipv4(class="form-control", placeholder=network.network_address) }}
</div>
<div class="mb-3">
<label for="prefix" class="form-label">Hostname</label>
{{ form.hostname(class="form-control", placeholder="example") }}
<label class="form-label">Hostname</label>
{{ form.host_name(class="form-control", placeholder="example") }}
</div>
<div class="mb-3">
<label for="description" class="form-label">Description</label>
{{ form.description(class="form-control", placeholder="webserver") }}
<label class="form-label">Description</label>
{{ form.host_desc(class="form-control", placeholder="webserver") }}
</div>
<button type="submit" class="btn btn-secondary w-100">Submit</button>
</form>
@@ -56,4 +73,14 @@
</div>
</div>
</div>
<!-- MODAL -->
<div id="modal-get"
class="modal modal-blur fade"
style="display: none"
aria-hidden="false"
tabindex="-1">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content"></div>
</div>
</div>
{% endblock %}
+20 -1
View File
@@ -27,7 +27,16 @@
<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>
<button class="btn btn-sm btn-outline-danger"style="padding-top:1px;padding-bottom:1px">delete</button>
<button
hx-get="{{ url_for('base.network_del_modal',net_id=network.id) }}"
hx-trigger="click"
hx-target="#modal-get"
data-bs-toggle="modal"
data-bs-target="#modal-get"
class="btn btn-sm btn-outline-danger"
style="padding-top:1px;padding-bottom:1px"
> Delete
</button>
</td>
</tr>
{% endfor %}
@@ -58,4 +67,14 @@
</div>
</div>
</div>
<!-- MODAL -->
<div id="modal-get"
class="modal modal-blur fade"
style="display: none"
aria-hidden="false"
tabindex="-1">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content"></div>
</div>
</div>
{% endblock %}