mirror of
https://github.com/Unleash/unleash.git
synced 2025-08-13 13:48:59 +02:00
feat: basic flag creation chart
This commit is contained in:
parent
9a768f7bdc
commit
9b375dc9b5
@ -22,6 +22,11 @@ export const useInsightsData = (
|
|||||||
projects,
|
projects,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const creationArchiveData = useFilteredTrends(
|
||||||
|
instanceInsights.creationArchiveTrends,
|
||||||
|
projects,
|
||||||
|
);
|
||||||
|
|
||||||
const groupedProjectsData = useGroupedProjectTrends(projectsData);
|
const groupedProjectsData = useGroupedProjectTrends(projectsData);
|
||||||
|
|
||||||
const metricsData = useFilteredTrends(
|
const metricsData = useFilteredTrends(
|
||||||
@ -34,6 +39,9 @@ export const useInsightsData = (
|
|||||||
|
|
||||||
const groupedLifecycleData = useGroupedProjectTrends(lifecycleData);
|
const groupedLifecycleData = useGroupedProjectTrends(lifecycleData);
|
||||||
|
|
||||||
|
const groupedCreationArchiveData =
|
||||||
|
useGroupedProjectTrends(creationArchiveData);
|
||||||
|
|
||||||
return useMemo(
|
return useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
...instanceInsights,
|
...instanceInsights,
|
||||||
@ -46,6 +54,7 @@ export const useInsightsData = (
|
|||||||
allMetricsDatapoints,
|
allMetricsDatapoints,
|
||||||
lifecycleData,
|
lifecycleData,
|
||||||
groupedLifecycleData,
|
groupedLifecycleData,
|
||||||
|
groupedCreationArchiveData,
|
||||||
}),
|
}),
|
||||||
[
|
[
|
||||||
instanceInsights,
|
instanceInsights,
|
||||||
@ -57,6 +66,7 @@ export const useInsightsData = (
|
|||||||
summary,
|
summary,
|
||||||
lifecycleData,
|
lifecycleData,
|
||||||
groupedLifecycleData,
|
groupedLifecycleData,
|
||||||
|
groupedCreationArchiveData,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -7,6 +7,7 @@ import useProjects from 'hooks/api/getters/useProjects/useProjects';
|
|||||||
|
|
||||||
type ProjectFlagTrends = InstanceInsightsSchema['projectFlagTrends'];
|
type ProjectFlagTrends = InstanceInsightsSchema['projectFlagTrends'];
|
||||||
type LifecycleTrends = InstanceInsightsSchema['lifecycleTrends'];
|
type LifecycleTrends = InstanceInsightsSchema['lifecycleTrends'];
|
||||||
|
type CreationArchiveTrends = InstanceInsightsSchema['creationArchiveTrends'];
|
||||||
|
|
||||||
export const calculateTechDebt = (item: {
|
export const calculateTechDebt = (item: {
|
||||||
total: number;
|
total: number;
|
||||||
@ -25,7 +26,8 @@ export const calculateTechDebt = (item: {
|
|||||||
export const useProjectChartData = (
|
export const useProjectChartData = (
|
||||||
projectFlagTrends:
|
projectFlagTrends:
|
||||||
| GroupedDataByProject<ProjectFlagTrends>
|
| GroupedDataByProject<ProjectFlagTrends>
|
||||||
| GroupedDataByProject<LifecycleTrends>,
|
| GroupedDataByProject<LifecycleTrends>
|
||||||
|
| GroupedDataByProject<CreationArchiveTrends>,
|
||||||
) => {
|
) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const getProjectColor = useProjectColor();
|
const getProjectColor = useProjectColor();
|
||||||
|
@ -27,6 +27,7 @@ import {
|
|||||||
import { useUiFlag } from 'hooks/useUiFlag';
|
import { useUiFlag } from 'hooks/useUiFlag';
|
||||||
import { NewProductionFlagsChart } from '../componentsChart/NewProductionFlagsChart/NewProductionFlagsChart.tsx';
|
import { NewProductionFlagsChart } from '../componentsChart/NewProductionFlagsChart/NewProductionFlagsChart.tsx';
|
||||||
import Lightbulb from '@mui/icons-material/LightbulbOutlined';
|
import Lightbulb from '@mui/icons-material/LightbulbOutlined';
|
||||||
|
import { CreationArchiveChart } from '../componentsChart/CreationArchiveChart/CreationArchiveChart.tsx';
|
||||||
|
|
||||||
export const PerformanceInsights: FC = () => {
|
export const PerformanceInsights: FC = () => {
|
||||||
const statePrefix = 'performance-';
|
const statePrefix = 'performance-';
|
||||||
@ -63,6 +64,7 @@ export const PerformanceInsights: FC = () => {
|
|||||||
groupedMetricsData,
|
groupedMetricsData,
|
||||||
allMetricsDatapoints,
|
allMetricsDatapoints,
|
||||||
environmentTypeTrends,
|
environmentTypeTrends,
|
||||||
|
groupedCreationArchiveData,
|
||||||
} = useInsightsData(insights, projects);
|
} = useInsightsData(insights, projects);
|
||||||
|
|
||||||
const { isEnterprise } = useUiConfig();
|
const { isEnterprise } = useUiConfig();
|
||||||
@ -110,6 +112,21 @@ export const PerformanceInsights: FC = () => {
|
|||||||
</StyledWidget>
|
</StyledWidget>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
|
{isLifecycleGraphsEnabled && isEnterprise() ? (
|
||||||
|
<StyledWidget>
|
||||||
|
<StyledWidgetStats width={275}>
|
||||||
|
<WidgetTitle title='Flags created vs archived' />
|
||||||
|
</StyledWidgetStats>
|
||||||
|
<StyledChartContainer>
|
||||||
|
<CreationArchiveChart
|
||||||
|
creationArchiveTrends={groupedCreationArchiveData}
|
||||||
|
isAggregate={showAllProjects}
|
||||||
|
isLoading={loading}
|
||||||
|
/>
|
||||||
|
</StyledChartContainer>
|
||||||
|
</StyledWidget>
|
||||||
|
) : null}
|
||||||
|
|
||||||
{showAllProjects ? (
|
{showAllProjects ? (
|
||||||
<StyledWidget>
|
<StyledWidget>
|
||||||
<StyledWidgetStats width={275}>
|
<StyledWidgetStats width={275}>
|
||||||
|
Loading…
Reference in New Issue
Block a user