1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-03-23 00:16:25 +01:00

fix: improve traffic messaging summary (#6922)

Minor tweaks to traffic messaging summary.
This commit is contained in:
Ivar Conradi Østhus 2024-04-24 15:59:18 +02:00 committed by GitHub
parent f5061bc3ff
commit 1b2f983974
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 3 deletions

View File

@ -85,8 +85,10 @@ const getSelectablePeriods = (): SelectablePeriod[] => {
current.getMonth() - subtractMonthCount, current.getMonth() - subtractMonthCount,
1, 1,
); );
if (date > new Date('2024-03-31')) {
selectablePeriods.push(toSelectablePeriod(date)); selectablePeriods.push(toSelectablePeriod(date));
} }
}
return selectablePeriods; return selectablePeriods;
}; };
@ -357,7 +359,7 @@ export const NetworkTrafficUsage: VFC = () => {
return ( return (
<ConditionallyRender <ConditionallyRender
condition={isOss() || !flagEnabled} condition={isOss() || !flagEnabled}
show={<Alert severity='warning'>No data available.</Alert>} show={<Alert severity='warning'>Not enabled.</Alert>}
elseShow={ elseShow={
<> <>
<StyledBox> <StyledBox>

View File

@ -53,6 +53,7 @@ export const NetworkTrafficUsagePlanSummary = ({
planIncludedRequests, planIncludedRequests,
}: INetworkTrafficUsagePlanSummary) => { }: INetworkTrafficUsagePlanSummary) => {
const { isPro } = useUiConfig(); const { isPro } = useUiConfig();
const overages = usageTotal - planIncludedRequests;
return ( return (
<StyledContainer> <StyledContainer>
<Grid item> <Grid item>
@ -61,7 +62,7 @@ export const NetworkTrafficUsagePlanSummary = ({
</StyledCardTitleRow> </StyledCardTitleRow>
<StyledCardDescription> <StyledCardDescription>
<RowContainer> <RowContainer>
Incoming requests for selection{' '} Incoming requests selected month{' '}
<StyledNumbersDiv> <StyledNumbersDiv>
<ConditionallyRender <ConditionallyRender
condition={isPro()} condition={isPro()}
@ -107,6 +108,19 @@ export const NetworkTrafficUsagePlanSummary = ({
</StyledCardDescription> </StyledCardDescription>
} }
/> />
<ConditionallyRender
condition={isPro() && overages > 0}
show={
<StyledCardDescription>
<RowContainer>
Requests overages this month
<StyledNumbersDiv>
{overages.toLocaleString()} requests
</StyledNumbersDiv>
</RowContainer>
</StyledCardDescription>
}
/>
</Grid> </Grid>
</StyledContainer> </StyledContainer>
); );