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 { Kebabified } from '../../../contexts/Kebabified';
import AdHocCommands from '../../../components/AdHocCommands/AdHocCommands'; import AdHocCommands from '../../../components/AdHocCommands/AdHocCommands';
import InventoryGroupHostListItem from './InventoryGroupHostListItem'; import InventoryGroupHostListItem from './InventoryGroupHostListItem';
import AddHostDropdown from '../shared/AddDropdown'; import AddDropdown from '../shared/AddDropdown';
const QS_CONFIG = getQSConfig('host', { const QS_CONFIG = getQSConfig('host', {
page: 1, page: 1,
@@ -185,7 +185,7 @@ function InventoryGroupHostList({ i18n }) {
); );
} }
// const addButton = <AddDropdown key="add" dropdownItems={addButtonOptions} />; const addButton = <AddDropdown key="add" dropdownItems={addButtonOptions} />;
return ( return (
<> <>
<PaginatedDataList <PaginatedDataList
@@ -229,18 +229,7 @@ function InventoryGroupHostList({ i18n }) {
} }
qsConfig={QS_CONFIG} qsConfig={QS_CONFIG}
additionalControls={[ additionalControls={[
...(canAdd ...(canAdd ? [addButton] : []),
? [
<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`)}
/>,
]
: []),
<Kebabified> <Kebabified>
{({ isKebabified }) => {({ isKebabified }) =>
isKebabified ? ( isKebabified ? (
@@ -299,18 +288,7 @@ function InventoryGroupHostList({ i18n }) {
onSelect={() => handleSelect(o)} onSelect={() => handleSelect(o)}
/> />
)} )}
emptyStateControls={ emptyStateControls={canAdd && addButton}
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`)}
/>
)
}
/> />
{isModalOpen && ( {isModalOpen && (
<AssociateModal <AssociateModal

View File

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