vpnmanager/templates/manager/index.html

161 lines
7.4 KiB
HTML

{% extends "base.html" %}
{% load notifications %}
{% load manager %}
{% block content %}
<p><b>Organization:</b> {% orgaString %}</p>
<p><b>User:</b> {{ user.first_name }} {{ user.last_name }} ({{ user.username }}) <a href="/users/{{ user.id }}/edit"><i class="fas fa-edit" title="Edit User"></i></a></p>
<div align="center"><b>Manage:</b>
<a id="linkdevices" href="#" onclick="showdevices();">Devices</a>
&dash; <a id="linkwifi" href="#" onclick="showwifi();">WiFi</a>
{% if user.is_staff %} &dash; <a id="linkusers" href="#" onclick="showusers();">Users</a>{% endif %}
{% if user.is_superuser %}
&dash; <a id="linknets" href="#" onclick="shownets();">Networks</a>
&dash; <a id="linkorgas" href="#" onclick="showorgas();">Organizations</a>
{% endif %}
</div>
{% getNotifications %}
<div name="devicespart" id="devicespart">
<h2>Devices</h2>
<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>
{% userDevices as devices %}
{% for device in devices %}
<tr>
<td><div style="display: inline; color: grey; font-weight: bold;" title="No information available" id="{{ device.id }}-indicator">&#11044;</div>&nbsp;<div style="display: inline;" {% if user.is_superuser %}title="{{ device.organization.name }}"{% endif %} 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>
<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>
{% userWifis as wifis %}
{% for wifi in wifis %}
<tr>
<td><div style="display:inline;" {% if user.is_superuser %}title="{{ wifi.organization.name }}"{% endif %}>{{ wifi.serial }}</div></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>
</div>
</div>
{% if request.user.is_staff %}
<div name="userpart" id="userpart">
<h2>Users</h2>
<div class="table-responsive">
<table id="users" name="users" class="table">
<thead>
<tr>
<th>Username</th>
<th>Real name</th>
<th>Last Activity</th>
<th>Options {% if user.is_superuser %}<a href="/makeuser/" style="font-weight:bold;color:green;"><i class="fas fa-plus" title="Add User"></i></a>{% endif %}</th>
</tr>
</thead>
{% userUsers as users %}
{% for auser in users %}
<tr>
<td><div style="display:inline;" {% if user.is_superuser %}title="{% directOrgaString auser %}"{% endif %}>{% if auser.is_staff %}<b>{% endif %}{{ auser.username }}{% if auser.is_staff %}</b>{% endif %}</div></td>
<td>{% if auser.is_staff %}<b>{% endif %}{{ auser.first_name }} {{ auser.last_name }}{% if auser.is_staff %}</b>{% endif %}</td>
<td>{{ auser.userstatus.last_action }}</td>
<td><a href="/users/{{ auser.id }}/edit"><i class="fas fa-edit" title="Edit User"></i></a> {% if auser.email %}<a href="mailto:{{ auser.email }}"><i class="fas fa-envelope" title="Send Email"></i></a>{% endif %}{% if user.is_superuser %} <a href="#"><i style="color: darkred;" onclick="askdeleteuser({{ auser.id }});" class="fas fa-trash-alt" title="Delete User"></i></a>{% endif %}</td>
</tr>
{% endfor %}
</table>
</div>
</div>
{% endif %}
{% if request.user.is_superuser %}
<div name ="netpart" id="netpart">
<h2>Networks</h2>
<div class="table-responsive">
<table id="networks" name="networks" class="table">
<thead>
<tr>
<th>Common Name</th>
<th>Internal IP</th>
<th>External IP</th>
<th>Options <a href="/makenet/" style="font-weight:bold;color:green;"><i class="fas fa-plus" title="Add User"></i></a></th>
</tr>
</thead>
{% userNets as networks %}
{% for network in networks %}
<tr>
<td><div style="display:inline;" title="{% netOrgaString network %}">{{ network.name }}</div></td>
<td>{{ network.intip }}</td>
<td>{{ network.extip }}</td>
<td><a href="#"><i style="color: darkred;" onclick="askdeletenet({{ network.id }});" class="fas fa-trash-alt" title="Delete Network"></i></a></td>
</tr>
{% endfor %}
</table>
</div>
</div>
<div name ="orgapart" id="orgapart">
<h2>Organizations</h2>
<div class="table-responsive">
<table id="organizations" name="organizations" class="table">
<thead>
<tr>
<th>Name</th>
<th>Users</th>
<th>Options <a href="/makeorga/" style="font-weight:bold;color:green;"><i class="fas fa-plus" title="Add Organization"></i></a></th>
</tr>
</thead>
{% allOrgas as organizations %}
{% for orga in organizations %}
<tr>
<td><div style="display:inline;">{{ orga.name }}</div></td>
<td>{{ orga.users.all|length }}{% if orga.userlimit %}/{{ orga.userlimit }}{% endif %}</td>
<td><a href="/organizations/{{ orga.id }}/edit"><i class="fas fa-edit" title="Edit Organization"></i></a> <a href="#"><i style="color: darkred;" onclick="askdeleteorga({{ orga.id }});" class="fas fa-trash-alt" title="Delete Organization"></i></a></td>
</tr>
{% endfor %}
</table>
</div>
</div>
{% endif %}
<script src="/js/devices.js"></script>
{% endblock %}