Optically separate device and WiFi management
This commit is contained in:
parent
db86431b48
commit
ddff965bda
2 changed files with 58 additions and 43 deletions
|
@ -5,61 +5,66 @@
|
|||
<p><b>Organization:</b> {{ organization }}</p>
|
||||
<p><b>User:</b> {{ user.first_name }} {{ user.last_name }} ({{ user.username }})</p>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="table" name="table" class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Device ID</th>
|
||||
<th>Common Name</th>
|
||||
<th>Network</th>
|
||||
<th>Latest IP</th>
|
||||
<th>Options {% if user.is_superuser %}<a href="/makedevice/" style="font-weight:bold;color:green;"><i class="fas fa-plus" title="Add Device"></i></a>{% endif %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<div align="center"><b>Manage:</b> <a href="#" onclick="showdevices();">Devices</a> ‐ <a href="#" onclick="showwifi();">WiFi</a></div>
|
||||
|
||||
{% for device in devices %}
|
||||
<tr>
|
||||
<td><div style="display: inline; color: grey; font-weight: bold;" id="{{ device.id }}-indicator">⬤</div> <div style="display: inline;" id="{{ device.id }}-id">{{ device.serial }}</div></td>
|
||||
<td id="{{ device.id }}-name">{% if device.name %}{{ device.name }}{% endif %}</td>
|
||||
<td id="{{ device.id }}-network">{{ device.network }}</td>
|
||||
<td><div style="display:inline" id="{{ device.id }}-ip">{% if device.curip %}{{ device.curip }} (at {{ device.lasttime }}){% endif %}</div></td>
|
||||
<td><a href="/devices/{{ device.id }}/edit"><i class="fas fa-edit" title="Edit Device"></i></a> <a href="#"><i style="color: green;" onclick="askreboot({{ device.id }});" class="fas fa-sync" title="Reboot Device"></i></a>{% if user.is_staff %} <a onclick="downloadnotice();" href="/devices/{{ device.id }}/download"><i class="fas fa-download" title="Download Configuration"></i></a>{% endif %}{% if user.is_superuser %} <a href="#"><i style="color: darkred;" onclick="askdelete({{ device.id }});" class="fas fa-trash-alt" title="Delete Device"></i></a>{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<div name="devicespart" id="devicespart">
|
||||
<h2>Devices</h2>
|
||||
|
||||
</table>
|
||||
<div class="table-responsive">
|
||||
<table id="table" name="table" class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Device ID</th>
|
||||
<th>Common Name</th>
|
||||
<th>Network</th>
|
||||
<th>Latest IP</th>
|
||||
<th>Options {% if user.is_superuser %}<a href="/makedevice/" style="font-weight:bold;color:green;"><i class="fas fa-plus" title="Add Device"></i></a>{% endif %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
{% for device in devices %}
|
||||
<tr>
|
||||
<td><div style="display: inline; color: grey; font-weight: bold;" id="{{ device.id }}-indicator">⬤</div> <div style="display: inline;" id="{{ device.id }}-id">{{ device.serial }}</div></td>
|
||||
<td id="{{ device.id }}-name">{% if device.name %}{{ device.name }}{% endif %}</td>
|
||||
<td id="{{ device.id }}-network">{{ device.network }}</td>
|
||||
<td><div style="display:inline" id="{{ device.id }}-ip">{% if device.curip %}{{ device.curip }} (at {{ device.lasttime }}){% endif %}</div></td>
|
||||
<td><a href="/devices/{{ device.id }}/edit"><i class="fas fa-edit" title="Edit Device"></i></a> <a href="#"><i style="color: green;" onclick="askreboot({{ device.id }});" class="fas fa-sync" title="Reboot Device"></i></a>{% if user.is_staff %} <a onclick="downloadnotice();" href="/devices/{{ device.id }}/download"><i class="fas fa-download" title="Download Configuration"></i></a>{% endif %}{% if user.is_superuser %} <a href="#"><i style="color: darkred;" onclick="askdelete({{ device.id }});" class="fas fa-trash-alt" title="Delete Device"></i></a>{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2>WiFi</h2>
|
||||
<div name="wifipart" id="wifipart">
|
||||
<h2>WiFi</h2>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="wifi" name="wifi" class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Common Name</th>
|
||||
<th>SSID</th>
|
||||
<th>Options {% if user.is_staff %}<a href="/makewifi/" style="font-weight:bold;color:green;"><i class="fas fa-plus" title="Add WiFi"></i></a>{% endif %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<div class="table-responsive">
|
||||
<table id="wifi" name="wifi" class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Common Name</th>
|
||||
<th>SSID</th>
|
||||
<th>Options {% if user.is_staff %}<a href="/makewifi/" style="font-weight:bold;color:green;"><i class="fas fa-plus" title="Add WiFi"></i></a>{% endif %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
{% for wifi in wifis %}
|
||||
<tr>
|
||||
<td>{{ wifi.serial }}</td>
|
||||
<td>{{ wifi.ssid }}</td>
|
||||
<td><a href="/wifi/{{ wifi.id }}/edit"><i class="fas fa-edit" title="Edit WiFi"></i></a>{% if user.is_staff %} <a href="#"><i style="color: darkred;" onclick="askdeletewifi({{ wifi.id }});" class="fas fa-trash-alt" title="Delete WiFi"></i></a>{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% for wifi in wifis %}
|
||||
<tr>
|
||||
<td>{{ wifi.serial }}</td>
|
||||
<td>{{ wifi.ssid }}</td>
|
||||
<td><a href="/wifi/{{ wifi.id }}/edit"><i class="fas fa-edit" title="Edit WiFi"></i></a>{% if user.is_staff %} <a href="#"><i style="color: darkred;" onclick="askdeletewifi({{ wifi.id }});" class="fas fa-trash-alt" title="Delete WiFi"></i></a>{% endif %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</table>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/js/devices.js"></script>
|
||||
|
||||
<script>
|
||||
/*$(document).ready(function() {
|
||||
$('#table').DataTable();
|
||||
});*/
|
||||
|
||||
showdevices();
|
||||
{% for device in devices %}
|
||||
updateStatus({{ device.id }});
|
||||
setInterval(updateStatus, 10000, {{ device.id }});
|
||||
|
|
|
@ -64,3 +64,13 @@ function askreboot(device_id) {
|
|||
function downloadnotice() {
|
||||
alert("Your file is being prepared. This will take a minute, please be patient and do not leave this page. The download will start automatically.");
|
||||
};
|
||||
|
||||
function showdevices() {
|
||||
$("#devicespart").show();
|
||||
$("#wifipart").hide();
|
||||
};
|
||||
|
||||
function showwifi() {
|
||||
$("#devicespart").hide();
|
||||
$("#wifipart").show();
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue