This commit is contained in:
Stefan Schwarz 2020-08-22 10:51:35 +02:00
parent 47784500fb
commit d6580d01cf

View file

@ -13,16 +13,17 @@
<div class="container"> <div class="container">
<section class="hero is-small is-primary is-bold box"> <section class="hero is-small is-primary is-bold box">
<div class="hero-body"> <div class="hero-body">
<div class="container"> <div class="container">
<h1 class="title">macnickenson</h1> <h1 class="title">mac4nick</h1>
</div> <p class="subtitle is-5">grant your nickname a few mac addresses</p>
</div>
</div> </div>
</section> </section>
{% for message in messages %} {% for message in messages %}
<div class="notification is-{{ message.0.color() }}"> <div class="notification is-{{ message.0.color() }}">
<button class="delete" <button class="delete"
></button> ></button>
{{ message.1 }} {{ message.1 }}
</div> </div>
{% endfor %} {% endfor %}
@ -38,45 +39,54 @@
</tr></thead> </tr></thead>
<tbody> <tbody>
{% for device in my %} {% for device in my %}
<tr><form action="/change" method="POST"> <tr><form action="/change" method="POST">
<td data-label="MAC"> <td data-label="MAC">
<span class="is-family-code">{{ device.macaddr }}</span> <span class="is-family-code">{{ device.macaddr }}</span>
{% if device.present %} {% if device.present %}
<span class="tag is-success">on</span> <span class="has-text-success icon is-small">
{% endif %} <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
<input type="hidden" name="macaddr" value="{{ device.macaddr }}" /> viewBox="0 0 24 24" fill="none" stroke="currentColor"
</td> stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
<td data-label="Descr"> class="feather feather-rss">
<input name="descr" required value="{{ device.descr }}" /> <path d="M4 11a9 9 0 0 1 9 9"></path>
</td> <path d="M4 4a16 16 0 0 1 16 16"></path>
<td data-label="Privacy"> <circle cx="5" cy="19" r="1"></circle>
<select name="privacy"> </svg>
</span>
{% endif %}
<input type="hidden" name="macaddr" value="{{ device.macaddr }}" />
</td>
<td data-label="Descr">
<input name="descr" required value="{{ device.descr }}" />
</td>
<td data-label="Privacy">
<select name="privacy">
<option value="0" <option value="0"
{{ device.privacy.selected(crate::db::PrivacyLevel::ShowUserAndDevice) }} {{ device.privacy.selected(crate::db::PrivacyLevel::ShowUserAndDevice) }}
>Show User and Device</option> >Show User and Device</option>
<option value="1" <option value="1"
{{ device.privacy.selected(crate::db::PrivacyLevel::ShowUser) }} {{ device.privacy.selected(crate::db::PrivacyLevel::ShowUser) }}
>Show User</option> >Show User</option>
<option value="2" <option value="2"
{{ device.privacy.selected(crate::db::PrivacyLevel::ShowAnonymous) }} {{ device.privacy.selected(crate::db::PrivacyLevel::ShowAnonymous) }}
>Show Anonymous</option> >Show Anonymous</option>
<option value="3" <option value="3"
{{ device.privacy.selected(crate::db::PrivacyLevel::HideUser) }} {{ device.privacy.selected(crate::db::PrivacyLevel::HideUser) }}
>Hide User</option> >Hide User</option>
<option value="4" <option value="4"
{{ device.privacy.selected(crate::db::PrivacyLevel::DontLog) }} {{ device.privacy.selected(crate::db::PrivacyLevel::DontLog) }}
>Dont Log</option> >Dont Log</option>
</select> </select>
</td> </td>
<td data-label="Actions"> <td data-label="Actions">
<div class="buttons has-addons"> <div class="buttons has-addons">
<button type="submit" name="action" value="update" <button type="submit" name="action" value="update"
class="button is-info is-small">Update</button> class="button is-info is-small">Update</button>
<button type="submit" name="action" value="delete" <button type="submit" name="action" value="delete"
class="button is-danger is-small">Delete</button> class="button is-danger is-small">Delete</button>
</div> </div>
</td> </td>
</form></tr> </form></tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
@ -85,37 +95,37 @@
<h2 class="title is-4">Unregistred Devices:</h2> <h2 class="title is-4">Unregistred Devices:</h2>
<table class="table is-striped is-fullwidth has-mobile-cards"> <table class="table is-striped is-fullwidth has-mobile-cards">
<thead><tr> <thead><tr>
<th>MAC-Address</th> <th>MAC-Address</th>
<th>IP-Address</th> <th>IP-Address</th>
<th>Description</th> <th>Description</th>
<th>Privacy</th> <th>Privacy</th>
<th>Actions</th> <th>Actions</th>
</tr></thead> </tr></thead>
<tbody> <tbody>
{% for device in unassinged %} {% for device in unassinged %}
<tr><form action="/change" method="POST"> <tr><form action="/change" method="POST">
<td data-label="MAC"> <td data-label="MAC">
<span class="is-family-code">{{ device.macaddr }}</span> <span class="is-family-code">{{ device.macaddr }}</span>
<input type="hidden" name="macaddr" value="{{ device.macaddr }}" /> <input type="hidden" name="macaddr" value="{{ device.macaddr }}" />
</td> </td>
<td data-label="IP-Address">{{ device.ip() }}</td> <td data-label="IP-Address">{{ device.ip() }}</td>
<td data-label="Descr"> <td data-label="Descr">
<input placeholder="awesome new device" required name="descr" /> <input placeholder="awesome new device" required name="descr" />
</td> </td>
<td data-label="Privacy"> <td data-label="Privacy">
<select name="privacy"> <select name="privacy">
<option value="0">Show User and Device</option> <option value="0">Show User and Device</option>
<option value="1">Show User</option> <option value="1">Show User</option>
<option value="2" selected>Show Anonymous</option> <option value="2" selected>Show Anonymous</option>
<option value="3">Hide User</option> <option value="3">Hide User</option>
<option value="4">Dont Log</option> <option value="4">Dont Log</option>
</select> </select>
</td> </td>
<td data-label="Actions"> <td data-label="Actions">
<button name="action" value="register" type="submit" <button name="action" value="register" type="submit"
class="button is-success is-small">Register</button> class="button is-success is-small">Register</button>
</td> </td>
</form></tr> </form></tr>
{% endfor %} {% endfor %}
</table> </table>
</div> </div>