Skip to content

Commit 67d4a22

Browse files
committed
feat: update env list header for cluster metadata
1 parent c8b4591 commit 67d4a22

File tree

4 files changed

+47
-47
lines changed

4 files changed

+47
-47
lines changed

src/Pages/GlobalConfigurations/ClustersAndEnvironments/EnvironmentList.tsx

Lines changed: 34 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,15 @@ const isFELibAvailable = importComponentFromFELibrary('isFELibAvailable', null,
4545

4646
// This is a list of namespaces and environments mapped to a cluster
4747
const ClustersEnvironmentsList = ({
48-
clusterId,
49-
clusterName,
50-
clusterType,
48+
clusterDetails,
5149
environments,
52-
isVirtualCluster,
53-
status,
5450
filterConfig: { sortBy, searchKey, sortOrder },
5551
showUnmappedEnvs,
5652
setDeleteEnvConfig: setDeleteEnvId,
5753
setEditEnvConfig: setEditEnvId,
5854
}: ClusterEnvListProps) => {
55+
const { clusterId, clusterName, isVirtualCluster, status, isProd, category } = clusterDetails
56+
5957
const [namespaceListLoading, namespaceListResult, namespaceListError, reloadNamespaces] = useAsync(
6058
() => namespaceListByClusterId(`${clusterId}`),
6159
[],
@@ -87,17 +85,19 @@ const ClustersEnvironmentsList = ({
8785

8886
const namespaceEnvList: EnvNamespaceRowType[] = useMemo(
8987
() => [
90-
...environments.map(({ id: envId, environmentName, namespace, isProd, category, description }) => ({
91-
clusterId,
92-
envId,
93-
environmentName,
94-
namespace,
95-
envType: isProd ? 'Production' : 'Non Production',
96-
category: category?.name ?? '',
97-
description,
98-
// false for virtual clusters and actual namespaces might not exist, for physical cluster showing not found if does not exist
99-
namespaceNotFound: isVirtualCluster || !showUnmappedEnvs ? false : !namespacesMap[namespace],
100-
})),
88+
...environments.map(
89+
({ id: envId, environmentName, namespace, isProd: isProdEnv, category, description }) => ({
90+
clusterId,
91+
envId,
92+
environmentName,
93+
namespace,
94+
envType: isProdEnv ? 'Production' : 'Non Production',
95+
category: category?.name ?? '',
96+
description,
97+
// false for virtual clusters and actual namespaces might not exist, for physical cluster showing not found if does not exist
98+
namespaceNotFound: isVirtualCluster || !showUnmappedEnvs ? false : !namespacesMap[namespace],
99+
}),
100+
),
101101
...(namespaceListResult?.result ?? [])
102102
.filter((namespace) => !mappedNamespacesMap[namespace])
103103
.map((namespace) => ({
@@ -276,28 +276,23 @@ const ClustersEnvironmentsList = ({
276276
<>
277277
{/* Cluster metadata */}
278278
<div
279-
className="px-20 py-6 bg__secondary flex dc__gap-16 dc__content-start fs-12 lh-20 cn-7 dc__position-sticky"
279+
className="px-20 py-6 bg__secondary dc__grid dc__align-items-center cluster-metadata-header dc__gap-16 dc__content-start fs-12 lh-20 cn-7 dc__position-sticky"
280280
style={{ top: '37px' }}
281281
>
282282
<ClusterIconWithStatus clusterStatus={status} isVirtualCluster={isVirtualCluster} />
283-
<span className="fw-6">{clusterName}</span>
284-
<div className="flex dc__gap-4 fw-4">
285-
<span>{clusterType}</span>
286-
<span>·</span>
287-
<span>{environments.length} Environments</span>
288-
{showUnmappedEnvs && (
289-
<>
290-
<span>·</span>
291-
{isVirtualCluster ? (
292-
<span>{environments.filter(({ namespace }) => !!namespace).length} Namespaces</span>
293-
) : (
294-
!namespaceListError && (
295-
<span>{(namespaceListResult?.result ?? []).length} Namespaces</span>
296-
)
297-
)}
298-
</>
299-
)}
300-
</div>
283+
<Tooltip
284+
content={`${clusterName} (${environments.length} Environments)`}
285+
alwaysShowTippyOnHover
286+
maxWidth={250}
287+
>
288+
<div className="flex left dc__gap-6">
289+
<span className="fw-6 dc__white-space-nowrap">{clusterName}</span>
290+
<span className="dc__ellipsis-right">({environments.length} Environments)</span>
291+
</div>
292+
</Tooltip>
293+
{showUnmappedEnvs ? <span>{(namespaceListResult?.result ?? []).length} Namespaces</span> : <span />}
294+
<span>{isProd ? 'Production' : 'Non Production'}</span>
295+
{category?.label && <span>{category.label}</span>}
301296
</div>
302297
{/* Env and Namespace List */}
303298
{renderNamespaceEnvList()}
@@ -427,14 +422,11 @@ const EnvironmentList = ({
427422
</div>
428423
{clusterList
429424
.filter(({ clusterId }) => !filterClusterId || filterClusterId === String(clusterId))
430-
.map(({ clusterId, clusterName, isProd, isVirtualCluster, status }) => (
425+
.map((clusterDetails) => (
431426
<ClustersEnvironmentsList
432-
key={`${clusterName}-${clusterId}`}
433-
clusterId={clusterId}
434-
clusterName={clusterName}
435-
clusterType={isProd ? 'Production' : 'Non Production'}
436-
environments={clusterIdVsEnvMap[clusterId] ?? []}
437-
isVirtualCluster={isVirtualCluster}
427+
key={`${clusterDetails.clusterName}-${clusterDetails.clusterId}`}
428+
clusterDetails={clusterDetails}
429+
environments={clusterIdVsEnvMap[clusterDetails.clusterId] ?? []}
438430
filterConfig={{
439431
sortBy,
440432
sortOrder,
@@ -443,7 +435,6 @@ const EnvironmentList = ({
443435
showUnmappedEnvs={showUnmappedEnvs}
444436
setDeleteEnvConfig={setDeleteEnvConfig}
445437
setEditEnvConfig={setEditEnvConfig}
446-
status={status}
447438
/>
448439
))}
449440
{deleteEnvConfig && (

src/Pages/GlobalConfigurations/ClustersAndEnvironments/cluster.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,9 @@
9191
&.with-category {
9292
grid-template-columns: 24px 200px 200px 100px 150px 1fr 60px;
9393
}
94+
}
95+
96+
.cluster-metadata-header {
97+
grid-template-columns: 24px 200px 200px 100px 100px;
98+
grid-column-gap: 16px;
9499
}

src/Pages/GlobalConfigurations/ClustersAndEnvironments/cluster.type.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,11 +372,11 @@ export interface EnvironmentListProps {
372372
}
373373

374374
export type DeleteEnvConfigType = Pick<EnvNamespaceRowType, 'envId' | 'clusterId'>
375+
375376
export type EditEnvConfigType = Pick<EnvNamespaceRowType, 'envId' | 'clusterId'> & { isVirtualCluster: boolean }
376-
export interface ClusterEnvListProps
377-
extends Pick<EnvironmentListProps, 'filterConfig' | 'showUnmappedEnvs'>,
378-
Pick<Cluster, 'clusterId' | 'clusterName' | 'status' | 'isVirtualCluster'> {
379-
clusterType: string
377+
378+
export interface ClusterEnvListProps extends Pick<EnvironmentListProps, 'filterConfig' | 'showUnmappedEnvs'> {
379+
clusterDetails: Cluster
380380
environments: Environment[]
381381
setDeleteEnvConfig: Dispatch<SetStateAction<DeleteEnvConfigType>>
382382
setEditEnvConfig: Dispatch<SetStateAction<EditEnvConfigType>>

src/css/base.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,10 @@ a:focus {
277277
white-space: normal;
278278
}
279279

280+
.dc__white-space-nowrap {
281+
white-space: nowrap;
282+
}
283+
280284
.dc__white-space-pre {
281285
white-space: pre;
282286
}

0 commit comments

Comments
 (0)