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

Minor teleterm fixes #681

Merged
merged 5 commits into from
Mar 18, 2022
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 @@ -20,7 +20,7 @@ export type KeyboardShortcutType =
| 'tab-new'
| 'tab-previous'
| 'tab-next'
| 'focus-global-search'
| 'open-quick-input'
| 'toggle-connections'
| 'toggle-clusters'
| 'toggle-identity';
Expand All @@ -44,7 +44,7 @@ export const keyboardShortcutsConfigProvider: ConfigServiceProvider<KeyboardShor
'tab-new': 'Command-T',
'tab-previous': 'Control-Shift-Tab',
'tab-next': 'Control-Tab',
'focus-global-search': 'F1',
'open-quick-input': 'Command-K',
'toggle-connections': 'Command-O',
'toggle-clusters': 'Command-E',
'toggle-identity': 'Command-I',
Expand All @@ -64,7 +64,7 @@ export const keyboardShortcutsConfigProvider: ConfigServiceProvider<KeyboardShor
'tab-new': 'Ctrl-Shift-T',
'tab-previous': 'Ctrl-PageUp',
'tab-next': 'Ctrl-PageDown',
'focus-global-search': 'F1',
'open-quick-input': 'Ctrl-K',
'toggle-connections': 'Ctrl-O',
'toggle-clusters': 'Ctrl-E',
'toggle-identity': 'Ctrl-I',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function ClusterAddPresentation({
value={addr}
autoFocus
onChange={e => setAddr(e.target.value)}
placeholder="https://cluster"
placeholder="teleport.example.com"
/>
<Box mt="5">
<ButtonPrimary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ const StyledNav = styled(Flex)`
function createItems(ctx: ClusterContext): SideNavItem[] {
const serverCount = ctx.getServers().length;
const dbCount = ctx.getDbs().length;
const kubeCount = ctx.getKubes().length;
const appCount = ctx.getApps().length;
// const kubeCount = ctx.getKubes().length;
// const appCount = ctx.getApps().length;

return [
{
Expand All @@ -72,13 +72,13 @@ function createItems(ctx: ClusterContext): SideNavItem[] {
to: '/resources/databases',
title: `Databases (${dbCount})`,
},
{
to: '/resources/kubes',
title: `Kubes (${kubeCount})`,
},
{
to: '/resources/apps',
title: `Apps (${appCount})`,
},
// {
// to: '/resources/kubes',
// title: `Kubes (${kubeCount})`,
// },
// {
// to: '/resources/apps',
// title: `Apps (${appCount})`,
// },
];
}
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 @@ -111,7 +111,7 @@ export default function useQuickInput() {
};

useKeyboardShortcuts({
'focus-global-search': () => {
'open-quick-input': () => {
quickInputService.show();
},
});
Expand Down
2 changes: 2 additions & 0 deletions packages/teleterm/src/ui/TopBar/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ const JustifyLeft = styled.div`
display: flex;
justify-self: start;
align-items: center;
height: 100%;
`;

const JustifyRight = styled.div`
display: flex;
justify-self: end;
align-items: center;
height: 100%;
`;
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,22 @@ export class ConnectionTrackerService extends ImmutableStore<ConnectionTrackerSt

getConnections(): ExtendedTrackedConnection[] {
return this.state.connections.map(connection => {
const { clusterUri } =
const { rootClusterUri, leafClusterUri } =
this._trackedConnectionOperationsFactory.create(connection);
const cluster = this._clusterService.findCluster(clusterUri);
const cluster = this._clusterService.findCluster(
leafClusterUri || rootClusterUri
);
return { ...connection, clusterName: cluster?.name };
});
}

async activateItem(id: string): Promise<void> {
const connection = this.state.connections.find(c => c.id === id);
const { clusterUri, activate } =
const { rootClusterUri, activate } =
this._trackedConnectionOperationsFactory.create(connection);

if (clusterUri !== this._workspacesService.getRootClusterUri()) {
await this._workspacesService.setActiveWorkspace(clusterUri);
if (rootClusterUri !== this._workspacesService.getRootClusterUri()) {
await this._workspacesService.setActiveWorkspace(rootClusterUri);
}
activate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,20 @@ export class TrackedConnectionOperationsFactory {
private getConnectionServerOperations(
connection: TrackedServerConnection
): TrackedConnectionOperations {
const clusterUri = routing.getClusterUri({
rootClusterId: routing.parseServerUri(connection.serverUri).params
.rootClusterId,
const { rootClusterId, leafClusterId } = routing.parseServerUri(
connection.serverUri
).params;
const { rootClusterUri, leafClusterUri } = this.getClusterUris({
rootClusterId,
leafClusterId,
});

const documentsService =
this._workspacesService.getWorkspaceDocumentService(clusterUri);
this._workspacesService.getWorkspaceDocumentService(rootClusterUri);

return {
clusterUri,
rootClusterUri,
leafClusterUri,
activate: () => {
let srvDoc = documentsService
.getDocuments()
Expand Down Expand Up @@ -68,16 +72,20 @@ export class TrackedConnectionOperationsFactory {
private getConnectionGatewayOperations(
connection: TrackedGatewayConnection
): TrackedConnectionOperations {
const clusterUri = routing.getClusterUri({
rootClusterId: routing.parseDbUri(connection.targetUri).params
.rootClusterId,
const { rootClusterId, leafClusterId } = routing.parseDbUri(
connection.targetUri
).params;
const { rootClusterUri, leafClusterUri } = this.getClusterUris({
rootClusterId,
leafClusterId,
});

const documentsService =
this._workspacesService.getWorkspaceDocumentService(clusterUri);
this._workspacesService.getWorkspaceDocumentService(rootClusterUri);

return {
clusterUri,
rootClusterUri,
leafClusterUri,
activate: () => {
let gwDoc = documentsService
.getDocuments()
Expand Down Expand Up @@ -110,10 +118,33 @@ export class TrackedConnectionOperationsFactory {
},
};
}

private getClusterUris({
rootClusterId,
leafClusterId,
}: {
rootClusterId: string;
leafClusterId: string;
}): { rootClusterUri: string; leafClusterUri: string } {
const rootClusterUri = routing.getClusterUri({
rootClusterId,
});
const leafClusterUri = routing.getClusterUri({
rootClusterId,
leafClusterId,
});

return {
rootClusterUri,
leafClusterUri:
rootClusterUri === leafClusterUri ? undefined : leafClusterUri,
};
}
}

interface TrackedConnectionOperations {
clusterUri: string;
rootClusterUri: string;
leafClusterUri: string;

activate(): void;

Expand Down