Sha256: 15429fba7e9d55b5fdc28beb7103661e91975bbe78df25684036552b526787d9
Contents?: true
Size: 1.71 KB
Versions: 2
Compression:
Stored size: 1.71 KB
Contents
import React from 'react'; import PropTypes from 'prop-types'; import { translate as __ } from 'foremanReact/common/I18n'; import { useQuery } from '@apollo/client'; import variableOverrides from '../../../../graphql/queries/hostVariableOverrides.gql'; import AnsibleVariableOverridesTable from './AnsibleVariableOverridesTable'; import { useParamsToVars, useCurrentPagination, } from '../../../../helpers/pageParamsHelper'; import { encodeId } from '../../../../globalIdHelper'; import './AnsibleVariableOverrides.scss'; const AnsibleVariableOverrides = ({ hostId, hostAttrs, history }) => { const hostGlobalId = encodeId('Host', hostId); const pagination = useCurrentPagination(history); const useFetchFn = () => useQuery(variableOverrides, { variables: { id: hostGlobalId, match: `fqdn=${hostAttrs.name}`, ...useParamsToVars(history), }, fetchPolicy: 'network-only', nextFetchPolicy: 'cache-first', }); const renameData = data => ({ variables: data.host.ansibleVariablesWithOverrides.nodes, totalCount: data.host.ansibleVariablesWithOverrides.totalCount, }); return ( <AnsibleVariableOverridesTable hostId={hostId} hostAttrs={hostAttrs} hostGlobalId={hostGlobalId} renameData={renameData} fetchFn={useFetchFn} renamedDataPath="variables" emptyStateTitle={__('No Ansible Variables found for Host')} permissions={['view_ansible_variables']} pagination={pagination} history={history} /> ); }; AnsibleVariableOverrides.propTypes = { hostId: PropTypes.number.isRequired, hostAttrs: PropTypes.object.isRequired, history: PropTypes.object.isRequired, }; export default AnsibleVariableOverrides;
Version data entries
2 entries across 2 versions & 1 rubygems