Skip to content

Commit

Permalink
add settings for nightly updates to the UI
Browse files Browse the repository at this point in the history
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
  • Loading branch information
dirkhh committed Jun 18, 2023
1 parent 912206f commit e488a25
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,11 @@ def handle_expert_post_request():
cmdline = "/usr/bin/docker-update-adsb-im"
subprocess.run(cmdline, timeout=600.0, shell=True)
return redirect("/expert")
if request.form.get("nightly_update") == "go":
ENV_FILE.update({
"NIGHTLY_BASE_UPDATE": "1" if request.form.get("nightly_base") else "0",
"NIGHTLY_CONTAINER_UPDATE": "1" if request.form.get("nightly_container") else "0",
})
if request.form.get("you-asked-for-it") == "you-got-it":
# well - let's at least try to save the old stuff
if not path.exists("/opt/adsb/env-working"):
Expand Down Expand Up @@ -350,7 +355,7 @@ def handle_expert_post_request():
return redirect("restarting")

print("request_form", request.form)
return redirect("/advanced")
return redirect("/")


@app.route("/aggregators", methods=("GET", "POST"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
(url_for('expert'), 'expert', 'Expert')
] -%}
{% set active_page = active_page|default('index') -%}
<a class="navbar-brand" href="{{ url_for('index') }}">ADSB Feeder</a>
<a class="navbar-brand" href="{{ url_for('director') }}">ADSB Feeder</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,36 @@ <h2>Install ssh credentials</h2>
<button type="submit" class="btn btn-primary mb-1 ml-3" name="ssh" value="go">Submit</button>
</div>
</form>
<p class="mb-5"></p>
<h2>Update feeder containers</h2>

<h2 class="mt-5">Nightly system update settings</h2>
<form method="POST" onsubmit="show_spinner(); return true;">
<div class="row">
<div class="col-8">
<div class="row">
<input type="checkbox" class="mb-3 col-sm-2" name="nightly_base" id="nightly_base"
{% if env_values.get("NIGHTLY_BASE_UPDATE") == "1" %} checked {% endif %}>
<label for="nightly_base" class="col-sm-10">Update the ADSB Feeder base OS every night</label>
<input type="checkbox" class="mb-3 col-sm-2" name="nightly_container" id="nightly_container"
{% if env_values.get("NIGHTLY_CONTAINER_UPDATE") == "1" %} checked {% endif %}>
<label for="nightly_container" class="col-sm-10">Update the ADSB Feeder containers every night</label>
</div>
</div>
<button type="submit" class="btn btn-primary mb-3 mt-3 ml-3 col-3" name="nightly_update" value="go">Update Settings</button>
</div>
</form>

<h2 class="mt-5">Update feeder containers</h2>
<form method="POST" onsubmit="show_spinner(); return true;">
<div class="row">
<label for="update" class="col-8">Update to the currently recommended container images.
This could take several minutes (depending on the speed of your internet connection and the amount of the
changes made in the containers.
</label>
<button type="submit" class="btn btn-primary mb-1 ml-3 col-3" name="update" value="go">Update</button>
<button type="submit" class="btn btn-primary mb-3 mt-3 ml-3 col-3" name="update" value="go">Update now</button>
</div>
</form>

<h2>Edit or replace main docker-compose file and .env file</h2>
<h2 class="mt-5">Edit or replace main docker-compose file and .env file</h2>
<p>
This is not designed for normal users. Unless you really know what you are doing, click the back button or
click <a href="/advanced">here</a> to get back to the reasonably safe part of this user interface.
Expand Down

0 comments on commit e488a25

Please sign in to comment.