Skip to content

feat(app): admin upload-questionnaire UI#48

Merged
JohnD-EE merged 1 commit into
mainfrom
feat/questionnaire-upload-ui
Jun 7, 2026
Merged

feat(app): admin upload-questionnaire UI#48
JohnD-EE merged 1 commit into
mainfrom
feat/questionnaire-upload-ui

Conversation

@JohnD-EE

@JohnD-EE JohnD-EE commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

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/questionnaires had 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.
    • Accepts .pdf / .docx / .md / .txt.
    • Optional goal and audience overrides (description, role, expertise level, locale, est. duration, sensitivity, notes) — every field left blank is inferred by the extractor. Enum selects use an Infer sentinel that is omitted from the request rather than sent blank.
    • Optional Extract tables from PDF toggle.
    • <FieldHelp> ⓘ popovers on every non-trivial field; inline server/network error surfacing.
  • /admin/questionnaires page — 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.
  • Docs.context/app/questionnaire/ingestion.md updated: ingestion is no longer API-only; admins drive it from the dialog.

Tests

  • upload-questionnaire-dialog.test.tsx — asserts the dialog POSTs multipart FormData with 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

  • Gated behind APP_QUESTIONNAIRES_ENABLED like the rest of the questionnaire surface.
  • tsc --noEmit passes (pre-push validation green).

🤖 Generated with Claude Code

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>
@JohnD-EE JohnD-EE merged commit db6b049 into main Jun 7, 2026
14 checks passed
@JohnD-EE JohnD-EE deleted the feat/questionnaire-upload-ui branch June 7, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant