From 63e2549ee30b74e01b29dfc41cb41e8b9e7b5a5b Mon Sep 17 00:00:00 2001 From: garethgeorge Date: Wed, 14 Aug 2024 17:38:03 -0700 Subject: [PATCH] fix: run list snapshots after updating repo config or adding new repo --- webui/src/views/AddRepoModal.tsx | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/webui/src/views/AddRepoModal.tsx b/webui/src/views/AddRepoModal.tsx index 6fd83aaa..1dcf1f2b 100644 --- a/webui/src/views/AddRepoModal.tsx +++ b/webui/src/views/AddRepoModal.tsx @@ -116,17 +116,27 @@ export const AddRepoModal = ({ template }: { template: Repo | null }) => { configCopy.repos![idx] = repo; setConfig(await backrestService.setConfig(configCopy)); showModal(null); - alertsApi.success("Updated repo " + repo.uri); - - // Update the snapshots for the repo to confirm the config works. - // TODO: this operation is only used here, find a different RPC for this purpose. - await backrestService.listSnapshots({ repoId: repo.id }); + alertsApi.success("Updated repo configuration " + repo.uri); } else { // We are in the create repo flow, create the new repo via the service setConfig(await backrestService.addRepo(repo)); showModal(null); alertsApi.success("Added repo " + repo.uri); } + + try { + // Update the snapshots for the repo to confirm the config works. + // TODO: this operation is only used here, find a different RPC for this purpose. + await backrestService.listSnapshots({ repoId: repo.id }); + } catch (e: any) { + alertsApi.error( + formatErrorAlert( + e, + "Failed to list snapshots for updated/added repo: " + ), + 10 + ); + } } catch (e: any) { alertsApi.error(formatErrorAlert(e, "Operation error: "), 10); } finally {