From 9be15d49769cd227ddb09f6bde80681c2b5799af Mon Sep 17 00:00:00 2001 From: andreas-unleash Date: Thu, 21 Mar 2024 16:39:03 +0200 Subject: [PATCH] Chore/rename dashboard files to insights (#6662) Renames everything related to `executive dashboard` to `insights` Closes: # [1-2213](https://linear.app/unleash/issue/1-2213/rename-in-fe) --------- Signed-off-by: andreas-unleash --- .../Insights.tsx} | 22 +++++++------ .../InsightsCharts.tsx} | 20 ++++++------ .../chart-info.ts | 0 .../components/Gauge/Gauge.tsx | 0 .../HorizontalDistributionChart.tsx | 0 .../InsightsHeader/InsightsHeader.tsx} | 2 +- .../InsightsHeader}/ShareLink/ShareLink.tsx | 0 .../LineChart/ChartTooltip/ChartTooltip.tsx | 0 .../components/LineChart/LineChart.tsx | 0 .../LineChart/LineChartComponent.tsx | 0 .../LineChart/createChartOptions.ts | 0 .../components/LineChart/createTooltip.ts | 0 .../components/LineChart/legendOptions.ts | 0 .../components/Widget/Widget.tsx | 0 .../componentsChart/FlagsChart/FlagsChart.tsx | 11 ++++--- .../FlagsProjectChart/FlagsProjectChart.tsx | 15 +++++---- .../MetricsChartTooltip-InfoSummary.test.tsx | 0 .../MetricsChartTooltip.tsx | 6 ++-- .../aggregate-metrics-by-day.test.ts | 0 .../aggregate-metrics-by-day.ts | 4 +-- .../MetricsSummaryChart.tsx | 12 +++---- .../HealthChartTooltip/HealthChartTooltip.tsx | 8 ++--- .../ProjectHealthChart/ProjectHealthChart.tsx | 10 +++--- .../TimeToProductionChart.tsx | 12 +++---- .../TimeToProductionTooltip.tsx | 6 ++-- .../median-time-to-production.test.ts | 8 ++--- .../median-time-to-production.ts | 4 +-- .../UpdatesPerEnvironmentTypeChart.tsx | 19 ++++++----- .../UpdatesPerEnvironmentTypeChartTooltip.tsx | 6 ++-- .../componentsChart/UsersChart/UsersChart.tsx | 8 ++--- .../UsersPerProjectChart.tsx | 15 +++++---- .../componentsStat/FlagStats/FlagStats.tsx | 0 .../HealthStats/HealthStats.tsx | 0 .../TimeToProduction/TimeToProduction.tsx | 2 +- .../UserStats/UserDistributionInfo.tsx | 0 .../componentsStat/UserStats/UserStats.tsx | 0 .../hooks/useFilteredFlagsSummary.test.ts | 10 +++--- .../hooks/useFilteredFlagsSummary.ts | 8 ++--- .../hooks/useFilteredTrends.test.ts | 0 .../hooks/useFilteredTrends.ts | 0 .../hooks/useGroupedProjectTrends.test.ts | 0 .../hooks/useGroupedProjectTrends.ts | 0 .../hooks/useInsightsData.ts} | 6 ++-- .../hooks/useMedianTimeToProduction.test.ts | 0 .../hooks/useMedianTimeToProduction.ts | 8 ++--- .../hooks/useMetricsSummary.ts | 4 +-- .../hooks/usePlaceholderData.ts | 0 .../hooks/useProjectChartData.ts | 4 +-- .../hooks/useProjectColor.ts | 0 frontend/src/component/menu/routes.ts | 4 +-- .../useInsights.ts} | 22 ++++++------- .../openapi/models/executiveSummarySchema.ts | 32 ------------------- frontend/src/openapi/models/index.ts | 16 +++++----- .../openapi/models/instanceInsightsSchema.ts | 32 +++++++++++++++++++ ...nsightsSchemaEnvironmentTypeTrendsItem.ts} | 2 +- ...> instanceInsightsSchemaFlagTrendsItem.ts} | 2 +- ...lags.ts => instanceInsightsSchemaFlags.ts} | 2 +- ...InsightsSchemaMetricsSummaryTrendsItem.ts} | 2 +- ...nceInsightsSchemaProjectFlagTrendsItem.ts} | 2 +- ...> instanceInsightsSchemaUserTrendsItem.ts} | 2 +- ...sers.ts => instanceInsightsSchemaUsers.ts} | 2 +- 61 files changed, 183 insertions(+), 167 deletions(-) rename frontend/src/component/{executiveDashboard/ExecutiveDashboard.tsx => insights/Insights.tsx} (76%) rename frontend/src/component/{executiveDashboard/Charts.tsx => insights/InsightsCharts.tsx} (93%) rename frontend/src/component/{executiveDashboard => insights}/chart-info.ts (100%) rename frontend/src/component/{executiveDashboard => insights}/components/Gauge/Gauge.tsx (100%) rename frontend/src/component/{executiveDashboard => insights}/components/HorizontalDistributionChart/HorizontalDistributionChart.tsx (100%) rename frontend/src/component/{executiveDashboard/components/DashboardHeader/DashboardHeader.tsx => insights/components/InsightsHeader/InsightsHeader.tsx} (98%) rename frontend/src/component/{executiveDashboard/components/DashboardHeader => insights/components/InsightsHeader}/ShareLink/ShareLink.tsx (100%) rename frontend/src/component/{executiveDashboard => insights}/components/LineChart/ChartTooltip/ChartTooltip.tsx (100%) rename frontend/src/component/{executiveDashboard => insights}/components/LineChart/LineChart.tsx (100%) rename frontend/src/component/{executiveDashboard => insights}/components/LineChart/LineChartComponent.tsx (100%) rename frontend/src/component/{executiveDashboard => insights}/components/LineChart/createChartOptions.ts (100%) rename frontend/src/component/{executiveDashboard => insights}/components/LineChart/createTooltip.ts (100%) rename frontend/src/component/{executiveDashboard => insights}/components/LineChart/legendOptions.ts (100%) rename frontend/src/component/{executiveDashboard => insights}/components/Widget/Widget.tsx (100%) rename frontend/src/component/{executiveDashboard => insights}/componentsChart/FlagsChart/FlagsChart.tsx (82%) rename frontend/src/component/{executiveDashboard => insights}/componentsChart/FlagsProjectChart/FlagsProjectChart.tsx (66%) rename frontend/src/component/{executiveDashboard => insights}/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip-InfoSummary.test.tsx (100%) rename frontend/src/component/{executiveDashboard => insights}/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip.tsx (95%) rename frontend/src/component/{executiveDashboard => insights}/componentsChart/MetricsSummaryChart/MetricsChartTooltip/aggregate-metrics-by-day.test.ts (100%) rename frontend/src/component/{executiveDashboard => insights}/componentsChart/MetricsSummaryChart/MetricsChartTooltip/aggregate-metrics-by-day.ts (87%) rename frontend/src/component/{executiveDashboard => insights}/componentsChart/MetricsSummaryChart/MetricsSummaryChart.tsx (84%) rename frontend/src/component/{executiveDashboard => insights}/componentsChart/ProjectHealthChart/HealthChartTooltip/HealthChartTooltip.tsx (93%) rename frontend/src/component/{executiveDashboard => insights}/componentsChart/ProjectHealthChart/ProjectHealthChart.tsx (90%) rename frontend/src/component/{executiveDashboard => insights}/componentsChart/TimeToProductionChart/TimeToProductionChart.tsx (85%) rename frontend/src/component/{executiveDashboard => insights}/componentsChart/TimeToProductionChart/TimeToProductionTooltip/TimeToProductionTooltip.tsx (93%) rename frontend/src/component/{executiveDashboard => insights}/componentsChart/TimeToProductionChart/median-time-to-production.test.ts (87%) rename frontend/src/component/{executiveDashboard => insights}/componentsChart/TimeToProductionChart/median-time-to-production.ts (89%) rename frontend/src/component/{executiveDashboard => insights}/componentsChart/UpdatesPerEnvironmentTypeChart/UpdatesPerEnvironmentTypeChart.tsx (84%) rename frontend/src/component/{executiveDashboard => insights}/componentsChart/UpdatesPerEnvironmentTypeChart/UpdatesPerEnvironmentTypeChartTooltip/UpdatesPerEnvironmentTypeChartTooltip.tsx (93%) rename frontend/src/component/{executiveDashboard => insights}/componentsChart/UsersChart/UsersChart.tsx (89%) rename frontend/src/component/{executiveDashboard => insights}/componentsChart/UsersPerProjectChart/UsersPerProjectChart.tsx (66%) rename frontend/src/component/{executiveDashboard => insights}/componentsStat/FlagStats/FlagStats.tsx (100%) rename frontend/src/component/{executiveDashboard => insights}/componentsStat/HealthStats/HealthStats.tsx (100%) rename frontend/src/component/{executiveDashboard => insights}/componentsStat/TimeToProduction/TimeToProduction.tsx (97%) rename frontend/src/component/{executiveDashboard => insights}/componentsStat/UserStats/UserDistributionInfo.tsx (100%) rename frontend/src/component/{executiveDashboard => insights}/componentsStat/UserStats/UserStats.tsx (100%) rename frontend/src/component/{executiveDashboard => insights}/hooks/useFilteredFlagsSummary.test.ts (93%) rename frontend/src/component/{executiveDashboard => insights}/hooks/useFilteredFlagsSummary.ts (90%) rename frontend/src/component/{executiveDashboard => insights}/hooks/useFilteredTrends.test.ts (100%) rename frontend/src/component/{executiveDashboard => insights}/hooks/useFilteredTrends.ts (100%) rename frontend/src/component/{executiveDashboard => insights}/hooks/useGroupedProjectTrends.test.ts (100%) rename frontend/src/component/{executiveDashboard => insights}/hooks/useGroupedProjectTrends.ts (100%) rename frontend/src/component/{executiveDashboard/hooks/useDashboardData.ts => insights/hooks/useInsightsData.ts} (91%) rename frontend/src/component/{executiveDashboard => insights}/hooks/useMedianTimeToProduction.test.ts (100%) rename frontend/src/component/{executiveDashboard => insights}/hooks/useMedianTimeToProduction.ts (85%) rename frontend/src/component/{executiveDashboard => insights}/hooks/useMetricsSummary.ts (88%) rename frontend/src/component/{executiveDashboard => insights}/hooks/usePlaceholderData.ts (100%) rename frontend/src/component/{executiveDashboard => insights}/hooks/useProjectChartData.ts (88%) rename frontend/src/component/{executiveDashboard => insights}/hooks/useProjectColor.ts (100%) rename frontend/src/hooks/api/getters/{useExecutiveSummary/useExecutiveSummary.ts => useInsights/useInsights.ts} (66%) delete mode 100644 frontend/src/openapi/models/executiveSummarySchema.ts create mode 100644 frontend/src/openapi/models/instanceInsightsSchema.ts rename frontend/src/openapi/models/{executiveSummarySchemaEnvironmentTypeTrendsItem.ts => instanceInsightsSchemaEnvironmentTypeTrendsItem.ts} (88%) rename frontend/src/openapi/models/{executiveSummarySchemaFlagTrendsItem.ts => instanceInsightsSchemaFlagTrendsItem.ts} (91%) rename frontend/src/openapi/models/{executiveSummarySchemaFlags.ts => instanceInsightsSchemaFlags.ts} (82%) rename frontend/src/openapi/models/{executiveSummarySchemaMetricsSummaryTrendsItem.ts => instanceInsightsSchemaMetricsSummaryTrendsItem.ts} (94%) rename frontend/src/openapi/models/{executiveSummarySchemaProjectFlagTrendsItem.ts => instanceInsightsSchemaProjectFlagTrendsItem.ts} (95%) rename frontend/src/openapi/models/{executiveSummarySchemaUserTrendsItem.ts => instanceInsightsSchemaUserTrendsItem.ts} (89%) rename frontend/src/openapi/models/{executiveSummarySchemaUsers.ts => instanceInsightsSchemaUsers.ts} (90%) diff --git a/frontend/src/component/executiveDashboard/ExecutiveDashboard.tsx b/frontend/src/component/insights/Insights.tsx similarity index 76% rename from frontend/src/component/executiveDashboard/ExecutiveDashboard.tsx rename to frontend/src/component/insights/Insights.tsx index 8dfb63839d0..efeb3a74061 100644 --- a/frontend/src/component/executiveDashboard/ExecutiveDashboard.tsx +++ b/frontend/src/component/insights/Insights.tsx @@ -6,10 +6,10 @@ import { allOption, ProjectSelect, } from 'component/common/ProjectSelect/ProjectSelect'; -import { useExecutiveDashboard } from 'hooks/api/getters/useExecutiveSummary/useExecutiveSummary'; -import { DashboardHeader } from './components/DashboardHeader/DashboardHeader'; -import { useDashboardData } from './hooks/useDashboardData'; -import { Charts } from './Charts'; +import { useInsights } from 'hooks/api/getters/useInsights/useInsights'; +import { InsightsHeader } from './components/InsightsHeader/InsightsHeader'; +import { useInsightsData } from './hooks/useInsightsData'; +import { InsightsCharts } from './InsightsCharts'; const StickyWrapper = styled(Box, { shouldForwardProp: (prop) => prop !== 'scrolled', @@ -22,9 +22,9 @@ const StickyWrapper = styled(Box, { transition: 'padding 0.3s ease', })); -export const ExecutiveDashboard: VFC = () => { +export const Insights: VFC = () => { const [scrolled, setScrolled] = useState(false); - const { executiveDashboardData, loading, error } = useExecutiveDashboard(); + const { insights, loading, error } = useInsights(); const stateConfig = { projects: withDefault(ArrayParam, [allOption.id]), }; @@ -36,7 +36,7 @@ export const ExecutiveDashboard: VFC = () => { ? (state.projects.filter(Boolean) as string[]) : []; - const dashboardData = useDashboardData(executiveDashboardData, projects); + const insightsData = useInsightsData(insights, projects); const handleScroll = () => { if (!scrolled && window.scrollY > 0) { @@ -53,7 +53,7 @@ export const ExecutiveDashboard: VFC = () => { return ( <> - { } /> - + ); }; diff --git a/frontend/src/component/executiveDashboard/Charts.tsx b/frontend/src/component/insights/InsightsCharts.tsx similarity index 93% rename from frontend/src/component/executiveDashboard/Charts.tsx rename to frontend/src/component/insights/InsightsCharts.tsx index a5ddf79c59c..9a3a71f6d5c 100644 --- a/frontend/src/component/executiveDashboard/Charts.tsx +++ b/frontend/src/component/insights/InsightsCharts.tsx @@ -12,7 +12,7 @@ import { TimeToProduction } from './componentsStat/TimeToProduction/TimeToProduc import { TimeToProductionChart } from './componentsChart/TimeToProductionChart/TimeToProductionChart'; import { MetricsSummaryChart } from './componentsChart/MetricsSummaryChart/MetricsSummaryChart'; import { UpdatesPerEnvironmentTypeChart } from './componentsChart/UpdatesPerEnvironmentTypeChart/UpdatesPerEnvironmentTypeChart'; -import type { ExecutiveSummarySchema } from '../../openapi'; +import type { InstanceInsightsSchema } from 'openapi'; import type { GroupedDataByProject } from './hooks/useGroupedProjectTrends'; import { Box, styled } from '@mui/material'; import { allOption } from '../common/ProjectSelect/ProjectSelect'; @@ -20,18 +20,18 @@ import type { VFC } from 'react'; import { chartInfo } from './chart-info'; interface IChartsProps { - flagTrends: ExecutiveSummarySchema['flagTrends']; - projectsData: ExecutiveSummarySchema['projectFlagTrends']; + flagTrends: InstanceInsightsSchema['flagTrends']; + projectsData: InstanceInsightsSchema['projectFlagTrends']; groupedProjectsData: GroupedDataByProject< - ExecutiveSummarySchema['projectFlagTrends'] + InstanceInsightsSchema['projectFlagTrends'] >; - metricsData: ExecutiveSummarySchema['metricsSummaryTrends']; + metricsData: InstanceInsightsSchema['metricsSummaryTrends']; groupedMetricsData: GroupedDataByProject< - ExecutiveSummarySchema['metricsSummaryTrends'] + InstanceInsightsSchema['metricsSummaryTrends'] >; - users: ExecutiveSummarySchema['users']; - userTrends: ExecutiveSummarySchema['userTrends']; - environmentTypeTrends: ExecutiveSummarySchema['environmentTypeTrends']; + users: InstanceInsightsSchema['users']; + userTrends: InstanceInsightsSchema['userTrends']; + environmentTypeTrends: InstanceInsightsSchema['environmentTypeTrends']; summary: { total: number; active: number; @@ -64,7 +64,7 @@ const ChartWidget = styled(Widget)(({ theme }) => ({ }, })); -export const Charts: VFC = ({ +export const InsightsCharts: VFC = ({ projects, users, summary, diff --git a/frontend/src/component/executiveDashboard/chart-info.ts b/frontend/src/component/insights/chart-info.ts similarity index 100% rename from frontend/src/component/executiveDashboard/chart-info.ts rename to frontend/src/component/insights/chart-info.ts diff --git a/frontend/src/component/executiveDashboard/components/Gauge/Gauge.tsx b/frontend/src/component/insights/components/Gauge/Gauge.tsx similarity index 100% rename from frontend/src/component/executiveDashboard/components/Gauge/Gauge.tsx rename to frontend/src/component/insights/components/Gauge/Gauge.tsx diff --git a/frontend/src/component/executiveDashboard/components/HorizontalDistributionChart/HorizontalDistributionChart.tsx b/frontend/src/component/insights/components/HorizontalDistributionChart/HorizontalDistributionChart.tsx similarity index 100% rename from frontend/src/component/executiveDashboard/components/HorizontalDistributionChart/HorizontalDistributionChart.tsx rename to frontend/src/component/insights/components/HorizontalDistributionChart/HorizontalDistributionChart.tsx diff --git a/frontend/src/component/executiveDashboard/components/DashboardHeader/DashboardHeader.tsx b/frontend/src/component/insights/components/InsightsHeader/InsightsHeader.tsx similarity index 98% rename from frontend/src/component/executiveDashboard/components/DashboardHeader/DashboardHeader.tsx rename to frontend/src/component/insights/components/InsightsHeader/InsightsHeader.tsx index b342c61e4cf..75fc56a9c34 100644 --- a/frontend/src/component/executiveDashboard/components/DashboardHeader/DashboardHeader.tsx +++ b/frontend/src/component/insights/components/InsightsHeader/InsightsHeader.tsx @@ -49,7 +49,7 @@ const StyledActionsSmallScreen = styled('div')(({ theme }) => ({ marginTop: theme.spacing(2), })); -export const DashboardHeader: VFC = ({ actions }) => { +export const InsightsHeader: VFC = ({ actions }) => { const showInactiveUsers = useUiFlag('showInactiveUsers'); const theme = useTheme(); const isSmallScreen = useMediaQuery(theme.breakpoints.down('md')); diff --git a/frontend/src/component/executiveDashboard/components/DashboardHeader/ShareLink/ShareLink.tsx b/frontend/src/component/insights/components/InsightsHeader/ShareLink/ShareLink.tsx similarity index 100% rename from frontend/src/component/executiveDashboard/components/DashboardHeader/ShareLink/ShareLink.tsx rename to frontend/src/component/insights/components/InsightsHeader/ShareLink/ShareLink.tsx diff --git a/frontend/src/component/executiveDashboard/components/LineChart/ChartTooltip/ChartTooltip.tsx b/frontend/src/component/insights/components/LineChart/ChartTooltip/ChartTooltip.tsx similarity index 100% rename from frontend/src/component/executiveDashboard/components/LineChart/ChartTooltip/ChartTooltip.tsx rename to frontend/src/component/insights/components/LineChart/ChartTooltip/ChartTooltip.tsx diff --git a/frontend/src/component/executiveDashboard/components/LineChart/LineChart.tsx b/frontend/src/component/insights/components/LineChart/LineChart.tsx similarity index 100% rename from frontend/src/component/executiveDashboard/components/LineChart/LineChart.tsx rename to frontend/src/component/insights/components/LineChart/LineChart.tsx diff --git a/frontend/src/component/executiveDashboard/components/LineChart/LineChartComponent.tsx b/frontend/src/component/insights/components/LineChart/LineChartComponent.tsx similarity index 100% rename from frontend/src/component/executiveDashboard/components/LineChart/LineChartComponent.tsx rename to frontend/src/component/insights/components/LineChart/LineChartComponent.tsx diff --git a/frontend/src/component/executiveDashboard/components/LineChart/createChartOptions.ts b/frontend/src/component/insights/components/LineChart/createChartOptions.ts similarity index 100% rename from frontend/src/component/executiveDashboard/components/LineChart/createChartOptions.ts rename to frontend/src/component/insights/components/LineChart/createChartOptions.ts diff --git a/frontend/src/component/executiveDashboard/components/LineChart/createTooltip.ts b/frontend/src/component/insights/components/LineChart/createTooltip.ts similarity index 100% rename from frontend/src/component/executiveDashboard/components/LineChart/createTooltip.ts rename to frontend/src/component/insights/components/LineChart/createTooltip.ts diff --git a/frontend/src/component/executiveDashboard/components/LineChart/legendOptions.ts b/frontend/src/component/insights/components/LineChart/legendOptions.ts similarity index 100% rename from frontend/src/component/executiveDashboard/components/LineChart/legendOptions.ts rename to frontend/src/component/insights/components/LineChart/legendOptions.ts diff --git a/frontend/src/component/executiveDashboard/components/Widget/Widget.tsx b/frontend/src/component/insights/components/Widget/Widget.tsx similarity index 100% rename from frontend/src/component/executiveDashboard/components/Widget/Widget.tsx rename to frontend/src/component/insights/components/Widget/Widget.tsx diff --git a/frontend/src/component/executiveDashboard/componentsChart/FlagsChart/FlagsChart.tsx b/frontend/src/component/insights/componentsChart/FlagsChart/FlagsChart.tsx similarity index 82% rename from frontend/src/component/executiveDashboard/componentsChart/FlagsChart/FlagsChart.tsx rename to frontend/src/component/insights/componentsChart/FlagsChart/FlagsChart.tsx index 0ef77bc6527..270c2810860 100644 --- a/frontend/src/component/executiveDashboard/componentsChart/FlagsChart/FlagsChart.tsx +++ b/frontend/src/component/insights/componentsChart/FlagsChart/FlagsChart.tsx @@ -1,12 +1,15 @@ import { useMemo, type VFC } from 'react'; import 'chartjs-adapter-date-fns'; import { useTheme } from '@mui/material'; -import type { ExecutiveSummarySchema } from 'openapi'; -import { LineChart, NotEnoughData } from '../../components/LineChart/LineChart'; -import { usePlaceholderData } from 'component/executiveDashboard/hooks/usePlaceholderData'; +import type { InstanceInsightsSchema } from 'openapi'; +import { + LineChart, + NotEnoughData, +} from 'component/insights/components/LineChart/LineChart'; +import { usePlaceholderData } from 'component/insights/hooks/usePlaceholderData'; interface IFlagsChartProps { - flagTrends: ExecutiveSummarySchema['flagTrends']; + flagTrends: InstanceInsightsSchema['flagTrends']; isLoading?: boolean; } diff --git a/frontend/src/component/executiveDashboard/componentsChart/FlagsProjectChart/FlagsProjectChart.tsx b/frontend/src/component/insights/componentsChart/FlagsProjectChart/FlagsProjectChart.tsx similarity index 66% rename from frontend/src/component/executiveDashboard/componentsChart/FlagsProjectChart/FlagsProjectChart.tsx rename to frontend/src/component/insights/componentsChart/FlagsProjectChart/FlagsProjectChart.tsx index 5b5bc26ca2a..6b8564be2ac 100644 --- a/frontend/src/component/executiveDashboard/componentsChart/FlagsProjectChart/FlagsProjectChart.tsx +++ b/frontend/src/component/insights/componentsChart/FlagsProjectChart/FlagsProjectChart.tsx @@ -1,14 +1,17 @@ import { useMemo, type VFC } from 'react'; import 'chartjs-adapter-date-fns'; -import type { ExecutiveSummarySchema } from 'openapi'; -import { LineChart, NotEnoughData } from '../../components/LineChart/LineChart'; -import { useProjectChartData } from 'component/executiveDashboard/hooks/useProjectChartData'; -import { usePlaceholderData } from 'component/executiveDashboard/hooks/usePlaceholderData'; -import type { GroupedDataByProject } from '../../hooks/useGroupedProjectTrends'; +import type { InstanceInsightsSchema } from 'openapi'; +import { + LineChart, + NotEnoughData, +} from 'component/insights/components/LineChart/LineChart'; +import { useProjectChartData } from 'component/insights/hooks/useProjectChartData'; +import { usePlaceholderData } from 'component/insights/hooks/usePlaceholderData'; +import type { GroupedDataByProject } from 'component/insights/hooks/useGroupedProjectTrends'; interface IFlagsProjectChartProps { projectFlagTrends: GroupedDataByProject< - ExecutiveSummarySchema['projectFlagTrends'] + InstanceInsightsSchema['projectFlagTrends'] >; } diff --git a/frontend/src/component/executiveDashboard/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip-InfoSummary.test.tsx b/frontend/src/component/insights/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip-InfoSummary.test.tsx similarity index 100% rename from frontend/src/component/executiveDashboard/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip-InfoSummary.test.tsx rename to frontend/src/component/insights/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip-InfoSummary.test.tsx diff --git a/frontend/src/component/executiveDashboard/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip.tsx b/frontend/src/component/insights/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip.tsx similarity index 95% rename from frontend/src/component/executiveDashboard/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip.tsx rename to frontend/src/component/insights/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip.tsx index 73c223dc815..6cd3c5b48e4 100644 --- a/frontend/src/component/executiveDashboard/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip.tsx +++ b/frontend/src/component/insights/componentsChart/MetricsSummaryChart/MetricsChartTooltip/MetricsChartTooltip.tsx @@ -1,7 +1,7 @@ import type { VFC } from 'react'; -import type { ExecutiveSummarySchemaMetricsSummaryTrendsItem } from 'openapi'; +import type { InstanceInsightsSchemaMetricsSummaryTrendsItem } from 'openapi'; import { Box, Divider, Paper, styled, Typography } from '@mui/material'; -import type { TooltipState } from '../../../components/LineChart/ChartTooltip/ChartTooltip'; +import type { TooltipState } from 'component/insights/components/LineChart/ChartTooltip/ChartTooltip'; const StyledTooltipItemContainer = styled(Paper)(({ theme }) => ({ padding: theme.spacing(2), @@ -66,7 +66,7 @@ export const MetricsSummaryTooltip: VFC<{ tooltip: TooltipState | null }> = ({ label: point.label, title: point.dataset.label, color: point.dataset.borderColor, - value: point.raw as ExecutiveSummarySchemaMetricsSummaryTrendsItem & { + value: point.raw as InstanceInsightsSchemaMetricsSummaryTrendsItem & { total: number; }, }; diff --git a/frontend/src/component/executiveDashboard/componentsChart/MetricsSummaryChart/MetricsChartTooltip/aggregate-metrics-by-day.test.ts b/frontend/src/component/insights/componentsChart/MetricsSummaryChart/MetricsChartTooltip/aggregate-metrics-by-day.test.ts similarity index 100% rename from frontend/src/component/executiveDashboard/componentsChart/MetricsSummaryChart/MetricsChartTooltip/aggregate-metrics-by-day.test.ts rename to frontend/src/component/insights/componentsChart/MetricsSummaryChart/MetricsChartTooltip/aggregate-metrics-by-day.test.ts diff --git a/frontend/src/component/executiveDashboard/componentsChart/MetricsSummaryChart/MetricsChartTooltip/aggregate-metrics-by-day.ts b/frontend/src/component/insights/componentsChart/MetricsSummaryChart/MetricsChartTooltip/aggregate-metrics-by-day.ts similarity index 87% rename from frontend/src/component/executiveDashboard/componentsChart/MetricsSummaryChart/MetricsChartTooltip/aggregate-metrics-by-day.ts rename to frontend/src/component/insights/componentsChart/MetricsSummaryChart/MetricsChartTooltip/aggregate-metrics-by-day.ts index 84916011da0..9008857bee1 100644 --- a/frontend/src/component/executiveDashboard/componentsChart/MetricsSummaryChart/MetricsChartTooltip/aggregate-metrics-by-day.ts +++ b/frontend/src/component/insights/componentsChart/MetricsSummaryChart/MetricsChartTooltip/aggregate-metrics-by-day.ts @@ -1,7 +1,7 @@ -import type { ExecutiveSummarySchema } from 'openapi'; +import type { InstanceInsightsSchema } from 'openapi'; export function aggregateDataPerDate( - items: ExecutiveSummarySchema['metricsSummaryTrends'], + items: InstanceInsightsSchema['metricsSummaryTrends'], ) { return items.reduce( (acc, item) => { diff --git a/frontend/src/component/executiveDashboard/componentsChart/MetricsSummaryChart/MetricsSummaryChart.tsx b/frontend/src/component/insights/componentsChart/MetricsSummaryChart/MetricsSummaryChart.tsx similarity index 84% rename from frontend/src/component/executiveDashboard/componentsChart/MetricsSummaryChart/MetricsSummaryChart.tsx rename to frontend/src/component/insights/componentsChart/MetricsSummaryChart/MetricsSummaryChart.tsx index cc2871a4948..c0a35b38326 100644 --- a/frontend/src/component/executiveDashboard/componentsChart/MetricsSummaryChart/MetricsSummaryChart.tsx +++ b/frontend/src/component/insights/componentsChart/MetricsSummaryChart/MetricsSummaryChart.tsx @@ -1,22 +1,22 @@ import { useMemo, type VFC } from 'react'; import 'chartjs-adapter-date-fns'; -import type { ExecutiveSummarySchema } from 'openapi'; +import type { InstanceInsightsSchema } from 'openapi'; import { fillGradientPrimary, LineChart, NotEnoughData, -} from '../../components/LineChart/LineChart'; +} from 'component/insights/components/LineChart/LineChart'; import { MetricsSummaryTooltip } from './MetricsChartTooltip/MetricsChartTooltip'; -import { useMetricsSummary } from '../../hooks/useMetricsSummary'; -import { usePlaceholderData } from 'component/executiveDashboard/hooks/usePlaceholderData'; -import type { GroupedDataByProject } from '../../hooks/useGroupedProjectTrends'; +import { useMetricsSummary } from 'component/insights/hooks/useMetricsSummary'; +import { usePlaceholderData } from 'component/insights/hooks/usePlaceholderData'; +import type { GroupedDataByProject } from 'component/insights/hooks/useGroupedProjectTrends'; import { useTheme } from '@mui/material'; import { aggregateDataPerDate } from './MetricsChartTooltip/aggregate-metrics-by-day'; interface IMetricsSummaryChartProps { metricsSummaryTrends: GroupedDataByProject< - ExecutiveSummarySchema['metricsSummaryTrends'] + InstanceInsightsSchema['metricsSummaryTrends'] >; isAggregate?: boolean; } diff --git a/frontend/src/component/executiveDashboard/componentsChart/ProjectHealthChart/HealthChartTooltip/HealthChartTooltip.tsx b/frontend/src/component/insights/componentsChart/ProjectHealthChart/HealthChartTooltip/HealthChartTooltip.tsx similarity index 93% rename from frontend/src/component/executiveDashboard/componentsChart/ProjectHealthChart/HealthChartTooltip/HealthChartTooltip.tsx rename to frontend/src/component/insights/componentsChart/ProjectHealthChart/HealthChartTooltip/HealthChartTooltip.tsx index f9219e521e5..2dd3a99c8f5 100644 --- a/frontend/src/component/executiveDashboard/componentsChart/ProjectHealthChart/HealthChartTooltip/HealthChartTooltip.tsx +++ b/frontend/src/component/insights/componentsChart/ProjectHealthChart/HealthChartTooltip/HealthChartTooltip.tsx @@ -1,9 +1,9 @@ import type { VFC } from 'react'; -import type { ExecutiveSummarySchemaProjectFlagTrendsItem } from 'openapi'; +import type { InstanceInsightsSchemaProjectFlagTrendsItem } from 'openapi'; import { Box, Divider, Paper, Typography, styled } from '@mui/material'; import { Badge } from 'component/common/Badge/Badge'; -import type { TooltipState } from '../../../components/LineChart/ChartTooltip/ChartTooltip'; -import { HorizontalDistributionChart } from '../../../components/HorizontalDistributionChart/HorizontalDistributionChart'; +import type { TooltipState } from 'component/insights/components/LineChart/ChartTooltip/ChartTooltip'; +import { HorizontalDistributionChart } from 'component/insights/components/HorizontalDistributionChart/HorizontalDistributionChart'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; const StyledTooltipItemContainer = styled(Paper)(({ theme }) => ({ @@ -89,7 +89,7 @@ export const HealthTooltip: VFC<{ tooltip: TooltipState | null }> = ({ label: point.label, title: point.dataset.label, color: point.dataset.borderColor, - value: point.raw as ExecutiveSummarySchemaProjectFlagTrendsItem, + value: point.raw as InstanceInsightsSchemaProjectFlagTrendsItem, }; }); diff --git a/frontend/src/component/executiveDashboard/componentsChart/ProjectHealthChart/ProjectHealthChart.tsx b/frontend/src/component/insights/componentsChart/ProjectHealthChart/ProjectHealthChart.tsx similarity index 90% rename from frontend/src/component/executiveDashboard/componentsChart/ProjectHealthChart/ProjectHealthChart.tsx rename to frontend/src/component/insights/componentsChart/ProjectHealthChart/ProjectHealthChart.tsx index b6cec83424b..766b571dd05 100644 --- a/frontend/src/component/executiveDashboard/componentsChart/ProjectHealthChart/ProjectHealthChart.tsx +++ b/frontend/src/component/insights/componentsChart/ProjectHealthChart/ProjectHealthChart.tsx @@ -1,19 +1,19 @@ import 'chartjs-adapter-date-fns'; import { useMemo, type VFC } from 'react'; -import type { ExecutiveSummarySchema } from 'openapi'; +import type { InstanceInsightsSchema } from 'openapi'; import { HealthTooltip } from './HealthChartTooltip/HealthChartTooltip'; -import { useProjectChartData } from 'component/executiveDashboard/hooks/useProjectChartData'; +import { useProjectChartData } from 'component/insights/hooks/useProjectChartData'; import { fillGradientPrimary, LineChart, NotEnoughData, -} from 'component/executiveDashboard/components/LineChart/LineChart'; +} from 'component/insights/components/LineChart/LineChart'; import { useTheme } from '@mui/material'; -import type { GroupedDataByProject } from '../../hooks/useGroupedProjectTrends'; +import type { GroupedDataByProject } from 'component/insights/hooks/useGroupedProjectTrends'; interface IProjectHealthChartProps { projectFlagTrends: GroupedDataByProject< - ExecutiveSummarySchema['projectFlagTrends'] + InstanceInsightsSchema['projectFlagTrends'] >; isAggregate?: boolean; } diff --git a/frontend/src/component/executiveDashboard/componentsChart/TimeToProductionChart/TimeToProductionChart.tsx b/frontend/src/component/insights/componentsChart/TimeToProductionChart/TimeToProductionChart.tsx similarity index 85% rename from frontend/src/component/executiveDashboard/componentsChart/TimeToProductionChart/TimeToProductionChart.tsx rename to frontend/src/component/insights/componentsChart/TimeToProductionChart/TimeToProductionChart.tsx index 280f56b99e5..71392391a2b 100644 --- a/frontend/src/component/executiveDashboard/componentsChart/TimeToProductionChart/TimeToProductionChart.tsx +++ b/frontend/src/component/insights/componentsChart/TimeToProductionChart/TimeToProductionChart.tsx @@ -1,21 +1,21 @@ import { useMemo, type VFC } from 'react'; import 'chartjs-adapter-date-fns'; -import type { ExecutiveSummarySchema } from 'openapi'; +import type { InstanceInsightsSchema } from 'openapi'; import { fillGradientPrimary, LineChart, NotEnoughData, -} from '../../components/LineChart/LineChart'; -import { useProjectChartData } from '../../hooks/useProjectChartData'; -import type { GroupedDataByProject } from '../../hooks/useGroupedProjectTrends'; -import { usePlaceholderData } from '../../hooks/usePlaceholderData'; +} from 'component/insights/components/LineChart/LineChart'; +import { useProjectChartData } from 'component/insights/hooks/useProjectChartData'; +import type { GroupedDataByProject } from 'component/insights/hooks/useGroupedProjectTrends'; +import { usePlaceholderData } from 'component/insights/hooks/usePlaceholderData'; import { TimeToProductionTooltip } from './TimeToProductionTooltip/TimeToProductionTooltip'; import { useTheme } from '@mui/material'; import { medianTimeToProduction } from './median-time-to-production'; interface ITimeToProductionChartProps { projectFlagTrends: GroupedDataByProject< - ExecutiveSummarySchema['projectFlagTrends'] + InstanceInsightsSchema['projectFlagTrends'] >; isAggregate?: boolean; } diff --git a/frontend/src/component/executiveDashboard/componentsChart/TimeToProductionChart/TimeToProductionTooltip/TimeToProductionTooltip.tsx b/frontend/src/component/insights/componentsChart/TimeToProductionChart/TimeToProductionTooltip/TimeToProductionTooltip.tsx similarity index 93% rename from frontend/src/component/executiveDashboard/componentsChart/TimeToProductionChart/TimeToProductionTooltip/TimeToProductionTooltip.tsx rename to frontend/src/component/insights/componentsChart/TimeToProductionChart/TimeToProductionTooltip/TimeToProductionTooltip.tsx index 15e9c7d1805..ded06ffba29 100644 --- a/frontend/src/component/executiveDashboard/componentsChart/TimeToProductionChart/TimeToProductionTooltip/TimeToProductionTooltip.tsx +++ b/frontend/src/component/insights/componentsChart/TimeToProductionChart/TimeToProductionTooltip/TimeToProductionTooltip.tsx @@ -1,8 +1,8 @@ import type { VFC } from 'react'; -import type { ExecutiveSummarySchemaProjectFlagTrendsItem } from 'openapi'; +import type { InstanceInsightsSchemaProjectFlagTrendsItem } from 'openapi'; import { Box, Paper, Typography, styled } from '@mui/material'; import { Badge } from 'component/common/Badge/Badge'; -import type { TooltipState } from '../../../components/LineChart/ChartTooltip/ChartTooltip'; +import type { TooltipState } from 'component/insights/components/LineChart/ChartTooltip/ChartTooltip'; const StyledTooltipItemContainer = styled(Paper)(({ theme }) => ({ padding: theme.spacing(2), @@ -62,7 +62,7 @@ export const TimeToProductionTooltip: VFC<{ tooltip: TooltipState | null }> = ({ label: point.label, title: point.dataset.label, color: point.dataset.borderColor, - value: point.raw as ExecutiveSummarySchemaProjectFlagTrendsItem, + value: point.raw as InstanceInsightsSchemaProjectFlagTrendsItem, }; }); diff --git a/frontend/src/component/executiveDashboard/componentsChart/TimeToProductionChart/median-time-to-production.test.ts b/frontend/src/component/insights/componentsChart/TimeToProductionChart/median-time-to-production.test.ts similarity index 87% rename from frontend/src/component/executiveDashboard/componentsChart/TimeToProductionChart/median-time-to-production.test.ts rename to frontend/src/component/insights/componentsChart/TimeToProductionChart/median-time-to-production.test.ts index 10eb75a7b34..36bf79d8e3d 100644 --- a/frontend/src/component/executiveDashboard/componentsChart/TimeToProductionChart/median-time-to-production.test.ts +++ b/frontend/src/component/insights/componentsChart/TimeToProductionChart/median-time-to-production.test.ts @@ -1,5 +1,5 @@ import { medianTimeToProduction } from './median-time-to-production'; -import type { ExecutiveSummarySchema } from 'openapi'; +import type { InstanceInsightsSchema } from 'openapi'; describe('medianTimeToProduction', () => { it('calculates the median with a single date and an odd number of projects', () => { @@ -7,7 +7,7 @@ describe('medianTimeToProduction', () => { { date: '2023-03-21', timeToProduction: 10 }, { date: '2023-03-21', timeToProduction: 20 }, { date: '2023-03-21', timeToProduction: 30 }, - ] as unknown as ExecutiveSummarySchema['projectFlagTrends']; + ] as unknown as InstanceInsightsSchema['projectFlagTrends']; const expected = { '2023-03-21': 20 }; expect(medianTimeToProduction(projectsData)).toEqual(expected); }); @@ -18,7 +18,7 @@ describe('medianTimeToProduction', () => { { date: '2023-03-22', timeToProduction: 20 }, { date: '2023-03-22', timeToProduction: 30 }, { date: '2023-03-22', timeToProduction: 40 }, - ] as unknown as ExecutiveSummarySchema['projectFlagTrends']; + ] as unknown as InstanceInsightsSchema['projectFlagTrends']; const expected = { '2023-03-22': 25 }; expect(medianTimeToProduction(projectsData)).toEqual(expected); }); @@ -31,7 +31,7 @@ describe('medianTimeToProduction', () => { { date: '2023-03-24', timeToProduction: 20 }, { date: '2023-03-24', timeToProduction: 30 }, { date: '2023-03-25', timeToProduction: 25 }, - ] as unknown as ExecutiveSummarySchema['projectFlagTrends']; + ] as unknown as InstanceInsightsSchema['projectFlagTrends']; const expected = { '2023-03-23': 10, '2023-03-24': 20, diff --git a/frontend/src/component/executiveDashboard/componentsChart/TimeToProductionChart/median-time-to-production.ts b/frontend/src/component/insights/componentsChart/TimeToProductionChart/median-time-to-production.ts similarity index 89% rename from frontend/src/component/executiveDashboard/componentsChart/TimeToProductionChart/median-time-to-production.ts rename to frontend/src/component/insights/componentsChart/TimeToProductionChart/median-time-to-production.ts index 1fe3507b117..4aede05874c 100644 --- a/frontend/src/component/executiveDashboard/componentsChart/TimeToProductionChart/median-time-to-production.ts +++ b/frontend/src/component/insights/componentsChart/TimeToProductionChart/median-time-to-production.ts @@ -1,11 +1,11 @@ -import type { ExecutiveSummarySchema } from 'openapi'; +import type { InstanceInsightsSchema } from 'openapi'; type GroupedDataByDate = Record; type DateResult = Record; export function medianTimeToProduction( - projectsData: ExecutiveSummarySchema['projectFlagTrends'], + projectsData: InstanceInsightsSchema['projectFlagTrends'], ): DateResult { const groupedData: GroupedDataByDate = {}; projectsData.forEach((item) => { diff --git a/frontend/src/component/executiveDashboard/componentsChart/UpdatesPerEnvironmentTypeChart/UpdatesPerEnvironmentTypeChart.tsx b/frontend/src/component/insights/componentsChart/UpdatesPerEnvironmentTypeChart/UpdatesPerEnvironmentTypeChart.tsx similarity index 84% rename from frontend/src/component/executiveDashboard/componentsChart/UpdatesPerEnvironmentTypeChart/UpdatesPerEnvironmentTypeChart.tsx rename to frontend/src/component/insights/componentsChart/UpdatesPerEnvironmentTypeChart/UpdatesPerEnvironmentTypeChart.tsx index ccf457d5b76..04cf5bbf495 100644 --- a/frontend/src/component/executiveDashboard/componentsChart/UpdatesPerEnvironmentTypeChart/UpdatesPerEnvironmentTypeChart.tsx +++ b/frontend/src/component/insights/componentsChart/UpdatesPerEnvironmentTypeChart/UpdatesPerEnvironmentTypeChart.tsx @@ -2,21 +2,24 @@ import { useMemo, type VFC } from 'react'; import 'chartjs-adapter-date-fns'; import { useTheme } from '@mui/material'; import type { - ExecutiveSummarySchema, - ExecutiveSummarySchemaEnvironmentTypeTrendsItem, + InstanceInsightsSchema, + InstanceInsightsSchemaEnvironmentTypeTrendsItem, } from 'openapi'; -import { LineChart, NotEnoughData } from '../../components/LineChart/LineChart'; -import { usePlaceholderData } from 'component/executiveDashboard/hooks/usePlaceholderData'; +import { + LineChart, + NotEnoughData, +} from 'component/insights/components/LineChart/LineChart'; +import { usePlaceholderData } from 'component/insights/hooks/usePlaceholderData'; import { UpdatesPerEnvironmentTypeChartTooltip } from './UpdatesPerEnvironmentTypeChartTooltip/UpdatesPerEnvironmentTypeChartTooltip'; interface IUpdatesPerEnvironmnetTypeChart { - environmentTypeTrends: ExecutiveSummarySchema['environmentTypeTrends']; + environmentTypeTrends: InstanceInsightsSchema['environmentTypeTrends']; isLoading?: boolean; } const groupByDate = ( - items: ExecutiveSummarySchemaEnvironmentTypeTrendsItem[], -): Record => { + items: InstanceInsightsSchemaEnvironmentTypeTrendsItem[], +): Record => { if (!items) { return {}; } @@ -33,7 +36,7 @@ const groupByDate = ( return acc; }, - {} as Record, + {} as Record, ); return grouped; diff --git a/frontend/src/component/executiveDashboard/componentsChart/UpdatesPerEnvironmentTypeChart/UpdatesPerEnvironmentTypeChartTooltip/UpdatesPerEnvironmentTypeChartTooltip.tsx b/frontend/src/component/insights/componentsChart/UpdatesPerEnvironmentTypeChart/UpdatesPerEnvironmentTypeChartTooltip/UpdatesPerEnvironmentTypeChartTooltip.tsx similarity index 93% rename from frontend/src/component/executiveDashboard/componentsChart/UpdatesPerEnvironmentTypeChart/UpdatesPerEnvironmentTypeChartTooltip/UpdatesPerEnvironmentTypeChartTooltip.tsx rename to frontend/src/component/insights/componentsChart/UpdatesPerEnvironmentTypeChart/UpdatesPerEnvironmentTypeChartTooltip/UpdatesPerEnvironmentTypeChartTooltip.tsx index 8f5c9337f0c..9e6489ef753 100644 --- a/frontend/src/component/executiveDashboard/componentsChart/UpdatesPerEnvironmentTypeChart/UpdatesPerEnvironmentTypeChartTooltip/UpdatesPerEnvironmentTypeChartTooltip.tsx +++ b/frontend/src/component/insights/componentsChart/UpdatesPerEnvironmentTypeChart/UpdatesPerEnvironmentTypeChartTooltip/UpdatesPerEnvironmentTypeChartTooltip.tsx @@ -1,7 +1,7 @@ import type { VFC } from 'react'; -import type { ExecutiveSummarySchemaEnvironmentTypeTrendsItem } from 'openapi'; +import type { InstanceInsightsSchemaEnvironmentTypeTrendsItem } from 'openapi'; import { Box, Divider, Paper, styled, Typography } from '@mui/material'; -import type { TooltipState } from '../../../components/LineChart/ChartTooltip/ChartTooltip'; +import type { TooltipState } from 'component/insights/components/LineChart/ChartTooltip/ChartTooltip'; const StyledTooltipItemContainer = styled(Paper)(({ theme }) => ({ padding: theme.spacing(2), @@ -64,7 +64,7 @@ export const UpdatesPerEnvironmentTypeChartTooltip: VFC<{ label: point.label, title: point.dataset.label, color: point.dataset.borderColor, - value: point.raw as ExecutiveSummarySchemaEnvironmentTypeTrendsItem, + value: point.raw as InstanceInsightsSchemaEnvironmentTypeTrendsItem, }; }); diff --git a/frontend/src/component/executiveDashboard/componentsChart/UsersChart/UsersChart.tsx b/frontend/src/component/insights/componentsChart/UsersChart/UsersChart.tsx similarity index 89% rename from frontend/src/component/executiveDashboard/componentsChart/UsersChart/UsersChart.tsx rename to frontend/src/component/insights/componentsChart/UsersChart/UsersChart.tsx index 6125704d413..af395ab15ea 100644 --- a/frontend/src/component/executiveDashboard/componentsChart/UsersChart/UsersChart.tsx +++ b/frontend/src/component/insights/componentsChart/UsersChart/UsersChart.tsx @@ -1,17 +1,17 @@ import { useMemo, type VFC } from 'react'; import 'chartjs-adapter-date-fns'; import { useTheme } from '@mui/material'; -import type { ExecutiveSummarySchema } from 'openapi'; +import type { InstanceInsightsSchema } from 'openapi'; import { fillGradientPrimary, LineChart, NotEnoughData, -} from '../../components/LineChart/LineChart'; +} from 'component/insights/components/LineChart/LineChart'; import { useUiFlag } from 'hooks/useUiFlag'; -import { usePlaceholderData } from 'component/executiveDashboard/hooks/usePlaceholderData'; +import { usePlaceholderData } from 'component/insights/hooks/usePlaceholderData'; interface IUsersChartProps { - userTrends: ExecutiveSummarySchema['userTrends']; + userTrends: InstanceInsightsSchema['userTrends']; isLoading?: boolean; } diff --git a/frontend/src/component/executiveDashboard/componentsChart/UsersPerProjectChart/UsersPerProjectChart.tsx b/frontend/src/component/insights/componentsChart/UsersPerProjectChart/UsersPerProjectChart.tsx similarity index 66% rename from frontend/src/component/executiveDashboard/componentsChart/UsersPerProjectChart/UsersPerProjectChart.tsx rename to frontend/src/component/insights/componentsChart/UsersPerProjectChart/UsersPerProjectChart.tsx index bed0ac29258..bc003c0e7eb 100644 --- a/frontend/src/component/executiveDashboard/componentsChart/UsersPerProjectChart/UsersPerProjectChart.tsx +++ b/frontend/src/component/insights/componentsChart/UsersPerProjectChart/UsersPerProjectChart.tsx @@ -1,14 +1,17 @@ import { useMemo, type VFC } from 'react'; import 'chartjs-adapter-date-fns'; -import type { ExecutiveSummarySchema } from 'openapi'; -import { LineChart, NotEnoughData } from '../../components/LineChart/LineChart'; -import { useProjectChartData } from 'component/executiveDashboard/hooks/useProjectChartData'; -import { usePlaceholderData } from 'component/executiveDashboard/hooks/usePlaceholderData'; -import type { GroupedDataByProject } from '../../hooks/useGroupedProjectTrends'; +import type { InstanceInsightsSchema } from 'openapi'; +import { + LineChart, + NotEnoughData, +} from 'component/insights/components/LineChart/LineChart'; +import { useProjectChartData } from 'component/insights/hooks/useProjectChartData'; +import { usePlaceholderData } from 'component/insights/hooks/usePlaceholderData'; +import type { GroupedDataByProject } from 'component/insights/hooks/useGroupedProjectTrends'; interface IUsersPerProjectChartProps { projectFlagTrends: GroupedDataByProject< - ExecutiveSummarySchema['projectFlagTrends'] + InstanceInsightsSchema['projectFlagTrends'] >; } diff --git a/frontend/src/component/executiveDashboard/componentsStat/FlagStats/FlagStats.tsx b/frontend/src/component/insights/componentsStat/FlagStats/FlagStats.tsx similarity index 100% rename from frontend/src/component/executiveDashboard/componentsStat/FlagStats/FlagStats.tsx rename to frontend/src/component/insights/componentsStat/FlagStats/FlagStats.tsx diff --git a/frontend/src/component/executiveDashboard/componentsStat/HealthStats/HealthStats.tsx b/frontend/src/component/insights/componentsStat/HealthStats/HealthStats.tsx similarity index 100% rename from frontend/src/component/executiveDashboard/componentsStat/HealthStats/HealthStats.tsx rename to frontend/src/component/insights/componentsStat/HealthStats/HealthStats.tsx diff --git a/frontend/src/component/executiveDashboard/componentsStat/TimeToProduction/TimeToProduction.tsx b/frontend/src/component/insights/componentsStat/TimeToProduction/TimeToProduction.tsx similarity index 97% rename from frontend/src/component/executiveDashboard/componentsStat/TimeToProduction/TimeToProduction.tsx rename to frontend/src/component/insights/componentsStat/TimeToProduction/TimeToProduction.tsx index 3a5725e0cd2..2436532734f 100644 --- a/frontend/src/component/executiveDashboard/componentsStat/TimeToProduction/TimeToProduction.tsx +++ b/frontend/src/component/insights/componentsStat/TimeToProduction/TimeToProduction.tsx @@ -1,6 +1,6 @@ import type { VFC } from 'react'; import { Typography, styled } from '@mui/material'; -import { Gauge } from '../../components/Gauge/Gauge'; +import { Gauge } from 'component/insights/components/Gauge/Gauge'; const StyledContainer = styled('div')(({ theme }) => ({ display: 'flex', diff --git a/frontend/src/component/executiveDashboard/componentsStat/UserStats/UserDistributionInfo.tsx b/frontend/src/component/insights/componentsStat/UserStats/UserDistributionInfo.tsx similarity index 100% rename from frontend/src/component/executiveDashboard/componentsStat/UserStats/UserDistributionInfo.tsx rename to frontend/src/component/insights/componentsStat/UserStats/UserDistributionInfo.tsx diff --git a/frontend/src/component/executiveDashboard/componentsStat/UserStats/UserStats.tsx b/frontend/src/component/insights/componentsStat/UserStats/UserStats.tsx similarity index 100% rename from frontend/src/component/executiveDashboard/componentsStat/UserStats/UserStats.tsx rename to frontend/src/component/insights/componentsStat/UserStats/UserStats.tsx diff --git a/frontend/src/component/executiveDashboard/hooks/useFilteredFlagsSummary.test.ts b/frontend/src/component/insights/hooks/useFilteredFlagsSummary.test.ts similarity index 93% rename from frontend/src/component/executiveDashboard/hooks/useFilteredFlagsSummary.test.ts rename to frontend/src/component/insights/hooks/useFilteredFlagsSummary.test.ts index b4a19b73ef2..4ccaaf2af51 100644 --- a/frontend/src/component/executiveDashboard/hooks/useFilteredFlagsSummary.test.ts +++ b/frontend/src/component/insights/hooks/useFilteredFlagsSummary.test.ts @@ -1,6 +1,6 @@ import { renderHook } from '@testing-library/react-hooks'; import { useFilteredFlagsSummary } from './useFilteredFlagsSummary'; -import type { ExecutiveSummarySchemaUsers } from '../../../openapi'; +import type { InstanceInsightsSchemaUsers } from 'openapi'; describe('useFilteredFlagTrends', () => { it('should summarize only last week of project flag trends', () => { @@ -48,7 +48,7 @@ describe('useFilteredFlagTrends', () => { date: '', }, ], - { total: 1 } as unknown as ExecutiveSummarySchemaUsers, + { total: 1 } as unknown as InstanceInsightsSchemaUsers, ), ); @@ -78,7 +78,7 @@ describe('useFilteredFlagTrends', () => { date: '', }, ], - { total: 1 } as unknown as ExecutiveSummarySchemaUsers, + { total: 1 } as unknown as InstanceInsightsSchemaUsers, ), ); @@ -118,7 +118,7 @@ describe('useFilteredFlagTrends', () => { date: '', }, ], - { total: 1 } as unknown as ExecutiveSummarySchemaUsers, + { total: 1 } as unknown as InstanceInsightsSchemaUsers, ), ); @@ -148,7 +148,7 @@ describe('useFilteredFlagTrends', () => { date: '', }, ], - { total: 1 } as unknown as ExecutiveSummarySchemaUsers, + { total: 1 } as unknown as InstanceInsightsSchemaUsers, ), ); diff --git a/frontend/src/component/executiveDashboard/hooks/useFilteredFlagsSummary.ts b/frontend/src/component/insights/hooks/useFilteredFlagsSummary.ts similarity index 90% rename from frontend/src/component/executiveDashboard/hooks/useFilteredFlagsSummary.ts rename to frontend/src/component/insights/hooks/useFilteredFlagsSummary.ts index 5c3ac1608ea..2635ea64bb3 100644 --- a/frontend/src/component/executiveDashboard/hooks/useFilteredFlagsSummary.ts +++ b/frontend/src/component/insights/hooks/useFilteredFlagsSummary.ts @@ -1,13 +1,13 @@ import { useMemo } from 'react'; import type { - ExecutiveSummarySchemaProjectFlagTrendsItem, - ExecutiveSummarySchemaUsers, + InstanceInsightsSchemaProjectFlagTrendsItem, + InstanceInsightsSchemaUsers, } from 'openapi'; // NOTE: should we move project filtering to the backend? export const useFilteredFlagsSummary = ( - filteredProjectFlagTrends: ExecutiveSummarySchemaProjectFlagTrendsItem[], - users: ExecutiveSummarySchemaUsers, + filteredProjectFlagTrends: InstanceInsightsSchemaProjectFlagTrendsItem[], + users: InstanceInsightsSchemaUsers, ) => useMemo(() => { const lastWeekId = filteredProjectFlagTrends.reduce((prev, current) => { diff --git a/frontend/src/component/executiveDashboard/hooks/useFilteredTrends.test.ts b/frontend/src/component/insights/hooks/useFilteredTrends.test.ts similarity index 100% rename from frontend/src/component/executiveDashboard/hooks/useFilteredTrends.test.ts rename to frontend/src/component/insights/hooks/useFilteredTrends.test.ts diff --git a/frontend/src/component/executiveDashboard/hooks/useFilteredTrends.ts b/frontend/src/component/insights/hooks/useFilteredTrends.ts similarity index 100% rename from frontend/src/component/executiveDashboard/hooks/useFilteredTrends.ts rename to frontend/src/component/insights/hooks/useFilteredTrends.ts diff --git a/frontend/src/component/executiveDashboard/hooks/useGroupedProjectTrends.test.ts b/frontend/src/component/insights/hooks/useGroupedProjectTrends.test.ts similarity index 100% rename from frontend/src/component/executiveDashboard/hooks/useGroupedProjectTrends.test.ts rename to frontend/src/component/insights/hooks/useGroupedProjectTrends.test.ts diff --git a/frontend/src/component/executiveDashboard/hooks/useGroupedProjectTrends.ts b/frontend/src/component/insights/hooks/useGroupedProjectTrends.ts similarity index 100% rename from frontend/src/component/executiveDashboard/hooks/useGroupedProjectTrends.ts rename to frontend/src/component/insights/hooks/useGroupedProjectTrends.ts diff --git a/frontend/src/component/executiveDashboard/hooks/useDashboardData.ts b/frontend/src/component/insights/hooks/useInsightsData.ts similarity index 91% rename from frontend/src/component/executiveDashboard/hooks/useDashboardData.ts rename to frontend/src/component/insights/hooks/useInsightsData.ts index ade24fdaf30..7499e567378 100644 --- a/frontend/src/component/executiveDashboard/hooks/useDashboardData.ts +++ b/frontend/src/component/insights/hooks/useInsightsData.ts @@ -1,12 +1,12 @@ import { useMemo } from 'react'; -import type { ExecutiveSummarySchema } from 'openapi'; +import type { InstanceInsightsSchema } from 'openapi'; import { useFilteredTrends } from './useFilteredTrends'; import { useGroupedProjectTrends } from './useGroupedProjectTrends'; import { useFilteredFlagsSummary } from './useFilteredFlagsSummary'; import { useMedianTimeToProduction } from './useMedianTimeToProduction'; -export const useDashboardData = ( - executiveDashboardData: ExecutiveSummarySchema, +export const useInsightsData = ( + executiveDashboardData: InstanceInsightsSchema, projects: string[], ) => { const projectsData = useFilteredTrends( diff --git a/frontend/src/component/executiveDashboard/hooks/useMedianTimeToProduction.test.ts b/frontend/src/component/insights/hooks/useMedianTimeToProduction.test.ts similarity index 100% rename from frontend/src/component/executiveDashboard/hooks/useMedianTimeToProduction.test.ts rename to frontend/src/component/insights/hooks/useMedianTimeToProduction.test.ts diff --git a/frontend/src/component/executiveDashboard/hooks/useMedianTimeToProduction.ts b/frontend/src/component/insights/hooks/useMedianTimeToProduction.ts similarity index 85% rename from frontend/src/component/executiveDashboard/hooks/useMedianTimeToProduction.ts rename to frontend/src/component/insights/hooks/useMedianTimeToProduction.ts index e4d689da1ae..6ae3df75008 100644 --- a/frontend/src/component/executiveDashboard/hooks/useMedianTimeToProduction.ts +++ b/frontend/src/component/insights/hooks/useMedianTimeToProduction.ts @@ -1,16 +1,16 @@ import { useMemo } from 'react'; import type { - ExecutiveSummarySchema, - ExecutiveSummarySchemaProjectFlagTrendsItem, + InstanceInsightsSchema, + InstanceInsightsSchemaProjectFlagTrendsItem, } from 'openapi'; import type { GroupedDataByProject } from './useGroupedProjectTrends'; -const validTrend = (trend: ExecutiveSummarySchemaProjectFlagTrendsItem) => +const validTrend = (trend: InstanceInsightsSchemaProjectFlagTrendsItem) => Boolean(trend) && Boolean(trend.timeToProduction); export const useMedianTimeToProduction = ( projectsData: GroupedDataByProject< - ExecutiveSummarySchema['projectFlagTrends'] + InstanceInsightsSchema['projectFlagTrends'] >, ) => useMemo(() => { diff --git a/frontend/src/component/executiveDashboard/hooks/useMetricsSummary.ts b/frontend/src/component/insights/hooks/useMetricsSummary.ts similarity index 88% rename from frontend/src/component/executiveDashboard/hooks/useMetricsSummary.ts rename to frontend/src/component/insights/hooks/useMetricsSummary.ts index 3cbe80493cb..935c2711168 100644 --- a/frontend/src/component/executiveDashboard/hooks/useMetricsSummary.ts +++ b/frontend/src/component/insights/hooks/useMetricsSummary.ts @@ -1,10 +1,10 @@ import { useMemo } from 'react'; import { useTheme } from '@mui/material'; -import type { ExecutiveSummarySchema } from 'openapi'; +import type { InstanceInsightsSchema } from 'openapi'; import { useProjectColor } from './useProjectColor'; import type { GroupedDataByProject } from './useGroupedProjectTrends'; -type MetricsSummaryTrends = ExecutiveSummarySchema['metricsSummaryTrends']; +type MetricsSummaryTrends = InstanceInsightsSchema['metricsSummaryTrends']; export const useMetricsSummary = ( metricsSummaryTrends: GroupedDataByProject, diff --git a/frontend/src/component/executiveDashboard/hooks/usePlaceholderData.ts b/frontend/src/component/insights/hooks/usePlaceholderData.ts similarity index 100% rename from frontend/src/component/executiveDashboard/hooks/usePlaceholderData.ts rename to frontend/src/component/insights/hooks/usePlaceholderData.ts diff --git a/frontend/src/component/executiveDashboard/hooks/useProjectChartData.ts b/frontend/src/component/insights/hooks/useProjectChartData.ts similarity index 88% rename from frontend/src/component/executiveDashboard/hooks/useProjectChartData.ts rename to frontend/src/component/insights/hooks/useProjectChartData.ts index 915bf584a8e..52caa036df9 100644 --- a/frontend/src/component/executiveDashboard/hooks/useProjectChartData.ts +++ b/frontend/src/component/insights/hooks/useProjectChartData.ts @@ -1,10 +1,10 @@ import { useMemo } from 'react'; -import type { ExecutiveSummarySchema } from 'openapi'; +import type { InstanceInsightsSchema } from 'openapi'; import { useProjectColor } from './useProjectColor'; import { useTheme } from '@mui/material'; import type { GroupedDataByProject } from './useGroupedProjectTrends'; -type ProjectFlagTrends = ExecutiveSummarySchema['projectFlagTrends']; +type ProjectFlagTrends = InstanceInsightsSchema['projectFlagTrends']; export const useProjectChartData = ( projectFlagTrends: GroupedDataByProject, diff --git a/frontend/src/component/executiveDashboard/hooks/useProjectColor.ts b/frontend/src/component/insights/hooks/useProjectColor.ts similarity index 100% rename from frontend/src/component/executiveDashboard/hooks/useProjectColor.ts rename to frontend/src/component/insights/hooks/useProjectColor.ts diff --git a/frontend/src/component/menu/routes.ts b/frontend/src/component/menu/routes.ts index 5e2e443f9ab..af20930a54a 100644 --- a/frontend/src/component/menu/routes.ts +++ b/frontend/src/component/menu/routes.ts @@ -44,7 +44,7 @@ import { FeatureTypesList } from 'component/featureTypes/FeatureTypesList'; import { ViewIntegration } from 'component/integrations/ViewIntegration/ViewIntegration'; import { PaginatedApplicationList } from '../application/ApplicationList/PaginatedApplicationList'; import { AddonRedirect } from 'component/integrations/AddonRedirect/AddonRedirect'; -import { ExecutiveDashboard } from 'component/executiveDashboard/ExecutiveDashboard'; +import { Insights } from '../insights/Insights'; import { FeedbackList } from '../feedbackNew/FeedbackList'; import { Application } from 'component/application/Application'; import { Signals } from 'component/signals/Signals'; @@ -64,7 +64,7 @@ export const routes: IRoute[] = [ { path: '/insights', title: 'Insights', - component: ExecutiveDashboard, + component: Insights, type: 'protected', menu: { mobile: true }, flag: 'executiveDashboardUI', diff --git a/frontend/src/hooks/api/getters/useExecutiveSummary/useExecutiveSummary.ts b/frontend/src/hooks/api/getters/useInsights/useInsights.ts similarity index 66% rename from frontend/src/hooks/api/getters/useExecutiveSummary/useExecutiveSummary.ts rename to frontend/src/hooks/api/getters/useInsights/useInsights.ts index 59e519065d7..d447ec89128 100644 --- a/frontend/src/hooks/api/getters/useExecutiveSummary/useExecutiveSummary.ts +++ b/frontend/src/hooks/api/getters/useInsights/useInsights.ts @@ -2,32 +2,32 @@ import useSWR, { mutate, type SWRConfiguration } from 'swr'; import { useCallback } from 'react'; import { formatApiPath } from 'utils/formatPath'; import handleErrorResponses from '../httpErrorResponseHandler'; -import type { ExecutiveSummarySchema } from 'openapi'; +import type { InstanceInsightsSchema } from 'openapi'; -interface IUseExecutiveDashboardDataOutput { - executiveDashboardData: ExecutiveSummarySchema; - refetchExecutiveDashboard: () => void; +interface IUseInsightsDataOutput { + insights: InstanceInsightsSchema; + refetchInsights: () => void; loading: boolean; error?: Error; } -export const useExecutiveDashboard = ( +export const useInsights = ( options?: SWRConfiguration, -): IUseExecutiveDashboardDataOutput => { +): IUseInsightsDataOutput => { const path = formatApiPath('api/admin/dashboard/executive'); - const { data, error } = useSWR( + const { data, error } = useSWR( path, fetchExecutiveDashboard, options, ); - const refetchExecutiveDashboard = useCallback(() => { + const refetchInsights = useCallback(() => { mutate(path).catch(console.warn); }, [path]); return { - executiveDashboardData: data || { + insights: data || { users: { total: 0, inactive: 0, active: 0 }, flags: { total: 0 }, userTrends: [], @@ -36,7 +36,7 @@ export const useExecutiveDashboard = ( metricsSummaryTrends: [], environmentTypeTrends: [], }, - refetchExecutiveDashboard, + refetchInsights, loading: !error && !data, error, }; @@ -44,7 +44,7 @@ export const useExecutiveDashboard = ( const fetchExecutiveDashboard = ( path: string, -): Promise => { +): Promise => { return fetch(path) .then(handleErrorResponses('Executive Dashboard Data')) .then((res) => res.json()); diff --git a/frontend/src/openapi/models/executiveSummarySchema.ts b/frontend/src/openapi/models/executiveSummarySchema.ts deleted file mode 100644 index 0f65daab6c2..00000000000 --- a/frontend/src/openapi/models/executiveSummarySchema.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Generated by Orval - * Do not edit manually. - * See `gen:api` script in package.json - */ -import type { ExecutiveSummarySchemaEnvironmentTypeTrendsItem } from './executiveSummarySchemaEnvironmentTypeTrendsItem'; -import type { ExecutiveSummarySchemaFlags } from './executiveSummarySchemaFlags'; -import type { ExecutiveSummarySchemaFlagTrendsItem } from './executiveSummarySchemaFlagTrendsItem'; -import type { ExecutiveSummarySchemaMetricsSummaryTrendsItem } from './executiveSummarySchemaMetricsSummaryTrendsItem'; -import type { ExecutiveSummarySchemaProjectFlagTrendsItem } from './executiveSummarySchemaProjectFlagTrendsItem'; -import type { ExecutiveSummarySchemaUsers } from './executiveSummarySchemaUsers'; -import type { ExecutiveSummarySchemaUserTrendsItem } from './executiveSummarySchemaUserTrendsItem'; - -/** - * Executive summary of Unleash usage - */ -export interface ExecutiveSummarySchema { - /** How updates per environment type changed over time */ - environmentTypeTrends: ExecutiveSummarySchemaEnvironmentTypeTrendsItem[]; - /** High level flag count statistics */ - flags: ExecutiveSummarySchemaFlags; - /** How number of flags changed over time */ - flagTrends: ExecutiveSummarySchemaFlagTrendsItem[]; - /** How metrics data per project changed over time */ - metricsSummaryTrends: ExecutiveSummarySchemaMetricsSummaryTrendsItem[]; - /** How number of flags per project changed over time */ - projectFlagTrends: ExecutiveSummarySchemaProjectFlagTrendsItem[]; - /** High level user count statistics */ - users: ExecutiveSummarySchemaUsers; - /** How number of users changed over time */ - userTrends: ExecutiveSummarySchemaUserTrendsItem[]; -} diff --git a/frontend/src/openapi/models/index.ts b/frontend/src/openapi/models/index.ts index a5d2b8422f3..139bb95c06e 100644 --- a/frontend/src/openapi/models/index.ts +++ b/frontend/src/openapi/models/index.ts @@ -521,14 +521,6 @@ export * from './eventSchemaPreData'; export * from './eventSchemaType'; export * from './eventsSchema'; export * from './eventsSchemaVersion'; -export * from './executiveSummarySchema'; -export * from './executiveSummarySchemaEnvironmentTypeTrendsItem'; -export * from './executiveSummarySchemaFlagTrendsItem'; -export * from './executiveSummarySchemaFlags'; -export * from './executiveSummarySchemaMetricsSummaryTrendsItem'; -export * from './executiveSummarySchemaProjectFlagTrendsItem'; -export * from './executiveSummarySchemaUserTrendsItem'; -export * from './executiveSummarySchemaUsers'; export * from './exportFeatures404'; export * from './exportQuerySchema'; export * from './exportQuerySchemaAnyOf'; @@ -770,6 +762,14 @@ export * from './instanceAdminStatsSchemaClientAppsItem'; export * from './instanceAdminStatsSchemaClientAppsItemRange'; export * from './instanceAdminStatsSchemaPreviousDayMetricsBucketsCount'; export * from './instanceAdminStatsSchemaProductionChanges'; +export * from './instanceInsightsSchema'; +export * from './instanceInsightsSchemaEnvironmentTypeTrendsItem'; +export * from './instanceInsightsSchemaFlagTrendsItem'; +export * from './instanceInsightsSchemaFlags'; +export * from './instanceInsightsSchemaMetricsSummaryTrendsItem'; +export * from './instanceInsightsSchemaProjectFlagTrendsItem'; +export * from './instanceInsightsSchemaUserTrendsItem'; +export * from './instanceInsightsSchemaUsers'; export * from './invoicesSchema'; export * from './invoicesSchemaItem'; export * from './legalValueSchema'; diff --git a/frontend/src/openapi/models/instanceInsightsSchema.ts b/frontend/src/openapi/models/instanceInsightsSchema.ts new file mode 100644 index 00000000000..e64ee03b5a4 --- /dev/null +++ b/frontend/src/openapi/models/instanceInsightsSchema.ts @@ -0,0 +1,32 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ +import type { InstanceInsightsSchemaEnvironmentTypeTrendsItem } from './instanceInsightsSchemaEnvironmentTypeTrendsItem'; +import type { InstanceInsightsSchemaFlags } from './instanceInsightsSchemaFlags'; +import type { InstanceInsightsSchemaFlagTrendsItem } from './instanceInsightsSchemaFlagTrendsItem'; +import type { InstanceInsightsSchemaMetricsSummaryTrendsItem } from './instanceInsightsSchemaMetricsSummaryTrendsItem'; +import type { InstanceInsightsSchemaProjectFlagTrendsItem } from './instanceInsightsSchemaProjectFlagTrendsItem'; +import type { InstanceInsightsSchemaUsers } from './instanceInsightsSchemaUsers'; +import type { InstanceInsightsSchemaUserTrendsItem } from './instanceInsightsSchemaUserTrendsItem'; + +/** + * A summary of this Unleash instance's usage statistics, including user and flag counts, and trends over time. + */ +export interface InstanceInsightsSchema { + /** How updates per environment type changed over time */ + environmentTypeTrends: InstanceInsightsSchemaEnvironmentTypeTrendsItem[]; + /** High level flag count statistics */ + flags: InstanceInsightsSchemaFlags; + /** How number of flags changed over time */ + flagTrends: InstanceInsightsSchemaFlagTrendsItem[]; + /** How metrics data per project changed over time */ + metricsSummaryTrends: InstanceInsightsSchemaMetricsSummaryTrendsItem[]; + /** How number of flags per project changed over time */ + projectFlagTrends: InstanceInsightsSchemaProjectFlagTrendsItem[]; + /** High level user count statistics */ + users: InstanceInsightsSchemaUsers; + /** How number of users changed over time */ + userTrends: InstanceInsightsSchemaUserTrendsItem[]; +} diff --git a/frontend/src/openapi/models/executiveSummarySchemaEnvironmentTypeTrendsItem.ts b/frontend/src/openapi/models/instanceInsightsSchemaEnvironmentTypeTrendsItem.ts similarity index 88% rename from frontend/src/openapi/models/executiveSummarySchemaEnvironmentTypeTrendsItem.ts rename to frontend/src/openapi/models/instanceInsightsSchemaEnvironmentTypeTrendsItem.ts index 10fe5a53345..c40291ff2e9 100644 --- a/frontend/src/openapi/models/executiveSummarySchemaEnvironmentTypeTrendsItem.ts +++ b/frontend/src/openapi/models/instanceInsightsSchemaEnvironmentTypeTrendsItem.ts @@ -4,7 +4,7 @@ * See `gen:api` script in package.json */ -export type ExecutiveSummarySchemaEnvironmentTypeTrendsItem = { +export type InstanceInsightsSchemaEnvironmentTypeTrendsItem = { /** A UTC date when the stats were captured. Time is the very end of a given day. */ date: string; /** Environment type the data belongs too */ diff --git a/frontend/src/openapi/models/executiveSummarySchemaFlagTrendsItem.ts b/frontend/src/openapi/models/instanceInsightsSchemaFlagTrendsItem.ts similarity index 91% rename from frontend/src/openapi/models/executiveSummarySchemaFlagTrendsItem.ts rename to frontend/src/openapi/models/instanceInsightsSchemaFlagTrendsItem.ts index a3e83600411..468c80a69b8 100644 --- a/frontend/src/openapi/models/executiveSummarySchemaFlagTrendsItem.ts +++ b/frontend/src/openapi/models/instanceInsightsSchemaFlagTrendsItem.ts @@ -4,7 +4,7 @@ * See `gen:api` script in package.json */ -export type ExecutiveSummarySchemaFlagTrendsItem = { +export type InstanceInsightsSchemaFlagTrendsItem = { /** The number of active flags on a particular day */ active: number; /** A UTC date when the stats were captured. Time is the very end of a given day. */ diff --git a/frontend/src/openapi/models/executiveSummarySchemaFlags.ts b/frontend/src/openapi/models/instanceInsightsSchemaFlags.ts similarity index 82% rename from frontend/src/openapi/models/executiveSummarySchemaFlags.ts rename to frontend/src/openapi/models/instanceInsightsSchemaFlags.ts index 2a069ff9c34..2b5216c6552 100644 --- a/frontend/src/openapi/models/executiveSummarySchemaFlags.ts +++ b/frontend/src/openapi/models/instanceInsightsSchemaFlags.ts @@ -7,7 +7,7 @@ /** * High level flag count statistics */ -export type ExecutiveSummarySchemaFlags = { +export type InstanceInsightsSchemaFlags = { /** The number of non-archived flags */ total: number; }; diff --git a/frontend/src/openapi/models/executiveSummarySchemaMetricsSummaryTrendsItem.ts b/frontend/src/openapi/models/instanceInsightsSchemaMetricsSummaryTrendsItem.ts similarity index 94% rename from frontend/src/openapi/models/executiveSummarySchemaMetricsSummaryTrendsItem.ts rename to frontend/src/openapi/models/instanceInsightsSchemaMetricsSummaryTrendsItem.ts index 7dd31b91af9..9ebc6a761c8 100644 --- a/frontend/src/openapi/models/executiveSummarySchemaMetricsSummaryTrendsItem.ts +++ b/frontend/src/openapi/models/instanceInsightsSchemaMetricsSummaryTrendsItem.ts @@ -4,7 +4,7 @@ * See `gen:api` script in package.json */ -export type ExecutiveSummarySchemaMetricsSummaryTrendsItem = { +export type InstanceInsightsSchemaMetricsSummaryTrendsItem = { /** A UTC date when metrics summary was captured. Time is the very end of a given day. */ date: string; /** Project id of the project the impressions summary belong to */ diff --git a/frontend/src/openapi/models/executiveSummarySchemaProjectFlagTrendsItem.ts b/frontend/src/openapi/models/instanceInsightsSchemaProjectFlagTrendsItem.ts similarity index 95% rename from frontend/src/openapi/models/executiveSummarySchemaProjectFlagTrendsItem.ts rename to frontend/src/openapi/models/instanceInsightsSchemaProjectFlagTrendsItem.ts index 9ce5e493b4d..664adf48f5e 100644 --- a/frontend/src/openapi/models/executiveSummarySchemaProjectFlagTrendsItem.ts +++ b/frontend/src/openapi/models/instanceInsightsSchemaProjectFlagTrendsItem.ts @@ -4,7 +4,7 @@ * See `gen:api` script in package.json */ -export type ExecutiveSummarySchemaProjectFlagTrendsItem = { +export type InstanceInsightsSchemaProjectFlagTrendsItem = { /** The number of active flags on a particular day */ active: number; /** A UTC date when the stats were captured. Time is the very end of a given day. */ diff --git a/frontend/src/openapi/models/executiveSummarySchemaUserTrendsItem.ts b/frontend/src/openapi/models/instanceInsightsSchemaUserTrendsItem.ts similarity index 89% rename from frontend/src/openapi/models/executiveSummarySchemaUserTrendsItem.ts rename to frontend/src/openapi/models/instanceInsightsSchemaUserTrendsItem.ts index bc562bda808..131da75e62a 100644 --- a/frontend/src/openapi/models/executiveSummarySchemaUserTrendsItem.ts +++ b/frontend/src/openapi/models/instanceInsightsSchemaUserTrendsItem.ts @@ -4,7 +4,7 @@ * See `gen:api` script in package.json */ -export type ExecutiveSummarySchemaUserTrendsItem = { +export type InstanceInsightsSchemaUserTrendsItem = { /** The number of active Unleash users on a particular day */ active: number; /** A UTC date when the stats were captured. Time is the very end of a given day. */ diff --git a/frontend/src/openapi/models/executiveSummarySchemaUsers.ts b/frontend/src/openapi/models/instanceInsightsSchemaUsers.ts similarity index 90% rename from frontend/src/openapi/models/executiveSummarySchemaUsers.ts rename to frontend/src/openapi/models/instanceInsightsSchemaUsers.ts index a524856f285..a1270519919 100644 --- a/frontend/src/openapi/models/executiveSummarySchemaUsers.ts +++ b/frontend/src/openapi/models/instanceInsightsSchemaUsers.ts @@ -7,7 +7,7 @@ /** * High level user count statistics */ -export type ExecutiveSummarySchemaUsers = { +export type InstanceInsightsSchemaUsers = { /** The number of active Unleash users who have user Unleash in the past 60 days */ active: number; /** The number of inactive Unleash users who have not used Unleash in the past 60 days. */