1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from 'react';
14 } from "@material-ui/core";
15 import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
16 import { RuntimeStatus } from "models/runtime-status";
17 import { ArvadosTheme } from 'common/custom-theme';
18 import classNames from 'classnames';
20 type CssRules = 'root'
31 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
33 marginBottom: theme.spacing.unit * 1,
39 paddingLeft: theme.spacing.unit * 1,
40 paddingRight: theme.spacing.unit * 1,
43 whiteSpace: 'pre-line',
46 paddingLeft: theme.spacing.unit * 1,
47 paddingRight: theme.spacing.unit * 1,
53 whiteSpace: 'pre-line',
56 color: theme.customs.colors.red900,
59 backgroundColor: theme.customs.colors.red100,
63 backgroundColor: theme.customs.colors.yellow100,
66 color: theme.customs.colors.yellow900,
69 export interface ProcessRuntimeStatusDataProps {
70 runtimeStatus: RuntimeStatus | undefined;
73 type ProcessRuntimeStatusProps = ProcessRuntimeStatusDataProps & WithStyles<CssRules>;
75 export const ProcessRuntimeStatus = withStyles(styles)(
76 ({ runtimeStatus, classes }: ProcessRuntimeStatusProps) => {
77 return <div className={classes.root}>
78 { runtimeStatus?.error &&
79 <div data-cy='process-runtime-status-error'><ExpansionPanel className={classes.error} elevation={0}>
80 <ExpansionPanelSummary className={classNames(classes.summary, classes.detailsText)} expandIcon={<ExpandMoreIcon />}>
81 <Typography className={classNames(classes.heading, classes.errorColor)}>
82 {`Error: ${runtimeStatus.error }`}
84 </ExpansionPanelSummary>
85 <ExpansionPanelDetails className={classes.details}>
86 <Typography className={classNames(classes.errorColor, classes.detailsText)}>
87 {runtimeStatus?.errorDetail || 'No additional error details available'}
89 </ExpansionPanelDetails>
90 </ExpansionPanel></div>
92 { runtimeStatus?.warning &&
93 <div data-cy='process-runtime-status-warning' ><ExpansionPanel className={classes.warning} elevation={0}>
94 <ExpansionPanelSummary className={classNames(classes.summary, classes.detailsText)} expandIcon={<ExpandMoreIcon />}>
95 <Typography className={classNames(classes.heading, classes.warningColor)}>
96 {`Warning: ${runtimeStatus.warning }`}
98 </ExpansionPanelSummary>
99 <ExpansionPanelDetails className={classes.details}>
100 <Typography className={classNames(classes.warningColor, classes.detailsText)}>
101 {runtimeStatus?.warningDetail || 'No additional warning details available'}
103 </ExpansionPanelDetails>
104 </ExpansionPanel></div>