add warning for local launch
This commit is contained in:
parent
eb071bcfc2
commit
ab91336e67
@ -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/<name>/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")
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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 %}
|
||||
<div id="warning-main">
|
||||
<img src="{{ url_for('static', filename='/img/Featured icon.svg')}}" alt="">
|
||||
<span>Changes have been made to some plugins that will only take effect after a local launch.</span>
|
||||
</div>
|
||||
<div class="installed-plugins-list">
|
||||
{% for plugin in plugins %}
|
||||
<div class="installed-plugin">
|
||||
@ -44,6 +48,9 @@ Running local launch will allow all changes to plugins to take effect. This coul
|
||||
<div class="author">{{ plugin.author }}</div>
|
||||
<div class="description">{{ plugin.description|safe }}</div>
|
||||
</div>
|
||||
<div class="warning" id="{{plugin.name}}-warning">
|
||||
<img src="{{ url_for('static', filename='/img/Featured icon.svg')}}" alt="">
|
||||
</div>
|
||||
|
||||
{{ switch(plugin.name, plugin.is_enabled)}}
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user