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-4.0.23 webpack/common/table/EmptyState.js
foreman_rh_cloud-3.0.22 webpack/common/table/EmptyState.js
foreman_rh_cloud-4.0.22 webpack/common/table/EmptyState.js
foreman_rh_cloud-4.0.21.1 webpack/common/table/EmptyState.js
foreman_rh_cloud-3.0.21.1 webpack/common/table/EmptyState.js
foreman_rh_cloud-3.0.21 webpack/common/table/EmptyState.js
foreman_rh_cloud-3.0.20 webpack/common/table/EmptyState.js
foreman_rh_cloud-3.0.19 webpack/InsightsCloudSync/Components/InsightsTable/components/EmptyState.js
foreman_rh_cloud-3.0.18.1 webpack/InsightsCloudSync/Components/InsightsTable/components/EmptyState.js
foreman_rh_cloud-3.0.18 webpack/InsightsCloudSync/Components/InsightsTable/components/EmptyState.js
foreman_rh_cloud-3.0.17 webpack/InsightsCloudSync/Components/InsightsTable/components/EmptyState.js
foreman_rh_cloud-3.0.16 webpack/InsightsCloudSync/Components/InsightsTable/components/EmptyState.js
foreman_rh_cloud-3.0.15 webpack/InsightsCloudSync/Components/InsightsTable/components/EmptyState.js