Display device name in breadcrumbs
This commit is contained in:
3
app.py
3
app.py
@@ -58,7 +58,8 @@ def devices():
|
||||
|
||||
@ app.route("/device/<device_id>")
|
||||
def device(device_id):
|
||||
return render_template('device.html', device_id=device_id)
|
||||
device = db.get_device(device_id)
|
||||
return render_template('device.html', device=device)
|
||||
|
||||
|
||||
@app.route("/overview/<device_id>")
|
||||
|
||||
3
db.py
3
db.py
@@ -56,3 +56,6 @@ class DataBase():
|
||||
GROUP BY DEVICE.ID
|
||||
ORDER BY LAST_LOGGED_AT
|
||||
""")
|
||||
|
||||
def get_device(self, device_id):
|
||||
return self.execute('SELECT * FROM device WHERE id = %s', [device_id], one=True)
|
||||
|
||||
@@ -1,4 +1,35 @@
|
||||
<div hx-get="{{ url_for('overview', device_id=device_id) }}" hx-trigger="load, every 2s">
|
||||
<div class="text-sm breadcrumbs">
|
||||
<nav class="flex" aria-label="Breadcrumb">
|
||||
<ol class="inline-flex items-center space-x-1 md:space-x-3">
|
||||
<li class="inline-flex items-center">
|
||||
<a hx-get="{{ url_for('devices') }}" hx-push-url="true" hx-target="#container"
|
||||
class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
||||
<svg aria-hidden="true" class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z">
|
||||
</path>
|
||||
</svg>
|
||||
Devices
|
||||
</a>
|
||||
</li>
|
||||
<li aria-current="page">
|
||||
<div class="flex items-center">
|
||||
<svg aria-hidden="true" class="w-6 h-6 text-gray-400" fill="currentColor" viewBox="0 0 20 20"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd"
|
||||
d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"
|
||||
clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
<span
|
||||
class="ml-1 text-sm font-medium text-gray-500 md:ml-2 dark:text-gray-400">{{device['name']}}</span>
|
||||
</div>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div hx-get="{{ url_for('overview', device_id=device['id']) }}" hx-trigger="load, every 2s">
|
||||
<div class="flex justify-center">
|
||||
<div role="status">
|
||||
<svg aria-hidden="true" class="w-8 h-8 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600"
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<tbody>
|
||||
{% for d in devices %}
|
||||
<tr class="bg-white border-b dark:bg-gray-800 dark:border-gray-700 cursor-pointer"
|
||||
hx-get="{{ url_for('overview', device_id=d['id']) }}" hx-push-url="true" hx-target="#container">
|
||||
hx-get="{{ url_for('device', device_id=d['id']) }}" hx-push-url="true" hx-target="#container">
|
||||
<th scope="row" class="px-6 py-4 font-medium text-gray-900 whitespace-nowrap dark:text-white">
|
||||
{{d['name']}}
|
||||
</th>
|
||||
|
||||
@@ -1,34 +1,3 @@
|
||||
<div class="text-sm breadcrumbs">
|
||||
<nav class="flex" aria-label="Breadcrumb">
|
||||
<ol class="inline-flex items-center space-x-1 md:space-x-3">
|
||||
<li class="inline-flex items-center">
|
||||
<a hx-get="{{ url_for('devices') }}" hx-push-url="true" hx-target="#container"
|
||||
class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
|
||||
<svg aria-hidden="true" class="w-4 h-4 mr-2" fill="currentColor" viewBox="0 0 20 20"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z">
|
||||
</path>
|
||||
</svg>
|
||||
Devices
|
||||
</a>
|
||||
</li>
|
||||
<li aria-current="page">
|
||||
<div class="flex items-center">
|
||||
<svg aria-hidden="true" class="w-6 h-6 text-gray-400" fill="currentColor"
|
||||
viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd"
|
||||
d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"
|
||||
clip-rule="evenodd"></path>
|
||||
</svg>
|
||||
<span class="ml-1 text-sm font-medium text-gray-500 md:ml-2 dark:text-gray-400">Assault
|
||||
Bike</span>
|
||||
</div>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<h1
|
||||
class="mb-4 text-4xl font-extrabold leading-none tracking-tight text-gray-900 md:text-5xl lg:text-6xl dark:text-white text-center">
|
||||
{{last_cadence}} rpm</h1>
|
||||
|
||||
Reference in New Issue
Block a user