diff --git a/tutordeck/server/app.py b/tutordeck/server/app.py index 624df05..ab28210 100644 --- a/tutordeck/server/app.py +++ b/tutordeck/server/app.py @@ -25,6 +25,7 @@ from tutordeck.server.utils import current_page_plugins, pagination_context from . import constants, tutorclient + app = Quart( __name__, static_url_path="/static", @@ -154,6 +155,8 @@ async def plugin(name: str) -> Response: plugin_config_defaults=tutorclient.Client.plugin_config_defaults(name), user_config=tutorclient.Project.get_user_config(), ) + + # Redirect to plugin page response = Response(rendered_template, status=200, content_type="text/html") response.headers["HX-Redirect"] = url_for( "plugin", name=name, seq_command_executed=seq_command_executed @@ -171,8 +174,9 @@ async def plugin_toggle(name: str) -> Response: # TODO check plugin exists form = await request.form enable_plugin = form.get("checked") == "on" - command = ["plugins", "enable" if enable_plugin else "disable", name] - tutorclient.CliPool.run_sequential(command) + tutorclient.CliPool.run_sequential( + ["plugins", "enable" if enable_plugin else "disable", name] + ) # TODO error management response = t.cast( diff --git a/tutordeck/server/static/js/logs.js b/tutordeck/server/static/js/logs.js index 7f14255..8cc4a39 100644 --- a/tutordeck/server/static/js/logs.js +++ b/tutordeck/server/static/js/logs.js @@ -39,6 +39,7 @@ htmx.on("htmx:sseBeforeMessage", function (evt) { const parallelCommandCompleted = executedNewCommand && !data.thread_alive; + // TODO this is a very brittle way of checking that we are on a plugin page... Let's not use static variables. Same for sequentialCommandExecuted. const onPluginPage = typeof pluginName !== "undefined"; // Note that sequential commands are only executed on the plugins page // Refreshing the page will run this block again diff --git a/tutordeck/server/templates/_config.html b/tutordeck/server/templates/_config.html index dbb543e..eed32e6 100644 --- a/tutordeck/server/templates/_config.html +++ b/tutordeck/server/templates/_config.html @@ -1,4 +1,4 @@ -