automation: establish an automation framework
This commit is contained in:
parent
1b53bf451c
commit
8abe5d60fa
31 changed files with 586 additions and 274 deletions
|
@ -20,11 +20,19 @@ def view_lifecycle(*,
|
|||
resource: AbstractResource,
|
||||
action: str):
|
||||
form = LifecycleForm()
|
||||
if action == "destroy":
|
||||
form.submit.render_kw = {"class": "btn btn-danger"}
|
||||
elif action == "deprecate":
|
||||
form.submit.render_kw = {"class": "btn btn-warning"}
|
||||
elif action == "kick":
|
||||
form.submit.render_kw = {"class": "btn btn-success"}
|
||||
if form.validate_on_submit():
|
||||
if action == "destroy":
|
||||
resource.destroy()
|
||||
elif action == "deprecate":
|
||||
resource.deprecate(reason="manual")
|
||||
elif action == "kick":
|
||||
resource.kick()
|
||||
else:
|
||||
flash("Unknown action")
|
||||
return redirect(url_for("portal.portal_home"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue