Sha256: f526fc9b617ed097a29ce28bb5337e3081f00893b3b3689d8d2ee8a32e7d0825

Contents?: true

Size: 1.35 KB

Versions: 5

Compression:

Stored size: 1.35 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';

import { ListView, LoadingState } from 'patternfly-react';
import PaginationWrapper from 'foremanReact/components/Pagination/PaginationWrapper';

import AnsibleRole from './AnsibleRole';

const AvailableRolesList = ({
  unassignedRoles,
  pagination,
  itemCount,
  onListingChange,
  onAddRole,
  loading,
}) => (
  <ListView>
    <div className="sticky-pagination">
      <PaginationWrapper
        viewType="list"
        itemCount={itemCount}
        pagination={pagination}
        onChange={onListingChange}
        dropdownButtonId="available-ansible-roles-pagination-row-dropdown"
      />
    </div>
    <LoadingState loading={loading}>
      {unassignedRoles.map((role, index) => (
        <AnsibleRole
          key={role.id}
          role={role}
          icon="fa fa-plus-circle"
          onClick={onAddRole}
          index={index}
        />
      ))}
    </LoadingState>
  </ListView>
);

AvailableRolesList.propTypes = {
  unassignedRoles: PropTypes.arrayOf(PropTypes.object).isRequired,
  pagination: PropTypes.shape({
    page: PropTypes.number,
    perPage: PropTypes.number,
  }).isRequired,
  itemCount: PropTypes.number.isRequired,
  onListingChange: PropTypes.func.isRequired,
  onAddRole: PropTypes.func.isRequired,
  loading: PropTypes.bool.isRequired,
};

export default AvailableRolesList;

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman_ansible-7.0.4 webpack/components/AnsibleRolesSwitcher/components/AvailableRolesList.js
foreman_ansible-7.0.3 webpack/components/AnsibleRolesSwitcher/components/AvailableRolesList.js
foreman_ansible-7.0.2 webpack/components/AnsibleRolesSwitcher/components/AvailableRolesList.js
foreman_ansible-7.0.1 webpack/components/AnsibleRolesSwitcher/components/AvailableRolesList.js
foreman_ansible-7.0.0 webpack/components/AnsibleRolesSwitcher/components/AvailableRolesList.js