import React from 'react';
import { ListView } from 'patternfly-react';
import PaginationWrapper from 'foremanReact/components/Pagination/PaginationWrapper';
import { isEmpty } from 'lodash';
import PropTypes from 'prop-types';
import AnsibleRole from './AnsibleRole';
const AssignedRolesList = ({
assignedRoles,
allAssignedRoles,
pagination,
itemCount,
onPaginationChange,
onRemoveRole,
resourceName,
}) => {
const directlyAssignedRoles = allAssignedRoles.filter(
role => !role.inherited
);
return (
{assignedRoles.map(role => (
))}
{isEmpty(directlyAssignedRoles) ? (
) : (
directlyAssignedRoles.map(role => (
))
)}
);
};
AssignedRolesList.propTypes = {
assignedRoles: PropTypes.arrayOf(PropTypes.object).isRequired,
allAssignedRoles: PropTypes.arrayOf(PropTypes.object).isRequired,
pagination: PropTypes.shape({
page: PropTypes.number,
perPage: PropTypes.number,
}).isRequired,
itemCount: PropTypes.number.isRequired,
onPaginationChange: PropTypes.func.isRequired,
onRemoveRole: PropTypes.func.isRequired,
resourceName: PropTypes.string.isRequired,
};
export default AssignedRolesList;