Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: UI should show error if repo/creds disconnect attempt fails #13498

Merged
merged 1 commit into from
May 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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