Skip to content

Commit 38a8101

Browse files
authored
Web: show status on unhealthy state only (#54695)
1 parent 07bba43 commit 38a8101

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

web/packages/shared/components/UnifiedResources/CardsView/ResourceCard.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
import { PinButton } from '../shared/PinButton';
3636
import { ResourceActionButtonWrapper } from '../shared/ResourceActionButton';
3737
import { SingleLineBox } from '../shared/SingleLineBox';
38+
import { isUnhealthy } from '../shared/StatusInfo';
3839
import { ResourceItemProps } from '../types';
3940
import { WarningRightEdgeBadgeSvg } from './WarningRightEdgeBadgeSvg';
4041

@@ -167,7 +168,7 @@ export function ResourceCard({
167168
}
168169
};
169170

170-
const hasUnhealthyStatus = status && status !== 'healthy';
171+
const hasUnhealthyStatus = isUnhealthy(status);
171172

172173
return (
173174
<CardContainer

web/packages/shared/components/UnifiedResources/ListView/ResourceListItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
} from '../shared/getBackgroundColor';
3636
import { PinButton } from '../shared/PinButton';
3737
import { ResourceActionButtonWrapper } from '../shared/ResourceActionButton';
38+
import { isUnhealthy } from '../shared/StatusInfo';
3839
import { ResourceItemProps } from '../types';
3940

4041
export function ResourceListItem({
@@ -70,7 +71,7 @@ export function ResourceListItem({
7071
}, [expandAllLabels]);
7172

7273
const showLabelsButton = labels.length > 0 && (hovered || showLabels);
73-
const hasUnhealthyStatus = status && status !== 'healthy';
74+
const hasUnhealthyStatus = isUnhealthy(status);
7475

7576
// Determines which column the resource type text should end at.
7677
// We do this because if there is no address, or the labels button

web/packages/shared/components/UnifiedResources/shared/StatusInfo.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ import { useInfiniteScroll } from 'shared/hooks';
3939
import { Attempt } from 'shared/hooks/useAttemptNext';
4040
import { pluralize } from 'shared/utils/text';
4141

42-
import { SharedResourceServer, UnifiedResourceDefinition } from '../types';
42+
import {
43+
ResourceStatus,
44+
SharedResourceServer,
45+
UnifiedResourceDefinition,
46+
} from '../types';
4347
import { SingleLineBox } from './SingleLineBox';
4448
import { getDatabaseIconName } from './viewItemsFactory';
4549

@@ -311,3 +315,7 @@ export function openStatusInfoPanel({
311315
});
312316
}
313317
}
318+
319+
export function isUnhealthy(status: ResourceStatus): boolean {
320+
return status && status === 'unhealthy';
321+
}

0 commit comments

Comments
 (0)