1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { StyleRulesCallback, WithStyles, withStyles, Card, CardContent, Grid, Table, TableHead, TableRow, TableCell, TableBody, Tooltip, IconButton, Checkbox } from '@material-ui/core';
7 import { ArvadosTheme } from '~/common/custom-theme';
8 import { MoreOptionsIcon } from '~/components/icon/icon';
9 import { KeepServiceResource } from '~/models/keep-services';
11 type CssRules = 'root' | 'tableRow';
13 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
25 export interface KeepServicePanelRootActionProps {
26 openRowOptions: (event: React.MouseEvent<HTMLElement>, keepService: KeepServiceResource) => void;
29 export interface KeepServicePanelRootDataProps {
30 keepServices: KeepServiceResource[];
31 hasKeepSerices: boolean;
34 type KeepServicePanelRootProps = KeepServicePanelRootActionProps & KeepServicePanelRootDataProps & WithStyles<CssRules>;
36 export const KeepServicePanelRoot = withStyles(styles)(
37 ({ classes, hasKeepSerices, keepServices, openRowOptions }: KeepServicePanelRootProps) =>
38 <Card className={classes.root}>
40 {hasKeepSerices && <Grid container direction="row">
44 <TableRow className={classes.tableRow}>
45 <TableCell>UUID</TableCell>
46 <TableCell>Read only</TableCell>
47 <TableCell>Service host</TableCell>
48 <TableCell>Service port</TableCell>
49 <TableCell>Service SSL flag</TableCell>
50 <TableCell>Service type</TableCell>
55 {keepServices.map((keepService, index) =>
56 <TableRow key={index} className={classes.tableRow}>
57 <TableCell>{keepService.uuid}</TableCell>
62 checked={keepService.readOnly} />
64 <TableCell>{keepService.serviceHost}</TableCell>
65 <TableCell>{keepService.servicePort}</TableCell>
70 checked={keepService.serviceSslFlag} />
72 <TableCell>{keepService.serviceType}</TableCell>
74 <Tooltip title="More options" disableFocusListener>
75 <IconButton onClick={event => openRowOptions(event, keepService)}>