Sha256: bdf7137867fff97cfe18f853d9aa79187d55c20073389067c0ecce6ae341e18b

Contents?: true

Size: 1.3 KB

Versions: 73

Compression:

Stored size: 1.3 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import {
  EmptyState,
  EmptyStateIcon,
  Spinner,
  EmptyStateVariant,
  Title,
} from '@patternfly/react-core';
import { ExclamationCircleIcon } from '@patternfly/react-icons';

import { STATUS } from 'foremanReact/constants';
import { translate as __, sprintf } from 'foremanReact/common/I18n';

const TableEmptyState = ({ status, error }) => {
  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>
      );
    default:
      return null;
  }
};

TableEmptyState.propTypes = {
  status: PropTypes.string,
  error: PropTypes.string,
};

TableEmptyState.defaultProps = {
  status: '',
  error: '',
};

export default TableEmptyState;

Version data entries

73 entries across 73 versions & 1 rubygems

Version Path
foreman_rh_cloud-5.0.43 webpack/common/table/EmptyState.js
foreman_rh_cloud-4.0.36 webpack/common/table/EmptyState.js
foreman_rh_cloud-3.0.33 webpack/common/table/EmptyState.js
foreman_rh_cloud-6.0.42.2 webpack/common/table/EmptyState.js
foreman_rh_cloud-6.0.42.1 webpack/common/table/EmptyState.js
foreman_rh_cloud-6.0.43 webpack/common/table/EmptyState.js
foreman_rh_cloud-5.0.42 webpack/common/table/EmptyState.js
foreman_rh_cloud-6.0.42 webpack/common/table/EmptyState.js
foreman_rh_cloud-5.0.41 webpack/common/table/EmptyState.js
foreman_rh_cloud-5.0.39 webpack/common/table/EmptyState.js
foreman_rh_cloud-5.0.38 webpack/common/table/EmptyState.js
foreman_rh_cloud-4.0.35 webpack/common/table/EmptyState.js
foreman_rh_cloud-5.0.37 webpack/common/table/EmptyState.js
foreman_rh_cloud-5.0.36 webpack/common/table/EmptyState.js
foreman_rh_cloud-5.0.35 webpack/common/table/EmptyState.js
foreman_rh_cloud-5.0.34 webpack/common/table/EmptyState.js
foreman_rh_cloud-5.0.33 webpack/common/table/EmptyState.js
foreman_rh_cloud-3.0.32 webpack/common/table/EmptyState.js
foreman_rh_cloud-4.0.32 webpack/common/table/EmptyState.js
foreman_rh_cloud-5.0.32 webpack/common/table/EmptyState.js