my plugins workspace styling

This commit is contained in:
Muhammad Labeeb 2025-02-10 16:49:45 +05:00 committed by Régis Behmo
parent 930ef8e4c6
commit 2ac8d50bd3
4 changed files with 49 additions and 16 deletions

View File

@ -79,6 +79,7 @@ async def installed_plugins() -> str:
"name": p.name,
"url": p.url,
"index": p.index,
"author": p.author.split('<')[0].strip(),
"description": markdown(p.description),
"is_enabled": p.name in enabled_plugins,
}
@ -110,7 +111,7 @@ async def plugin(name: str) -> str:
async def plugin_toggle(name: str) -> WerkzeugResponse:
# TODO check plugin exists
form = await request.form
enable_plugin = form.get("enabled") == "on"
enable_plugin = form.get("checked") == "on"
command = ["plugins", "enable" if enable_plugin else "disable", name]
tutorclient.CliPool.run_sequential(command)
# TODO error management
@ -160,7 +161,9 @@ 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"])
breakpoint()
# TODO uncomment in production
# tutorclient.CliPool.run_parallel(app, ["local", "launch", "--non-interactive"])
return redirect(url_for("cli_logs"))

View File

@ -0,0 +1,5 @@
<svg width="56" height="56" viewBox="0 0 56 56" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="4" y="4" width="48" height="48" rx="24" fill="#FFF5D2"/>
<rect x="4" y="4" width="48" height="48" rx="24" stroke="#FFFAEB" stroke-width="8"/>
<path d="M27.9998 23.9992V27.9992M27.9998 31.9992H28.0098M26.2898 18.8592L17.8198 32.9992C17.6451 33.3017 17.5527 33.6445 17.5518 33.9937C17.5508 34.343 17.6413 34.6864 17.8142 34.9898C17.9871 35.2931 18.2365 35.546 18.5375 35.7231C18.8385 35.9002 19.1806 35.9954 19.5298 35.9992H36.4698C36.819 35.9954 37.1611 35.9002 37.4621 35.7231C37.7631 35.546 38.0124 35.2931 38.1854 34.9898C38.3583 34.6864 38.4488 34.343 38.4478 33.9937C38.4468 33.6445 38.3544 33.3017 38.1798 32.9992L29.7098 18.8592C29.5315 18.5653 29.2805 18.3223 28.981 18.1537C28.6814 17.9851 28.3435 17.8965 27.9998 17.8965C27.656 17.8965 27.3181 17.9851 27.0186 18.1537C26.7191 18.3223 26.468 18.5653 26.2898 18.8592Z" stroke="#BF6A02" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 1021 B

View File

@ -73,6 +73,23 @@
</div>
</div>
</div>
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
{% block model_icon %}{% endblock %}
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<h5 class="modal-title" id="exampleModalLabel">{% block modal_title%}{% endblock %}</h5>
<p class="modal-description">{% block modal_description %}{% endblock %}</p>
</div>
<div class="modal-footer">
{% block modal_footer %}{% endblock %}
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script src="{{ url_for('static', filename='/js/dash.js') }}"></script>
{% block scripts %}{% endblock %}

View File

@ -3,8 +3,21 @@
{% block page_title %}Plugin Marketplace{% endblock %}
{% block page_description %}View and install available plugins.{% endblock %}
{% block page_button %}
<form action="{{ url_for('plugins_update') }}" method="POST">
<button class="btn btn-primary" type="submit">Local Launch</button>
<button class="btn btn-primary" type="button" data-bs-toggle="modal" data-bs-target="#exampleModal">Local Launch</button>
{% endblock %}
{% block model_icon %}
<img src="{{ url_for('static', filename='/img/Featured icon.svg') }}" alt="">
{% endblock %}
{% block modal_title %}
Run local launch for all plugins?
{% endblock %}
{% block modal_description %}
Running local launch will allow all changes to plugins to take effect. This could take a few minutes to complete.
{% endblock %}
{% block modal_footer %}
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">Not Now</button>
<form method="POST" action="{{ url_for('cli_local_launch')}}">
<button type="submit" class="btn btn-primary">Run Local Launch</button>
</form>
{% endblock %}
@ -12,19 +25,14 @@
<div class="installed-plugins-list">
{% for plugin in plugins %}
<div class="installed-plugin">
<div>
<div><a href="{{ url_for('plugin', name=plugin) }}">{{ plugin.name }}</a></div>
<div>Edly</div>
<div>{{ plugin.description|safe }}</div>
<div class="details">
<div class="name"><a href="{{ url_for('plugin', name=plugin.name) }}">{{ plugin.name }}</a></div>
<div class="author">{{ plugin.author }}</div>
<div class="description">{{ plugin.description|safe }}</div>
</div>
<div>
<form method="POST" action="{{ url_for('plugin_toggle', name=plugin_name) }}">
{% if plugin in enabled_plugins %}
<input class="form-check-input" id="flexSwitchCheckChecked" type="checkbox" onchange="this.form.submit()" checked {% if is_enabled %}checked{% endif %} />
<label class="form-check-label" for="flexSwitchCheckDefault">Default switch checkbox input</label>
{% else %}
<!-- <input class="form-check-input" id="flexSwitchCheckChecked" type="checkbox" onchange="this.form.submit()" checked /> -->
{% endif %}
<div class="form-check form-switch">
<form method="POST" action="{{ url_for('plugin_toggle', name=plugin.name) }}">
<input type="checkbox" name="checked" class="form-check-input" role="switch" onchange="this.form.submit()" {% if plugin.is_enabled %} id="flexSwitchCheckDefault" checked {% else %} id="flexSwitchCheckChecked" {% endif %} />
</form>
</div>
</div>