1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from "react";
6 import { compose } from 'redux';
7 import { withStyles, Dialog, DialogTitle, DialogContent, DialogActions, Button, StyleRulesCallback, WithStyles } from '@material-ui/core';
8 import { WithDialogProps, withDialog } from "~/store/dialog/with-dialog";
9 import { SSH_KEY_PUBLIC_KEY_DIALOG } from '~/store/auth/auth-action-ssh';
10 import { ArvadosTheme } from '~/common/custom-theme';
11 import { DefaultCodeSnippet } from '~/components/default-code-snippet/default-code-snippet';
13 type CssRules = 'codeSnippet';
15 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
17 borderRadius: theme.spacing.unit * 0.5,
19 borderColor: theme.palette.grey["400"],
21 wordWrap: 'break-word',
22 whiteSpace: 'pre-wrap'
27 interface PublicKeyDialogDataProps {
32 export const PublicKeyDialog = compose(
33 withDialog(SSH_KEY_PUBLIC_KEY_DIALOG),
35 ({ open, closeDialog, data, classes }: WithDialogProps<PublicKeyDialogDataProps> & WithStyles<CssRules>) =>
40 <DialogTitle>{data.name} - SSH Key</DialogTitle>
42 {data && data.publicKey && <DefaultCodeSnippet
43 className={classes.codeSnippet}
44 lines={data.publicKey.split(' ')} />}
50 onClick={closeDialog}>