portal: link to context-specific help where we can
This commit is contained in:
parent
2801eefd43
commit
5b9946c431
6 changed files with 76 additions and 31 deletions
|
@ -14,6 +14,12 @@ from app.portal.util import view_lifecycle, response_404
|
|||
bp = Blueprint("automation", __name__)
|
||||
|
||||
|
||||
_SECTION_TEMPLATE_VARS = {
|
||||
"section": "automation",
|
||||
"help_url": "https://bypass.censorship.guide/user/automation.html"
|
||||
}
|
||||
|
||||
|
||||
class EditAutomationForm(FlaskForm): # type: ignore
|
||||
enabled = BooleanField('Enabled')
|
||||
submit = SubmitField('Save Changes')
|
||||
|
@ -28,10 +34,10 @@ def automation_list() -> ResponseReturnValue:
|
|||
automations
|
||||
))
|
||||
return render_template("list.html.j2",
|
||||
section="automation",
|
||||
title="Automation Jobs",
|
||||
item="automation",
|
||||
items=automations)
|
||||
items=automations,
|
||||
**_SECTION_TEMPLATE_VARS)
|
||||
|
||||
|
||||
@bp.route('/edit/<automation_id>', methods=['GET', 'POST'])
|
||||
|
@ -39,9 +45,9 @@ def automation_edit(automation_id: int) -> ResponseReturnValue:
|
|||
automation: Optional[Automation] = Automation.query.filter(Automation.id == automation_id).first()
|
||||
if automation is None:
|
||||
return Response(render_template("error.html.j2",
|
||||
section="automation",
|
||||
header="404 Automation Job Not Found",
|
||||
message="The requested automation job could not be found."),
|
||||
message="The requested automation job could not be found.",
|
||||
**_SECTION_TEMPLATE_VARS),
|
||||
status=404)
|
||||
form = EditAutomationForm(enabled=automation.enabled)
|
||||
if form.validate_on_submit():
|
||||
|
@ -53,8 +59,9 @@ def automation_edit(automation_id: int) -> ResponseReturnValue:
|
|||
except exc.SQLAlchemyError:
|
||||
flash("An error occurred saving the changes to the bridge configuration.", "danger")
|
||||
return render_template("automation.html.j2",
|
||||
section="automation",
|
||||
automation=automation, form=form)
|
||||
automation=automation,
|
||||
form=form,
|
||||
**_SECTION_TEMPLATE_VARS)
|
||||
|
||||
|
||||
@bp.route("/kick/<automation_id>", methods=['GET', 'POST'])
|
||||
|
@ -69,7 +76,7 @@ def automation_kick(automation_id: int) -> ResponseReturnValue:
|
|||
message=automation.description,
|
||||
success_view="portal.automation.automation_list",
|
||||
success_message="This automation job will next run within 1 minute.",
|
||||
section="automation",
|
||||
resource=automation,
|
||||
action="kick"
|
||||
action="kick",
|
||||
**_SECTION_TEMPLATE_VARS
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue