diff --git a/tutordash/server/app.py b/tutordash/server/app.py index 236ec6a..732aecb 100644 --- a/tutordash/server/app.py +++ b/tutordash/server/app.py @@ -155,7 +155,12 @@ async def plugin_toggle(name: str) -> WerkzeugResponse: command = ["plugins", "enable" if enable_plugin else "disable", name] tutorclient.CliPool.run_sequential(command) # TODO error management - return redirect(url_for("plugin", name=name)) + response = await make_response(redirect(url_for("plugin", name=name))) + if enable_plugin: + response.set_cookie(name, "requires launch", max_age=60*60*24*30) + else: + response.delete_cookie(name) + return response @app.post("/plugin//install") @@ -202,7 +207,11 @@ async def config_unset(name: str) -> WerkzeugResponse: @app.post("/cli/local/launch") async def cli_local_launch() -> WerkzeugResponse: tutorclient.CliPool.run_parallel(app, ["local", "launch", "--non-interactive"]) - return redirect(url_for("cli_logs")) + response = await make_response(redirect(url_for("cli_logs"))) + for cookie_name in request.cookies: + if cookie_name != 'csrf_token': + response.delete_cookie(cookie_name) + return response @app.get("/cli/logs") diff --git a/tutordash/server/static/js/dash.js b/tutordash/server/static/js/dash.js index 33169e3..26af4cf 100644 --- a/tutordash/server/static/js/dash.js +++ b/tutordash/server/static/js/dash.js @@ -1,3 +1,17 @@ +function SetWarning(){ + const warningElements = document.querySelectorAll('[id$="-warning"]'); + const warningMain = document.getElementById('warning-main'); + warningElements.forEach(function(warningElement) { + const pluginName = warningElement.id.replace('-warning', ''); + if (document.cookie.includes(pluginName)) { + warningElement.style.display = 'block'; + warningMain.style.display = 'flex'; + } + }); +} +SetWarning() + + let open = document.querySelectorAll(".open-modal-button"); const modal_container = document.getElementById("modal_container"); let close = document.querySelectorAll(".close-modal-button"); diff --git a/tutordash/server/static/scss/dash.scss b/tutordash/server/static/scss/dash.scss index 3cdb2a7..f611d3a 100644 --- a/tutordash/server/static/scss/dash.scss +++ b/tutordash/server/static/scss/dash.scss @@ -9,7 +9,6 @@ $blue: #1570ef; $light-blue: #2e90fa; $green: #009951; $font-family_1: Arial; - * { box-sizing: border-box; } @@ -175,9 +174,21 @@ body { } .content { flex-grow: 1; - max-height: 75vh; margin: 0em 2em 2em 2em; border-bottom: 1px solid $extra-light-gray; + #warning-main { + display: none; + border: 1px solid $extra-light-gray; + border-radius: 1em; + align-items: center; + font-size: 1.25em; + color: $gray; + margin-bottom: 2em; + padding: 1em; + span { + margin-left: 1em; + } + } .installed-plugins-list { border: 1px solid $extra-light-gray; border-radius: 1em; @@ -195,6 +206,7 @@ body { display: flex; flex-direction: column; justify-content: center; + flex-grow: 1; .name { font-size: 1.25em; a { @@ -222,6 +234,13 @@ body { } } } + .warning { + display: none; + margin-right: 2em; + img { + width: 2.5em; + } + } } } .store-plugins { diff --git a/tutordash/server/templates/installed_plugins.html b/tutordash/server/templates/installed_plugins.html index 43bcc37..14bbd9a 100644 --- a/tutordash/server/templates/installed_plugins.html +++ b/tutordash/server/templates/installed_plugins.html @@ -36,6 +36,10 @@ Running local launch will allow all changes to plugins to take effect. This coul {% set sidebar_active_tab = "my-plugins" %} {% block workspace_content %} +
+ + Changes have been made to some plugins that will only take effect after a local launch. +
{% for plugin in plugins %}
@@ -44,6 +48,9 @@ Running local launch will allow all changes to plugins to take effect. This coul
{{ plugin.author }}
{{ plugin.description|safe }}
+
+ +
{{ switch(plugin.name, plugin.is_enabled)}}