Sha256: d8feb53329427f64ebb4b68228c3ce415471aaf0d4cffd03306fd02a8d3c6831

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

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

import { ExternalLinkSquareAltIcon } from '@patternfly/react-icons';
import { Button } from '@patternfly/react-core';

import { translate as __ } from 'foremanReact/common/I18n';
import { foremanUrl } from 'foremanReact/common/helpers';
import { useForemanHostsPageUrl } from 'foremanReact/Root/Context/ForemanContext';

const ViewSelectedHostsLink = ({
  hostIdsParam,
  isAllHostsSelected,
  defaultFailedHostsSearch,
}) => {
  const search = isAllHostsSelected ? defaultFailedHostsSearch : hostIdsParam;
  const url = foremanUrl(`${useForemanHostsPageUrl()}?search=${search}`);
  return (
    <Button
      component="a"
      variant="link"
      icon={<ExternalLinkSquareAltIcon />}
      iconPosition="right"
      target="_blank"
      href={url}
    >
      {__('View selected hosts')}
    </Button>
  );
};

ViewSelectedHostsLink.propTypes = {
  isAllHostsSelected: PropTypes.bool.isRequired,
  defaultFailedHostsSearch: PropTypes.string.isRequired,
  hostIdsParam: PropTypes.string.isRequired,
};

export default ViewSelectedHostsLink;

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foreman_openscap-9.0.1 webpack/components/OpenscapRemediationWizard/ViewSelectedHostsLink.js
foreman_openscap-9.0.0 webpack/components/OpenscapRemediationWizard/ViewSelectedHostsLink.js