Sha256: da14cece1bf24876c17c980f6489eb19a038e49aba4ddb3f946de0a3ae04cbc2
Contents?: true
Size: 1.73 KB
Versions: 13
Compression:
Stored size: 1.73 KB
Contents
import React from 'react'; import PropTypes from 'prop-types'; import { EmptyState, EmptyStateIcon, Spinner, EmptyStateVariant, Title, } from '@patternfly/react-core'; import { ExclamationCircleIcon, CheckIcon } from '@patternfly/react-icons'; import { STATUS } from 'foremanReact/constants'; import { translate as __, sprintf } from 'foremanReact/common/I18n'; const TableEmptyState = ({ status, error, rowsLength }) => { switch (status) { case STATUS.PENDING: return ( <EmptyState variant={EmptyStateVariant.small}> <EmptyStateIcon variant="container" component={Spinner} /> <Title headingLevel="h2" size="lg"> {__('Loading')} </Title> </EmptyState> ); case STATUS.ERROR: return ( <EmptyState variant={EmptyStateVariant.small}> <EmptyStateIcon variant="container" component={ExclamationCircleIcon} /> <Title headingLevel="h2" size="lg"> {sprintf(__('The server returned the following error: %s'), error)} </Title> </EmptyState> ); case STATUS.RESOLVED: if (rowsLength > 0) return null; return ( <EmptyState variant={EmptyStateVariant.large}> <EmptyStateIcon variant="container" component={CheckIcon} /> <Title headingLevel="h2" size="lg"> {__('There are no recommendations for your hosts')} </Title> </EmptyState> ); default: return null; } }; TableEmptyState.propTypes = { status: PropTypes.string, error: PropTypes.string, rowsLength: PropTypes.number, }; TableEmptyState.defaultProps = { status: '', error: '', rowsLength: 0, }; export default TableEmptyState;
Version data entries
13 entries across 13 versions & 1 rubygems