fix: minor docs and formatting

This commit is contained in:
Régis Behmo 2025-08-11 15:56:09 +02:00 committed by Régis Behmo
parent 0ce05a9cd7
commit d389db41af
3 changed files with 8 additions and 3 deletions

View File

@ -25,6 +25,7 @@ from tutordeck.server.utils import current_page_plugins, pagination_context
from . import constants, tutorclient from . import constants, tutorclient
app = Quart( app = Quart(
__name__, __name__,
static_url_path="/static", static_url_path="/static",
@ -154,6 +155,8 @@ async def plugin(name: str) -> Response:
plugin_config_defaults=tutorclient.Client.plugin_config_defaults(name), plugin_config_defaults=tutorclient.Client.plugin_config_defaults(name),
user_config=tutorclient.Project.get_user_config(), user_config=tutorclient.Project.get_user_config(),
) )
# Redirect to plugin page
response = Response(rendered_template, status=200, content_type="text/html") response = Response(rendered_template, status=200, content_type="text/html")
response.headers["HX-Redirect"] = url_for( response.headers["HX-Redirect"] = url_for(
"plugin", name=name, seq_command_executed=seq_command_executed "plugin", name=name, seq_command_executed=seq_command_executed
@ -171,8 +174,9 @@ async def plugin_toggle(name: str) -> Response:
# TODO check plugin exists # TODO check plugin exists
form = await request.form form = await request.form
enable_plugin = form.get("checked") == "on" enable_plugin = form.get("checked") == "on"
command = ["plugins", "enable" if enable_plugin else "disable", name] tutorclient.CliPool.run_sequential(
tutorclient.CliPool.run_sequential(command) ["plugins", "enable" if enable_plugin else "disable", name]
)
# TODO error management # TODO error management
response = t.cast( response = t.cast(

View File

@ -39,6 +39,7 @@ htmx.on("htmx:sseBeforeMessage", function (evt) {
const parallelCommandCompleted = executedNewCommand && !data.thread_alive; 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"; const onPluginPage = typeof pluginName !== "undefined";
// Note that sequential commands are only executed on the plugins page // Note that sequential commands are only executed on the plugins page
// Refreshing the page will run this block again // Refreshing the page will run this block again

View File

@ -1,4 +1,4 @@
<div class="config"> <div class="config">
{% for key, value in config.items() %} {% for key, value in config.items() %}
<div class="item"> <div class="item">
<div>{{ key }}:</div> <div>{{ key }}:</div>