From 00487547c4aff6bf0c94438768191960a3369365 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Tue, 27 Sep 2022 13:42:55 +0200 Subject: [proxy] facilitate manually pruning orphaned packages (including installed ones) --- src/hydrilla/proxy/web_ui/root.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/hydrilla/proxy/web_ui/root.py') diff --git a/src/hydrilla/proxy/web_ui/root.py b/src/hydrilla/proxy/web_ui/root.py index a28fde8..24ff73f 100644 --- a/src/hydrilla/proxy/web_ui/root.py +++ b/src/hydrilla/proxy/web_ui/root.py @@ -111,7 +111,13 @@ app_lock = Lock() @app.route('/', methods=['GET']) def home(errors: t.Mapping[str, bool] = {}) -> werkzeug.Response: - html = flask.render_template('index.html.jinja', **errors) + state = _app.get_haketilo_state() + + html = flask.render_template( + 'index.html.jinja', + orphan_item_stats = state.count_orphan_items(), + **errors + ) return flask.make_response(html, 200) @app.route('/', methods=['POST']) @@ -134,6 +140,8 @@ def home_post() -> werkzeug.Response: state.update_settings(advanced_user=True) elif action == 'user_make_simple': state.update_settings(advanced_user=False) + elif action == 'prune_orphans': + state.prune_orphan_items() else: raise ValueError() -- cgit v1.2.3