diff --git a/packages/teleterm/src/mainProcess/contextMenus/clusterContextMenu.ts b/packages/teleterm/src/mainProcess/contextMenus/clusterContextMenu.ts deleted file mode 100644 index bc6eda557..000000000 --- a/packages/teleterm/src/mainProcess/contextMenus/clusterContextMenu.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { ipcMain, ipcRenderer, Menu } from 'electron'; -import { - ClusterContextMenuEventChannel, - ClusterContextMenuEventType, - ClusterContextMenuOptions, -} from '../types'; - -type MainClusterContextMenuOptions = Pick< - ClusterContextMenuOptions, - 'isClusterConnected' ->; - -export function subscribeToClusterContextMenuEvent(): void { - ipcMain.handle( - ClusterContextMenuEventChannel, - (event, options: MainClusterContextMenuOptions) => { - return new Promise(resolve => { - Menu.buildFromTemplate([ - { - label: 'Refresh', - enabled: options.isClusterConnected, - click: () => resolve(ClusterContextMenuEventType.Refresh), - }, - { - type: 'separator', - }, - { - label: 'Login', - enabled: !options.isClusterConnected, - click: () => resolve(ClusterContextMenuEventType.Login), - }, - { - label: 'Logout', - enabled: options.isClusterConnected, - click: () => resolve(ClusterContextMenuEventType.Logout), - }, - { - type: 'separator', - }, - { - label: 'Remove', - click: () => resolve(ClusterContextMenuEventType.Remove), - }, - ]).popup({ - callback: () => resolve(undefined), - }); - }); - } - ); -} - -export async function openClusterContextMenu( - options: ClusterContextMenuOptions -): Promise { - const mainOptions: MainClusterContextMenuOptions = { - isClusterConnected: options.isClusterConnected, - }; - const eventType = await ipcRenderer.invoke( - ClusterContextMenuEventChannel, - mainOptions - ); - switch (eventType) { - case ClusterContextMenuEventType.Refresh: - return options.onRefresh(); - case ClusterContextMenuEventType.Login: - return options.onLogin(); - case ClusterContextMenuEventType.Logout: - return options.onLogout(); - case ClusterContextMenuEventType.Remove: - return options.onRemove(); - } -} \ No newline at end of file diff --git a/packages/teleterm/src/mainProcess/mainProcess.ts b/packages/teleterm/src/mainProcess/mainProcess.ts index 2cee49e44..33cc87903 100644 --- a/packages/teleterm/src/mainProcess/mainProcess.ts +++ b/packages/teleterm/src/mainProcess/mainProcess.ts @@ -10,7 +10,6 @@ import { import { ChildProcess, spawn } from 'child_process'; import { Logger, RuntimeSettings } from 'teleterm/types'; import { getAssetPath } from './runtimeSettings'; -import { subscribeToClusterContextMenuEvent } from './contextMenus/clusterContextMenu'; import { subscribeToTerminalContextMenuEvent } from './contextMenus/terminalContextMenu'; import { ConfigService, @@ -103,7 +102,6 @@ export default class MainProcess { }); subscribeToTerminalContextMenuEvent(); - subscribeToClusterContextMenuEvent(); subscribeToTabContextMenuEvent(); subscribeToConfigServiceEvents(this.configService); } diff --git a/packages/teleterm/src/mainProcess/mainProcessClient.ts b/packages/teleterm/src/mainProcess/mainProcessClient.ts index 9e36bcff1..485c9a194 100644 --- a/packages/teleterm/src/mainProcess/mainProcessClient.ts +++ b/packages/teleterm/src/mainProcess/mainProcessClient.ts @@ -1,5 +1,4 @@ import { ipcRenderer } from 'electron'; -import { openClusterContextMenu } from './contextMenus/clusterContextMenu'; import { openTerminalContextMenu } from './contextMenus/terminalContextMenu'; import { MainProcessClient } from './types'; import { createConfigServiceClient } from '../services/config'; @@ -11,7 +10,6 @@ export default function createMainProcessClient(): MainProcessClient { return ipcRenderer.sendSync('main-process-get-runtime-settings'); }, openTerminalContextMenu, - openClusterContextMenu, openTabContextMenu, configService: createConfigServiceClient(), }; diff --git a/packages/teleterm/src/mainProcess/types.ts b/packages/teleterm/src/mainProcess/types.ts index 5336fa7ac..d6ada96c1 100644 --- a/packages/teleterm/src/mainProcess/types.ts +++ b/packages/teleterm/src/mainProcess/types.ts @@ -18,7 +18,6 @@ export type RuntimeSettings = { export type MainProcessClient = { getRuntimeSettings(): RuntimeSettings; openTerminalContextMenu(): void; - openClusterContextMenu(options: ClusterContextMenuOptions): void; openTabContextMenu(options: TabContextMenuOptions): void; configService: ConfigService; }; @@ -41,18 +40,10 @@ export interface TabContextMenuOptions { onDuplicatePty(): void; } -export const ClusterContextMenuEventChannel = 'ClusterContextMenuEventChannel'; export const TerminalContextMenuEventChannel = 'TerminalContextMenuEventChannel'; export const TabContextMenuEventChannel = 'TabContextMenuEventChannel'; export const ConfigServiceEventChannel = 'ConfigServiceEventChannel'; -export enum ClusterContextMenuEventType { - Refresh = 'Refresh', - Login = 'Login', - Logout = 'Logout', - Remove = 'Remove', -} - export enum TabContextMenuEventType { Close = 'Close', CloseOthers = 'CloseOthers', diff --git a/packages/teleterm/src/ui/Navigator/Expander.tsx b/packages/teleterm/src/ui/Navigator/Expander.tsx deleted file mode 100644 index 2efc35774..000000000 --- a/packages/teleterm/src/ui/Navigator/Expander.tsx +++ /dev/null @@ -1,118 +0,0 @@ -/* -Copyright 2019 Gravitational, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import React from 'react'; -import styled from 'styled-components'; -import { space, color } from 'design/system'; -import * as Icons from 'design/Icon'; -import { Flex } from 'design'; - -const AccordingContext = React.createContext(null); - -const Expander: React.FC = props => { - const [expanded, setExpanded] = React.useState(true); - const [header, ...children] = React.Children.toArray(props.children); - const toggle = () => setExpanded(!expanded); - - return ( - - {header} - {children} - - ); -}; - -export const ExpanderHeader: React.FC = props => { - const { onContextMenu, children, ...styles } = props; - const ctx = React.useContext(AccordingContext); - const ArrowIcon = ctx.expanded ? Icons.CarrotDown : Icons.CarrotRight; - - return ( - - - - {children} - - - ); -}; - -export const ExpanderContent = styled(Flex)(props => { - const ctx = React.useContext(AccordingContext); - return { - display: ctx.expanded ? 'block' : 'none', - color: props.theme.colors.text.secondary, - flexDirection: 'column', - }; -}); - -export default Expander; - -export const StyledHeader = styled(Flex)(props => { - const theme = props.theme; - return { - width: '100%', - margin: '0', - boxSizing: 'border-box', - display: 'flex', - alignItems: 'center', - justifyContent: 'flex-start', - border: 'none', - cursor: 'pointer', - outline: 'none', - textDecoration: 'none', - lineHeight: '24px', - fontSize: '12px', - fontWeight: theme.regular, - fontFamily: theme.font, - paddingLeft: theme.space[2] + 'px', - background: theme.colors.primary.main, - color: theme.colors.text.primary, - '&.active': { - borderLeftColor: theme.colors.accent, - background: theme.colors.primary.lighter, - color: theme.colors.primary.contrastText, - '.marker': { - background: theme.colors.secondary.light, - }, - }, - - '&:hover, &:focus': { - color: theme.colors.primary.contrastText, - background: theme.colors.primary.light, - }, - - height: '36px', - ...space(props), - ...color(props), - }; -}); - -type AccordingContextState = { - expanded: boolean; - toggle(): void; -}; - -type ExpanderHeaderProps = { - onClick?: () => void; - onContextMenu?: () => void; - [key: string]: any; -}; diff --git a/packages/teleterm/src/ui/Navigator/ExpanderClusters/ExpanderClusters.story.tsx b/packages/teleterm/src/ui/Navigator/ExpanderClusters/ExpanderClusters.story.tsx deleted file mode 100644 index 6fe20ecba..000000000 --- a/packages/teleterm/src/ui/Navigator/ExpanderClusters/ExpanderClusters.story.tsx +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright 2022 Gravitational, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from 'react'; -import { ExpanderClustersPresentational } from 'teleterm/ui/Navigator/ExpanderClusters/ExpanderClusters'; -import { MockAppContextProvider } from 'teleterm/ui/fixtures/MockAppContextProvider'; -import { ExpanderClusterState } from './types'; - -export default { - title: 'Teleterm/Navigator/ExpanderClusters', -}; - -function getState(): ExpanderClusterState { - return { - onAddCluster() {}, - onSyncClusters() {}, - onOpenContextMenu() {}, - onOpen() {}, - items: [ - { - clusterUri: '/clusters/root1.teleport.sh', - title: 'root1.teleport.sh', - syncing: false, - connected: false, - active: false, - }, - { - clusterUri: '/clusters/root2.teleport.sh', - title: 'root2.teleport.sh', - syncing: false, - connected: true, - active: true, - }, - { - clusterUri: '/clusters/root3.teleport.sh', - title: 'root3.teleport.sh', - connected: true, - syncing: false, - active: false, - leaves: [ - { - clusterUri: - '/clusters/root3.teleport.sh/leaves/internal1.example.com', - title: 'internal1.example.com', - syncing: false, - connected: false, - active: false, - }, - { - clusterUri: - '/clusters/root3.teleport.sh/leaves/internal2.example.com', - title: 'internal2.example.com', - syncing: false, - connected: true, - active: false, - }, - ], - }, - ], - }; -} - -export function Syncing() { - const state = getState(); - state.items.forEach(i => { - i.syncing = true; - }); - return ( - - - - ); -} - -export function ClusterItems() { - const state = getState(); - return ( - - - - ); -} diff --git a/packages/teleterm/src/ui/Navigator/ExpanderClusters/ExpanderClusters.test.tsx b/packages/teleterm/src/ui/Navigator/ExpanderClusters/ExpanderClusters.test.tsx deleted file mode 100644 index fd72cb5bc..000000000 --- a/packages/teleterm/src/ui/Navigator/ExpanderClusters/ExpanderClusters.test.tsx +++ /dev/null @@ -1,139 +0,0 @@ -/** - * Copyright 2022 Gravitational, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* eslint-disable jest/no-commented-out-tests */ - -import React from 'react'; -import { fireEvent, render } from 'design/utils/testing'; -import { ExpanderClustersPresentational } from './ExpanderClusters'; -import { ExpanderClusterState } from './types'; -import { MockAppContextProvider } from 'teleterm/ui/fixtures/MockAppContextProvider'; - -test.skip('should render simple and trusted clusters', () => { - const state: ExpanderClusterState = { - onAddCluster() {}, - onSyncClusters() {}, - onOpenContextMenu() {}, - onOpen() {}, - items: [ - { - clusterUri: 'test-uri', - title: 'Test title', - connected: false, - syncing: false, - active: false, - leaves: [ - { - clusterUri: 'trusted-cluster-test-uri', - title: 'Trusted cluster', - syncing: false, - connected: false, - active: false, - }, - ], - }, - ], - }; - - const { getByText } = render( - - - - ); - - expect(getByText(state.items[0].title)).toBeInTheDocument(); - expect(getByText(state.items[0].leaves[0].title)).toBeInTheDocument(); -}); - -test.skip('should invoke callback when context menu is clicked', () => { - const state: ExpanderClusterState = { - onAddCluster() {}, - onSyncClusters() {}, - onOpenContextMenu: jest.fn(), - onOpen() {}, - items: [ - { - clusterUri: 'test-uri', - title: 'Test title', - connected: false, - syncing: false, - active: false, - }, - ], - }; - - const { getByText } = render( - - - - ); - - fireEvent.contextMenu(getByText(state.items[0].title)); - expect(state.onOpenContextMenu).toHaveBeenCalledWith(state.items[0]); -}); - -/* -test('should invoke callback when remove button is clicked', () => { - const handleRemove = jest.fn(); - - const items: ClusterNavItem[] = [ - { uri: 'test-uri', title: 'Test title', connected: false, syncing: false }, - ]; - const { getByTitle } = render( - - - - ); - - const removeButton = getByTitle('Remove'); - expect(removeButton).toBeInTheDocument(); - - fireEvent.click(removeButton); - expect(handleRemove).toHaveBeenCalledWith(items[0].uri); -}); - -test('should invoke callback when add button is clicked', () => { - const handleAdd = jest.fn(); - - const { getByTitle } = render( - - - - ); - - const addButton = getByTitle('Add cluster'); - expect(addButton).toBeInTheDocument(); - - fireEvent.click(addButton); - expect(handleAdd).toHaveBeenCalledWith(); -}); - -test('should invoke callback when sync button is clicked', () => { - const handleSync = jest.fn(); - - const { getByTitle } = render( - - - - ); - - const syncButton = getByTitle('Sync clusters'); - expect(syncButton).toBeInTheDocument(); - - fireEvent.click(syncButton); - expect(handleSync).toHaveBeenCalledWith(); -}); -*/ diff --git a/packages/teleterm/src/ui/Navigator/ExpanderClusters/ExpanderClusters.tsx b/packages/teleterm/src/ui/Navigator/ExpanderClusters/ExpanderClusters.tsx deleted file mode 100644 index e14ff3c7c..000000000 --- a/packages/teleterm/src/ui/Navigator/ExpanderClusters/ExpanderClusters.tsx +++ /dev/null @@ -1,90 +0,0 @@ -/* -Copyright 2019 Gravitational, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import React from 'react'; -import { Flex, Text, ButtonIcon, Box } from 'design'; -import { Restore, Add } from 'design/Icon'; -import Expander, { ExpanderHeader, ExpanderContent } from './../Expander'; -import { useExpanderClusters } from './useExpanderClusters'; -// import { ExpanderClusterItem } from '../../Identity/ExpanderClusterItem'; -import { ExpanderClusterState } from './types'; - -export function ExpanderClusters() { - const state = useExpanderClusters(); - return ; -} - -export function ExpanderClustersPresentational(props: ExpanderClusterState) { - const { items, onSyncClusters, onAddCluster, onOpen, onOpenContextMenu } = - props; - - const handleSyncClick = (e: React.BaseSyntheticEvent) => { - e.stopPropagation(); - onSyncClusters?.(); - }; - - const handleAddClick = (e: React.BaseSyntheticEvent) => { - e.stopPropagation(); - onAddCluster?.(); - }; - - // const $clustersItems = items.map(i => ( - // onOpenContextMenu?.(i)} - // /> - // )); - - return ( - - - - - Clusters - - - - - - - - - - - - - {/*{$clustersItems}*/} - - - ); -} diff --git a/packages/teleterm/src/ui/Navigator/ExpanderClusters/index.ts b/packages/teleterm/src/ui/Navigator/ExpanderClusters/index.ts deleted file mode 100644 index bf33b0fe2..000000000 --- a/packages/teleterm/src/ui/Navigator/ExpanderClusters/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* -Copyright 2019 Gravitational, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -export { ExpanderClusters } from './ExpanderClusters'; diff --git a/packages/teleterm/src/ui/Navigator/ExpanderClusters/types.ts b/packages/teleterm/src/ui/Navigator/ExpanderClusters/types.ts deleted file mode 100644 index 621ccc011..000000000 --- a/packages/teleterm/src/ui/Navigator/ExpanderClusters/types.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2022 Gravitational, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { NavItem } from 'teleterm/ui/Navigator/types'; - -export interface ClusterNavItem extends NavItem { - connected: boolean; - syncing: boolean; - leaves?: ClusterNavItem[]; - clusterUri: string; - active: boolean; -} - -export interface ExpanderClusterState { - items: ClusterNavItem[]; - onAddCluster?(): void; - onSyncClusters?(): void; - onOpenContextMenu?(item: ClusterNavItem): void; - onOpen(clusterUri: string): void; -} diff --git a/packages/teleterm/src/ui/Navigator/ExpanderClusters/useExpanderClusters.ts b/packages/teleterm/src/ui/Navigator/ExpanderClusters/useExpanderClusters.ts deleted file mode 100644 index 97bcee925..000000000 --- a/packages/teleterm/src/ui/Navigator/ExpanderClusters/useExpanderClusters.ts +++ /dev/null @@ -1,113 +0,0 @@ -/* -Copyright 2019 Gravitational, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import { useAppContext } from 'teleterm/ui/appContextProvider'; -import AppContext from 'teleterm/ui/appContext'; -import { ExpanderClusterState, ClusterNavItem } from './types'; - -export function useExpanderClusters(): ExpanderClusterState { - const ctx = useAppContext(); - const items = initItems(ctx); - - // subscribe - ctx.clustersService.useState(); - - function onAddCluster() { - ctx.commandLauncher.executeCommand('cluster-connect', {}); - } - - function onSyncClusters() { - ctx.clustersService.syncRootClusters(); - } - - function onLogin(clusterUri: string) { - ctx.commandLauncher.executeCommand('cluster-connect', { clusterUri }); - } - - function onLogout(clusterUri: string) { - ctx.clustersService.logout(clusterUri); - } - - function onOpen(clusterUri: string) { - ctx.commandLauncher.executeCommand('cluster-open', { clusterUri }); - } - - function onRemove(clusterUri: string) { - ctx.commandLauncher.executeCommand('cluster-remove', { clusterUri }); - } - - function onOpenContextMenu(navItem: ClusterNavItem) { - ctx.mainProcessClient.openClusterContextMenu({ - isClusterConnected: navItem.connected, - onLogin() { - onLogin(navItem.clusterUri); - }, - onLogout() { - onLogout(navItem.clusterUri); - }, - onRemove() { - onRemove(navItem.clusterUri); - }, - onRefresh() { - ctx.clustersService.syncRootCluster(navItem.clusterUri); - }, - }); - } - - return { - items, - onAddCluster, - onOpenContextMenu, - onSyncClusters, - onOpen, - }; -} - -function initItems(ctx: AppContext): ClusterNavItem[] { - function findLeaves(clusterUri: string) { - return ctx.clustersService - .getClusters() - .filter(c => c.leaf && c.uri.startsWith(clusterUri)) - .map(cluster => { - return { - active: ctx.workspacesService - .getActiveWorkspaceDocumentService() - .isClusterDocumentActive(cluster.uri), - clusterUri: cluster.uri, - title: cluster.name, - connected: true, - syncing: false, - }; - }); - } - - return ctx.clustersService - .getClusters() - .filter(c => !c.leaf) - .map(cluster => { - const { syncing } = ctx.clustersService.getClusterSyncStatus(cluster.uri); - return { - active: ctx.workspacesService - .getActiveWorkspaceDocumentService() - .isClusterDocumentActive(cluster.uri), - title: cluster.name, - clusterUri: cluster.uri, - connected: cluster.connected, - syncing: syncing, - leaves: cluster.connected ? findLeaves(cluster.uri) : [], - }; - }); -} diff --git a/packages/teleterm/src/ui/Navigator/Navigator.story.tsx b/packages/teleterm/src/ui/Navigator/Navigator.story.tsx deleted file mode 100644 index 5b85b362b..000000000 --- a/packages/teleterm/src/ui/Navigator/Navigator.story.tsx +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Copyright 2020 Gravitational, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import React from 'react'; -import AppContextProvider from 'teleterm/ui/appContextProvider'; -import { Navigator } from './Navigator'; -import { MockAppContext } from 'teleterm/ui/fixtures/mocks'; -import { SyncStatus } from 'teleterm/ui/services/clusters/types'; -import styled from 'styled-components'; - -export default { - title: 'Teleterm/Navigator', -}; - -export const Story = () => { - const appContext = new MockAppContext(); - - appContext.statePersistenceService.getConnectionTrackerState = () => { - return { - connections: [ - { - connected: true, - kind: 'connection.server', - title: 'graves', - id: 'morris', - serverUri: 'brock', - login: 'casey', - clusterUri: '', - }, - { - connected: true, - kind: 'connection.gateway', - title: 'graves', - id: 'morris', - targetUri: 'brock', - port: '22', - gatewayUri: 'empty', - clusterUri: '' - }, - ], - }; - }; - - appContext.clustersService.getClusterSyncStatus = () => { - const loading: SyncStatus = { status: 'processing' }; - const error: SyncStatus = { status: 'failed', statusText: 'Server Error' }; - return { - syncing: true, - dbs: error, - servers: loading, - apps: loading, - kubes: loading, - }; - }; - - appContext.clustersService.getClusters = () => [ - { - uri: 'clusters/localhost', - leaf: false, - name: 'localhost', - connected: true, - }, - { - uri: 'clusters/example-host', - leaf: false, - name: 'example-host', - connected: true, - }, - ]; - - return ( - - - - - - ); -}; - -export function NoData() { - const appContext = new MockAppContext(); - appContext.clustersService.getClusters = () => []; - - return ( - - - - - - ); -} - -const Container = styled.div` - background: white; - max-width: 300px; - max-height: 700px; - overflow: auto; -`; diff --git a/packages/teleterm/src/ui/Navigator/Navigator.tsx b/packages/teleterm/src/ui/Navigator/Navigator.tsx deleted file mode 100644 index 1150eb89a..000000000 --- a/packages/teleterm/src/ui/Navigator/Navigator.tsx +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright 2019 Gravitational, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -import React from 'react'; -import styled from 'styled-components'; -import { Box, Text } from 'design'; - -export function Navigator() { - return ( - - ); -} - -const Nav = styled(Box)` - display: flex; - flex-direction: column; - height: 100%; - user-select: none; -`; - -const Scrollable = styled(Box)` - height: 100%; - overflow: auto; -`; - -const Separator = styled.div` - background: ${props => props.theme.colors.primary.lighter}; - height: 1px; -`; diff --git a/packages/teleterm/src/ui/Navigator/index.ts b/packages/teleterm/src/ui/Navigator/index.ts deleted file mode 100644 index d9df71873..000000000 --- a/packages/teleterm/src/ui/Navigator/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* -Copyright 2019 Gravitational, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -export { Navigator } from './Navigator'; diff --git a/packages/teleterm/src/ui/Navigator/types.ts b/packages/teleterm/src/ui/Navigator/types.ts deleted file mode 100644 index c3039c25c..000000000 --- a/packages/teleterm/src/ui/Navigator/types.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { FC } from 'react'; - -export interface NavItem { - title: string; - uri?: string; - Icon?: FC; -}