Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
take localClusterUri into account in QuickInput
Browse files Browse the repository at this point in the history
  • Loading branch information
gzdunek committed Mar 18, 2022
1 parent 3eee9e6 commit 78c02c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/teleterm/src/ui/QuickInput/useQuickInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function useQuickInput() {
const [activeSuggestion, setActiveSuggestion] = React.useState(0);
const autocompleteResult = React.useMemo(
() => quickInputService.getAutocompleteResult(inputValue),
[inputValue]
[inputValue, workspacesService.getActiveWorkspace()?.localClusterUri]
);
const hasSuggestions =
autocompleteResult.kind === 'autocomplete.partial-match';
Expand Down
18 changes: 12 additions & 6 deletions packages/teleterm/src/ui/services/quickInput/quickPickers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,13 @@ export class QuickSshLoginPicker implements QuickInputPicker {
) {}

private filterSshLogins(input: string): SuggestionSshLogin[] {
// TODO(ravicious): Use local cluster URI.
// TODO(ravicious): Handle the `--cluster` tsh ssh flag.
const rootClusterUri = this.workspacesService.getRootClusterUri();
const cluster = this.clustersService.findCluster(rootClusterUri);
const localClusterUri =
this.workspacesService.getActiveWorkspace()?.localClusterUri;
if (!localClusterUri) {
return [];
}
const cluster = this.clustersService.findCluster(localClusterUri);
const allLogins = cluster?.loggedInUser?.sshLoginsList || [];
let matchingLogins: typeof allLogins;

Expand Down Expand Up @@ -315,10 +318,13 @@ export class QuickServerPicker implements QuickInputPicker {
) {}

private filterServers(input: string): SuggestionServer[] {
// TODO(ravicious): Use local cluster URI.
// TODO(ravicious): Handle the `--cluster` tsh ssh flag.
const rootClusterUri = this.workspacesService.getRootClusterUri();
const servers = this.clustersService.searchServers(rootClusterUri, {
const localClusterUri =
this.workspacesService.getActiveWorkspace()?.localClusterUri;
if (!localClusterUri) {
return [];
}
const servers = this.clustersService.searchServers(localClusterUri, {
search: input,
});

Expand Down

0 comments on commit 78c02c7

Please sign in to comment.