Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,33 @@ const BridgePileCard = React.memo(function BridgePileCard({pile}: BridgePileCard
return <Label theme={theme}>{pile.State}</Label>;
}, [pile.State]);

const renderBeingPromotedStatus = React.useCallback(() => {
const isBeingPromoted = pile.IsBeingPromoted;
const icon = isBeingPromoted ? CircleCheckFill : CircleXmarkFill;
Copy link

Copilot AI Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The icons CircleCheckFill and CircleXmarkFill are not imported. You need to import these icons from @gravity-ui/icons at the top of the file.

Copilot uses AI. Check for mistakes.
const text = isBeingPromoted ? i18n('value_yes') : i18n('value_no');

return (
<Flex gap={1} alignItems="center">
<Icon
data={icon}
size={16}
className={b('status-icon', {primary: isBeingPromoted})}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Promotion Status Styled Incorrectly

The renderBeingPromotedStatus function applies the primary CSS class modifier to its icon. This reuses styling meant for the actual primary status, which can visually confuse users as "Being Promoted" and "Primary" statuses will look the same.

Fix in Cursor Fix in Web

/>
<Text color="secondary">{text}</Text>
</Flex>
);
}, [pile.IsBeingPromoted]);

const info = React.useMemo(
() => [
{
name: i18n('field_primary'),
content: renderPrimaryStatus(),
},
{
name: i18n('field_being-promoted'),
content: renderBeingPromotedStatus(),
},
{
name: i18n('field_state'),
content: renderStateStatus(),
Expand All @@ -62,7 +83,7 @@ const BridgePileCard = React.memo(function BridgePileCard({pile}: BridgePileCard
pile.Nodes === undefined ? EMPTY_DATA_PLACEHOLDER : formatNumber(pile.Nodes),
},
],
[renderPrimaryStatus, renderStateStatus, pile.Nodes],
[renderPrimaryStatus, renderBeingPromotedStatus, renderStateStatus, pile.Nodes],
);

return (
Expand Down
1 change: 1 addition & 0 deletions src/containers/Cluster/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"label_load": "Load",
"field_name": "Name",
"field_primary": "Primary",
"field_being-promoted": "Being Promoted",
"field_state": "State",
"field_nodes": "Nodes",
"value_yes": "Yes",
Expand Down
2 changes: 2 additions & 0 deletions src/types/api/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ export interface TBridgePile {
State?: string;
/** whether this pile is primary */
IsPrimary?: boolean;
/** whether this pile is being promoted to primary */
IsBeingPromoted?: boolean;
/** number of nodes in the pile */
Nodes?: number;
}
Expand Down
1 change: 1 addition & 0 deletions tests/suites/bridge/bridge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ test.describe('Bridge mode - Cluster Overview', () => {
const firstPileContent = await clusterPage.getFirstPileContent();
expect(firstPileContent).toContain('r1');
expect(firstPileContent).toContain('Yes'); // Primary status
expect(firstPileContent).toContain('No'); // Being Promoted status (false for first pile)
expect(firstPileContent).toContain('SYNCHRONIZED');
expect(firstPileContent).toContain('16'); // Nodes count
});
Expand Down
18 changes: 16 additions & 2 deletions tests/suites/bridge/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,22 @@ export const mockClusterWithBridgePiles = (page: Page) => {
NetworkWriteThroughput: '1445752',
BridgeInfo: {
Piles: [
{PileId: 1, Name: 'r1', State: 'SYNCHRONIZED', IsPrimary: true, Nodes: 16},
{PileId: 2, Name: 'r2', State: 'READY', IsPrimary: false, Nodes: 12},
{
PileId: 1,
Name: 'r1',
State: 'SYNCHRONIZED',
IsPrimary: true,
IsBeingPromoted: false,
Nodes: 16,
},
{
PileId: 2,
Name: 'r2',
State: 'READY',
IsPrimary: false,
IsBeingPromoted: true,
Nodes: 12,
},
],
},
}),
Expand Down
Loading