Repository navigation
Add useImportConfig hook - #215
Conversation
| (signal) => importExportApi.importConfig({ ...opts, data, dryRun: false }, signal), | ||
| (value) => { | ||
| setResult(value); | ||
| toast.success(intl.formatMessage({ id: "importExport.import.success" }, value.progress)); |
There was a problem hiding this comment.
The backend returns 200 with status “completed” even when entities fail, so a fully failed import shows a success toast. During a restore, this reports configuration as applied when it is not.
There was a problem hiding this comment.
That's a good point, I'll remove the toast entirely from the hook, leaving the component that invokes it to handle feedback providing.
| const intl = useIntl(); | ||
| const { hasPermission } = useAuth(); | ||
| const canImport = hasPermission("admin.import"); | ||
| const canPreview = hasPermission("admin.system_config"); |
There was a problem hiding this comment.
Preview needs MCPGATEWAY_ADMIN_API_ENABLED (default false), so it returns an unexplained 404.
There was a problem hiding this comment.
Hmm, we should avoid /admin endpoints, I'll remove it from the BFF for now. We have a dry-run option on the import endpoint, I think we can use that instead.
99bfdeb to
1c420de
Compare
1c420de to
849723c
Compare
c70db22 to
88eb500
Compare
cd65a84 to
d62312a
Compare
d62312a to
c8b994b
Compare
e7c4f68 to
9e3a7ff
Compare
d398fc1 to
24f601e
Compare
24f601e to
229b1dc
Compare
vishu-bh
left a comment
There was a problem hiding this comment.
implementation looks solid.
One edge case to check.
| async (file: File) => { | ||
| reset(); | ||
| try { | ||
| setData(await parseImportFile(file)); |
There was a problem hiding this comment.
Selecting slow file A and then file B lets A finish last and replace B, so the next import can send the wrong configuration. Resetting during File.text() also restores the discarded file when its read completes. Please invalidate pending reads on reset/new selection and guard both data and error updates with a generation token. Add regression tests for these sequences.
Signed-off-by: Gabriel Costa <gabrielcg@proton.me>
Signed-off-by: Gabriel Costa <gabrielcg@proton.me>
Signed-off-by: Gabriel Costa <gabrielcg@proton.me>
bf896f2 to
c3e7852
Compare
Relates to IBM/mcp-context-forge#7408