feat(app): admin upload-questionnaire UI#48
Merged
Conversation
Add the missing admin entry point for creating questionnaires. The ingestion endpoint (POST /api/v1/app/questionnaires) shipped API-only in P1; the P2 admin surface only managed already-ingested questionnaires, so there was no way to create the first one from the UI — the empty state told admins to call the API by hand. - New UploadQuestionnaireDialog (file + goal + full audience overrides + extract-tables toggle), modeled on ReingestDialog; posts multipart FormData and routes to the new questionnaire's detail page on success. - Wire it into the /admin/questionnaires header and the empty-state CTA. - Tests for the dialog (post shape, key-omission, navigation, errors) and the table empty state. - Update ingestion.md: the surface is no longer API-only. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
Adds an admin UI for ingesting a new questionnaire from a source document — closing the gap where ingestion was API-only (
POST /api/v1/app/questionnaireshad no UI). Admins can now upload a document and have its sections/questions extracted into a draft from/admin/questionnaires.What changed
UploadQuestionnaireDialog(new) — a multipart upload dialog that POSTs a document plus optional metadata overrides to the ingest endpoint. On success it routes to the new questionnaire's detail page..pdf / .docx / .md / .txt.Infersentinel that is omitted from the request rather than sent blank.<FieldHelp>ⓘ popovers on every non-trivial field; inline server/network error surfacing./admin/questionnairespage — header restructured to host an "Upload questionnaire" button alongside the title.QuestionnairesTable— empty state now shows a friendly message + upload CTA instead of the old "POST the API by hand" guidance..context/app/questionnaire/ingestion.mdupdated: ingestion is no longer API-only; admins drive it from the dialog.Tests
upload-questionnaire-dialog.test.tsx— asserts the dialog POSTs multipartFormDatawith exactly the filled fields, omits untouched overrides, sends supplied overrides/enum selects/table toggle, navigates on success, and surfaces server/network errors inline without navigating.questionnaires-table.test.tsx— empty-state CTA renders with no rows; rows + enriched columns render (and no CTA) when questionnaires exist.Notes
APP_QUESTIONNAIRES_ENABLEDlike the rest of the questionnaire surface.tsc --noEmitpasses (pre-push validation green).🤖 Generated with Claude Code