1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as 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
46 alignSelf: 'flex-end',
52 interface ProcessLogMainCardDataProps {
56 export interface ProcessLogMainCardActionProps {
57 onContextMenu: (event: React.MouseEvent<any>, process: Process) => void;
60 export type ProcessLogMainCardProps = ProcessLogMainCardDataProps
61 & ProcessLogMainCardActionProps
62 & CodeSnippetDataProps
63 & ProcessLogFormDataProps
64 & ProcessLogFormActionProps;
66 export const ProcessLogMainCard = withStyles(styles)(
67 ({ classes, process, selectedFilter, filters, onChange, lines, onContextMenu }: ProcessLogMainCardProps & WithStyles<CssRules>) =>
69 <Link to={`/processes/${process.containerRequest.uuid}`} className={classes.backLink}>
70 <BackIcon className={classes.backIcon} /> Back
72 <Card className={classes.card}>
74 avatar={<ProcessIcon className={classes.iconHeader} />}
76 <Tooltip title="More options" disableFocusListener>
77 <IconButton onClick={event => onContextMenu(event, process)} aria-label="More options">
82 <Tooltip title={process.containerRequest.name} placement="bottom-start">
83 <Typography noWrap variant="title" className={classes.title}>
84 {process.containerRequest.name}
87 subheader={process.containerRequest.description} />
96 <ProcessLogForm selectedFilter={selectedFilter} filters={filters} onChange={onChange} />
98 <Grid item xs={6} className={classes.link}>
99 <Typography component='div'>
105 <ProcessLogCodeSnippet lines={lines} />
110 messages={['No logs yet']} />