X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/e4b54c3b5d99c99553e319ead28c3aa8dcd6eecc..9d76aaa7f959780465232366551c5f1e970d1752:/src/views/ssh-key-panel/ssh-key-panel-root.tsx diff --git a/src/views/ssh-key-panel/ssh-key-panel-root.tsx b/src/views/ssh-key-panel/ssh-key-panel-root.tsx index f752228f..99ad1bff 100644 --- a/src/views/ssh-key-panel/ssh-key-panel-root.tsx +++ b/src/views/ssh-key-panel/ssh-key-panel-root.tsx @@ -2,54 +2,115 @@ // // SPDX-License-Identifier: AGPL-3.0 -import * as React from 'react'; -import { StyleRulesCallback, WithStyles, withStyles, Card, CardContent, Button, Typography } from '@material-ui/core'; -import { ArvadosTheme } from '~/common/custom-theme'; -import { SshKeyResource } from '~/models/ssh-key'; +import React from 'react'; +import { StyleRulesCallback, WithStyles, withStyles, Card, CardContent, Button, Typography, Grid, Table, TableHead, TableRow, TableCell, TableBody, Tooltip, IconButton } from '@material-ui/core'; +import { ArvadosTheme } from 'common/custom-theme'; +import { SshKeyResource } from 'models/ssh-key'; +import { AddIcon, MoreOptionsIcon, KeyIcon } from 'components/icon/icon'; - -type CssRules = 'root' | 'link'; +type CssRules = 'root' | 'link' | 'buttonContainer' | 'table' | 'tableRow' | 'keyIcon'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ root: { - width: '100%' + width: '100%', + overflow: 'auto' }, link: { color: theme.palette.primary.main, textDecoration: 'none', margin: '0px 4px' + }, + buttonContainer: { + textAlign: 'right' + }, + table: { + marginTop: theme.spacing.unit + }, + tableRow: { + '& td, th': { + whiteSpace: 'nowrap' + } + }, + keyIcon: { + color: theme.palette.primary.main } }); export interface SshKeyPanelRootActionProps { - onClick: () => void; + openSshKeyCreateDialog: () => void; + openRowOptions: (event: React.MouseEvent, sshKey: SshKeyResource) => void; + openPublicKeyDialog: (name: string, publicKey: string) => void; } export interface SshKeyPanelRootDataProps { - sshKeys?: SshKeyResource[]; + sshKeys: SshKeyResource[]; + hasKeys: boolean; } type SshKeyPanelRootProps = SshKeyPanelRootDataProps & SshKeyPanelRootActionProps & WithStyles; export const SshKeyPanelRoot = withStyles(styles)( - ({ classes, sshKeys, onClick }: SshKeyPanelRootProps) => + ({ classes, sshKeys, openSshKeyCreateDialog, openPublicKeyDialog, hasKeys, openRowOptions }: SshKeyPanelRootProps) => - - You have not yet set up an SSH public key for use with Arvados. - - Learn more. - - - - When you have an SSH key you would like to use, add it using button below. - - + + + { !hasKeys && + You have not yet set up an SSH public key for use with Arvados. + + Learn more. + + } + { !hasKeys && + When you have an SSH key you would like to use, add it using button below. + } + + + + + + + {hasKeys && + + + Name + UUID + Authorized user + Expires at + Key type + Public Key + + + + + {sshKeys.map((sshKey, index) => + + {sshKey.name} + {sshKey.uuid} + {sshKey.authorizedUserUuid} + {sshKey.expiresAt || '(none)'} + {sshKey.keyType} + + + openPublicKeyDialog(sshKey.name, sshKey.publicKey)}> + + + + + + + openRowOptions(event, sshKey)}> + + + + + )} + +
} +
); \ No newline at end of file