Sha256: c92fc8f3ebf67f722867be3dbd6c8adbe4d5ef992911529e2bdf2bca3dfcde4d

Contents?: true

Size: 1.21 KB

Versions: 11

Compression:

Stored size: 1.21 KB

Contents

import React from 'react';
import PropTypes from 'prop-types';
import { translate as __ } from 'foremanReact/common/I18n';

import { useQuery } from '@apollo/client';

import HostgroupsTable from './HostgroupsTable';

import hostgroups from '../../../graphql/queries/hostgroups.gql';
import {
  useParamsToVars,
  useCurrentPagination,
} from '../../../helpers/pageParamsHelper';

const HostgroupsTab = props => {
  const useFetchFn = componentProps =>
    useQuery(hostgroups, {
      variables: {
        search: `oval_policy_id = ${componentProps.match.params.id}`,
        ...useParamsToVars(componentProps.history),
      },
    });

  const renameData = data => ({
    hostgroups: data.hostgroups.nodes,
    totalCount: data.hostgroups.totalCount,
  });

  const pagination = useCurrentPagination(props.history);

  return (
    <HostgroupsTable
      {...props}
      fetchFn={useFetchFn}
      renameData={renameData}
      resultPath="hostgroups.nodes"
      pagination={pagination}
      emptyStateTitle={__('No Hostgroups found.')}
      permissions={['view_hostgroups']}
    />
  );
};

HostgroupsTab.propTypes = {
  match: PropTypes.object.isRequired,
  history: PropTypes.object.isRequired,
};

export default HostgroupsTab;

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
foreman_openscap-8.0.0 webpack/routes/OvalPolicies/OvalPoliciesShow/HostgroupsTab.js
foreman_openscap-7.1.1 webpack/routes/OvalPolicies/OvalPoliciesShow/HostgroupsTab.js
foreman_openscap-7.1.0 webpack/routes/OvalPolicies/OvalPoliciesShow/HostgroupsTab.js
foreman_openscap-7.0.0 webpack/routes/OvalPolicies/OvalPoliciesShow/HostgroupsTab.js
foreman_openscap-6.0.0 webpack/routes/OvalPolicies/OvalPoliciesShow/HostgroupsTab.js
foreman_openscap-5.2.3 webpack/routes/OvalPolicies/OvalPoliciesShow/HostgroupsTab.js
foreman_openscap-5.2.2 webpack/routes/OvalPolicies/OvalPoliciesShow/HostgroupsTab.js
foreman_openscap-5.1.1 webpack/routes/OvalPolicies/OvalPoliciesShow/HostgroupsTab.js
foreman_openscap-5.2.1 webpack/routes/OvalPolicies/OvalPoliciesShow/HostgroupsTab.js
foreman_openscap-5.2.0 webpack/routes/OvalPolicies/OvalPoliciesShow/HostgroupsTab.js
foreman_openscap-5.1.0 webpack/routes/OvalPolicies/OvalPoliciesShow/HostgroupsTab.js