generated from RedHatInsights/frontend-starter-app
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(OCPADVISOR-88): Hide upgrade risks for managed clusters (#560)
* Hide upgrade risks for managed clusters * Assume that all clusters are managed while fetching info * Create hook for upgrade risks enable/disable; improve tests * Add extra tests for active_tab
- Loading branch information
Showing
9 changed files
with
133 additions
and
27 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
...api/insights-results-aggregator/v2/cluster/dcb95bbf-8673-4f3a-a63c-12d4a530aa6f/info.json
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,9 @@ | ||
{ | ||
"cluster": { | ||
"cluster_id": "dcb95bbf-8673-4f3a-a63c-12d4a530aa6f", | ||
"display_name": "Cluster With Issues", | ||
"managed": false, | ||
"status": "Stale" | ||
}, | ||
"status": "ok" | ||
} |
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
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
16 changes: 16 additions & 0 deletions
16
src/Components/UpgradeRisksTable/useUpgradeRisksFeature.js
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,16 @@ | ||
import get from 'lodash/get'; | ||
import { useParams } from 'react-router-dom'; | ||
|
||
import { useUpgradeRisksFeatureFlag } from '../../Utilities/useFeatureFlag'; | ||
import { useGetClusterInfoState } from '../../Services/SmartProxy'; | ||
|
||
const useUpgradeRisksFeature = (clusterId) => { | ||
const upgradeRisksEnabled = useUpgradeRisksFeatureFlag(); | ||
const id = clusterId || useParams().clusterId; | ||
const clusterInfo = useGetClusterInfoState({ id }); // doesn't request new data, uses cache | ||
const isManaged = get(clusterInfo, 'data.managed', true); | ||
|
||
return upgradeRisksEnabled && !isManaged; | ||
}; | ||
|
||
export default useUpgradeRisksFeature; |
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