Skip to content

Commit

Permalink
Refs #36822 - Added the slot fill for hosts index
Browse files Browse the repository at this point in the history
  • Loading branch information
parthaa committed Oct 18, 2023
1 parent 06cf003 commit 264246d
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
26 changes: 26 additions & 0 deletions webpack/components/extensions/Hosts/ActionsBar/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React, { useContext } from 'react';
import { DropdownItem } from '@patternfly/react-core';
import { CubeIcon } from '@patternfly/react-icons';
import { translate as __ } from 'foremanReact/common/I18n';
import { foremanUrl } from 'foremanReact/common/helpers';
import { ForemanHostsIndexActionsBarContext } from 'foremanReact/components/HostsIndex';

Check failure on line 6 in webpack/components/extensions/Hosts/ActionsBar/index.js

View workflow job for this annotation

GitHub Actions / build

Expected 1 empty line after import statement not followed by another import
const HostActionsBar = () => {
const { fetchBulkParams, selectedCount } = useContext(ForemanHostsIndexActionsBarContext);
const href = selectedCount > 0 ? foremanUrl(`/change_host_content_source?search=${fetchBulkParams()}`): '';

Check failure on line 9 in webpack/components/extensions/Hosts/ActionsBar/index.js

View workflow job for this annotation

GitHub Actions / build

Multiple spaces found before '?'

Check failure on line 9 in webpack/components/extensions/Hosts/ActionsBar/index.js

View workflow job for this annotation

GitHub Actions / build

Operator ':' must be spaced
const title = __('Change content source');
return (
<>
<DropdownItem
ouiaId="change-content-s-dropdown-item"
key="change-content-source-dropdown-item"
title={title}
href={href}
isDisabled={selectedCount === 0}
>
<CubeIcon /> {title}
</DropdownItem>
</>
);
};

export default HostActionsBar;
8 changes: 8 additions & 0 deletions webpack/components/extensions/Hosts/HostsSelectors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {
selectAPIResponse,
} from 'foremanReact/redux/API/APISelectors';
import { STATUS } from 'foremanReact/constants';

Check failure on line 4 in webpack/components/extensions/Hosts/HostsSelectors.js

View workflow job for this annotation

GitHub Actions / build

'STATUS' is defined but never used
import HOSTS_KEY from './constants';

export const selectHosts = state =>

Check failure on line 7 in webpack/components/extensions/Hosts/HostsSelectors.js

View workflow job for this annotation

GitHub Actions / build

Prefer default export on a file with single export
selectAPIResponse(state, HOSTS_KEY) ?? {};
2 changes: 2 additions & 0 deletions webpack/components/extensions/Hosts/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const HOSTS_INDEX = 'HOSTS';
export default HOSTS_INDEX;
13 changes: 11 additions & 2 deletions webpack/global_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import {
SystemPropertiesCardVirtualization,
SystemPropertiesCardTracer,
} from './components/extensions/HostDetails/DetailsTabCards/SystemPropertiesCardExtensions';
import HostActionsBar from './components/extensions/HostDetails/ActionsBar';
import HostDetailsActionsBar from './components/extensions/HostDetails/ActionsBar';
import HostsIndexActionsBar from './components/extensions/Hosts/ActionsBar';
import RecentCommunicationCardExtensions from './components/extensions/HostDetails/DetailsTabCards/RecentCommunicationCardExtensions';
import SystemPurposeCard from './components/extensions/HostDetails/Cards/SystemPurposeCard/SystemPurposeCard';

Expand Down Expand Up @@ -67,7 +68,15 @@ addGlobalFill('host-details-tab-properties-3', 'Virtualization', <SystemProperti
addGlobalFill(
'host-details-kebab',
'katello-host-details-kebab',
<HostActionsBar key="katello-host-details-kebab" />,
<HostDetailsActionsBar key="katello-host-details-kebab" />,
100,
);

addGlobalFill(
'hosts-index-kebab',
'katello-hosts-index-kebab',
<HostsIndexActionsBar key="katello-hosts-index-kebab" />,
100,
);

addGlobalFill('host-tab-details-cards', 'HW properties', <HwPropertiesCard key="hw-properties" />, 200);

0 comments on commit 264246d

Please sign in to comment.