blob: 7e771243cd65b75b994a868bbe5224dbbe13c2ca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# snag
# Matt Kohls
# (c) 2023
from flask import (
Blueprint, flash, g, redirect, render_template, request, url_for
)
from werkzeug.exceptions import abort
from datetime import datetime
from snag.db import get_db
bp = Blueprint('dashboard', __name__)
@bp.route('/')
def dashboard():
db = get_db()
rows = db.execute(
'SELECT de.deviceId, de.environment, d.deviceName'
' FROM device_env de JOIN devices d ON de.deviceId = d.deviceId'
' ORDER BY entry DESC'
).fetchall()
deviceList = [dict(deviceId=row['deviceId'], location=row['environment'], name=row['deviceName']) for row in rows]
return render_template('dashboard/dashboard.html', deviceList=deviceList, generatedAt=datetime.now())
|