Skip to content

Commit 411790c

Browse files
Fix control plane type calculation for details page (stolostron#4046)
Signed-off-by: Kevin Cormier <kcormier@redhat.com>
1 parent 0ac4311 commit 411790c

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

frontend/src/routes/Infrastructure/Clusters/ManagedClusters/ClusterDetails/ClusterOverview/ClusterOverview.tsx

+2-18
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import TemplateSummaryModal from '../../../../../../components/TemplateSummaryMo
5252
import { CredentialsForm } from '../../../../../Credentials/CredentialsForm'
5353
import { useProjects } from '../../../../../../hooks/useProjects'
5454
import { ClusterAction, clusterSupportsAction } from '../../utils/cluster-actions'
55+
import { getControlPlaneString } from '../../ManagedClusters'
5556

5657
function getAIClusterProperties(
5758
clusterDeployment: ClusterDeployment,
@@ -80,23 +81,6 @@ export function ClusterOverviewPageContent() {
8081
const [curatorSummaryModalIsOpen, setCuratorSummaryModalIsOpen] = useState<boolean>(false)
8182
const { projects } = useProjects()
8283

83-
const renderControlPlaneType = () => {
84-
if (cluster?.name === 'local-cluster') {
85-
return t('Hub')
86-
}
87-
if (cluster?.isRegionalHubCluster) {
88-
if (cluster?.isHostedCluster || cluster?.isHypershift) {
89-
return t('Hub, Hosted')
90-
}
91-
return t('Hub')
92-
}
93-
if (cluster?.isHostedCluster || cluster?.isHypershift) {
94-
return t('Hosted')
95-
} else {
96-
return t('Standalone')
97-
}
98-
}
99-
10084
const clusterProperties: { [key: string]: { key: string; value?: React.ReactNode; keyAction?: React.ReactNode } } = {
10185
/*
10286
Translation hack, otherwise the text will get removed:
@@ -127,7 +111,7 @@ export function ClusterOverviewPageContent() {
127111
},
128112
clusterControlPlaneType: {
129113
key: t('table.clusterControlPlaneType'),
130-
value: renderControlPlaneType(),
114+
value: getControlPlaneString(cluster, t),
131115
},
132116
clusterClaim: {
133117
key: t('table.clusterClaim'),

frontend/src/routes/Infrastructure/Clusters/ManagedClusters/ManagedClusters.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ export function useClusterProviderColumn(): IAcmTableColumn<Cluster> {
765765
}
766766
}
767767

768-
const getControlPlaneString = (cluster: Cluster, t: TFunction<string, undefined>) => {
768+
export const getControlPlaneString = (cluster: Cluster, t: TFunction<string, undefined>) => {
769769
const clusterHasControlPlane = () => {
770770
const nodeList = cluster.nodes?.nodeList
771771
const roleList = nodeList?.map((node: NodeInfo) => getRoles(node))

0 commit comments

Comments
 (0)