Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,6 @@ function getKindName(connection: ExtendedTrackedConnection): string {
case 'connection.kube':
return 'KUBE';
default:
// The default branch is triggered when the state read from the disk
// contains a connection not supported by the given Connect version.
//
// For example, the user can open an app connection in Connect v15
// and then downgrade to a version that doesn't support apps.
// That connection should be shown as 'UNKNOWN' in the connection list.
return 'UNKNOWN';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,27 @@ export class ConnectionTrackerService extends ImmutableStore<ConnectionTrackerSt
}

getConnections(): ExtendedTrackedConnection[] {
return this.state.connections.map(connection => {
const { rootClusterUri, leafClusterUri } =
this._trackedConnectionOperationsFactory.create(connection);
const clusterUri = leafClusterUri || rootClusterUri;
const clusterName =
this._clusterService.findCluster(clusterUri)?.name ||
routing.parseClusterName(clusterUri);
return { ...connection, clusterName };
});
return this.state.connections
.map(connection => {
const trackedConnection =
this._trackedConnectionOperationsFactory.create(connection);
// A connection is undefined when the state read from the disk
// contains a connection not supported by the given Connect version.
//
// For example, the user can open a desktop connection in Connect v18
// and then downgrade to a version that doesn't support desktops.
// That connection shouldn't be shown on the list.
if (!trackedConnection) {
return;
}
const { rootClusterUri, leafClusterUri } = trackedConnection;
const clusterUri = leafClusterUri || rootClusterUri;
const clusterName =
this._clusterService.findCluster(clusterUri)?.name ||
routing.parseClusterName(clusterUri);
return { ...connection, clusterName };
})
.filter(Boolean);
}

async activateItem(
Expand Down
Loading