[FEATURE]: Import configuration in the web UI
Summary Provide a way for users to import (previously exported) Contextforge configuration in the new, React UI.
Acceptance criteria:
- User is informed of which entities conflict.
- An import that creates some entities and fails others shows status.
- A caller without import permission cannot reach the preview call.
- All states have localized copy in the supported locales.
Related issues: #7408, #4097, #4093. Depends on a non-admin preview route and on the import design issue. PRs 209, 210, 212 and 215 in contextforge-web-ui call /v1/admin/import/preview and need retargeting before merge.
Proposed import flow:
flowchart TD
A["Import configuration<br/>gated on admin.import"] --> B["File picker"]
B --> C{"Read the file and check its structure<br/>version, exported_at, entities"}
C -->|"invalid"| C1["Inline error<br/>no server call"]
C -->|"valid"| D["POST /v1/import<br/>dry_run: true"]
D -->|"422"| D1["Inline error"]
D -->|"valid"| E["Confirm step"]
E -->|"Cancel"| E1["No change"]
E -->|"Import"| F["POST /v1/import, dry_run: false<br/>unselected types stripped from the envelope"]
F --> G["Result<br/>created / updated / skipped / failed"]
G --> H1["Success"]
G --> H2["Partial<br/>entities that succeeded stay,<br/>failed entities show error"]
G --> H3["Failed<br/>nothing new is left behind"]
H2 -.->|"fix the cause and re-import"| A
Notes: Proposing a one button approach vs a separate Import and Dry run.
Approach to partial outcomes: validate before applying so they rarely happen, show clearly what succeeded and failed when they do, and let the user recover by fixing the cause and importing the same file again. Re-importing works because #7418 makes repeat imports update existing entities instead of skipping them.
Out of scope for this issue / to be tracked separately: what the user does about servers that need credentials, tool references that did not resolve, and servers left pending.
@gcgoncalves , reopening to track the follow up work: update the user experience to one button approach vs a separate Import and dry run. Dry run should run behind the scenes for all imports instead of being a separate button (to help avoid problems if the user selects the wrong file by accident, for example... they would hopefully catch it on the confirmation step that shows the entities to import).
The dry is now under the import step. Closing.