add workspace for installed apps

This commit is contained in:
Muhammad Labeeb 2025-02-07 20:24:44 +05:00 committed by Régis Behmo
parent 3b464fc1af
commit 930ef8e4c6
3 changed files with 32 additions and 30 deletions

View File

@ -72,9 +72,21 @@ async def plugin_store() -> str:
@app.get("/plugin/installed") @app.get("/plugin/installed")
async def installed_plugins() -> str: async def installed_plugins() -> str:
installed_plugins = tutorclient.Client.installed_plugins()
enabled_plugins = tutorclient.Client.enabled_plugins()
plugins: list[dict[str, str]] = [
{
"name": p.name,
"url": p.url,
"index": p.index,
"description": markdown(p.description),
"is_enabled": p.name in enabled_plugins,
}
for p in tutorclient.Client.plugins_in_store() if p.name in installed_plugins
]
return await render_template( return await render_template(
"installed_plugins.html", "installed_plugins.html",
# plugins=plugins, plugins=plugins,
**shared_template_context(), **shared_template_context(),
) )

View File

@ -1,33 +1,23 @@
{% extends "index.html" %} {% extends "workspace_header_general.html" %}
{% block workspace_header %} {% block page_title %}Plugin Marketplace{% endblock %}
<div> {% block page_description %}View and install available plugins.{% endblock %}
<div class="title">My Plugins</div> {% block page_button %}
<div class="description">View all your installed plugins in one place.</div> <form action="{{ url_for('plugins_update') }}" method="POST">
</div> <button class="btn btn-primary" type="submit">Local Launch</button>
<div class="local-launch-button"> </form>
<form action="{{ url_for('plugins_update') }}" method="POST">
<button type="submit">Local Launch</button>
</form>
</div>
{% endblock %} {% endblock %}
{% block workspace_content %} {% block workspace_content %}
<div class="search-row"> <div class="installed-plugins-list">
<div class="search-container"> {% for plugin in plugins %}
<input type="text" class="form-control search-input" placeholder="Search"> <div class="installed-plugin">
<i class="fas fa-search search-icon"></i> <div>
</div> <div><a href="{{ url_for('plugin', name=plugin) }}">{{ plugin.name }}</a></div>
</div> <div>Edly</div>
<!-- <form action="{{ url_for('plugins_update') }}" method="POST"> <div>{{ plugin.description|safe }}</div>
<button type="submit">Refresh</button> </div>
</form> --> <div>
<div class="my-plugins-list">
{% for plugin in installed_plugins %}
<div>
<li>
<a href="{{ url_for('plugin', name=plugin) }}">{{ plugin }}</a>
<form method="POST" action="{{ url_for('plugin_toggle', name=plugin_name) }}"> <form method="POST" action="{{ url_for('plugin_toggle', name=plugin_name) }}">
{% if plugin in enabled_plugins %} {% if plugin in enabled_plugins %}
<input class="form-check-input" id="flexSwitchCheckChecked" type="checkbox" onchange="this.form.submit()" checked {% if is_enabled %}checked{% endif %} /> <input class="form-check-input" id="flexSwitchCheckChecked" type="checkbox" onchange="this.form.submit()" checked {% if is_enabled %}checked{% endif %} />
@ -36,7 +26,7 @@
<!-- <input class="form-check-input" id="flexSwitchCheckChecked" type="checkbox" onchange="this.form.submit()" checked /> --> <!-- <input class="form-check-input" id="flexSwitchCheckChecked" type="checkbox" onchange="this.form.submit()" checked /> -->
{% endif %} {% endif %}
</form> </form>
</li> </div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>

View File

@ -6,8 +6,8 @@
<div class="page-title">{% block page_title %}{% endblock %}</div> <div class="page-title">{% block page_title %}{% endblock %}</div>
<div class="page-description">{% block page_description %}{% endblock %}</div> <div class="page-description">{% block page_description %}{% endblock %}</div>
</div> </div>
<div> <div class="launch-button">
<div>{% block page_button %}{% endblock %}</div> {% block page_button %}{% endblock %}
</div> </div>
</div> </div>
<div class="search-container"> <div class="search-container">