Merge pull request #35 from UniversityRadioYork/marks/restart-confirm
This commit is contained in:
commit
8896dc4f83
2 changed files with 14 additions and 0 deletions
9
ui-templates/restart-confirm.html
Normal file
9
ui-templates/restart-confirm.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
{% extends 'base.html' %}
|
||||
{% block content_inner %}
|
||||
<div class="text-center">
|
||||
<p class="lead text-gray-800 mb-2">Hang on a second!</p>
|
||||
<p class="text-gray-900 mb-3">Something is currently playing. Restarting will interrupt it! Are you sure?</p>
|
||||
<a href="/status" class="btn btn-info">Cancel</a>
|
||||
<a href="/restart?confirm=true" class="btn btn-danger">Confirm</a>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -496,6 +496,11 @@ def quit(request):
|
|||
|
||||
@app.route("/restart")
|
||||
def restart(request):
|
||||
if request.args.get("confirm", '') != "true":
|
||||
for i in range(server_state.get()["num_channels"]):
|
||||
state = status(i)
|
||||
if state["playing"]:
|
||||
return render_template("restart-confirm.html", data=None)
|
||||
server_state.update("running_state", "restarting")
|
||||
|
||||
data = {
|
||||
|
|
Loading…
Reference in a new issue