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' | 'summary' | 'details' | 'error' | 'errorColor' | 'warning' | 'warningColor';
22 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
27 paddingLeft: theme.spacing.unit * 1,
28 paddingRight: theme.spacing.unit * 1,
31 paddingLeft: theme.spacing.unit * 1,
32 paddingRight: theme.spacing.unit * 1,
35 color: theme.customs.colors.red900,
38 backgroundColor: theme.customs.colors.red100,
42 backgroundColor: theme.customs.colors.yellow100,
45 color: theme.customs.colors.yellow900,
48 export interface ProcessRuntimeStatusDataProps {
49 runtimeStatus: RuntimeStatus | undefined;
52 type ProcessRuntimeStatusProps = ProcessRuntimeStatusDataProps & WithStyles<CssRules>;
54 export const ProcessRuntimeStatus = withStyles(styles)(
55 ({ runtimeStatus, classes }: ProcessRuntimeStatusProps) => {
57 { runtimeStatus?.error &&
58 <ExpansionPanel className={classes.error} elevation={0}>
59 <ExpansionPanelSummary className={classes.summary} expandIcon={<ExpandMoreIcon />}>
60 <Typography className={classNames(classes.heading, classes.errorColor)}>
61 {`Error: ${runtimeStatus.error }`}
63 </ExpansionPanelSummary>
64 <ExpansionPanelDetails className={classes.details}>
65 <Typography className={classes.errorColor}>
66 {runtimeStatus?.errorDetail || 'No additional error details available'}
68 </ExpansionPanelDetails>
71 { runtimeStatus?.warning &&
72 <ExpansionPanel className={classes.warning} elevation={0}>
73 <ExpansionPanelSummary className={classes.summary} expandIcon={<ExpandMoreIcon />}>
74 <Typography className={classNames(classes.heading, classes.warningColor)}>
75 {`Warning: ${runtimeStatus.warning }`}
77 </ExpansionPanelSummary>
78 <ExpansionPanelDetails className={classes.details}>
79 <Typography className={classes.warningColor}>
80 {runtimeStatus?.warningDetail || 'No additional warning details available'}
82 </ExpansionPanelDetails>