This commit is contained in:
Takeus committed 2025-02-18 15:29:27 +01:00
1 parent eefc23fad8
commit 06b7efd58b
12 files changed
+483 -73

No files matched your search

+6
View File
@@ -22,6 +22,7 @@
<th>ID</th>
<th>Username</th>
<th>Admin User</th>
<th>RO</th>
<th>Last Connection</th>
<th>Actions</th>
</tr>
@@ -32,6 +33,7 @@
<td>{{user.id}}</td>
<td>{{user.username}}</td>
<td>{{user.is_admin}}</td>
<td>{{user.is_reado}}</td>
<td>{% if user.dat_last != None %}{{user.dat_last.strftime('%Y-%m-%d %H:%M:%S')}}{%else%}N/A{%endif%}</td>
<td>
<button
@@ -80,6 +82,10 @@
<label class="form-label">Is Admin?</label>
{{ form.is_admin(class="form-control") }}
</div>
<div class="mb-3">
<label class="form-label">Is Readonly?</label>
{{ form.is_readonly(class="form-control") }}
</div>
<button type="submit" class="btn btn-secondary w-100">Submit</button>
</form>
</div>
+50 -3
View File
@@ -1,5 +1,5 @@
{% if modal.modal_type == 'form' %}
<div class="modal-dialog modal-dialog-centered">
<div class="modal-dialog">
<form method="post" action="{{modal.form_url}}{% if pagination_active %}?page={{old_page}}{%endif%}">
{{ form.csrf_token }}
<div class="modal-content">
@@ -8,8 +8,29 @@
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
{% if modal.inventory %}
{{ modal.body|safe }}<hr>
<div class="row">
{% for entry in form %}
{% if entry.id != 'csrf_token' %}
{% if entry.id == 'item_ip_allocations' %}
<div class="col-12">
{{ entry.label(class="form-label") }}<br>
{{ entry(class="form-control",placeholder='192.168.1.1,192.168.1.2 (separate with ,)') }}
</div>
{% else %}
<div class="col-6">
<div class="mb-2">
{{ entry.label(class="form-label") }}<br>
{{ entry(class="form-control") }}
</div>
</div>
{% endif %}
{% endif %}
{% endfor %}
</div>
{% else %}
<p>
{{ modal.body|safe }}<hr>
{% for entry in form %}
{% if entry.id != 'csrf_token' %}
<div class="mb-3">
@@ -19,6 +40,7 @@
{% endif %}
{% endfor %}
</p>
{% endif %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
@@ -27,11 +49,36 @@
</div>
</form>
</div>
{% elif modal.modal_type == 'infos' %}
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title text-{{modal.color}}">{{ modal.title|safe }}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="row">
{% for info in informations %}
<div class="{{info[2]}}">
<div class="mb-3">
<label for="{{info[0]}}">{{info[0]}}</label>
<input class="form-control" type="text" id="{{info[0]}}" value="{{info[1]}}" readonly>
<!--{{ key }} : {{ value }}-->
</div>
</div>
{% endfor %}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
{% else %}
<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>
<h5 class="modal-title text-{{modal.color}}">{{ modal.title|safe }}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
+2 -1
View File
@@ -20,7 +20,8 @@
<li><a class="dropdown-item" href="{{ url_for('inventory.list_items',item_type=3) }}"><i class="bi bi-server"></i> Virtual Machines</a></li>
<li><a class="dropdown-item" href="{{ url_for('inventory.list_items',item_type=4) }}"><i class="bi bi-ethernet"></i> Networks Devices</a></li>
<li><a class="dropdown-item" href="{{ url_for('inventory.list_items',item_type=0) }}"><i class="bi bi-collection"></i> Others</a></li>
<li><a class="dropdown-item" href="{{ url_for('inventory.add_item') }}"><i class="bi bi-plus-circle"></i> ADD NEW</a></li>
<li><a class="dropdown-item" href="{{ url_for('inventory.list_items',item_type=5) }}"><i class="bi bi-collection"></i> All</a></li>
{% if current_user.is_reado == False %}<li><a class="dropdown-item" href="{{ url_for('inventory.add_item') }}"><i class="bi bi-plus-circle"></i> ADD NEW</a></li>{% endif %}
</ul>
</li>
{% if current_user.is_admin %}
+12 -1
View File
@@ -5,7 +5,16 @@
<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>
<button
hx-get="{{ url_for('inventory.item_view_modal',item_id=allocation.device_id) }}"
hx-trigger="click"
hx-target="#modal-view"
data-bs-toggle="modal"
data-bs-target="#modal-view"
class="btn btn-sm btn-outline-primary"
style="padding-top:1px;padding-bottom:1px"
> Details
</button>
{% else %}
N/A
{% endif %}
@@ -13,6 +22,7 @@
<td>{{allocation.is_dhcp}}</td>
<td>{{allocation.is_gateway}}</td>
<td>{{allocation.is_decom}}</td>
{% if current_user.is_reado == False %}
<td>
{% if allocation.is_used %}
<button
@@ -53,5 +63,6 @@
</button>
{% endif %}
</td>
{% endif %}
</tr>
{% endfor %}
+12 -3
View File
@@ -18,7 +18,7 @@
</div>
<!-- IPV4 TABLE -->
<div class="col-12">
<table class="table table-striped table-hover table-sm">
<table class="table table-hover table-sm">
<thead>
<tr>
<th scope="col">IPv4</th>
@@ -27,8 +27,8 @@
<th scope="col">Device</th>
<th scope="col">DHCP</th>
<th scope="col">GATEWAY</th>
<th scope="col">DECOM</th>
<th scope="col">Actions</th>
<th scope="col">DECOM</th>
{% if current_user.is_reado == False %}<th scope="col">Actions</th>{% endif %}
</tr>
</thead>
<tbody id="search-results">
@@ -73,4 +73,13 @@
<div class="modal-content"></div>
</div>
</div>
<div id="modal-view"
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 %}
+121 -25
View File
@@ -2,36 +2,132 @@
{% block content %}
{% include 'panel/_nav.html' %}
{% include 'panel/_flash.html' %}
<div class="container" style="margin-top:5vh;">
<div class="container" style="margin-top:4vh;">
<div class="row">
<div class="col-2"></div>
<div class="col-8">
<table class="table table-striped table-hover table-sm">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Hostname</th>
<th scope="col">Description</th>
<th scope="col">Type</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
{% for item in item_list %}
<tr>
<td>{{item.id}}</td>
<td>{{item.host_name}}</td>
<td>{{item.host_desc}}</td>
<td>{{item.host_type}}</td>
<td>
<a href="{{ url_for('inventory.action_item',action=1,item_id=item.id) }}?page={{active_page}}" class="btn btn-sm btn-outline-danger" style="padding-top:1px;padding-bottom:1px">Delete</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<h1>{{title}}</h1>
<div class="card shadow-sm">
<div class="card-body">
<table class="table table-hover table-sm">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">Hostname</th>
<th scope="col">Description</th>
<th scope="col">Type</th>
<th scope="col">Owner</th>
<th scope="col">Allocation(s)</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
{% for item in item_list %}
<tr>
<th scope="row">{{item.id}}</th>
<td>{{item.host_name}}</td>
<td>{{item.host_desc}}</td>
{% if item.host_type == 1 %}
<td><i class="bi bi-pc-display"></i> (PC)</td>
{% elif item.host_type == 2 %}
<td><i class="bi bi-server"></i> (SRV)</td>
{% elif item.host_type == 3 %}
<td><i class="bi bi-server"></i> (VM)</td>
{% elif item.host_type == 4 %}
<td><i class="bi bi-ethernet"></i> (NT)</td>
{% elif item.host_type == 0 %}
<td>Other</td>
{% endif %}
<!--
{% if 'WINDOWS' in item.host_os|upper or 'WS' in item.host_os|upper %}
<td><i class="bi bi-windows"></i> {{item.host_os}}</td>
{% elif 'UBUNTU' in item.host_os|upper %}
<td><i class="bi bi-ubuntu"></i> {{item.host_os}}</td>
{% elif 'MACOS' in item.host_os|upper or 'APPLE' in item.host_os|upper %}
<td><i class="bi bi-apple"></i> {{item.host_os}}</td>
{% else %}
<td>{{item.host_os}}</td>
{% endif %}
-->
<td>{{item.host_owner}}</td>
<td>
{% if item.host_allocations != None %}
{% set alloc_count = item.host_allocations.split(',')|length-1 %}
{{alloc_count}}
{% else %}
{{item.host_allocations}}
{% endif %}
</td>
<td>
<button
hx-get="{{ url_for('inventory.item_view_modal',item_id=item.id) }}?page={{current_page}}"
hx-trigger="click"
hx-target="#modal-view"
data-bs-toggle="modal"
data-bs-target="#modal-view"
class="btn btn-sm btn-outline-info"
style="padding-top:1px;padding-bottom:1px"
> Details
</button>
{% if current_user.is_reado == False %}
<button
hx-get="{{ url_for('inventory.item_edit_modal',item_id=item.id) }}?page={{current_page}}"
hx-trigger="click"
hx-target="#modal-edit"
data-bs-toggle="modal"
data-bs-target="#modal-edit"
class="btn btn-sm btn-outline-primary"
style="padding-top:1px;padding-bottom:1px"
> Edit
</button>
<button
hx-get="{{ url_for('inventory.item_del_modal',item_id=item.id) }}?page={{current_page}}"
hx-trigger="click"
hx-target="#modal-del"
data-bs-toggle="modal"
data-bs-target="#modal-del"
class="btn btn-sm btn-outline-danger"
style="padding-top:1px;padding-bottom:1px"
> Delete
</button>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="col-2"></div>
</div>
</div>
<!-- MODAL -->
<div id="modal-del"
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>
<div id="modal-edit"
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>
<div id="modal-view"
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 %}
+5 -1
View File
@@ -5,7 +5,7 @@
<div class="container" style="margin-top:5vh;">
<div class="row">
<!-- PREFIXES TABLE -->
<div class="col-9">
<div class="col-{% if current_user.is_reado == False %}9{% else %}12{% endif %}">
<table class="table table-striped table-hover">
<thead>
<tr>
@@ -27,6 +27,7 @@
<td><b>{{network.description}}</b></td>
<td>
<a href="{{ url_for('network.allocations',net_id=network.id) }}?page=1" class="btn btn-sm btn-outline-info" style="padding-top:1px;padding-bottom:1px">Allocations</a>
{% if current_user.is_reado == False %}
<button
hx-get="{{ url_for('network.network_del_modal',net_id=network.id) }}"
hx-trigger="click"
@@ -37,6 +38,7 @@
style="padding-top:1px;padding-bottom:1px"
> Delete
</button>
{% endif %}
</td>
</tr>
{% endfor %}
@@ -44,6 +46,7 @@
</table>
</div>
<!-- PREFIX FORM -->
{% if current_user.is_reado == False %}
<div class="col-3">
<div class="card p-4 shadow rounded-3">
<h2 class="text-center mb-4">Add Network</h2>
@@ -65,6 +68,7 @@
</form>
</div>
</div>
{% endif %}
</div>
</div>
<!-- MODAL -->