// Copyright (C) The Arvados Authors. All rights reserved. // // SPDX-License-Identifier: AGPL-3.0 import React from 'react'; import { CustomStyleRulesCallback } from 'common/custom-theme'; import { ExpansionPanel, ExpansionPanelDetails, ExpansionPanelSummary, Paper, Typography, withStyles, WithStyles } from "@material-ui/core"; import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import { RuntimeStatus } from "models/runtime-status"; import { ArvadosTheme } from 'common/custom-theme'; import classNames from 'classnames'; type CssRules = 'root' | 'heading' | 'summary' | 'summaryText' | 'details' | 'detailsText' | 'error' | 'errorColor' | 'warning' | 'warningColor' | 'paperRoot'; const styles: CustomStyleRulesCallback = (theme: ArvadosTheme) => ({ root: { marginBottom: theme.spacing(1), }, heading: { fontSize: '1rem', }, summary: { paddingLeft: theme.spacing(1), paddingRight: theme.spacing(1), }, summaryText: { whiteSpace: 'pre-line', }, details: { paddingLeft: theme.spacing(1), paddingRight: theme.spacing(1), }, detailsText: { fontSize: '0.8rem', marginTop: '0px', marginBottom: '0px', whiteSpace: 'pre-line', }, errorColor: { color: theme.customs.colors.grey700, }, error: { backgroundColor: theme.customs.colors.red100, }, warning: { backgroundColor: theme.customs.colors.yellow100, }, warningColor: { color: theme.customs.colors.grey700, }, paperRoot: { minHeight: theme.spacing(6), display: 'flex', alignItems: 'center', }, }); export interface ProcessRuntimeStatusDataProps { runtimeStatus: RuntimeStatus | undefined; containerCount: number; } type ProcessRuntimeStatusProps = ProcessRuntimeStatusDataProps & WithStyles; export const ProcessRuntimeStatus = withStyles(styles)( ({ runtimeStatus, containerCount, classes }: ProcessRuntimeStatusProps) => { return
{ runtimeStatus?.error &&
}> {`Error: ${runtimeStatus.error }`} {runtimeStatus?.errorDetail || 'No additional error details available'}
} { runtimeStatus?.warning &&
}> {`Warning: ${runtimeStatus.warning }`} {runtimeStatus?.warningDetail || 'No additional warning details available'}
} { containerCount > 1 &&
{`Warning: Process retried ${containerCount - 1} time${containerCount > 2 ? 's' : ''} due to failure.`}
}
});