1
0
mirror of https://github.com/Unleash/unleash.git synced 2026-02-04 20:10:52 +01:00

feat: now impact metrics charts are limited to 20 (#11090)

This commit is contained in:
Jaanus Sellin 2025-12-05 12:18:43 +02:00 committed by GitHub
parent a521255f16
commit 2597f34e7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 2 deletions

View File

@ -129,6 +129,9 @@ export const FeatureImpactMetrics: FC = () => {
[impactMetrics.configs, projectId],
);
const maxChartsReached = impactMetrics.configs.length >= 20;
const isDisabled = metadataLoading || !!metadataError || maxChartsReached;
return (
<PageContent>
<PageHeader
@ -140,9 +143,17 @@ export const FeatureImpactMetrics: FC = () => {
variant='contained'
startIcon={<Add />}
onClick={handleAddChart}
disabled={metadataLoading || !!metadataError}
disabled={isDisabled}
permission={UPDATE_FEATURE}
projectId={projectId}
tooltipProps={
maxChartsReached
? {
title: 'Maximum of 20 impact metrics charts allowed',
arrow: true,
}
: undefined
}
>
Add Chart
</PermissionButton>

View File

@ -139,6 +139,8 @@ export const ImpactMetrics: FC = () => {
const hasError = metadataError || settingsError;
const isLoading = metadataLoading || settingsLoading;
const maxChartsReached = charts.length >= 20;
const isDisabled = isLoading || !!hasError || maxChartsReached;
return (
<>
@ -154,8 +156,16 @@ export const ImpactMetrics: FC = () => {
variant='contained'
startIcon={<Add />}
onClick={handleAddChart}
disabled={isLoading || !!hasError}
disabled={isDisabled}
permission={ADMIN}
tooltipProps={
maxChartsReached
? {
title: 'Maximum of 20 impact metrics charts allowed',
arrow: true,
}
: undefined
}
>
Add Chart
</PermissionButton>