Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions locales/en/plugin__odf-console.json
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,7 @@
"Headers that should be exposed to the browser.": "Headers that should be exposed to the browser.",
"Health": "Health",
"Health check metrics are being collected. This may take a few moments.": "Health check metrics are being collected. This may take a few moments.",
"Health checks unavailable": "Health checks unavailable",
"Health score": "Health score",
"Health Score": "Health Score",
"Health Score Over Time": "Health Score Over Time",
Expand Down Expand Up @@ -1181,6 +1182,7 @@
"Information unavailable": "Information unavailable",
"Infrastructure": "Infrastructure",
"Infrastructure health": "Infrastructure health",
"Infrastructure health monitoring is unavailable because no OSDs are present in the cluster.": "Infrastructure health monitoring is unavailable because no OSDs are present in the cluster.",
"Infrastructures": "Infrastructures",
"Initiate": "Initiate",
"Initiating": "Initiating",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import { HEALTH_SCORE_QUERY } from '@odf/core/components/odf-dashboard/queries';
import { useODFSystemFlagsSelector } from '@odf/core/redux';
import { TWENTY_FOUR_HOURS } from '@odf/shared/constants';
import {
useCustomPrometheusPoll,
Expand Down Expand Up @@ -38,7 +39,12 @@ import {
Text,
TextVariants,
} from '@patternfly/react-core';
import { ArrowRightIcon, SpaceShuttleIcon } from '@patternfly/react-icons';
import {
ArrowRightIcon,
CubesIcon,
SpaceShuttleIcon,
} from '@patternfly/react-icons';
import { hasAnyCeph } from '../../../utils';
import {
useHealthAlerts,
useSilencedAlerts,
Expand All @@ -58,6 +64,10 @@ export const HealthOverviewCard: React.FC = () => {
const [chartRef, chartWidth] = useRefWidth();
const basePath = usePrometheusBasePath();

// Check if Ceph/OSDs are available in any storage cluster
const { systemFlags, areFlagsSafe } = useODFSystemFlagsSelector();
const isCephAvailable = hasAnyCeph(systemFlags);

// Fetch health score metric over time (range query)
const [healthScoreData, healthScoreError, healthScoreLoading] =
useCustomPrometheusPoll({
Expand Down Expand Up @@ -139,6 +149,10 @@ export const HealthOverviewCard: React.FC = () => {

const hasError = healthScoreError || healthAlertsError || silencedAlertsError;
const hasNoData = chartData.length === 0;

// Determine if Ceph is unavailable (flags loaded and no Ceph found)
const isCephUnavailable = areFlagsSafe && !isCephAvailable;

const showEmptyState = isLoading || hasError || hasNoData;

// Determine specific error message
Expand All @@ -159,6 +173,31 @@ export const HealthOverviewCard: React.FC = () => {

const cardTitle = t('Infrastructure health');

// Show unavailable state when no Ceph/OSDs are present
if (isCephUnavailable) {
return (
<Card isFlat>
<CardHeader>
<CardTitle>{cardTitle}</CardTitle>
</CardHeader>
<CardBody>
<EmptyState variant={EmptyStateVariant.lg}>
<EmptyStateHeader
titleText={t('Health checks unavailable')}
icon={<EmptyStateIcon icon={CubesIcon} />}
headingLevel="h4"
/>
<EmptyStateBody>
{t(
'Infrastructure health monitoring is unavailable because no OSDs are present in the cluster.'
)}
</EmptyStateBody>
</EmptyState>
</CardBody>
</Card>
);
}

if (showEmptyState) {
return (
<Card isFlat>
Expand Down
Loading