90602de0d2a1d05320c6ccfae3e6cd5bf86f2381
[arvados-workbench2.git] / src / views / ssh-key-panel / ssh-key-panel-root.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import * as React from 'react';
6 import { StyleRulesCallback, WithStyles, withStyles, Card, CardContent, Button, Typography } from '@material-ui/core';
7 import { ArvadosTheme } from '~/common/custom-theme';
8 import { SshKey } from '~/models/ssh-key';
9
10
11 type CssRules = 'root' | 'link';
12
13 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
14     root: {
15        width: '100%'
16     },
17     link: {
18         color: theme.palette.primary.main,
19         textDecoration: 'none',
20         margin: '0px 4px'
21     }
22 });
23
24 export interface SshKeyPanelRootActionProps {
25     onClick: () => void;
26 }
27
28 export interface SshKeyPanelRootDataProps {
29     sshKeys?: SshKey[];
30 }
31
32 type SshKeyPanelRootProps = SshKeyPanelRootDataProps & SshKeyPanelRootActionProps & WithStyles<CssRules>;
33
34 export const SshKeyPanelRoot = withStyles(styles)(
35     ({ classes, sshKeys, onClick }: SshKeyPanelRootProps) =>
36         <Card className={classes.root}>
37             <CardContent>
38                 <Typography variant='body1' paragraph={true}>
39                     You have not yet set up an SSH public key for use with Arvados.
40                     <a href='https://doc.arvados.org/user/getting_started/ssh-access-unix.html' target='blank' className={classes.link}>
41                         Learn more.
42                     </a>
43                 </Typography>
44                 <Typography variant='body1' paragraph={true}>
45                     When you have an SSH key you would like to use, add it using button below.
46                 </Typography>
47                 <Button
48                     onClick={onClick}
49                     color="primary"
50                     variant="contained">
51                     Add New Ssh Key
52                 </Button>
53             </CardContent>
54         </Card>
55     );