// Copyright (C) The Arvados Authors. All rights reserved. // // SPDX-License-Identifier: AGPL-3.0 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, MoreVerticalIcon, KeyIcon } from 'components/icon/icon'; type CssRules = 'root' | 'link' | 'buttonContainer' | 'table' | 'tableRow' | 'keyIcon'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ root: { 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 { openSshKeyCreateDialog: () => void; openRowOptions: (event: React.MouseEvent, sshKey: SshKeyResource) => void; openPublicKeyDialog: (name: string, publicKey: string) => void; } export interface SshKeyPanelRootDataProps { sshKeys: SshKeyResource[]; hasKeys: boolean; } type SshKeyPanelRootProps = SshKeyPanelRootDataProps & SshKeyPanelRootActionProps & WithStyles; export const SshKeyPanelRoot = withStyles(styles)( ({ classes, sshKeys, openSshKeyCreateDialog, openPublicKeyDialog, hasKeys, openRowOptions }: SshKeyPanelRootProps) => {!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)}> )}
}
);