fix: run list snapshots after updating repo config or adding new repo

This commit is contained in:
garethgeorge
2024-08-14 17:38:03 -07:00
parent 9deb7168cb
commit 63e2549ee3
+15 -5
View File
@@ -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 {