mirror of
https://github.com/TakeusV1/flask_ipam.git
synced 2026-10-13 17:15:33 +02:00
DEV V1.2
This commit is contained in:
1 parent
a9e8a70df5
commit
eefc23fad8
14 files changed
+406
-326
No files matched your search
@@ -10,16 +10,17 @@
|
||||
<a class="nav-link {% if is_dash %}active{% endif %}" href="{{ url_for('base.dashboard') }}"><i class="bi bi-house-door-fill"></i> Dashboard</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if is_networks %}active{% endif %}" href="{{ url_for('base.networks') }}"><i class="bi bi-globe"></i> Network(s)</a>
|
||||
<a class="nav-link {% if is_networks %}active{% endif %}" href="{{ url_for('network.networks') }}"><i class="bi bi-globe"></i> Network(s)</a>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle disabled" role="button" data-bs-toggle="dropdown" aria-expanded="false"><i class="bi bi-archive-fill"></i> Inventory</a>
|
||||
<a class="nav-link dropdown-toggle" role="button" data-bs-toggle="dropdown" aria-expanded="false"><i class="bi bi-archive-fill"></i> Inventory</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="#"><i class="bi bi-pc-display"></i> Computers</a></li>
|
||||
<li><a class="dropdown-item" href="#"><i class="bi bi-server"></i> Servers</a></li>
|
||||
<li><a class="dropdown-item" href="#"><i class="bi bi-server"></i> Virtual Machines</a></li>
|
||||
<li><a class="dropdown-item" href="#"><i class="bi bi-ethernet"></i> Networks Devices</a></li>
|
||||
<li><a class="dropdown-item" href="#"><i class="bi bi-collection"></i> Others</a></li>
|
||||
<li><a class="dropdown-item" href="{{ url_for('inventory.list_items',item_type=1) }}"><i class="bi bi-pc-display"></i> Computers</a></li>
|
||||
<li><a class="dropdown-item" href="{{ url_for('inventory.list_items',item_type=2) }}"><i class="bi bi-server"></i> Servers</a></li>
|
||||
<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>
|
||||
</ul>
|
||||
</li>
|
||||
{% if current_user.is_admin %}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<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-get="{{ url_for('network.allocation_edit_modal',net_id=network.id,ipv4=allocation.ipv4) }}?page={{active_page}}"
|
||||
hx-trigger="click"
|
||||
hx-target="#modal-edit"
|
||||
data-bs-toggle="modal"
|
||||
@@ -26,12 +26,12 @@
|
||||
> Edit
|
||||
</button>
|
||||
{% if allocation.is_decom %}
|
||||
<a href="{{ url_for('base.allocation_decom',action=2,net_id=network.id,ipv4=allocation.ipv4) }}?page={{active_page}}" class="btn btn-sm btn-outline-primary" style="padding-top:1px;padding-bottom:1px">Undecom</a>
|
||||
<a href="{{ url_for('network.allocation_decom',action=2,net_id=network.id,ipv4=allocation.ipv4) }}?page={{active_page}}" class="btn btn-sm btn-outline-primary" style="padding-top:1px;padding-bottom:1px">Undecom</a>
|
||||
{% else %}
|
||||
<a href="{{ url_for('base.allocation_decom',action=1,net_id=network.id,ipv4=allocation.ipv4) }}?page={{active_page}}" class="btn btn-sm btn-outline-warning" style="padding-top:1px;padding-bottom:1px">Decom</a>
|
||||
<a href="{{ url_for('network.allocation_decom',action=1,net_id=network.id,ipv4=allocation.ipv4) }}?page={{active_page}}" class="btn btn-sm btn-outline-warning" style="padding-top:1px;padding-bottom:1px">Decom</a>
|
||||
{% endif %}
|
||||
<button
|
||||
hx-get="{{ url_for('base.allocation_del_modal',net_id=network.id,ipv4=allocation.ipv4) }}?page={{active_page}}"
|
||||
hx-get="{{ url_for('network.allocation_del_modal',net_id=network.id,ipv4=allocation.ipv4) }}?page={{active_page}}"
|
||||
hx-trigger="click"
|
||||
hx-target="#modal-del"
|
||||
data-bs-toggle="modal"
|
||||
@@ -42,7 +42,7 @@
|
||||
</button>
|
||||
{% else %}
|
||||
<button
|
||||
hx-get="{{ url_for('base.allocation_edit_modal',net_id=network.id,ipv4=allocation.ipv4) }}?page={{active_page}}"
|
||||
hx-get="{{ url_for('network.allocation_edit_modal',net_id=network.id,ipv4=allocation.ipv4) }}?page={{active_page}}"
|
||||
hx-trigger="click"
|
||||
hx-target="#modal-edit"
|
||||
data-bs-toggle="modal"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<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-post="{{ url_for('network.allocation_search',net_id=network.id) }}"
|
||||
hx-trigger="input changed delay:500ms, keyup[key=='Enter']"
|
||||
hx-target="#search-results"
|
||||
hx-indicator=".htmx-indicator"
|
||||
@@ -36,28 +36,6 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- IPV4 FORM
|
||||
<div class="col-3">
|
||||
<div class="card p-4 shadow rounded-3">
|
||||
<h2 class="text-center mb-4">Add IPv4</h2>
|
||||
<form method="POST">
|
||||
{{ form.csrf_token }}
|
||||
<div class="mb-3">
|
||||
<label class="form-label">IPv4</label>
|
||||
{{ form.ipv4(class="form-control", placeholder=network.network_address) }}
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Hostname</label>
|
||||
{{ form.host_name(class="form-control", placeholder="example") }}
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<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>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<nav>
|
||||
@@ -68,12 +46,6 @@
|
||||
{% if allocations.has_next %}
|
||||
<li class="page-item"><a class="page-link" href="?page={{next_page}}">Next</a></li>
|
||||
{% endif %}
|
||||
<!--
|
||||
{% for page in range(allocations.pages+1) %}
|
||||
{% if page != 0%}
|
||||
<li class="page-item"><a class="page-link {%if page==active_page%}active{%endif%}" href="?page={{page}}">{{page}}</a></li>
|
||||
{% endif %}
|
||||
{% endfor %}-->
|
||||
</ul>
|
||||
</nav>
|
||||
<div>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="row">
|
||||
<!-- NETWORKS -->
|
||||
<div class="col-3">
|
||||
<a href="{{ url_for('base.networks') }}" class="card text-bg-info mb-3 text-decoration-none">
|
||||
<a href="{{ url_for('network.networks') }}" class="card text-bg-info mb-3 text-decoration-none">
|
||||
<div class="card-header"><i class="bi bi-globe"></i> <b>Total Networks</b></div>
|
||||
<div class="card-body">
|
||||
<h1 class="card-title text-center">{{db_networks}}</h1>
|
||||
@@ -14,7 +14,7 @@
|
||||
</div>
|
||||
<!-- TOTAL IP -->
|
||||
<div class="col-3">
|
||||
<a href="{{ url_for('base.networks') }}" class="card text-bg-secondary mb-3 text-decoration-none" style="margin-bottom:1vh;">
|
||||
<a href="{{ url_for('network.networks') }}" class="card text-bg-secondary mb-3 text-decoration-none" style="margin-bottom:1vh;">
|
||||
<div class="card-header"><i class="bi bi-broadcast-pin"></i> <b>Total Allocations</b></div>
|
||||
<div class="card-body">
|
||||
<h1 class="card-title text-center">{{db_allocations}} / {{ available_alloc }}</h1>
|
||||
@@ -75,12 +75,17 @@
|
||||
});
|
||||
/* Devices Chart */
|
||||
const ctx1 = document.getElementById('deviceschart');
|
||||
var computers = JSON.parse('{{ Inventory.query.filter_by(host_type=1).count() | tojson }}');
|
||||
var servers = JSON.parse('{{ Inventory.query.filter_by(host_type=2).count() | tojson }}');
|
||||
var virtual_machines = JSON.parse('{{ Inventory.query.filter_by(host_type=3).count() | tojson }}');
|
||||
var networks_devices = JSON.parse('{{ Inventory.query.filter_by(host_type=4).count() | tojson }}');
|
||||
var others = JSON.parse('{{ Inventory.query.filter_by(host_type=0).count() | tojson }}');
|
||||
new Chart(ctx1, {
|
||||
type: 'doughnut',
|
||||
data: {
|
||||
labels: ['Computers', 'Servers', 'VM', 'Network Devices', 'Others'],
|
||||
datasets: [{
|
||||
data: [1, 1, 1, 1, 1],
|
||||
data: [computers, servers, virtual_machines, networks_devices, others],
|
||||
borderWidth: 2
|
||||
}]
|
||||
},
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
{% extends 'panel/_base.html' %}
|
||||
{% block content %}
|
||||
{% include 'panel/_nav.html' %}
|
||||
{% include 'panel/_flash.html' %}
|
||||
<div class="container" style="margin-top:5vh;">
|
||||
<div class="row">
|
||||
<div class="col-4"></div>
|
||||
<div class="col-4">
|
||||
<div class="card p-4 shadow rounded-3">
|
||||
<h2 class="text-center mb-4">Add Item</h2>
|
||||
<form method="POST">
|
||||
{{ form.csrf_token }}
|
||||
<div class="mb-3">
|
||||
<label for="subnet" class="form-label">Name</label>
|
||||
{{ form.item_name(class="form-control", placeholder="Computer A") }}
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="prefix" class="form-label">Description</label>
|
||||
{{ form.item_desc(class="form-control", placeholder="Computer A for IT support...") }}
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="description" class="form-label">Item Type</label>
|
||||
{{ form.item_type(class="form-control") }}
|
||||
</div>
|
||||
<button type="submit" class="btn btn-secondary w-100">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4"></div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,37 @@
|
||||
{% extends 'panel/_base.html' %}
|
||||
{% block content %}
|
||||
{% include 'panel/_nav.html' %}
|
||||
{% include 'panel/_flash.html' %}
|
||||
<div class="container" style="margin-top:5vh;">
|
||||
<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>
|
||||
</div>
|
||||
<div class="col-2"></div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -26,9 +26,9 @@
|
||||
<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) }}?page=1" class="btn btn-sm btn-outline-info" style="padding-top:1px;padding-bottom:1px">Allocations</a>
|
||||
<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>
|
||||
<button
|
||||
hx-get="{{ url_for('base.network_del_modal',net_id=network.id) }}"
|
||||
hx-get="{{ url_for('network.network_del_modal',net_id=network.id) }}"
|
||||
hx-trigger="click"
|
||||
hx-target="#modal-get"
|
||||
data-bs-toggle="modal"
|
||||
|
||||
Reference in new issue
Block a user