feat(webhooks): paginate list + call-history endpoints (server + web UI) (#1268)

Add total-count pagination to the webhook admin endpoints and the web UI.

Store:
- WebhookStore/WebhookCallStore gain Count; WebhookListFilter gains
  IncludeRevoked + Query (PG + SQLite, parameterized, tenant-scoped)

API:
- GET /v1/webhooks and GET /v1/webhooks/{id}/calls return
  {items, total, limit, offset} with server-side search + revoked filtering

Web UI:
- server-driven list pager + search/revoked filter; call-history dialog uses
  the real total (fixes the full-page "has more" boundary bug)
- i18n pager labels (en/vi/zh)

Tests: store pagination integration test; mock stores implement Count.
No schema migration (read-only COUNT).
This commit is contained in:
thotam authored and GitHub committed 2026-06-24 10:39:24 +07:00
1 parent 2945d4db6c
commit 06ef06ca37
22 files changed
+472 -54

No files matched your search

+20 -2
View File
@@ -95,9 +95,27 @@ Fields:
### List — `GET /v1/webhooks`
Query params: `agent_id=<uuid>` (optional filter).
Query params (all optional):
- `agent_id=<uuid>` — filter by bound agent.
- `q=<text>` — case-insensitive match on name, or prefix match on `secret_prefix`.
- `include_revoked=true` — include revoked webhooks (default: excluded).
- `limit` — page size (default 20, max 200).
- `offset` — page offset (default 0).
Returns array of webhook objects. `secret` and `hmac_signing_key` are **not** included.
Returns a paginated envelope. `secret` and `hmac_signing_key` are **not** included.
```json
{
"items": [ /* webhook objects */ ],
"total": 42,
"limit": 20,
"offset": 0
}
```
### List calls — `GET /v1/webhooks/{id}/calls`
Delivery history for a webhook. Query params (all optional): `status` (`queued`|`running`|`done`|`failed`|`dead`), `limit` (default 20, max 200), `offset`. Returns the same `{items, total, limit, offset}` envelope.
### Get — `GET /v1/webhooks/{id}`