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:
parent
a521255f16
commit
2597f34e7e
@ -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>
|
||||
|
||||
@ -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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user