router.html: Log blocked status changes to router events
Like normal router events, the block/unblock events are deleted if they become old enough. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
parent
3742f5415d
commit
84eb048904
|
@ -278,10 +278,20 @@ def router_info(dbid):
|
|||
if request.form.get("blocked") == "true":
|
||||
added = mysql.utcnow()
|
||||
mysql.execute("INSERT INTO blocked (mac, added) VALUES (%s, %s)",(mac,added,))
|
||||
mysql.execute("""
|
||||
INSERT INTO router_events (router, time, type, comment)
|
||||
VALUES (%s, %s, %s, %s)
|
||||
""",(dbid,mysql.utcnow(),"admin","Marked as blocked",))
|
||||
mysql.commit()
|
||||
else:
|
||||
mysql.execute("DELETE FROM blocked WHERE mac = %s",(mac,))
|
||||
mysql.execute("""
|
||||
INSERT INTO router_events (router, time, type, comment)
|
||||
VALUES (%s, %s, %s, %s)
|
||||
""",(dbid,mysql.utcnow(),"admin","Removed blocked status",))
|
||||
mysql.commit()
|
||||
router["events"] = mysql.fetchall("""SELECT * FROM router_events WHERE router = %s""",(dbid,))
|
||||
router["events"] = mysql.utcawaretuple(router["events"],"time")
|
||||
else:
|
||||
flash("<b>You are not authorized to perform this action!</b>", "danger")
|
||||
elif request.form.get("act") == "report":
|
||||
|
|
|
@ -157,6 +157,7 @@ def status2css(status):
|
|||
"netmon": "primary",
|
||||
"update": "primary",
|
||||
"orphaned": "default",
|
||||
"admin": "warning",
|
||||
}
|
||||
return "label label-%s" % status_map.get(status, "default")
|
||||
|
||||
|
|
Loading…
Reference in New Issue