From 389df2d4df76f66b968aa955bba4beefd34a8012 Mon Sep 17 00:00:00 2001 From: Matthew Date: Fri, 25 Sep 2026 13:24:24 +1000 Subject: [PATCH] build(deps): greentechhub-ui v0.10.0; tables use refresh_event gth_data_table(refresh_event=...) replaces the hand-rolled _table_refresh.html out-of-band hook. v0.10.0 also toasts failed htmx requests on its own: web 404s now surface their HTTPException detail (e.g. "Stock not found"). Co-Authored-By: Claude Opus 5.5 --- requirements.txt | 2 +- src/pyfinbot/web/templates/_stock_table.html | 4 +--- src/pyfinbot/web/templates/_table_refresh.html | 10 ---------- src/pyfinbot/web/templates/_transaction_table.html | 4 +--- tests/test_web_stocks.py | 4 +++- tests/test_web_transactions.py | 1 + 6 files changed, 7 insertions(+), 18 deletions(-) delete mode 100644 src/pyfinbot/web/templates/_table_refresh.html diff --git a/requirements.txt b/requirements.txt index 04ac646..0209e88 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ email-validator~=2.3.0 fastapi~=0.136.3 fastapi-pagination==0.15.13 # pinned exactly: 0.15.16 breaks against fastapi 0.136.3 (TypeError: get_body_field() got an unexpected keyword argument 'body_params') — confirmed on unmodified main, unrelated to the web UI work in this commit greentechhub-fastapi @ git+https://github.com/GreenMachine582/greentechhub-fastapi.git@v0.8.0 -greentechhub-ui @ git+https://github.com/GreenMachine582/greentechhub-ui.git@v0.9.0 +greentechhub-ui @ git+https://github.com/GreenMachine582/greentechhub-ui.git@v0.10.0 httpx~=0.28.1 jinja2~=3.1 mypy~=2.1.0 diff --git a/src/pyfinbot/web/templates/_stock_table.html b/src/pyfinbot/web/templates/_stock_table.html index 5e816f9..bfbb5eb 100644 --- a/src/pyfinbot/web/templates/_stock_table.html +++ b/src/pyfinbot/web/templates/_stock_table.html @@ -1,13 +1,12 @@ {% from "table.html" import gth_data_table %} {% from "badge.html" import gth_badge %} -{% from "_table_refresh.html" import table_refresh %} {% call(stock) gth_data_table(table, [ {"label": "Symbol", "sort_key": "symbol"}, {"label": "Market", "sort_key": "market"}, {"label": "Name", "sort_key": "name"}, "Status", "", - ], stocks, empty_message="No stocks match these filters.") %} + ], stocks, empty_message="No stocks match these filters.", refresh_event="stocksChanged") %} {{ stock.symbol }} {{ stock.market }} @@ -25,4 +24,3 @@ {% endcall %} -{% if not table.rows_only %}{{ table_refresh(table, "stocksChanged") }}{% endif %} diff --git a/src/pyfinbot/web/templates/_table_refresh.html b/src/pyfinbot/web/templates/_table_refresh.html deleted file mode 100644 index 0422df0..0000000 --- a/src/pyfinbot/web/templates/_table_refresh.html +++ /dev/null @@ -1,10 +0,0 @@ -{% macro table_refresh(state, event) %} -{# Re-requests a gth_data_table (page 1, current sort + filters) whenever - `event` fires on — e.g. a save's HX-Trigger. Render it next to the - table in the table's fragment: on the page it's a plain element, and in - every re-rendered fragment hx-swap-oob replaces it, so its URL follows - the table's latest sort/filters. Not for rows-only (load more) responses. #} - -{% endmacro %} diff --git a/src/pyfinbot/web/templates/_transaction_table.html b/src/pyfinbot/web/templates/_transaction_table.html index c977d31..5e7a3c5 100644 --- a/src/pyfinbot/web/templates/_transaction_table.html +++ b/src/pyfinbot/web/templates/_transaction_table.html @@ -1,6 +1,5 @@ {% from "table.html" import gth_data_table %} {% from "badge.html" import gth_badge %} -{% from "_table_refresh.html" import table_refresh %} {% call(txn) gth_data_table(table, [ {"label": "Date", "sort_key": "transaction_date"}, "Stock", @@ -13,7 +12,7 @@ "FY", "Notes", "", - ], transactions, empty_message="No transactions match these filters.") %} + ], transactions, empty_message="No transactions match these filters.", refresh_event="transactionsChanged") %} {{ txn.transaction_date.strftime("%d/%m/%Y") }} @@ -39,4 +38,3 @@ {% endcall %} -{% if not table.rows_only %}{{ table_refresh(table, "transactionsChanged") }}{% endif %} diff --git a/tests/test_web_stocks.py b/tests/test_web_stocks.py index 63d52df..b69c493 100644 --- a/tests/test_web_stocks.py +++ b/tests/test_web_stocks.py @@ -55,7 +55,9 @@ async def test_filters(self, client): resp = await client.get("/stocks", headers=HX, params={"status": "all", "sort": "symbol", "dir": "desc"}) assert resp.text.index("OLD") < resp.text.index("BHP") assert 'id="stocks"' in resp.text and "" in resp.text async def test_filters(self, client):