diff --git a/webpack/assets/javascripts/react_app/components/PF4/TableIndexPage/ActionButtons.js b/webpack/assets/javascripts/react_app/components/PF4/TableIndexPage/ActionButtons.js
index c285d27d042c..3c999f02feab 100644
--- a/webpack/assets/javascripts/react_app/components/PF4/TableIndexPage/ActionButtons.js
+++ b/webpack/assets/javascripts/react_app/components/PF4/TableIndexPage/ActionButtons.js
@@ -44,6 +44,7 @@ export const ActionButtons = ({ buttons: originalButtons }) => {
key={button.title}
title={button.title}
{...button.action}
+ isDisabled = {button.isDisabled}
>
{button.icon} {button.title}
diff --git a/webpack/assets/javascripts/react_app/components/PF4/TableIndexPage/TableIndexPage.js b/webpack/assets/javascripts/react_app/components/PF4/TableIndexPage/TableIndexPage.js
index f559a45f0414..afe516e397c3 100644
--- a/webpack/assets/javascripts/react_app/components/PF4/TableIndexPage/TableIndexPage.js
+++ b/webpack/assets/javascripts/react_app/components/PF4/TableIndexPage/TableIndexPage.js
@@ -128,7 +128,7 @@ const TableIndexPage = ({
results,
metadata: {},
});
-console.log({selectAllOptions});
+
const {
selectAll,
selectPage,
@@ -166,6 +166,21 @@ console.log({selectAllOptions});
}
};
+ const additionalActionButtons = customActionButtons.map((customButton) => {
+ const responseButton = {...customButton}
+
+ if (selectedCount === 0) {
+ responseButton.isDisabled = true
+ }
+
+ if (displaySelectAllCheckbox && responseButton.action?.onClick && selectedCount > 0) {
+ responseButton.action.onClick = () => responseButton.action.onClick(fetchBulkParams());
+ }
+ return responseButton;
+ });
+
+
+
const actionButtons = [
creatable &&
canCreate && {
@@ -183,7 +198,7 @@ console.log({selectAllOptions});
icon: ,
action: { href: customHelpURL || helpURL() },
},
- ...customActionButtons,
+ ...additionalActionButtons,
].filter(item => item);
return (
@@ -326,7 +341,7 @@ TableIndexPage.propTypes = {
isDeleteable: PropTypes.bool,
searchable: PropTypes.bool,
children: PropTypes.node,
- displaySelectAllCheckbox: PropTypes.bool,
+ displaySelectAllCheckbox: PropTypes.bool
};
TableIndexPage.defaultProps = {
diff --git a/webpack/assets/javascripts/react_app/routes/Hosts/HostsPage/index.js b/webpack/assets/javascripts/react_app/routes/Hosts/HostsPage/index.js
index d0018279366a..c81a32e3454d 100644
--- a/webpack/assets/javascripts/react_app/routes/Hosts/HostsPage/index.js
+++ b/webpack/assets/javascripts/react_app/routes/Hosts/HostsPage/index.js
@@ -1,11 +1,20 @@
import React from 'react';
+import { useDispatch } from 'react-redux';
+import { QuestionCircleIcon } from '@patternfly/react-icons';
+import {
+ Split, SplitItem, ActionList, ActionListItem, Dropdown,
+ DropdownItem, KebabToggle, Skeleton, Tooltip, ToggleGroup,
+ DropdownToggle, DropdownToggleAction,
+} from '@patternfly/react-core';
import { translate as __ } from '../../../common/I18n';
import TableIndexPage from '../../../components/PF4/TableIndexPage/TableIndexPage';
+
import { HOSTS_API_PATH, API_REQUEST_KEY } from '../constants';
const HostsPage = () => {
+ const dispatch = useDispatch();
const columns = {
name: {
title: __('Name'),
@@ -18,6 +27,65 @@ const HostsPage = () => {
isSorted: true,
},
};
+
+
+ const changeContentSource = (search) => {
+ dispatch ({
+ type: 'API_GET',
+ payload: {
+ key: "HOSTS_CHANGE_CONTENT_SOURCE",
+ url: `/change_host_content_source?search=${search}`,
+ },
+ });
+ }
+
+ const dropdownItems = [
+
+ {__('Change Content Source')}
+ ,
+ ];
+
+ const customActionButtons = [{
+ title: __('Change Content Source'),
+ icon: ,
+ action: { onClick: changeContentSource },
+ }]
+
+
+ // const customActionButtons = (
+ //
+ //
+ //
+ // // {__('Change Content Source')}
+ // // ,
+ // // ]}
+ // // splitButtonVariant="action"
+ // // toggleVariant="primary"
+ // // // onToggle={onActionToggle}
+ // // />
+ // //}
+ // // isOpen={isActionOpen}
+ // dropdownItems={dropdownItems}
+ // />
+ //
+ //
+ // );
+
return (
{
columns={columns}
areAllRowsOnPageSelected = { () => false }
displaySelectAllCheckbox = { true }
+ customActionButtons = {customActionButtons}
/>
);
};