Пример #1
0
def catalog():
    check_privs()
    scenarios = populate_catalog()
    groups = StudentGroups.query.all()
    scenarioModder = modScenarioForm(request.form)  # type2Form()  #

    return render_template(
        "dashboard/catalog.html", scenarios=scenarios, groups=groups, form=scenarioModder
    )
Пример #2
0
def process_scenarioModder():  # Form submitted to create a scenario |  # makeScenarioForm
    sM = modScenarioForm(request.form)  # type2Form(request.form)  #
    if sM.validate_on_submit():
        sid = sM.sid.data  # string1.data  #
        action = sM.mod_scenario.data  # string2.data  #

        return {"Start": tasks.start, "Stop": tasks.stop, "Destroy": tasks.destroy}[action].delay(sid)
    else:
        flash("Failed to start scenario")
Пример #3
0
def scenarios():
    """List of scenarios and scenario controls"""
    check_privs()
    scenarioModder = modScenarioForm()  # type2Form()  #
    scenarios = Scenarios.query.all()
    groups = StudentGroups.query.all()

    if request.method == "GET":
        return render_template(
            "dashboard/scenarios.html",
            scenarios=scenarios,
            scenarioModder=scenarioModder,
            groups=groups,
        )

    elif request.method == "POST":
        process_request(request.form)
        return render_template(
            "dashboard/scenarios.html",
            scenarios=scenarios,
            scenarioModder=scenarioModder,
            groups=groups,
        )