Sha256: 7dff73a5d0a3484e6bae2217a32ed088c1b26ae4d6add2a9cb96da145bb3bfcc

Contents?: true

Size: 1.96 KB

Versions: 9

Compression:

Stored size: 1.96 KB

Contents

import React from 'react';
import { ListView } from 'patternfly-react';
import { sprintf } from 'jed';

import PaginationRow from '../../components/PaginationRow/index';
import RepositorySet from './components/RepositorySet';
import EnabledRepository from './components/EnabledRepository';

export const getSetsComponent = (repoSetsState, onPaginationChange) => {
  const {
    results,
    searchIsActive,
    pagination,
    itemCount,
  } = repoSetsState;

  if (results.length === 0) {
    if (searchIsActive) {
      return <p>{__('No repository sets match your search criteria.')}</p>;
    }
    const noProductsMessage =
      sprintf(
        __('No Red Hat products currently exist, please import a manifest %(anchorBegin)s here %(anchorEnd)s to receive Red Hat content. No repository sets available.'),
        {
          anchorBegin: '<a href="/subscriptions/">',
          anchorEnd: '</a>',
        },
      );

    // eslint-disable-next-line react/no-danger
    return <p dangerouslySetInnerHTML={{ __html: noProductsMessage }} />;
  }
  return (
    <ListView>
      <PaginationRow
        viewType="list"
        itemCount={itemCount}
        pagination={pagination}
        onChange={onPaginationChange}
      />
      {results.map(set => <RepositorySet id={set.id} key={set.id} {...set} />)}
    </ListView>
  );
};

export const getEnabledComponent = (enabledReposState, onPaginationChange) => {
  const {
    repositories,
    searchIsActive,
    pagination,
    itemCount,
  } = enabledReposState;

  if (repositories.length === 0) {
    if (searchIsActive) {
      return <p>{__('No enabled repositories match your search criteria.')}</p>;
    }
    return <p>{__('No repositories enabled.')}</p>;
  }

  return (
    <ListView>
      <PaginationRow
        viewType="list"
        itemCount={itemCount}
        pagination={pagination}
        onChange={onPaginationChange}
      />
      {repositories.map(repo => <EnabledRepository key={repo.id} {...repo} />)}
    </ListView>
  );
};

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
katello-3.8.1 webpack/scenes/RedHatRepositories/helpers.js
katello-3.7.1.1 webpack/scenes/RedHatRepositories/helpers.js
katello-3.7.1 webpack/scenes/RedHatRepositories/helpers.js
katello-3.8.0 webpack/scenes/RedHatRepositories/helpers.js
katello-3.8.0.rc3 webpack/scenes/RedHatRepositories/helpers.js
katello-3.8.0.rc2 webpack/scenes/RedHatRepositories/helpers.js
katello-3.7.0 webpack/scenes/RedHatRepositories/helpers.js
katello-3.8.0.rc1 webpack/scenes/RedHatRepositories/helpers.js
katello-3.7.0.rc2 webpack/scenes/RedHatRepositories/helpers.js