-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs #36822 - Added the slot fill for hosts index
- Loading branch information
Showing
4 changed files
with
55 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
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'; | ||
|
||
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({})}`); | ||
} | ||
|
||
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const HOSTS_INDEX = 'HOSTS'; | ||
export default HOSTS_INDEX; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters