1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from 'react';
6 import { Link } from 'react-router-dom';
8 StyleRulesCallback, WithStyles, withStyles, Card,
9 CardHeader, IconButton, CardContent, Grid, Typography, Tooltip
10 } from '@material-ui/core';
11 import { Process } from 'store/processes/process';
12 import { ProcessLogCodeSnippet } from 'views/process-log-panel/process-log-code-snippet';
13 import { ProcessLogForm, ProcessLogFormDataProps, ProcessLogFormActionProps } from 'views/process-log-panel/process-log-form';
14 import { MoreOptionsIcon, ProcessIcon } from 'components/icon/icon';
15 import { ArvadosTheme } from 'common/custom-theme';
16 import { CodeSnippetDataProps } from 'components/code-snippet/code-snippet';
17 import { BackIcon } from 'components/icon/icon';
18 import { DefaultView } from 'components/default-view/default-view';
20 type CssRules = 'backLink' | 'backIcon' | 'card' | 'title' | 'iconHeader' | 'link';
22 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
28 textDecoration: 'none',
29 padding: theme.spacing.unit,
30 color: theme.palette.grey["700"],
33 marginRight: theme.spacing.unit
39 color: theme.palette.grey["700"]
43 color: theme.customs.colors.green700
47 color: theme.palette.primary.main,
56 interface ProcessLogMainCardDataProps {
60 export interface ProcessLogMainCardActionProps {
61 onContextMenu: (event: React.MouseEvent<any>, process: Process) => void;
62 navigateToLogCollection: (uuid: string) => void;
65 export type ProcessLogMainCardProps = ProcessLogMainCardDataProps
66 & ProcessLogMainCardActionProps
67 & CodeSnippetDataProps
68 & ProcessLogFormDataProps
69 & ProcessLogFormActionProps;
71 export const ProcessLogMainCard = withStyles(styles)(
72 ({ classes, process, selectedFilter, filters, onChange, lines, onContextMenu, navigateToLogCollection }: ProcessLogMainCardProps & WithStyles<CssRules>) =>
74 <Link to={`/processes/${process.containerRequest.uuid}`} className={classes.backLink}>
75 <BackIcon className={classes.backIcon} /> BACK
77 <Card className={classes.card}>
79 avatar={<ProcessIcon className={classes.iconHeader} />}
81 <Tooltip title="More options" disableFocusListener>
82 <IconButton onClick={event => onContextMenu(event, process)} aria-label="More options">
87 <Tooltip title={process.containerRequest.name} placement="bottom-start">
88 <Typography noWrap variant='h6' className={classes.title}>
89 {process.containerRequest.name}
92 subheader={process.containerRequest.description} />
101 <ProcessLogForm selectedFilter={selectedFilter} filters={filters} onChange={onChange} />
103 <Grid item xs={6} className={classes.link}>
104 <span onClick={() => navigateToLogCollection(process.containerRequest.logUuid!)}>
110 <ProcessLogCodeSnippet lines={lines} />
115 messages={['No logs yet']} />