Skip to content

Commit 2e963b8

Browse files
Merge pull request #2986 from SanjalKatiyar/pvc_health_card
Add VolumeHealthCard
2 parents e2a8c04 + e323cb6 commit 2e963b8

17 files changed

Lines changed: 478 additions & 37 deletions

File tree

locales/en/plugin__odf-console.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
"{{count}} minute_other": "{{count}} minute",
4040
"{{count}} more_one": "{{count}} more",
4141
"{{count}} more_other": "{{count}} more",
42+
"{{count}} PersistentVolumeClaims need attention_one": "{{count}} PersistentVolumeClaims need attention",
43+
"{{count}} PersistentVolumeClaims need attention_other": "{{count}} PersistentVolumeClaims need attention",
4244
"{{count}} placements_one": "{{count}} placements",
4345
"{{count}} placements_other": "{{count}} placements",
4446
"{{count}} provisioner_one": "{{count}} provisioner",
@@ -276,6 +278,7 @@
276278
"All disk type may include HDD disks. Data Foundation does not support HDD disks as local devices. Select SSD if you plan to use Data Foundation.": "All disk type may include HDD disks. Data Foundation does not support HDD disks as local devices. Select SSD if you plan to use Data Foundation.",
277279
"All headers": "All headers",
278280
"All metadata is filterable by default, unless you marked it as non-filterable when you created the index.": "All metadata is filterable by default, unless you marked it as non-filterable when you created the index.",
281+
"All Namespaces": "All Namespaces",
279282
"All origins": "All origins",
280283
"All other capacity usage that are not a part of the top 5 consumers.": "All other capacity usage that are not a part of the top 5 consumers.",
281284
"All processes that use application subscription is deprecated": "All processes that use application subscription is deprecated",
@@ -1571,6 +1574,7 @@
15711574
"No external systems connected": "No external systems connected",
15721575
"No file systems found": "No file systems found",
15731576
"No IAM users found": "No IAM users found",
1577+
"No issues found.": "No issues found.",
15741578
"No labels": "No labels",
15751579
"No less than {{min}} characters": "No less than {{min}} characters",
15761580
"No lifecycle rules defined for the objects in your bucket.": "No lifecycle rules defined for the objects in your bucket.",
@@ -2569,11 +2573,13 @@
25692573
"Versions": "Versions",
25702574
"View {{title}} metrics in query browser": "View {{title}} metrics in query browser",
25712575
"View all": "View all",
2576+
"View all PersistentVolumeClaims": "View all PersistentVolumeClaims",
25722577
"View and manage your vector buckets": "View and manage your vector buckets",
25732578
"View buckets": "View buckets",
25742579
"View details": "View details",
25752580
"View did not complete successfully.": "View did not complete successfully.",
25762581
"View documentation": "View documentation",
2582+
"View Events": "View Events",
25772583
"View external systems": "View external systems",
25782584
"View failed objects": "View failed objects",
25792585
"View health checks": "View health checks",
@@ -2594,6 +2600,9 @@
25942600
"Volume Consistency groups": "Volume Consistency groups",
25952601
"Volume consistency groups modal": "Volume consistency groups modal",
25962602
"Volume group replication: ": "Volume group replication: ",
2603+
"Volume health": "Volume health",
2604+
"Volume health table": "Volume health table",
2605+
"Volume health table skeleton": "Volume health table skeleton",
25972606
"Volume last synced on:": "Volume last synced on:",
25982607
"Volume mode": "Volume mode",
25992608
"Volume replication health": "Volume replication health",

packages/client/src/components/dashboards/cards/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export * from './activity-card';
22
export * from './details-card';
33
export * from './inventory-card';
44
export * from './status-card';
5+
export * from './volume-health-card';
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import * as React from 'react';
2+
import { VolumeHealthCard as VolumeHealthCardContent } from '@odf/ocs/dashboards/common/volume-health-card/volume-health-card';
3+
import { getCephSC } from '@odf/ocs/utils/common';
4+
import { getName } from '@odf/shared/selectors';
5+
import {
6+
PersistentVolumeClaimKind,
7+
StorageClassResourceKind,
8+
} from '@odf/shared/types';
9+
import { filterPVCsByStorageClass } from '@odf/shared/utils';
10+
11+
const pvcFilter = (
12+
scs: StorageClassResourceKind[],
13+
pvcs: PersistentVolumeClaimKind[],
14+
_ns: string
15+
) => {
16+
const cephSCs = getCephSC(scs).map(getName) || [];
17+
const cephPVCs = filterPVCsByStorageClass(cephSCs, pvcs) || [];
18+
const cephPVCsSet = new Set(cephPVCs.map(getName));
19+
20+
return (pvc: PersistentVolumeClaimKind) => cephPVCsSet.has(getName(pvc));
21+
};
22+
23+
export const VolumeHealthCard: React.FC = () => {
24+
return <VolumeHealthCardContent pvcFilter={pvcFilter} />;
25+
};

packages/client/src/components/dashboards/client-dashboard.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,20 @@ import UtilizationCard from '@odf/ocs/dashboards/persistent-external/utilization
55
import PageHeading from '@odf/shared/heading/page-heading';
66
import { useCustomTranslation } from '@odf/shared/useCustomTranslationHook';
77
import Tabs from '@odf/shared/utils/Tabs';
8-
import { ActivityCard, DetailsCard, StatusCard, InventoryCard } from './cards';
8+
import {
9+
ActivityCard,
10+
DetailsCard,
11+
StatusCard,
12+
InventoryCard,
13+
VolumeHealthCard,
14+
} from './cards';
915

1016
const PersistentClientDashboard: React.FC = () => {
1117
const mainCards: React.ComponentType[] = [
1218
StatusCard,
1319
BreakdownCard,
1420
UtilizationCard,
21+
VolumeHealthCard,
1522
];
1623
const leftCards: React.ComponentType[] = [DetailsCard, InventoryCard];
1724
const rightCards: React.ComponentType[] = [ActivityCard];

packages/ocs/dashboards/block-pool/inventory-card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import {
1010
StorageClassResourceKind,
1111
} from '@odf/shared/types';
1212
import { useCustomTranslation } from '@odf/shared/useCustomTranslationHook';
13+
import { getStorageClassName } from '@odf/shared/utils';
1314
import { useK8sWatchResource } from '@openshift-console/dynamic-plugin-sdk';
1415
import { ResourceInventoryItem } from '@openshift-console/dynamic-plugin-sdk-internal';
1516
import { Card, CardBody, CardHeader, CardTitle } from '@patternfly/react-core';
16-
import { getStorageClassName } from '../../utils/common';
1717
import { BlockPoolDashboardContext } from './block-pool-dashboard-context';
1818

1919
export const scResource = {

0 commit comments

Comments
 (0)