/m/doorboy: quick refactor
This commit is contained in:
@@ -199,7 +199,7 @@ def view_doorboy_slam():
|
|||||||
def view_doorboy():
|
def view_doorboy():
|
||||||
user = read_user()
|
user = read_user()
|
||||||
workshop_access = "k-space:workshop" in g.users_lookup.get(user["username"], User()).groups
|
workshop_access = "k-space:workshop" in g.users_lookup.get(user["username"], User()).groups
|
||||||
latest_events = db.eventlog.find({"component": "doorboy", "type":"open-door"}).sort([("timestamp", -1)]).limit(10);
|
# latest_events = db.eventlog.find({"component": "doorboy", "type":"open-door"}).sort([("timestamp", -1)]).limit(10);
|
||||||
latest_swipes = db.inventory.find({"component": "doorboy", "type":"token"}).sort([("last_seen", -1)]).limit(10);
|
latest_swipes = db.inventory.find({"component": "doorboy", "type":"token"}).sort([("last_seen", -1)]).limit(10);
|
||||||
return render_template("doorboy.html", **locals())
|
return render_template("doorboy.html", **locals())
|
||||||
|
|
||||||
|
BIN
inventory-app/static/backdoor.jpg
Normal file
BIN
inventory-app/static/backdoor.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
BIN
inventory-app/static/doorstairs.png
Normal file
BIN
inventory-app/static/doorstairs.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.0 KiB |
BIN
inventory-app/static/frontdoor.jpg
Normal file
BIN
inventory-app/static/frontdoor.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
BIN
inventory-app/static/grounddoor.png
Normal file
BIN
inventory-app/static/grounddoor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 43 KiB |
BIN
inventory-app/static/workshopdoor.jpg
Normal file
BIN
inventory-app/static/workshopdoor.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
@@ -69,12 +69,18 @@ span.tooltipped {
|
|||||||
text-decoration-style: dotted;
|
text-decoration-style: dotted;
|
||||||
}
|
}
|
||||||
|
|
||||||
.horizontalRow {
|
.horizontalRow {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
|
align-items: center;
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.buttonExtra {
|
||||||
|
border: 4px solid #2bbbad;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@@ -1,21 +1,99 @@
|
|||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="container">
|
<!-- This page is referenced by https://wiki.k-space.ee/en/hosting/doors -->
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
<p>Press to open:</p>
|
<div>
|
||||||
<ul>
|
<h3>Open</h3>
|
||||||
<li><a class="waves-effect waves-light btn" href="/m/doorboy/grounddoor/open">Ground door</a> the one on street level facing KBFI</li>
|
|
||||||
<li><a class="waves-effect waves-light btn" href="/m/doorboy/frontdoor/open">Front door</a> the one from ground door 5 floors upward</li>
|
|
||||||
<li><a class="waves-effect waves-light btn" href="/m/doorboy/backdoor/open">Back door</a> on 5th floor on the Pancake cafeteria side. Note: ground door on cafeteria side is open whenever the cafeteria is open. Other times use the ground door listed above.</li>
|
|
||||||
<li><a class="waves-effect waves-light btn {% if not workshop_access%}disabled{%endif%}" href="/m/doorboy/workshopdoor/open">Workshop door</a> also known as the dirty room</li>
|
|
||||||
<!--
|
|
||||||
<li>Coming later: <a class="waves-effect waves-light btn" href="/m/doorboy/server/open">Server room door</a></li>
|
|
||||||
-->
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<p>Manage your keycards or keyfobs here:</p>
|
<div class="horizontalRow">
|
||||||
<a href="/m/doorboy/me" class="waves-effect waves-light btn"><i class="material-icons left">person</i>My cards</a>
|
<div class="col s12 buttonExtra">
|
||||||
|
<div>
|
||||||
|
<div><img src="/static/backdoor.jpg"></div>
|
||||||
|
<div><a class="waves-effect waves-light btn" href="/m/doorboy/backdoor/open">Back door</a></div>
|
||||||
|
<div>k6.ee/0001</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col s12 buttonExtra horizontalRow">
|
||||||
|
<div>
|
||||||
|
<div><img src="/static/grounddoor.png"></div>
|
||||||
|
<div><a class="waves-effect waves-light btn" href="/m/doorboy/grounddoor/open">Ground door</a></div>
|
||||||
|
<div>k6.ee/????</div>
|
||||||
|
</div>
|
||||||
|
<div><img src="/static/doorstairs.png"></div>
|
||||||
|
<div>
|
||||||
|
<div><img src="/static/frontdoor.jpg"></div>
|
||||||
|
<div><a class="waves-effect waves-light btn" href="/m/doorboy/frontdoor/open">Front door</a></div>
|
||||||
|
<div>k6.ee/0079</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="horizontalRow">
|
||||||
|
<div>
|
||||||
|
<div class="col s12 buttonExtra"><div><img src="/static/workshopdoor.jpg"></div><div><a class="waves-effect waves-light btn {% if not workshop_access%}disabled{%endif%}" href="/m/doorboy/workshopdoor/open">Workshop</a></div><div>k6.ee/0020</div></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
<div><ul>
|
||||||
|
<li>Doors locations: <a href="https://k-space.ee/where">k-space.ee/where</a></li>
|
||||||
|
<li>Hardware and stack are documented <a href="https://wiki.k-space.ee/en/hosting/doors">in Wiki</a>.</li>
|
||||||
|
<li><a href="https://wiki.k-space.ee/en/about/membership">Membership</a> determines door access.</li>
|
||||||
|
</ul></div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h3>Keycards</h3>
|
||||||
|
<a href="/m/doorboy/me" class="waves-effect waves-light btn"><i class="material-icons left">person</i>Linked keycards</a>
|
||||||
|
<p>Adding keycards:
|
||||||
|
<ol>
|
||||||
|
<li>Swipe keycard at any door listed above</li>
|
||||||
|
<li>Refresh this page</li>
|
||||||
|
<li>Find it below, click <pre style="display: inline;">Claim keycard</pre></li>
|
||||||
|
</ol>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h4>Keycards last seen:</h4>
|
||||||
|
Does not include door opens by webhook.
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<!-- <th> </th> -->
|
||||||
|
<th>Last seen</th>
|
||||||
|
<th> </th>
|
||||||
|
<th>Who</th>
|
||||||
|
<th>UID hash tail</th>
|
||||||
|
<!-- <th>Granted</th> -->
|
||||||
|
<th> </th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for o in latest_swipes %}
|
||||||
|
<tr>
|
||||||
|
<!-- Does not work -->
|
||||||
|
<!-- <td>
|
||||||
|
{% if o.inventory and o.inventory.owner %}
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
<i class="material-icons">error</i>{% endif %}
|
||||||
|
</td> -->
|
||||||
|
<td>{{ (o.last_seen or o.timestamp) | timeago }}</td>
|
||||||
|
<td>{{ o.door }}</td>
|
||||||
|
<td>{% if o.inventory and o.inventory.owner %}<a href="/m/user/{{ o.inventory.owner.username }}">{{ o.inventory.owner.username | display_name }}</a>{% else %}Unknown{% endif %}</td>
|
||||||
|
<td><a href="/m/doorboy/{{ o._id }}/events">{{ o.token.uid_hash[-6:] }}</a></td>
|
||||||
|
<!-- <td>{% if o.success %}<i class="material-icons">check_circle</i>{% else %} {% endif %}</td> -->
|
||||||
|
<td>{% if o.inventory and o.inventory.owner %}{{ o.token.comment }}{% else %}<a class="waves-effect waves-light btn" href="/m/doorboy/{{ o._id }}/claim">Claim keycard</a>{% endif %}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
{% if false %}
|
||||||
|
<!-- whole section commented out -->
|
||||||
|
<div>
|
||||||
|
|
||||||
<p>Recent door open requests via Slack or the buttons above</p>
|
<p>Recent door open requests via Slack or the buttons above</p>
|
||||||
|
|
||||||
@@ -40,40 +118,8 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
<p>Please claim keycards or keyfobs associated with you here!</p>
|
{% endif %}
|
||||||
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th> </th>
|
|
||||||
<th>Last seen</th>
|
|
||||||
<th> </th>
|
|
||||||
<th>Who</th>
|
|
||||||
<th>UID hash tail</th>
|
|
||||||
<th>Granted</th>
|
|
||||||
<th> </th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for o in latest_swipes %}
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
{% if o.inventory and o.inventory.owner %}
|
|
||||||
|
|
||||||
{% else %}
|
|
||||||
<i class="material-icons">error</i>{% endif %}
|
|
||||||
</td>
|
|
||||||
<td>{{ (o.last_seen or o.timestamp) | timeago }}</td>
|
|
||||||
<td>{{ o.door }}</td>
|
|
||||||
<td>{% if o.inventory and o.inventory.owner %}<a href="/m/user/{{ o.inventory.owner.username }}">{{ o.inventory.owner.username | display_name }}</a>{% else %}Unknown{% endif %}</td>
|
|
||||||
<td><a href="/m/doorboy/{{ o._id }}/events">{{ o.token.uid_hash[-6:] }}</a></td>
|
|
||||||
<td>{% if o.success %}<i class="material-icons">check_circle</i>{% else %} {% endif %}</td>
|
|
||||||
<td>{% if o.inventory and o.inventory.owner %}{{ o.token.comment }}{% else %}<a class="waves-effect waves-light btn" href="/m/doorboy/{{ o._id }}/claim">This is mine!</a>{% endif %}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Reference in New Issue
Block a user