Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.
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
2 changes: 2 additions & 0 deletions packages/design/src/Icon/Icon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ export const Expand = makeFontIcon('Expand', 'icon-frame-expand');
export const Facebook = makeFontIcon('Facebook', 'icon-facebook');
export const FacebookSquare = makeFontIcon('FacebookSquare', 'icon-facebook2');
export const FileCode = makeFontIcon('Youtube', 'icon-file-code');
export const FolderPlus = makeFontIcon('FolderPlus', 'icon-folder-plus');
export const FolderShared = makeFontIcon('FolderShared', 'icon-folder-shared');
export const ForwarderAdded = makeFontIcon(
'ForwarderAdded',
'icon-add-fowarder'
Expand Down
2 changes: 2 additions & 0 deletions packages/design/src/Icon/Icon.story.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ export const ListOfIcons = () => (
<IconBox IconCmpt={Icon.Expand} text="Expand" />
<IconBox IconCmpt={Icon.Facebook} text="Facebook" />
<IconBox IconCmpt={Icon.FacebookSquare} text="FacebookSquare" />
<IconBox IconCmpt={Icon.FolderPlus} text="FolderPlus" />
<IconBox IconCmpt={Icon.FolderShared} text="FolderShared" />
<IconBox IconCmpt={Icon.ForwarderAdded} text="ForwarderAdded" />
<IconBox IconCmpt={Icon.Github} text="Github" />
<IconBox IconCmpt={Icon.Google} text="Google" />
Expand Down
Binary file not shown.
4 changes: 4 additions & 0 deletions packages/design/src/assets/icomoon/fonts/icomoon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/design/src/assets/icomoon/fonts/icomoon.ttf
Binary file not shown.
Binary file modified packages/design/src/assets/icomoon/fonts/icomoon.woff
Binary file not shown.
Binary file modified packages/design/src/assets/icomoon/fonts/icomoon.woff2
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/design/src/assets/icomoon/style.css

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions packages/shared/libs/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export class Logger {
this.log('info', ...args);
}

debug(...args) {
this.log('debug', ...args);
}

error(...args) {
this.log('error', ...args);
}
Expand Down
1 change: 1 addition & 0 deletions packages/teleport/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
},
"devDependencies": {
"@gravitational/build": "^1.0.0",
"@types/wicg-native-file-system": "^2020.6.0",
"jest-canvas-mock": "^2.3.1"
}
}
12 changes: 11 additions & 1 deletion packages/teleport/src/DesktopSession/ActionMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import * as Icons from 'design/Icon';
import { Flex } from 'design';

