mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
feat: human readable project names in insight charts (#7686)
This commit is contained in:
parent
1cd1f982ee
commit
94588c12d4
@ -3,6 +3,7 @@ import type { InstanceInsightsSchema } from 'openapi';
|
||||
import { useProjectColor } from './useProjectColor';
|
||||
import { useTheme } from '@mui/material';
|
||||
import type { GroupedDataByProject } from './useGroupedProjectTrends';
|
||||
import useProjects from 'hooks/api/getters/useProjects/useProjects';
|
||||
|
||||
type ProjectFlagTrends = InstanceInsightsSchema['projectFlagTrends'];
|
||||
|
||||
@ -11,13 +12,17 @@ export const useProjectChartData = (
|
||||
) => {
|
||||
const theme = useTheme();
|
||||
const getProjectColor = useProjectColor();
|
||||
const { projects } = useProjects();
|
||||
const projectNames = new Map(
|
||||
projects.map((project) => [project.id, project.name]),
|
||||
);
|
||||
|
||||
const data = useMemo(() => {
|
||||
const datasets = Object.entries(projectFlagTrends).map(
|
||||
([project, trends]) => {
|
||||
const color = getProjectColor(project);
|
||||
return {
|
||||
label: project,
|
||||
label: projectNames.get(project) || project,
|
||||
data: trends,
|
||||
borderColor: color,
|
||||
backgroundColor: color,
|
||||
|
Loading…
Reference in New Issue
Block a user