Skip to content

Commit

Permalink
Merge pull request #1190 from bipuladh/fd-values
Browse files Browse the repository at this point in the history
Bug 2260818: Updates selector for failure domain values
  • Loading branch information
openshift-merge-bot[bot] authored Jan 30, 2024
2 parents c719113 + 7242942 commit 2a84cf6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
31 changes: 11 additions & 20 deletions packages/odf/modals/configure-mons/configure-mons.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import * as React from 'react';
import {
NodeKind,
NodeModel,
StorageClusterKind,
StorageClusterModel,
getName,
getNamespace,
useCustomTranslation,
useK8sList,
} from '@odf/shared';
import { LoadingInline } from '@odf/shared/generic/Loading';
import { ModalBody, ModalFooter, ModalHeader } from '@odf/shared/modals/Modal';
Expand All @@ -25,7 +22,6 @@ import {
Text,
TextVariants,
} from '@patternfly/react-core';
import { groupNodesByZones } from '../../components/topology/utils';
import { useSafeK8sGet } from '../../hooks';
import { getODFSystemFlags } from '../../redux';

Expand Down Expand Up @@ -60,9 +56,7 @@ const LowMonAlertModal: ModalComponent = ({ closeModal }) => {
namespace
);

const [nodes, nodesLoaded, nodesLoadError] = useK8sList<NodeKind>(NodeModel);
const failureDomains =
nodesLoaded && !nodesLoadError ? groupNodesByZones(nodes)?.length : [];
const failureDomains = storageCluster?.status?.failureDomainValues?.length;
const Header = <ModalHeader>{t('Configure Ceph Monitor')}</ModalHeader>;

const monitorCount = getMonitorCount(storageCluster);
Expand All @@ -88,7 +82,6 @@ const LowMonAlertModal: ModalComponent = ({ closeModal }) => {
setErrorMessage(err);
});
};
const allResourcesLoaded = storageClusterLoaded && nodesLoaded;

return (
<Modal
Expand All @@ -112,17 +105,15 @@ const LowMonAlertModal: ModalComponent = ({ closeModal }) => {
direction={{ default: 'column' }}
spaceItems={{ default: 'spaceItemsNone' }}
>
{!nodesLoadError && (
<FlexItem>
{nodesLoaded ? (
t('Node failure domains: {{failureDomains}}', {
failureDomains,
})
) : (
<LoadingInline />
)}
</FlexItem>
)}
<FlexItem>
{storageClusterLoaded ? (
t('Node failure domains: {{failureDomains}}', {
failureDomains,
})
) : (
<LoadingInline />
)}
</FlexItem>
<FlexItem>
{storageClusterLoaded ? (
t('Ceph Monitor count: {{monitorCount}}', { monitorCount })
Expand Down Expand Up @@ -153,7 +144,7 @@ const LowMonAlertModal: ModalComponent = ({ closeModal }) => {
>
{t('Cancel')}
</Button>
{!inProgress && allResourcesLoaded ? (
{!inProgress && storageClusterLoaded ? (
<Button
key="Add"
data-test="modal-submit-action"
Expand Down
1 change: 1 addition & 0 deletions packages/shared/src/types/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export type StorageClusterKind = K8sResourceCommon & {
status?: {
phase: string;
failureDomain?: string;
failureDomainValues: string[];
currentMonCount?: number;
};
};
Expand Down

0 comments on commit 2a84cf6

Please sign in to comment.