1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from 'react';
15 } from "@material-ui/core";
16 import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
17 import { RuntimeStatus } from "models/runtime-status";
18 import { ArvadosTheme } from 'common/custom-theme';
19 import classNames from 'classnames';
21 type CssRules = 'root'
33 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
35 marginBottom: theme.spacing.unit * 1,
41 paddingLeft: theme.spacing.unit * 1,
42 paddingRight: theme.spacing.unit * 1,
45 whiteSpace: 'pre-line',
48 paddingLeft: theme.spacing.unit * 1,
49 paddingRight: theme.spacing.unit * 1,
55 whiteSpace: 'pre-line',
58 color: theme.customs.colors.grey700,
61 backgroundColor: theme.customs.colors.red100,
65 backgroundColor: theme.customs.colors.yellow100,
68 color: theme.customs.colors.grey700,
71 minHeight: theme.spacing.unit * 6,
76 export interface ProcessRuntimeStatusDataProps {
77 runtimeStatus: RuntimeStatus | undefined;
78 containerCount: number;
81 type ProcessRuntimeStatusProps = ProcessRuntimeStatusDataProps & WithStyles<CssRules>;
83 export const ProcessRuntimeStatus = withStyles(styles)(
84 ({ runtimeStatus, containerCount, classes }: ProcessRuntimeStatusProps) => {
85 return <div className={classes.root}>
86 { runtimeStatus?.error &&
87 <div data-cy='process-runtime-status-error'><ExpansionPanel className={classes.error} elevation={0}>
88 <ExpansionPanelSummary className={classNames(classes.summary, classes.detailsText)} expandIcon={<ExpandMoreIcon />}>
89 <Typography className={classNames(classes.heading, classes.errorColor)}>
90 {`Error: ${runtimeStatus.error }`}
92 </ExpansionPanelSummary>
93 <ExpansionPanelDetails className={classes.details}>
94 <Typography className={classNames(classes.errorColor, classes.detailsText)}>
95 {runtimeStatus?.errorDetail || 'No additional error details available'}
97 </ExpansionPanelDetails>
98 </ExpansionPanel></div>
100 { runtimeStatus?.warning &&
101 <div data-cy='process-runtime-status-warning' ><ExpansionPanel className={classes.warning} elevation={0}>
102 <ExpansionPanelSummary className={classNames(classes.summary, classes.detailsText)} expandIcon={<ExpandMoreIcon />}>
103 <Typography className={classNames(classes.heading, classes.warningColor)}>
104 {`Warning: ${runtimeStatus.warning }`}
106 </ExpansionPanelSummary>
107 <ExpansionPanelDetails className={classes.details}>
108 <Typography className={classNames(classes.warningColor, classes.detailsText)}>
109 {runtimeStatus?.warningDetail || 'No additional warning details available'}
111 </ExpansionPanelDetails>
112 </ExpansionPanel></div>
114 { containerCount > 1 &&
115 <div data-cy='process-runtime-status-retry-warning' >
116 <Paper className={classNames(classes.warning, classes.paperRoot)} elevation={0}>
117 <Typography className={classNames(classes.heading, classes.summary, classes.warningColor)}>
118 {`Warning: Process retried ${containerCount - 1} time${containerCount > 2 ? 's' : ''} due to failure.`}