Skip to content

Commit

Permalink
fix: UI should show error if repo/creds disconnect attempt fails (arg…
Browse files Browse the repository at this point in the history
…oproj#13498)

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
  • Loading branch information
alexmt authored and xiaowu.zhu committed Aug 9, 2023
1 parent aea413d commit d7d6915
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions ui/src/app/settings/components/repos-list/repos-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -849,17 +849,31 @@ export class ReposList extends React.Component<
private async disconnectRepo(repo: string) {
const confirmed = await this.appContext.apis.popup.confirm('Disconnect repository', `Are you sure you want to disconnect '${repo}'?`);
if (confirmed) {
await services.repos.delete(repo);
this.repoLoader.reload();
try {
await services.repos.delete(repo);
this.repoLoader.reload();
} catch (e) {
this.appContext.apis.notifications.show({
content: <ErrorNotification title='Unable to disconnect repository' e={e} />,
type: NotificationType.Error
});
}
}
}

// Remove repository credentials from the configuration
private async removeRepoCreds(url: string) {
const confirmed = await this.appContext.apis.popup.confirm('Remove repository credentials', `Are you sure you want to remove credentials for URL prefix '${url}'?`);
if (confirmed) {
await services.repocreds.delete(url);
this.credsLoader.reload();
try {
await services.repocreds.delete(url);
this.credsLoader.reload();
} catch (e) {
this.appContext.apis.notifications.show({
content: <ErrorNotification title='Unable to remove repository credentials' e={e} />,
type: NotificationType.Error
});
}
}
}

Expand Down

0 comments on commit d7d6915

Please sign in to comment.