From d5acbea711a804f0dec3e00394696832daf4e7d2 Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com> Date: Tue, 10 Jun 2025 14:15:09 +0200 Subject: [PATCH] chore: update frontend schema - technicalDebt (#10098) generated with `api:gen` --- .../insights/hooks/useProjectChartData.ts | 14 +---------- .../useProjectStatus/useProjectStatus.ts | 3 +++ .../openapi/models/healthOverviewSchema.ts | 11 ++++++++- .../src/openapi/models/healthReportSchema.ts | 11 ++++++++- frontend/src/openapi/models/index.ts | 2 ++ ...anceInsightsSchemaProjectFlagTrendsItem.ts | 11 ++++++++- ...alDashboardProjectDetailsSchemaInsights.ts | 9 +++++++- .../personalDashboardSchemaProjectsItem.ts | 9 +++++++- .../openapi/models/projectInsightsSchema.ts | 8 ++++++- .../models/projectInsightsSchemaHealth.ts | 5 ++-- .../projectInsightsSchemaTechnicalDebt.ts | 23 +++++++++++++++++++ .../openapi/models/projectOverviewSchema.ts | 11 ++++++++- frontend/src/openapi/models/projectSchema.ts | 11 ++++++++- .../src/openapi/models/projectStatusSchema.ts | 3 +++ .../projectStatusSchemaTechnicalDebt.ts | 17 ++++++++++++++ 15 files changed, 125 insertions(+), 23 deletions(-) create mode 100644 frontend/src/openapi/models/projectInsightsSchemaTechnicalDebt.ts create mode 100644 frontend/src/openapi/models/projectStatusSchemaTechnicalDebt.ts diff --git a/frontend/src/component/insights/hooks/useProjectChartData.ts b/frontend/src/component/insights/hooks/useProjectChartData.ts index 2e9836eff8..2f13c74c4f 100644 --- a/frontend/src/component/insights/hooks/useProjectChartData.ts +++ b/frontend/src/component/insights/hooks/useProjectChartData.ts @@ -4,7 +4,6 @@ import { useProjectColor } from './useProjectColor.js'; import { useTheme } from '@mui/material'; import type { GroupedDataByProject } from './useGroupedProjectTrends.js'; import useProjects from 'hooks/api/getters/useProjects/useProjects'; -import { useFlag } from '@unleash/proxy-client-react'; type ProjectFlagTrends = InstanceInsightsSchema['projectFlagTrends']; @@ -26,7 +25,6 @@ export const useProjectChartData = ( projectFlagTrends: GroupedDataByProject, ) => { const theme = useTheme(); - const healthToTechDebtEnabled = useFlag('healthToTechDebt'); const getProjectColor = useProjectColor(); const { projects } = useProjects(); const projectNames = new Map( @@ -39,17 +37,7 @@ export const useProjectChartData = ( const color = getProjectColor(project); return { label: projectNames.get(project) || project, - data: trends.map((item) => ({ - ...item, - - ...(healthToTechDebtEnabled - ? { - technicalDebt: item.total - ? calculateTechDebt(item) - : undefined, - } - : {}), - })), + data: trends, borderColor: color, backgroundColor: color, fill: false, diff --git a/frontend/src/hooks/api/getters/useProjectStatus/useProjectStatus.ts b/frontend/src/hooks/api/getters/useProjectStatus/useProjectStatus.ts index 67aaa64560..4430ad760a 100644 --- a/frontend/src/hooks/api/getters/useProjectStatus/useProjectStatus.ts +++ b/frontend/src/hooks/api/getters/useProjectStatus/useProjectStatus.ts @@ -14,6 +14,9 @@ const placeholderData: ProjectStatusSchema = { health: { current: 0, }, + technicalDebt: { + current: 0, + }, lifecycleSummary: { initial: { currentFlags: 0, diff --git a/frontend/src/openapi/models/healthOverviewSchema.ts b/frontend/src/openapi/models/healthOverviewSchema.ts index 38f6231161..8e4622ee87 100644 --- a/frontend/src/openapi/models/healthOverviewSchema.ts +++ b/frontend/src/openapi/models/healthOverviewSchema.ts @@ -37,7 +37,10 @@ export interface HealthOverviewSchema { featureNaming?: CreateFeatureNamingPatternSchema; /** An array containing an overview of all the features of the project and their individual status */ features: FeatureSchema[]; - /** The overall [health rating](https://docs.getunleash.io/reference/technical-debt#project-status) of the project. */ + /** + * Use `technicalDebt` instead. + * @deprecated + */ health: number; /** * The number of users/members in the project. @@ -50,6 +53,12 @@ export interface HealthOverviewSchema { name: string; /** Project statistics */ stats?: ProjectStatsSchema; + /** + * An indicator of the [project's technical debt](https://docs.getunleash.io/reference/technical-debt#project-status) on a scale from 0 to 100 + * @minimum 0 + * @maximum 100 + */ + technicalDebt: number; /** * When the project was last updated. * @nullable diff --git a/frontend/src/openapi/models/healthReportSchema.ts b/frontend/src/openapi/models/healthReportSchema.ts index a59430c6b8..77391c5866 100644 --- a/frontend/src/openapi/models/healthReportSchema.ts +++ b/frontend/src/openapi/models/healthReportSchema.ts @@ -39,7 +39,10 @@ export interface HealthReportSchema { featureNaming?: CreateFeatureNamingPatternSchema; /** An array containing an overview of all the features of the project and their individual status */ features: FeatureSchema[]; - /** The overall [health rating](https://docs.getunleash.io/reference/technical-debt#project-status) of the project. */ + /** + * Use `technicalDebt` instead. + * @deprecated + */ health: number; /** * The number of users/members in the project. @@ -56,6 +59,12 @@ export interface HealthReportSchema { staleCount: number; /** Project statistics */ stats?: ProjectStatsSchema; + /** + * An indicator of the [project's technical debt](https://docs.getunleash.io/reference/technical-debt#project-status) on a scale from 0 to 100 + * @minimum 0 + * @maximum 100 + */ + technicalDebt: number; /** * When the project was last updated. * @nullable diff --git a/frontend/src/openapi/models/index.ts b/frontend/src/openapi/models/index.ts index 969241d832..c4bf4101cb 100644 --- a/frontend/src/openapi/models/index.ts +++ b/frontend/src/openapi/models/index.ts @@ -1066,6 +1066,7 @@ export * from './projectFlagCreatorsSchemaItem.js'; export * from './projectInsightsSchema.js'; export * from './projectInsightsSchemaHealth.js'; export * from './projectInsightsSchemaMembers.js'; +export * from './projectInsightsSchemaTechnicalDebt.js'; export * from './projectLinkTemplateSchema.js'; export * from './projectOverviewSchema.js'; export * from './projectOverviewSchemaMode.js'; @@ -1100,6 +1101,7 @@ export * from './projectStatusSchemaLifecycleSummaryLive.js'; export * from './projectStatusSchemaLifecycleSummaryPreLive.js'; export * from './projectStatusSchemaResources.js'; export * from './projectStatusSchemaStaleFlags.js'; +export * from './projectStatusSchemaTechnicalDebt.js'; export * from './projectUsersSchema.js'; export * from './projectsSchema.js'; export * from './provideFeedbackSchema.js'; diff --git a/frontend/src/openapi/models/instanceInsightsSchemaProjectFlagTrendsItem.ts b/frontend/src/openapi/models/instanceInsightsSchemaProjectFlagTrendsItem.ts index 207f0dc502..b4d2df67fc 100644 --- a/frontend/src/openapi/models/instanceInsightsSchemaProjectFlagTrendsItem.ts +++ b/frontend/src/openapi/models/instanceInsightsSchemaProjectFlagTrendsItem.ts @@ -9,7 +9,10 @@ export type InstanceInsightsSchemaProjectFlagTrendsItem = { active: number; /** A UTC date when the stats were captured. Time is the very end of a given day. */ date: string; - /** An indicator of the [project's health](https://docs.getunleash.io/reference/technical-debt#health-rating) on a scale from 0 to 100 */ + /** + * Use `technicalDebt` instead. + * @deprecated + */ health: number; /** The number of time calculated potentially stale flags on a particular day */ potentiallyStale: number; @@ -17,6 +20,12 @@ export type InstanceInsightsSchemaProjectFlagTrendsItem = { project: string; /** The number of user marked stale flags on a particular day */ stale: number; + /** + * An indicator of the [project's technical debt](https://docs.getunleash.io/reference/technical-debt) on a scale from 0 to 100 + * @minimum 0 + * @maximum 100 + */ + technicalDebt?: number; /** The average time from when a feature was created to when it was enabled in the "production" environment during the current window */ timeToProduction?: number; /** The number of all flags on a particular day */ diff --git a/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaInsights.ts b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaInsights.ts index 44523408ee..6befc9c243 100644 --- a/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaInsights.ts +++ b/frontend/src/openapi/models/personalDashboardProjectDetailsSchemaInsights.ts @@ -26,7 +26,8 @@ export type PersonalDashboardProjectDetailsSchemaInsights = { */ avgHealthPastWindow: number | null; /** - * The project's current health score + * Use `technicalDebt` instead. + * @deprecated * @minimum 0 */ health: number; @@ -40,6 +41,12 @@ export type PersonalDashboardProjectDetailsSchemaInsights = { * @minimum 0 */ staleFlags: number; + /** + * An indicator of the [project's technical debt](https://docs.getunleash.io/reference/technical-debt#project-status) on a scale from 0 to 100 + * @minimum 0 + * @maximum 100 + */ + technicalDebt: number; /** * The current number of non-archived flags * @minimum 0 diff --git a/frontend/src/openapi/models/personalDashboardSchemaProjectsItem.ts b/frontend/src/openapi/models/personalDashboardSchemaProjectsItem.ts index 9a70559af0..066f93c6dd 100644 --- a/frontend/src/openapi/models/personalDashboardSchemaProjectsItem.ts +++ b/frontend/src/openapi/models/personalDashboardSchemaProjectsItem.ts @@ -11,7 +11,8 @@ export type PersonalDashboardSchemaProjectsItem = { */ featureCount: number; /** - * An indicator of the [project's health](https://docs.getunleash.io/reference/technical-debt#project-status) on a scale from 0 to 100 + * Use `technicalDebt` instead. + * @deprecated * @minimum 0 */ health: number; @@ -24,4 +25,10 @@ export type PersonalDashboardSchemaProjectsItem = { memberCount: number; /** The name of the project */ name: string; + /** + * An indicator of the [project's technical debt](https://docs.getunleash.io/reference/technical-debt#project-status) on a scale from 0 to 100 + * @minimum 0 + * @maximum 100 + */ + technicalDebt: number; }; diff --git a/frontend/src/openapi/models/projectInsightsSchema.ts b/frontend/src/openapi/models/projectInsightsSchema.ts index ed826eaa9c..3f498152b2 100644 --- a/frontend/src/openapi/models/projectInsightsSchema.ts +++ b/frontend/src/openapi/models/projectInsightsSchema.ts @@ -8,6 +8,7 @@ import type { ProjectInsightsSchemaHealth } from './projectInsightsSchemaHealth. import type { ProjectDoraMetricsSchema } from './projectDoraMetricsSchema.js'; import type { ProjectInsightsSchemaMembers } from './projectInsightsSchemaMembers.js'; import type { ProjectStatsSchema } from './projectStatsSchema.js'; +import type { ProjectInsightsSchemaTechnicalDebt } from './projectInsightsSchemaTechnicalDebt.js'; /** * A high-level overview of a project insights. It contains information such as project statistics, overall health, types of flags, members overview, change requests overview. @@ -15,7 +16,10 @@ import type { ProjectStatsSchema } from './projectStatsSchema.js'; export interface ProjectInsightsSchema { /** The number of features of each type */ featureTypeCounts: FeatureTypeCountSchema[]; - /** Health summary of the project */ + /** + * Use `technicalDebt` instead. Summary of the project health + * @deprecated + */ health: ProjectInsightsSchemaHealth; /** Lead time (DORA) metrics */ leadTime: ProjectDoraMetricsSchema; @@ -23,4 +27,6 @@ export interface ProjectInsightsSchema { members: ProjectInsightsSchemaMembers; /** Project statistics */ stats: ProjectStatsSchema; + /** Summary of the projects technical debt */ + technicalDebt: ProjectInsightsSchemaTechnicalDebt; } diff --git a/frontend/src/openapi/models/projectInsightsSchemaHealth.ts b/frontend/src/openapi/models/projectInsightsSchemaHealth.ts index 3af8c50b89..6f385cbb1e 100644 --- a/frontend/src/openapi/models/projectInsightsSchemaHealth.ts +++ b/frontend/src/openapi/models/projectInsightsSchemaHealth.ts @@ -5,14 +5,15 @@ */ /** - * Health summary of the project + * Use `technicalDebt` instead. Summary of the project health + * @deprecated */ export type ProjectInsightsSchemaHealth = { /** The number of active feature flags. */ activeCount: number; /** The number of potentially stale feature flags. */ potentiallyStaleCount: number; - /** An indicator of the [project's health](https://docs.getunleash.io/reference/technical-debt#project-status) on a scale from 0 to 100 */ + /** An indicator of the [project's technical debt](https://docs.getunleash.io/reference/technical-debt#project-status) on a scale from 0 to 100 */ rating: number; /** The number of stale feature flags. */ staleCount: number; diff --git a/frontend/src/openapi/models/projectInsightsSchemaTechnicalDebt.ts b/frontend/src/openapi/models/projectInsightsSchemaTechnicalDebt.ts new file mode 100644 index 0000000000..c73f0f270b --- /dev/null +++ b/frontend/src/openapi/models/projectInsightsSchemaTechnicalDebt.ts @@ -0,0 +1,23 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ + +/** + * Summary of the projects technical debt + */ +export type ProjectInsightsSchemaTechnicalDebt = { + /** The number of active feature flags. */ + activeCount: number; + /** The number of potentially stale feature flags. */ + potentiallyStaleCount: number; + /** + * An indicator of the [project's technical debt](https://docs.getunleash.io/reference/technical-debt#project-status) on a scale from 0 to 100 + * @minimum 0 + * @maximum 100 + */ + rating: number; + /** The number of stale feature flags. */ + staleCount: number; +}; diff --git a/frontend/src/openapi/models/projectOverviewSchema.ts b/frontend/src/openapi/models/projectOverviewSchema.ts index 6943987fc3..f8904bac5a 100644 --- a/frontend/src/openapi/models/projectOverviewSchema.ts +++ b/frontend/src/openapi/models/projectOverviewSchema.ts @@ -44,7 +44,10 @@ export interface ProjectOverviewSchema { featureNaming?: CreateFeatureNamingPatternSchema; /** The number of features of each type that are in this project */ featureTypeCounts?: FeatureTypeCountSchema[]; - /** An indicator of the [project's health](https://docs.getunleash.io/reference/technical-debt#project-status) on a scale from 0 to 100 */ + /** + * Use `technicalDebt` instead. + * @deprecated + */ health?: number; /** A list of templates for links that will be automatically added to new feature flags. */ linkTemplates?: ProjectLinkTemplateSchema[]; @@ -58,6 +61,12 @@ export interface ProjectOverviewSchema { onboardingStatus: ProjectOverviewSchemaOnboardingStatus; /** Project statistics */ stats?: ProjectStatsSchema; + /** + * An indicator of the [project's technical debt](https://docs.getunleash.io/reference/technical-debt#project-status) on a scale from 0 to 100 + * @minimum 0 + * @maximum 100 + */ + technicalDebt?: number; /** * When the project was last updated. * @nullable diff --git a/frontend/src/openapi/models/projectSchema.ts b/frontend/src/openapi/models/projectSchema.ts index eea9283251..803985ab26 100644 --- a/frontend/src/openapi/models/projectSchema.ts +++ b/frontend/src/openapi/models/projectSchema.ts @@ -37,7 +37,10 @@ export interface ProjectSchema { favorite?: boolean; /** The number of features this project has */ featureCount?: number; - /** An indicator of the [project's health](https://docs.getunleash.io/reference/technical-debt#project-status) on a scale from 0 to 100 */ + /** + * Use `technicalDebt` instead. + * @deprecated + */ health?: number; /** The id of this project */ id: string; @@ -69,6 +72,12 @@ export interface ProjectSchema { * @deprecated */ staleFeatureCount?: number; + /** + * An indicator of the [project's technical debt](https://docs.getunleash.io/reference/technical-debt#project-status) on a scale from 0 to 100 + * @minimum 0 + * @maximum 100 + */ + technicalDebt?: number; /** * When this project was last updated. * @deprecated diff --git a/frontend/src/openapi/models/projectStatusSchema.ts b/frontend/src/openapi/models/projectStatusSchema.ts index 9fac2b2f6d..fd7bf2a0be 100644 --- a/frontend/src/openapi/models/projectStatusSchema.ts +++ b/frontend/src/openapi/models/projectStatusSchema.ts @@ -8,6 +8,7 @@ import type { ProjectStatusSchemaHealth } from './projectStatusSchemaHealth.js'; import type { ProjectStatusSchemaLifecycleSummary } from './projectStatusSchemaLifecycleSummary.js'; import type { ProjectStatusSchemaResources } from './projectStatusSchemaResources.js'; import type { ProjectStatusSchemaStaleFlags } from './projectStatusSchemaStaleFlags.js'; +import type { ProjectStatusSchemaTechnicalDebt } from './projectStatusSchemaTechnicalDebt.js'; /** * Schema representing the overall status of a project, including an array of activity records. Each record in the activity array contains a date and a count, providing a snapshot of the project’s activity level over time. @@ -23,4 +24,6 @@ export interface ProjectStatusSchema { resources: ProjectStatusSchemaResources; /** Information on stale and potentially stale flags in this project. */ staleFlags: ProjectStatusSchemaStaleFlags; + /** Information about the project's health rating */ + technicalDebt: ProjectStatusSchemaTechnicalDebt; } diff --git a/frontend/src/openapi/models/projectStatusSchemaTechnicalDebt.ts b/frontend/src/openapi/models/projectStatusSchemaTechnicalDebt.ts new file mode 100644 index 0000000000..bb4a8891f1 --- /dev/null +++ b/frontend/src/openapi/models/projectStatusSchemaTechnicalDebt.ts @@ -0,0 +1,17 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ + +/** + * Information about the project's health rating + */ +export type ProjectStatusSchemaTechnicalDebt = { + /** + * The project's current health score, based on the ratio of healthy flags to stale and potentially stale flags. + * @minimum 0 + * @maximum 100 + */ + current: number; +};