1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-05 17:53:12 +02:00

chore: update frontend schema - technicalDebt (#10098)

generated with `api:gen`
This commit is contained in:
Tymoteusz Czech 2025-06-10 14:15:09 +02:00 committed by GitHub
parent 1e7d022b5a
commit d5acbea711
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 125 additions and 23 deletions

View File

@ -4,7 +4,6 @@ import { useProjectColor } from './useProjectColor.js';
import { useTheme } from '@mui/material'; import { useTheme } from '@mui/material';
import type { GroupedDataByProject } from './useGroupedProjectTrends.js'; import type { GroupedDataByProject } from './useGroupedProjectTrends.js';
import useProjects from 'hooks/api/getters/useProjects/useProjects'; import useProjects from 'hooks/api/getters/useProjects/useProjects';
import { useFlag } from '@unleash/proxy-client-react';
type ProjectFlagTrends = InstanceInsightsSchema['projectFlagTrends']; type ProjectFlagTrends = InstanceInsightsSchema['projectFlagTrends'];
@ -26,7 +25,6 @@ export const useProjectChartData = (
projectFlagTrends: GroupedDataByProject<ProjectFlagTrends>, projectFlagTrends: GroupedDataByProject<ProjectFlagTrends>,
) => { ) => {
const theme = useTheme(); const theme = useTheme();
const healthToTechDebtEnabled = useFlag('healthToTechDebt');
const getProjectColor = useProjectColor(); const getProjectColor = useProjectColor();
const { projects } = useProjects(); const { projects } = useProjects();
const projectNames = new Map( const projectNames = new Map(
@ -39,17 +37,7 @@ export const useProjectChartData = (
const color = getProjectColor(project); const color = getProjectColor(project);
return { return {
label: projectNames.get(project) || project, label: projectNames.get(project) || project,
data: trends.map((item) => ({ data: trends,
...item,
...(healthToTechDebtEnabled
? {
technicalDebt: item.total
? calculateTechDebt(item)
: undefined,
}
: {}),
})),
borderColor: color, borderColor: color,
backgroundColor: color, backgroundColor: color,
fill: false, fill: false,

View File

@ -14,6 +14,9 @@ const placeholderData: ProjectStatusSchema = {
health: { health: {
current: 0, current: 0,
}, },
technicalDebt: {
current: 0,
},
lifecycleSummary: { lifecycleSummary: {
initial: { initial: {
currentFlags: 0, currentFlags: 0,

View File

@ -37,7 +37,10 @@ export interface HealthOverviewSchema {
featureNaming?: CreateFeatureNamingPatternSchema; featureNaming?: CreateFeatureNamingPatternSchema;
/** An array containing an overview of all the features of the project and their individual status */ /** An array containing an overview of all the features of the project and their individual status */
features: FeatureSchema[]; features: FeatureSchema[];
/** The overall [health rating](https://docs.getunleash.io/reference/technical-debt#project-status) of the project. */ /**
* Use `technicalDebt` instead.
* @deprecated
*/
health: number; health: number;
/** /**
* The number of users/members in the project. * The number of users/members in the project.
@ -50,6 +53,12 @@ export interface HealthOverviewSchema {
name: string; name: string;
/** Project statistics */ /** Project statistics */
stats?: ProjectStatsSchema; 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. * When the project was last updated.
* @nullable * @nullable

View File

@ -39,7 +39,10 @@ export interface HealthReportSchema {
featureNaming?: CreateFeatureNamingPatternSchema; featureNaming?: CreateFeatureNamingPatternSchema;
/** An array containing an overview of all the features of the project and their individual status */ /** An array containing an overview of all the features of the project and their individual status */
features: FeatureSchema[]; features: FeatureSchema[];
/** The overall [health rating](https://docs.getunleash.io/reference/technical-debt#project-status) of the project. */ /**
* Use `technicalDebt` instead.
* @deprecated
*/
health: number; health: number;
/** /**
* The number of users/members in the project. * The number of users/members in the project.
@ -56,6 +59,12 @@ export interface HealthReportSchema {
staleCount: number; staleCount: number;
/** Project statistics */ /** Project statistics */
stats?: ProjectStatsSchema; 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. * When the project was last updated.
* @nullable * @nullable

View File

@ -1066,6 +1066,7 @@ export * from './projectFlagCreatorsSchemaItem.js';
export * from './projectInsightsSchema.js'; export * from './projectInsightsSchema.js';
export * from './projectInsightsSchemaHealth.js'; export * from './projectInsightsSchemaHealth.js';
export * from './projectInsightsSchemaMembers.js'; export * from './projectInsightsSchemaMembers.js';
export * from './projectInsightsSchemaTechnicalDebt.js';
export * from './projectLinkTemplateSchema.js'; export * from './projectLinkTemplateSchema.js';
export * from './projectOverviewSchema.js'; export * from './projectOverviewSchema.js';
export * from './projectOverviewSchemaMode.js'; export * from './projectOverviewSchemaMode.js';
@ -1100,6 +1101,7 @@ export * from './projectStatusSchemaLifecycleSummaryLive.js';
export * from './projectStatusSchemaLifecycleSummaryPreLive.js'; export * from './projectStatusSchemaLifecycleSummaryPreLive.js';
export * from './projectStatusSchemaResources.js'; export * from './projectStatusSchemaResources.js';
export * from './projectStatusSchemaStaleFlags.js'; export * from './projectStatusSchemaStaleFlags.js';
export * from './projectStatusSchemaTechnicalDebt.js';
export * from './projectUsersSchema.js'; export * from './projectUsersSchema.js';
export * from './projectsSchema.js'; export * from './projectsSchema.js';
export * from './provideFeedbackSchema.js'; export * from './provideFeedbackSchema.js';

View File

@ -9,7 +9,10 @@ export type InstanceInsightsSchemaProjectFlagTrendsItem = {
active: number; active: number;
/** A UTC date when the stats were captured. Time is the very end of a given day. */ /** A UTC date when the stats were captured. Time is the very end of a given day. */
date: string; 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; health: number;
/** The number of time calculated potentially stale flags on a particular day */ /** The number of time calculated potentially stale flags on a particular day */
potentiallyStale: number; potentiallyStale: number;
@ -17,6 +20,12 @@ export type InstanceInsightsSchemaProjectFlagTrendsItem = {
project: string; project: string;
/** The number of user marked stale flags on a particular day */ /** The number of user marked stale flags on a particular day */
stale: number; 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 */ /** The average time from when a feature was created to when it was enabled in the "production" environment during the current window */
timeToProduction?: number; timeToProduction?: number;
/** The number of all flags on a particular day */ /** The number of all flags on a particular day */

View File

@ -26,7 +26,8 @@ export type PersonalDashboardProjectDetailsSchemaInsights = {
*/ */
avgHealthPastWindow: number | null; avgHealthPastWindow: number | null;
/** /**
* The project's current health score * Use `technicalDebt` instead.
* @deprecated
* @minimum 0 * @minimum 0
*/ */
health: number; health: number;
@ -40,6 +41,12 @@ export type PersonalDashboardProjectDetailsSchemaInsights = {
* @minimum 0 * @minimum 0
*/ */
staleFlags: number; 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 * The current number of non-archived flags
* @minimum 0 * @minimum 0

View File

@ -11,7 +11,8 @@ export type PersonalDashboardSchemaProjectsItem = {
*/ */
featureCount: number; 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 * @minimum 0
*/ */
health: number; health: number;
@ -24,4 +25,10 @@ export type PersonalDashboardSchemaProjectsItem = {
memberCount: number; memberCount: number;
/** The name of the project */ /** The name of the project */
name: string; 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;
}; };

View File

@ -8,6 +8,7 @@ import type { ProjectInsightsSchemaHealth } from './projectInsightsSchemaHealth.
import type { ProjectDoraMetricsSchema } from './projectDoraMetricsSchema.js'; import type { ProjectDoraMetricsSchema } from './projectDoraMetricsSchema.js';
import type { ProjectInsightsSchemaMembers } from './projectInsightsSchemaMembers.js'; import type { ProjectInsightsSchemaMembers } from './projectInsightsSchemaMembers.js';
import type { ProjectStatsSchema } from './projectStatsSchema.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. * 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 { export interface ProjectInsightsSchema {
/** The number of features of each type */ /** The number of features of each type */
featureTypeCounts: FeatureTypeCountSchema[]; featureTypeCounts: FeatureTypeCountSchema[];
/** Health summary of the project */ /**
* Use `technicalDebt` instead. Summary of the project health
* @deprecated
*/
health: ProjectInsightsSchemaHealth; health: ProjectInsightsSchemaHealth;
/** Lead time (DORA) metrics */ /** Lead time (DORA) metrics */
leadTime: ProjectDoraMetricsSchema; leadTime: ProjectDoraMetricsSchema;
@ -23,4 +27,6 @@ export interface ProjectInsightsSchema {
members: ProjectInsightsSchemaMembers; members: ProjectInsightsSchemaMembers;
/** Project statistics */ /** Project statistics */
stats: ProjectStatsSchema; stats: ProjectStatsSchema;
/** Summary of the projects technical debt */
technicalDebt: ProjectInsightsSchemaTechnicalDebt;
} }

View File

@ -5,14 +5,15 @@
*/ */
/** /**
* Health summary of the project * Use `technicalDebt` instead. Summary of the project health
* @deprecated
*/ */
export type ProjectInsightsSchemaHealth = { export type ProjectInsightsSchemaHealth = {
/** The number of active feature flags. */ /** The number of active feature flags. */
activeCount: number; activeCount: number;
/** The number of potentially stale feature flags. */ /** The number of potentially stale feature flags. */
potentiallyStaleCount: number; 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; rating: number;
/** The number of stale feature flags. */ /** The number of stale feature flags. */
staleCount: number; staleCount: number;

View File

@ -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;
};

View File

@ -44,7 +44,10 @@ export interface ProjectOverviewSchema {
featureNaming?: CreateFeatureNamingPatternSchema; featureNaming?: CreateFeatureNamingPatternSchema;
/** The number of features of each type that are in this project */ /** The number of features of each type that are in this project */
featureTypeCounts?: FeatureTypeCountSchema[]; 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; health?: number;
/** A list of templates for links that will be automatically added to new feature flags. */ /** A list of templates for links that will be automatically added to new feature flags. */
linkTemplates?: ProjectLinkTemplateSchema[]; linkTemplates?: ProjectLinkTemplateSchema[];
@ -58,6 +61,12 @@ export interface ProjectOverviewSchema {
onboardingStatus: ProjectOverviewSchemaOnboardingStatus; onboardingStatus: ProjectOverviewSchemaOnboardingStatus;
/** Project statistics */ /** Project statistics */
stats?: ProjectStatsSchema; 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. * When the project was last updated.
* @nullable * @nullable

View File

@ -37,7 +37,10 @@ export interface ProjectSchema {
favorite?: boolean; favorite?: boolean;
/** The number of features this project has */ /** The number of features this project has */
featureCount?: number; 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; health?: number;
/** The id of this project */ /** The id of this project */
id: string; id: string;
@ -69,6 +72,12 @@ export interface ProjectSchema {
* @deprecated * @deprecated
*/ */
staleFeatureCount?: number; 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. * When this project was last updated.
* @deprecated * @deprecated

View File

@ -8,6 +8,7 @@ import type { ProjectStatusSchemaHealth } from './projectStatusSchemaHealth.js';
import type { ProjectStatusSchemaLifecycleSummary } from './projectStatusSchemaLifecycleSummary.js'; import type { ProjectStatusSchemaLifecycleSummary } from './projectStatusSchemaLifecycleSummary.js';
import type { ProjectStatusSchemaResources } from './projectStatusSchemaResources.js'; import type { ProjectStatusSchemaResources } from './projectStatusSchemaResources.js';
import type { ProjectStatusSchemaStaleFlags } from './projectStatusSchemaStaleFlags.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 projects activity level over time. * 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 projects activity level over time.
@ -23,4 +24,6 @@ export interface ProjectStatusSchema {
resources: ProjectStatusSchemaResources; resources: ProjectStatusSchemaResources;
/** Information on stale and potentially stale flags in this project. */ /** Information on stale and potentially stale flags in this project. */
staleFlags: ProjectStatusSchemaStaleFlags; staleFlags: ProjectStatusSchemaStaleFlags;
/** Information about the project's health rating */
technicalDebt: ProjectStatusSchemaTechnicalDebt;
} }

View File

@ -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;
};