make web UI compatible with multiDB
This commit is contained in:
parent
eb0f6c0310
commit
cd94d032e3
1 changed files with 6 additions and 6 deletions
|
@ -110,7 +110,7 @@ def addtime():
|
|||
return render_template("add_time.html", kinds=kinds, info=info)
|
||||
|
||||
|
||||
@db.route("/edit/time/<int:alarmid>", methods=["GET", "POST"])
|
||||
@db.route("/edit/time/<alarmid>", methods=["GET", "POST"])
|
||||
def edit_time(alarmid):
|
||||
model = get_model()
|
||||
timespec = model.get_alarm_by_id(alarmid)
|
||||
|
@ -197,7 +197,7 @@ def addaudio_kind(kind):
|
|||
)
|
||||
|
||||
|
||||
@db.route("/edit/audio/<int:actionid>", methods=["GET", "POST"])
|
||||
@db.route("/edit/audio/<actionid>", methods=["GET", "POST"])
|
||||
def edit_audio(actionid):
|
||||
model = get_model()
|
||||
audiospec = model.get_action_by_id(actionid)
|
||||
|
@ -223,7 +223,7 @@ def edit_audio(actionid):
|
|||
@db.route("/edit/event/<alarmid>")
|
||||
def edit_event(alarmid):
|
||||
model = current_app.larigira.controller.monitor.model
|
||||
alarm = model.get_alarm_by_id(int(alarmid))
|
||||
alarm = model.get_alarm_by_id(alarmid)
|
||||
if alarm is None:
|
||||
abort(404)
|
||||
allactions = model.get_all_actions()
|
||||
|
@ -245,16 +245,16 @@ def change_actions(alarmid):
|
|||
new_actions = []
|
||||
model = current_app.larigira.controller.monitor.model
|
||||
ret = model.update_alarm(
|
||||
int(alarmid), new_fields={"actions": [int(a) for a in new_actions]}
|
||||
alarmid, new_fields={"actions": [a for a in new_actions]}
|
||||
)
|
||||
return jsonify(dict(updated=alarmid, ret=ret))
|
||||
|
||||
|
||||
@db.route("/api/alarm/<int:alarmid>/delete", methods=["POST"])
|
||||
@db.route("/api/alarm/<alarmid>/delete", methods=["POST"])
|
||||
def delete_alarm(alarmid):
|
||||
model = current_app.larigira.controller.monitor.model
|
||||
try:
|
||||
alarm = model.get_alarm_by_id(int(alarmid))
|
||||
alarm = model.get_alarm_by_id(alarmid)
|
||||
print(alarm["nick"])
|
||||
model.delete_alarm(alarmid)
|
||||
except KeyError:
|
||||
|
|
Loading…
Reference in a new issue