Skip to content

Commit

Permalink
feat(THEEDGE-3758): show both tabs when adding systems to group
Browse files Browse the repository at this point in the history
Show both tabs when adding systems to group, when adding conventional systems, conventional tab should be selected by default and when adding immutable systems, immutable tab should be selected by default.
FIXES: https://issues.redhat.com/browse/THEEDGE-3758
  • Loading branch information
ldjebran committed Dec 14, 2023
1 parent aff72b5 commit 8add871
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/components/GroupSystems/GroupImmutableSystems.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
} from '../../Utilities/edge';
import { edgeColumns } from '../ImmutableDevices/columns';
import { mergeArraysByKey } from '@redhat-cloud-services/frontend-components-utilities/helpers';
import { hybridInventoryTabKeys } from '../../Utilities/constants';
export const prepareColumns = (
initialColumns,
hideGroupColumn,
Expand Down Expand Up @@ -212,6 +213,8 @@ const GroupImmutableSystems = ({ groupName, groupId, ...props }) => {
}}
groupId={groupId}
groupName={groupName}
edgeParityIsAllowed={true}
activeTab={hybridInventoryTabKeys.immutable.key}
/>
)}
{removeHostsFromGroupModalOpen && (
Expand Down
3 changes: 3 additions & 0 deletions src/components/GroupSystems/GroupSystems.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { useBulkSelectConfig } from '../../Utilities/hooks/useBulkSelectConfig';
import difference from 'lodash/difference';
import map from 'lodash/map';
import useGlobalFilter from '../filters/useGlobalFilter';
import { hybridInventoryTabKeys } from '../../Utilities/constants';

export const prepareColumns = (
initialColumns,
Expand Down Expand Up @@ -126,6 +127,8 @@ const GroupSystems = ({ groupName, groupId }) => {
}}
groupId={groupId}
groupName={groupName}
edgeParityIsAllowed={true}
activeTab={hybridInventoryTabKeys.conventional.key}
/>
)}
{removeHostsFromGroupModalOpen && (
Expand Down
19 changes: 13 additions & 6 deletions src/components/InventoryGroups/Modals/AddSystemsToGroupModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ import useFeatureFlag from '../../../Utilities/useFeatureFlag';
import { PageHeaderTitle } from '@redhat-cloud-services/frontend-components/PageHeader';
import { InfoCircleIcon } from '@patternfly/react-icons';
import { AccountStatContext } from '../../../Routes';
import { hybridInventoryTabKeys } from '../../../Utilities/constants';

const AddSystemsToGroupModal = ({
isModalOpen,
setIsModalOpen,
groupId,
groupName,
edgeParityIsAllowed,
activeTab,
}) => {
const dispatch = useDispatch();

Expand Down Expand Up @@ -135,10 +137,14 @@ const AddSystemsToGroupModal = ({
alreadyHasGroup.length > 0 || immutableDevicesAlreadyHasGroup.length > 0;

const { hasEdgeDevices } = useContext(AccountStatContext);
const [activeTab, setActiveTab] = useState(0);
const [activeTabKey, setActiveTabKey] = useState(
hybridInventoryTabKeys[activeTab] === undefined
? hybridInventoryTabKeys.conventional.key
: activeTab
);

const handleTabClick = (_event, tabIndex) => {
setActiveTab(tabIndex);
const handleTabClick = (_event, tabKey) => {
setActiveTabKey(tabKey);
};

let overallSelectedText;
Expand Down Expand Up @@ -248,18 +254,18 @@ const AddSystemsToGroupModal = ({
{edgeParityEnabled && hasEdgeDevices ? (
<Tabs
className="pf-m-light pf-c-table"
activeKey={activeTab}
activeKey={activeTabKey}
onSelect={handleTabClick}
aria-label="Hybrid inventory tabs"
>
<Tab
eventKey={0}
eventKey={hybridInventoryTabKeys.conventional.key}
title={<TabTitleText>Conventional (RPM-DNF)</TabTitleText>}
>
{ConventionalInventoryTable}
</Tab>
<Tab
eventKey={1}
eventKey={hybridInventoryTabKeys.immutable.key}
title={<TabTitleText>Immutable (OSTree)</TabTitleText>}
>
<section className={'pf-c-toolbar'}>
Expand Down Expand Up @@ -288,6 +294,7 @@ AddSystemsToGroupModal.propTypes = {
groupId: PropTypes.string,
groupName: PropTypes.string,
edgeParityIsAllowed: PropTypes.bool,
activeTab: PropTypes.string,
};

export default AddSystemsToGroupModal;

0 comments on commit 8add871

Please sign in to comment.