Remove excessive status elements since there only needs to be one status statement for each image in the list. Also, replace the pending spinner with a pending icon.
73 lines
2 KiB
JavaScript
73 lines
2 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { Flex } from '@patternfly/react-core';
|
|
import { CheckCircleIcon, PendingIcon, ExclamationCircleIcon, InProgressIcon } from '@patternfly/react-icons';
|
|
|
|
import './ImageBuildStatus.scss';
|
|
|
|
const ImageBuildStatus = (props) => {
|
|
const messages = {
|
|
success: [
|
|
{
|
|
icon: <CheckCircleIcon className="success" />,
|
|
text: 'Ready'
|
|
}
|
|
],
|
|
failure: [
|
|
{
|
|
icon: <ExclamationCircleIcon className="error" />,
|
|
text: 'Image build failed'
|
|
}
|
|
],
|
|
pending: [
|
|
{
|
|
icon: <PendingIcon />,
|
|
text: 'Image build, Upload, Cloud registration pending'
|
|
}
|
|
],
|
|
// Keep "running" for backward compatibility
|
|
running: [
|
|
{
|
|
icon: <InProgressIcon className="pending" />,
|
|
text: 'Image build in progress'
|
|
}
|
|
],
|
|
building: [
|
|
{
|
|
icon: <InProgressIcon className="pending" />,
|
|
text: 'Image build in progress'
|
|
}
|
|
],
|
|
uploading: [
|
|
{
|
|
icon: <InProgressIcon className="pending" />,
|
|
text: 'Image upload in progress'
|
|
}
|
|
],
|
|
registering: [
|
|
{
|
|
icon: <InProgressIcon className="pending" />,
|
|
text: 'Cloud registration in progress'
|
|
}
|
|
]
|
|
};
|
|
return (
|
|
<React.Fragment>
|
|
{messages[props.status] &&
|
|
messages[props.status].map((message, key) => (
|
|
<Flex key={ key } className="pf-u-align-items-baseline pf-m-nowrap">
|
|
<div>{message.icon}</div>
|
|
<small>{message.text}</small>
|
|
</Flex>
|
|
))
|
|
}
|
|
</React.Fragment>
|
|
);
|
|
};
|
|
|
|
ImageBuildStatus.propTypes = {
|
|
status: PropTypes.string,
|
|
};
|
|
|
|
export default ImageBuildStatus;
|