From da24d23eb765e4c76b92c3a283e74014e7a7d7a3 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Mon, 29 May 2023 18:54:57 -0700 Subject: [PATCH] Re-implement deactivate with HTTP DELETE --- intake/app.py | 11 +++++++++++ intake/templates/feed.jinja2 | 8 ++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/intake/app.py b/intake/app.py index 12ee40f..b613a91 100644 --- a/intake/app.py +++ b/intake/app.py @@ -74,6 +74,17 @@ def source_feed(source_name): ) +@app.delete("/item//") +def deactivate(source_name, item_id): + source = LocalSource(intake_data_dir(), source_name) + item = source.get_item(item_id) + if item["active"]: + print(f"Deactivating {source_name}/{item_id}") + item["active"] = False + source.save_item(item) + return jsonify({"active": item["active"]}) + + def wsgi(): # init_default_logging() return app diff --git a/intake/templates/feed.jinja2 b/intake/templates/feed.jinja2 index 28fc330..a862e10 100644 --- a/intake/templates/feed.jinja2 +++ b/intake/templates/feed.jinja2 @@ -60,12 +60,8 @@ table.feed-control td {