Skip to content

Commit

Permalink
Clean up parsing cluster name, add missing action to retry starting a…
Browse files Browse the repository at this point in the history
… headless watcher
  • Loading branch information
gzdunek committed Oct 16, 2024
1 parent 0588e8c commit 7e324b1
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions web/packages/teleterm/src/ui/services/clusters/clustersService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,6 @@ export class ClustersService extends ImmutableStore<types.ClustersServiceState>
async syncAndWatchRootClusterWithErrorHandling(
clusterUri: uri.RootClusterUri
) {
const cluster = this.findCluster(clusterUri);
const clusterName =
cluster?.name || routing.parseClusterUri(clusterUri).params.rootClusterId;

try {
await this.syncRootCluster(clusterUri);
} catch (e) {
Expand All @@ -319,9 +315,22 @@ export class ClustersService extends ImmutableStore<types.ClustersServiceState>
try {
await this.client.startHeadlessWatcher({ rootClusterUri: clusterUri });
} catch (e) {
this.notificationsService.notifyError({
const cluster = this.findCluster(clusterUri);
const clusterName =
cluster?.name ||
routing.parseClusterUri(clusterUri).params.rootClusterId;

const notificationId = this.notificationsService.notifyError({
title: `Could not start headless requests watcher for ${clusterName}`,
description: e.message,
action: {
content: 'Retry',
onClick: () => {
this.notificationsService.removeNotification(notificationId);
// retry the entire call
this.syncAndWatchRootClusterWithErrorHandling(clusterUri);
},
},
});
}
}
Expand Down

0 comments on commit 7e324b1

Please sign in to comment.