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 = 'heading'
29 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
34 paddingLeft: theme.spacing.unit * 1,
35 paddingRight: theme.spacing.unit * 1,
38 paddingLeft: theme.spacing.unit * 1,
39 paddingRight: theme.spacing.unit * 1,
45 whiteSpace: 'pre-line',
48 color: theme.customs.colors.red900,
51 backgroundColor: theme.customs.colors.red100,
55 backgroundColor: theme.customs.colors.yellow100,
58 color: theme.customs.colors.yellow900,
61 export interface ProcessRuntimeStatusDataProps {
62 runtimeStatus: RuntimeStatus | undefined;
65 type ProcessRuntimeStatusProps = ProcessRuntimeStatusDataProps & WithStyles<CssRules>;
67 export const ProcessRuntimeStatus = withStyles(styles)(
68 ({ runtimeStatus, classes }: ProcessRuntimeStatusProps) => {
70 { runtimeStatus?.error &&
71 <div data-cy='process-runtime-status-error'><ExpansionPanel className={classes.error} elevation={0}>
72 <ExpansionPanelSummary className={classes.summary} expandIcon={<ExpandMoreIcon />}>
73 <Typography className={classNames(classes.heading, classes.errorColor)}>
74 {`Error: ${runtimeStatus.error }`}
76 </ExpansionPanelSummary>
77 <ExpansionPanelDetails className={classes.details}>
78 <Typography className={classNames(classes.errorColor, classes.detailsText)}>
79 {runtimeStatus?.errorDetail || 'No additional error details available'}
81 </ExpansionPanelDetails>
82 </ExpansionPanel></div>
84 { runtimeStatus?.warning &&
85 <div data-cy='process-runtime-status-warning' ><ExpansionPanel className={classes.warning} elevation={0}>
86 <ExpansionPanelSummary className={classes.summary} expandIcon={<ExpandMoreIcon />}>
87 <Typography className={classNames(classes.heading, classes.warningColor)}>
88 {`Warning: ${runtimeStatus.warning }`}
90 </ExpansionPanelSummary>
91 <ExpansionPanelDetails className={classes.details}>
92 <Typography className={classNames(classes.warningColor, classes.detailsText)}>
93 {runtimeStatus?.warningDetail || 'No additional warning details available'}
95 </ExpansionPanelDetails>
96 </ExpansionPanel></div>