Sha256: 715b096e53bc01e26b58e3293b5c960617295e3fc8554900e5664fd9a5637fd0

Contents?: true

Size: 1.56 KB

Versions: 49

Compression:

Stored size: 1.56 KB

Contents

import React from 'react';
import { EmptyState,
  EmptyStateBody,
  EmptyStateIcon,
  EmptyStateVariant,
  Bullseye,
  Title } from '@patternfly/react-core';
import PropTypes from 'prop-types';
import { CubeIcon, ExclamationCircleIcon, SearchIcon } from '@patternfly/react-icons';
import { global_danger_color_200 as dangerColor } from '@patternfly/react-tokens';

const KatelloEmptyStateIcon = ({ error, search }) => {
  if (error) return <EmptyStateIcon icon={ExclamationCircleIcon} color={dangerColor.value} />;
  if (search) return <EmptyStateIcon icon={SearchIcon} />;
  return <EmptyStateIcon icon={CubeIcon} />;
};

const EmptyStateMessage = ({
  title, body, error, search,
}) => (
  <Bullseye>
    <EmptyState variant={EmptyStateVariant.small}>
      <KatelloEmptyStateIcon error={!!error} search={search} />
      <Title headingLevel="h2" size="lg">
        {title}
      </Title>
      <EmptyStateBody>
        {body}
      </EmptyStateBody>
    </EmptyState>
  </Bullseye>
);

KatelloEmptyStateIcon.propTypes = {
  error: PropTypes.bool,
  search: PropTypes.bool,
};

KatelloEmptyStateIcon.defaultProps = {
  error: false,
  search: false,
};

EmptyStateMessage.propTypes = {
  title: PropTypes.string,
  body: PropTypes.string,
  error: PropTypes.oneOfType([
    PropTypes.shape({}),
    PropTypes.string,
  ]),
  search: PropTypes.bool,
};

EmptyStateMessage.defaultProps = {
  title: 'Unable to connect',
  body: 'There was an error retrieving data from the server. Check your connection and try again.',
  error: undefined,
  search: false,
};

export default EmptyStateMessage;

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
katello-4.2.2 webpack/components/Table/EmptyStateMessage.js
katello-4.2.1 webpack/components/Table/EmptyStateMessage.js
katello-4.2.0.1 webpack/components/Table/EmptyStateMessage.js
katello-4.1.4 webpack/components/Table/EmptyStateMessage.js
katello-4.0.3 webpack/components/Table/EmptyStateMessage.js
katello-4.2.0.1.rc3 webpack/components/Table/EmptyStateMessage.js
katello-3.18.5 webpack/components/Table/EmptyStateMessage.js
katello-4.2.0.1.rc2 webpack/components/Table/EmptyStateMessage.js
katello-4.2.0.rc2 webpack/components/Table/EmptyStateMessage.js
katello-4.1.3 webpack/components/Table/EmptyStateMessage.js
katello-4.2.0.rc1 webpack/components/Table/EmptyStateMessage.js
katello-4.0.2.1 webpack/components/Table/EmptyStateMessage.js
katello-4.1.2.1 webpack/components/Table/EmptyStateMessage.js
katello-4.0.2 webpack/components/Table/EmptyStateMessage.js
katello-4.1.2 webpack/components/Table/EmptyStateMessage.js
katello-3.18.4 webpack/components/Table/EmptyStateMessage.js
katello-4.1.1 webpack/components/Table/EmptyStateMessage.js
katello-4.1.0 webpack/components/Table/EmptyStateMessage.js
katello-4.0.1.2 webpack/components/Table/EmptyStateMessage.js
katello-3.18.3.1 webpack/components/Table/EmptyStateMessage.js