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'
30 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
35 paddingLeft: theme.spacing.unit * 1,
36 paddingRight: theme.spacing.unit * 1,
39 whiteSpace: 'pre-line',
42 paddingLeft: theme.spacing.unit * 1,
43 paddingRight: theme.spacing.unit * 1,
49 whiteSpace: 'pre-line',
52 color: theme.customs.colors.red900,
55 backgroundColor: theme.customs.colors.red100,
59 backgroundColor: theme.customs.colors.yellow100,
62 color: theme.customs.colors.yellow900,
65 export interface ProcessRuntimeStatusDataProps {
66 runtimeStatus: RuntimeStatus | undefined;
69 type ProcessRuntimeStatusProps = ProcessRuntimeStatusDataProps & WithStyles<CssRules>;
71 export const ProcessRuntimeStatus = withStyles(styles)(
72 ({ runtimeStatus, classes }: ProcessRuntimeStatusProps) => {
74 { runtimeStatus?.error &&
75 <div data-cy='process-runtime-status-error'><ExpansionPanel className={classes.error} elevation={0}>
76 <ExpansionPanelSummary className={classNames(classes.summary, classes.detailsText)} expandIcon={<ExpandMoreIcon />}>
77 <Typography className={classNames(classes.heading, classes.errorColor)}>
78 {`Error: ${runtimeStatus.error }`}
80 </ExpansionPanelSummary>
81 <ExpansionPanelDetails className={classes.details}>
82 <Typography className={classNames(classes.errorColor, classes.detailsText)}>
83 {runtimeStatus?.errorDetail || 'No additional error details available'}
85 </ExpansionPanelDetails>
86 </ExpansionPanel></div>
88 { runtimeStatus?.warning &&
89 <div data-cy='process-runtime-status-warning' ><ExpansionPanel className={classes.warning} elevation={0}>
90 <ExpansionPanelSummary className={classNames(classes.summary, classes.detailsText)} expandIcon={<ExpandMoreIcon />}>
91 <Typography className={classNames(classes.heading, classes.warningColor)}>
92 {`Warning: ${runtimeStatus.warning }`}
94 </ExpansionPanelSummary>
95 <ExpansionPanelDetails className={classes.details}>
96 <Typography className={classNames(classes.warningColor, classes.detailsText)}>
97 {runtimeStatus?.warningDetail || 'No additional warning details available'}
99 </ExpansionPanelDetails>
100 </ExpansionPanel></div>