-
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FE: Online partition count is red fix (#137)
Co-authored-by: Mgrdich <[email protected]>
- Loading branch information
Showing
17 changed files
with
428 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
frontend/src/components/Brokers/BrokersList/BrokersMetrics/BrokersMetrics.styled.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const DangerText = styled.span` | ||
color: ${({ theme }) => theme.circularAlert.color.error}; | ||
`; |
105 changes: 105 additions & 0 deletions
105
frontend/src/components/Brokers/BrokersList/BrokersMetrics/BrokersMetrics.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import React from 'react'; | ||
import * as Metrics from 'components/common/Metrics'; | ||
|
||
import * as S from './BrokersMetrics.styled'; | ||
|
||
type BrokersMetricsProps = { | ||
brokerCount: number | undefined; | ||
inSyncReplicasCount: number | undefined; | ||
outOfSyncReplicasCount: number | undefined; | ||
offlinePartitionCount: number | undefined; | ||
activeControllers: number | undefined; | ||
onlinePartitionCount: number | undefined; | ||
underReplicatedPartitionCount: number | undefined; | ||
version: string | undefined; | ||
}; | ||
|
||
export const BrokersMetrics = ({ | ||
brokerCount, | ||
version, | ||
activeControllers, | ||
outOfSyncReplicasCount, | ||
inSyncReplicasCount, | ||
offlinePartitionCount, | ||
underReplicatedPartitionCount, | ||
onlinePartitionCount, | ||
}: BrokersMetricsProps) => { | ||
const replicas = (inSyncReplicasCount ?? 0) + (outOfSyncReplicasCount ?? 0); | ||
const areAllInSync = inSyncReplicasCount && replicas === inSyncReplicasCount; | ||
const partitionIsOffline = offlinePartitionCount && offlinePartitionCount > 0; | ||
|
||
const isActiveControllerUnKnown = typeof activeControllers === 'undefined'; | ||
|
||
return ( | ||
<Metrics.Wrapper> | ||
<Metrics.Section title="Uptime"> | ||
<Metrics.Indicator label="Broker Count"> | ||
{brokerCount} | ||
</Metrics.Indicator> | ||
|
||
<Metrics.Indicator | ||
label="Active Controller" | ||
isAlert={isActiveControllerUnKnown} | ||
> | ||
{isActiveControllerUnKnown ? ( | ||
<S.DangerText>No Active Controller</S.DangerText> | ||
) : ( | ||
activeControllers | ||
)} | ||
</Metrics.Indicator> | ||
|
||
<Metrics.Indicator label="Version">{version}</Metrics.Indicator> | ||
</Metrics.Section> | ||
|
||
<Metrics.Section title="Partitions"> | ||
<Metrics.Indicator | ||
label="Online" | ||
isAlert | ||
alertType={partitionIsOffline ? 'error' : 'success'} | ||
> | ||
{partitionIsOffline ? ( | ||
<Metrics.RedText>{onlinePartitionCount}</Metrics.RedText> | ||
) : ( | ||
onlinePartitionCount | ||
)} | ||
<Metrics.LightText> | ||
{` of ${(onlinePartitionCount || 0) + (offlinePartitionCount || 0)} | ||
`} | ||
</Metrics.LightText> | ||
</Metrics.Indicator> | ||
|
||
<Metrics.Indicator | ||
label="URP" | ||
title="Under replicated partitions" | ||
isAlert | ||
alertType={!underReplicatedPartitionCount ? 'success' : 'error'} | ||
> | ||
{!underReplicatedPartitionCount ? ( | ||
<Metrics.LightText> | ||
{underReplicatedPartitionCount} | ||
</Metrics.LightText> | ||
) : ( | ||
<Metrics.RedText>{underReplicatedPartitionCount}</Metrics.RedText> | ||
)} | ||
</Metrics.Indicator> | ||
|
||
<Metrics.Indicator | ||
label="In Sync Replicas" | ||
isAlert | ||
alertType={areAllInSync ? 'success' : 'error'} | ||
> | ||
{areAllInSync ? ( | ||
replicas | ||
) : ( | ||
<Metrics.RedText>{inSyncReplicasCount}</Metrics.RedText> | ||
)} | ||
<Metrics.LightText> of {replicas}</Metrics.LightText> | ||
</Metrics.Indicator> | ||
|
||
<Metrics.Indicator label="Out Of Sync Replicas"> | ||
{outOfSyncReplicasCount} | ||
</Metrics.Indicator> | ||
</Metrics.Section> | ||
</Metrics.Wrapper> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.