feat: knowledge-graph datasets admin UI with paginated list (#532) - #821
Merged
Conversation
#430 shipped the CSV dataset pipeline API-only and deferred the admin UI its own triage criteria asked for ("deletable via admin UI"), so upload/browse/delete has been curl-only since. Frontend-only change: the five endpoints under /api/v1/datasets already existed and are untouched. The row preview paginates server-side (limit/offset, 25 per page) rather than fetching the table and slicing locally. A dataset holds up to MAX_DATASET_ROWS (50 000) rows — pulling that into the DOM to show one screenful is the case queryDatasetRows exists to prevent. The schema is read once on open, so turning a page costs one request, not two. GET /v1/datasets passes no limit, so listDatasets applies its default of 50 and the route offers no way to raise it. Hitting exactly 50 is indistinguishable from "there are more", so the page says so instead of letting the list end silently. The import receipt surfaces privacyScan scanned/masked cell counts because this path runs the same scan as chat-attachment auto-ingest: an operator uploading customer data should be able to see that masking ran rather than take it on trust. The server ACL is owner-only, so the page lists only datasets the logged-in account imported. That is stated in the UI copy — on an admin page a silently personal subset would otherwise read as the instance's. Dataset types are re-declared in _lib/api.ts rather than imported, since web-ui does not build against the middleware workspace (same convention as MemorableKnowledgeNode). Error copy maps the route's dataset.* codes locally rather than via errorHelp.ts, whose coverage test scopes it to five route files and fails on outside codes as orphans. Closes #532.
- plugin-api 1.7.0 (MINOR, snapshot updated): listDatasets gains offset;
new optional countDatasets — back-compat for external implementers
- neon + inmemory graphs implement offset/count; the three extras wrappers
forward countDatasets only when the inner graph supports it (no
fabricated totals — the UI falls back to an explicit cap warning)
- GET /api/v1/datasets parses limit/offset (400 on invalid) and returns
{ items, totalMatched } — datasets past the old 50-cap are now reachable
and deletable from the admin UI (#598 review must-fix 1)
- web-ui: real prev/next list pagination with range copy (en+de); request
guards so a stale detail/list response can never overwrite a newer one
(#598 must-fix 2); delete failures get their own error slot and resync
the list (#598 must-fix 3); empty last page steps back after delete
- non-ApiError failures render a localized headline, never the raw
exception message; tooLarge copy parameterizes {maxMb}
- i18n request config sets an explicit timeZone (kills per-row IntlError)
- page.tsx split into _components/ to stay under the 500-line rule
- handoff doc: REST/interface sections updated to match
- tests: middleware route + inmemory pagination/count; web-ui list paging,
step-back after delete, count-less fallback, delete-failure, stale race
…in-ui-v2 # Conflicts: # middleware/package-lock.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Admin page
web-ui/app/admin/datasets/for Knowledge-Graph datasets: upload CSV, browse inferred schema + row preview, delete. Closes #532 — and with it the last open triage criterion of #430 ("deletable via admin UI"), whose backend shipped in #533.Salvages the closed PR #598/#728 work (commit 1) and resolves every blocker from that review (commit 2):
listDatasetsgainsoffset, new optionalcountDatasets(1.7.0 MINOR, API snapshot updated); implemented in neon + inmemory graphs, forwarded by the extras wrappers only when the inner graph supports it;GET /api/v1/datasetsparseslimit/offset(400 on invalid) and returns{ items, totalMatched }. Datasets past the old 50-cap were invisible and undeletable — now paged.page.tsxsplit into_components/(<500-line rule).Test plan
totalMatched, 400 on invalid query) + inmemory offset/count testsi18n:checkOK (3613 keys, en/de parity incl. ICU args)Risk / blast radius
Low-medium. Interface change is additive (optional method + optional param, MINOR bump); route change is additive (
totalMatchedalongsideitems; new query params validated). UI is reachable only from the new admin route.Completes #430 — after merge, #430 can be closed.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.