Sha256: d1f86aea9bf2798216091b6b9c3746f2814d3e5ed208b0f3812235d7cfdd7739

Contents?: true

Size: 1.07 KB

Versions: 9

Compression:

Stored size: 1.07 KB

Contents

import React, { useContext } from 'react';
import { DropdownItem } from '@patternfly/react-core';
import { translate as __ } from 'foremanReact/common/I18n';
import { foremanUrl } from 'foremanReact/common/helpers';
import { ForemanHostsIndexActionsBarContext } from 'foremanReact/components/HostsIndex';

const HostActionsBar = () => {
  const {
    fetchBulkParams,
    selectedCount,
    selectAllMode,
  } = useContext(ForemanHostsIndexActionsBarContext);

  let href = '';
  if (selectAllMode) {
    const query = fetchBulkParams({ selectAllQuery: 'created_at < "1 second ago"' });
    href = foremanUrl(`/change_host_content_source?search=${query}`);
  } else if (selectedCount > 0) {
    href = foremanUrl(`/change_host_content_source?search=${fetchBulkParams()}`);
  }

  return (
    <>
      <DropdownItem
        ouiaId="change-content-s-dropdown-item"
        key="change-content-source-dropdown-item"
        href={href}
        isDisabled={selectedCount === 0}
      >
        {__('Change content source')}
      </DropdownItem>
    </>
  );
};

export default HostActionsBar;

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
katello-4.12.1 webpack/components/extensions/Hosts/ActionsBar/index.js
katello-4.12.0 webpack/components/extensions/Hosts/ActionsBar/index.js
katello-4.12.0.rc3 webpack/components/extensions/Hosts/ActionsBar/index.js
katello-4.12.0.rc2 webpack/components/extensions/Hosts/ActionsBar/index.js
katello-4.12.0.rc1 webpack/components/extensions/Hosts/ActionsBar/index.js
katello-4.11.1 webpack/components/extensions/Hosts/ActionsBar/index.js
katello-4.11.0 webpack/components/extensions/Hosts/ActionsBar/index.js
katello-4.11.0.rc2 webpack/components/extensions/Hosts/ActionsBar/index.js
katello-4.11.0.rc1 webpack/components/extensions/Hosts/ActionsBar/index.js