brings all lists in line with exsiting Ad Hoc workflow

This commit is contained in:
Alex Corey 2020-10-08 12:24:25 -04:00
parent b919d4885c
commit ef85a321bc
2 changed files with 9 additions and 31 deletions

View File

@ -25,7 +25,7 @@ import DisassociateButton from '../../../components/DisassociateButton';
import { Kebabified } from '../../../contexts/Kebabified';
import AdHocCommands from '../../../components/AdHocCommands/AdHocCommands';
import InventoryGroupHostListItem from './InventoryGroupHostListItem';
import AddHostDropdown from '../shared/AddDropdown';
import AddDropdown from '../shared/AddDropdown';
const QS_CONFIG = getQSConfig('host', {
page: 1,
@ -185,7 +185,7 @@ function InventoryGroupHostList({ i18n }) {
);
}
// const addButton = <AddDropdown key="add" dropdownItems={addButtonOptions} />;
const addButton = <AddDropdown key="add" dropdownItems={addButtonOptions} />;
return (
<>
<PaginatedDataList
@ -229,18 +229,7 @@ function InventoryGroupHostList({ i18n }) {
}
qsConfig={QS_CONFIG}
additionalControls={[
...(canAdd
? [
<AddHostDropdown
key="associate"
onAddExisting={() => setIsModalOpen(true)}
onAddNew={() => history.push(addFormUrl)}
newTitle={i18n._(t`Add new host`)}
existingTitle={i18n._(t`Add existing host`)}
label={i18n._(t`host`)}
/>,
]
: []),
...(canAdd ? [addButton] : []),
<Kebabified>
{({ isKebabified }) =>
isKebabified ? (
@ -299,18 +288,7 @@ function InventoryGroupHostList({ i18n }) {
onSelect={() => handleSelect(o)}
/>
)}
emptyStateControls={
canAdd && (
<AddHostDropdown
key="associate"
onAddExisting={() => setIsModalOpen(true)}
onAddNew={() => history.push(addFormUrl)}
newTitle={i18n._(t`Add new host`)}
existingTitle={i18n._(t`Add existing host`)}
label={i18n._(t`host`)}
/>
)
}
emptyStateControls={canAdd && addButton}
/>
{isModalOpen && (
<AssociateModal

View File

@ -19,7 +19,7 @@ import PaginatedDataList from '../../../components/PaginatedDataList';
import InventoryGroupRelatedGroupListItem from './InventoryRelatedGroupListItem';
import AddDropdown from '../shared/AddDropdown';
import { Kebabified } from '../../../contexts/Kebabified';
import AdHocCommandsButton from '../../../components/AdHocCommands/AdHocCommands';
import AdHocCommands from '../../../components/AdHocCommands/AdHocCommands';
import AssociateModal from '../../../components/AssociateModal';
import DisassociateButton from '../../../components/DisassociateButton';
@ -160,7 +160,7 @@ function InventoryRelatedGroupList({ i18n }) {
<Kebabified>
{({ isKebabified }) =>
isKebabified ? (
<AdHocCommandsButton
<AdHocCommands
adHocItems={selected}
apiModule={InventoriesAPI}
itemId={parseInt(inventoryId, 10)}
@ -174,7 +174,7 @@ function InventoryRelatedGroupList({ i18n }) {
{i18n._(t`Run command`)}
</DropdownItem>
)}
</AdHocCommandsButton>
</AdHocCommands>
) : (
<ToolbarItem>
<Tooltip
@ -185,7 +185,7 @@ function InventoryRelatedGroupList({ i18n }) {
position="top"
key="adhoc"
>
<AdHocCommandsButton
<AdHocCommands
css="margin-right: 20px"
adHocItems={selected}
apiModule={InventoriesAPI}
@ -201,7 +201,7 @@ function InventoryRelatedGroupList({ i18n }) {
{i18n._(t`Run command`)}
</Button>
)}
</AdHocCommandsButton>
</AdHocCommands>
</Tooltip>
</ToolbarItem>
)