def run(): """Run the web interface.""" app = get_application() app.run()
"""Views for scenario nodes page.""" from flask import render_template from web_interface.application import get_application, get_autostorage_api from web_interface.form.scenario_nodes import CreateScenarioNodeForm from autostorage.api.manager.scenario_node import ScenarioNodeManager APP = get_application() @APP.route("/scenario_nodes", methods=["GET", "POST"]) def scenario_nodes(): """Return page with scenario nodes.""" new_node_form = CreateScenarioNodeForm() api = get_autostorage_api() node_manager = ScenarioNodeManager(api) if new_node_form.validate_on_submit(): node_manager.create_scenario_node(new_node_form.name.data) with api.get_session() as session: node_states = node_manager.get_scenario_node_states().with_session(session).all() return render_template( "scenario_nodes.html", node_states=node_states, new_node_form=new_node_form, )