-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(InventoryGroupDetails): THEEDGE-3707 implement edge group details…
… expostion
- Loading branch information
Showing
5 changed files
with
92 additions
and
6 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react'; | ||
import AsyncComponent from '@redhat-cloud-services/frontend-components/AsyncComponent'; | ||
import ErrorState from '@redhat-cloud-services/frontend-components/ErrorState'; | ||
import { resolveRelPath } from '../../Utilities/path'; | ||
import { getNotificationProp } from '../../Utilities/edge'; | ||
import { useLocation, useNavigate, useParams } from 'react-router-dom'; | ||
import { useDispatch } from 'react-redux'; | ||
|
||
const EdgeGroupsDetailsView = (props) => { | ||
const dispatch = useDispatch(); | ||
const notificationProp = getNotificationProp(dispatch); | ||
return ( | ||
<AsyncComponent | ||
appName="edge" | ||
module="./GroupsDetails" | ||
ErrorComponent={<ErrorState />} | ||
navigateProp={useNavigate} | ||
locationProp={useLocation} | ||
paramsProp={useParams} | ||
notificationProp={notificationProp} | ||
pathPrefix={resolveRelPath('')} | ||
{...props} | ||
/> | ||
); | ||
}; | ||
|
||
export default EdgeGroupsDetailsView; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import { inventoryHasConventionalSystems } from '../Utilities/conventional'; | ||
import { inventoryHasEdgeSystems } from '../Utilities/edge'; | ||
import useEdgeGroups from '../Utilities/hooks/useEdgeGroups'; | ||
import useFeatureFlag from '../Utilities/useFeatureFlag'; | ||
import PropTypes from 'prop-types'; | ||
import { Spinner } from '@patternfly/react-core'; | ||
import EdgeGroupsDetailsView from '../components/InventoryGroupDetail/EdgeGroupDetails'; | ||
import InventoryGroupDetail from './InventoryGroupDetail'; | ||
|
||
const InventoryOrEdgeGroupDetailsView = () => { | ||
const [enforceEdgeGroups, isLoading] = useEdgeGroups(); | ||
const [hasConventionalSystems, setHasConventionalSystems] = useState(true); | ||
const [hasEdgeDevices, setHasEdgeDevices] = useState(true); | ||
const edgeParityInventoryListEnabled = useFeatureFlag( | ||
'edgeParity.inventory-list' | ||
); | ||
|
||
useEffect(() => { | ||
try { | ||
(async () => { | ||
const hasConventionalSystems = await inventoryHasConventionalSystems(); | ||
if (edgeParityInventoryListEnabled) { | ||
const hasEdgeSystems = await inventoryHasEdgeSystems(); | ||
setHasConventionalSystems(hasConventionalSystems); | ||
setHasEdgeDevices(hasEdgeSystems); | ||
} | ||
})(); | ||
} catch (e) { | ||
console.log(e); | ||
} | ||
}, []); | ||
|
||
const GroupsDetailComponents = enforceEdgeGroups | ||
? EdgeGroupsDetailsView | ||
: InventoryGroupDetail; | ||
if (!isLoading) { | ||
return ( | ||
<GroupsDetailComponents | ||
hasConventionalSystems={hasConventionalSystems} | ||
hasEdgeDevices={hasEdgeDevices} | ||
/> | ||
); | ||
} else { | ||
return <Spinner />; | ||
} | ||
}; | ||
|
||
InventoryOrEdgeGroupDetailsView.prototype = { | ||
enforceEdgeGroups: PropTypes.bool, | ||
isLoading: PropTypes.bool, | ||
}; | ||
|
||
export default InventoryOrEdgeGroupDetailsView; |