export default function ActionMenu(props: Props) {
const { showShareDirectory, onShareDirectory, onDisconnect } = props;

return (
<Flex alignItems="center">
<MenuIcon
Expand All @@ -31,7 +33,13 @@ export default function ActionMenu(props: Props) {
}}
menuProps={menuProps}
>
<MenuItem onClick={props.onDisconnect}>
{showShareDirectory && (
<MenuItem onClick={onShareDirectory}>
<MenuItemIcon as={Icons.FolderPlus} mr="2" />
Share Directory
</MenuItem>
)}
<MenuItem onClick={onDisconnect}>
<MenuItemIcon as={Icons.PowerSwitch} mr="2" />
Disconnect
</MenuItem>
Expand All @@ -41,6 +49,8 @@ export default function ActionMenu(props: Props) {
}

type Props = {
showShareDirectory: boolean;
onShareDirectory: VoidFunction;
onDisconnect: VoidFunction;
};

Expand Down
10 changes: 6 additions & 4 deletions packages/teleport/src/DesktopSession/DesktopSession.story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,17 @@ const props: State = {
permission: { state: '' },
errorText: '',
},
isRecording: false,
tdpClient: fakeClient(),
username: 'user',
onWsOpen: () => {},
onWsClose: () => {},
wsConnection: 'closed',
disconnected: false,
setDisconnected: () => null,
setDisconnected: () => {},
setClipboardState: () => {},
canShareDirectory: true,
isSharingDirectory: false,
setIsSharingDirectory: () => {},
onPngFrame: () => {},
onTdpError: () => {},
onKeyDown: () => {},
Expand Down Expand Up @@ -108,7 +111,6 @@ export const ConnectedSettingsFalse = () => {
permission: { state: '' },
errorText: '',
}}
isRecording={false}
onPngFrame={(ctx: CanvasRenderingContext2D) => {
fillGray(ctx.canvas);
}}
Expand All @@ -135,7 +137,7 @@ export const ConnectedSettingsTrue = () => {
permission: { state: 'granted' },
errorText: '',
}}
isRecording={true}
isSharingDirectory={true}
onPngFrame={(ctx: CanvasRenderingContext2D) => {
fillGray(ctx.canvas);
}}
Expand Down
29 changes: 26 additions & 3 deletions packages/teleport/src/DesktopSession/DesktopSession.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ function Session(props: PropsWithChildren<State>) {
username,
hostname,
clipboardState,
isRecording,
setClipboardState,
canShareDirectory,
isSharingDirectory,
setIsSharingDirectory,
onPngFrame,
onClipboardData,
onTdpError,
Expand Down Expand Up @@ -139,16 +142,36 @@ function Session(props: PropsWithChildren<State>) {
!disconnected &&
clipboardSuccess;

const onShareDirectory = () => {
window
.showDirectoryPicker()
.then(sharedDirHandle => {
setIsSharingDirectory(true);
tdpClient.sharedDirectory = sharedDirHandle;
tdpClient.sendSharedDirectoryAnnounce();
})
.catch(() => {
setIsSharingDirectory(false);
});
};

return (
<Flex flexDirection="column">
<TopBar
onDisconnect={() => {
setDisconnected(true);
setClipboardState(prevState => ({
...prevState,
enabled: false,
}));
setIsSharingDirectory(false);
tdpClient.nuke();
}}
userHost={`${username}@${hostname}`}
clipboard={clipboardSharingActive}
recording={isRecording}
clipboardSharingEnabled={clipboardSharingActive}
canShareDirectory={canShareDirectory}
isSharingDirectory={isSharingDirectory}
onShareDirectory={onShareDirectory}
/>

{props.children}
Expand Down
69 changes: 39 additions & 30 deletions packages/teleport/src/DesktopSession/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@ limitations under the License.
import React from 'react';
import styled, { useTheme } from 'styled-components';
import { Text, TopNav, Flex } from 'design';
import { Clipboard } from 'design/Icon';
import { Clipboard, FolderShared } from 'design/Icon';
import { colors } from 'teleport/Console/colors';
import ActionMenu from './ActionMenu';

export default function TopBar(props: Props) {
const { userHost, clipboard, recording, onDisconnect } = props;
const {
userHost,
clipboardSharingEnabled,
onDisconnect,
canShareDirectory,
isSharingDirectory,
onShareDirectory,
} = props;
const theme = useTheme();

const primaryOnTrue = (b: boolean): any => {
Expand All @@ -42,30 +49,32 @@ export default function TopBar(props: Props) {
{userHost}
</Text>

<Text
style={{
...primaryOnTrue(clipboard),
verticalAlign: 'text-bottom',
}}
>
<StyledClipboard style={primaryOnTrue(clipboard)} pr={2} />
Clipboard Sharing {clipboard ? 'Enabled' : 'Disabled'}
</Text>

<Flex px={3}>
<Flex alignItems="center">
<StyledRecordingIndicator
style={{
backgroundColor: recording
? theme.colors.error.light
: theme.colors.text.secondary,
}}
<StyledFolderShared
style={primaryOnTrue(isSharingDirectory)}
pr={3}
title={
isSharingDirectory
? 'Directory Sharing Enabled'
: 'Directory Sharing Disabled'
}
/>
<StyledClipboard
style={primaryOnTrue(clipboardSharingEnabled)}
pr={3}
title={
clipboardSharingEnabled
? 'Clipboard Sharing Enabled'
: 'Clipboard Sharing Disabled'
}
/>
<Text style={primaryOnTrue(recording)}>
{recording ? '' : 'Not '}Recording
</Text>
</Flex>
<ActionMenu onDisconnect={onDisconnect} />
<ActionMenu
onDisconnect={onDisconnect}
showShareDirectory={canShareDirectory && !isSharingDirectory}
onShareDirectory={onShareDirectory}
/>
</Flex>
</TopNav>
);
Expand All @@ -79,17 +88,17 @@ const StyledClipboard = styled(Clipboard)`
align-self: 'center';
`;

const StyledRecordingIndicator = styled.div`
width: 10px;
height: 10px;
border-radius: 10px;
margin-right: 6px;
vertical-align: text-bottom;
const StyledFolderShared = styled(FolderShared)`
font-weight: ${({ theme }) => theme.fontWeights.bold};
font-size: ${({ theme }) => theme.fontSizes[6] + 'px'};
align-self: 'center';
`;

type Props = {
userHost: string;
clipboard: boolean;
recording: boolean;
clipboardSharingEnabled: boolean;
canShareDirectory: boolean;
isSharingDirectory: boolean;
onDisconnect: VoidFunction;
onShareDirectory: VoidFunction;
};
Loading