diff --git a/frontend/src/hooks/api/getters/useProjectStatus/useProjectStatus.ts b/frontend/src/hooks/api/getters/useProjectStatus/useProjectStatus.ts index d3a5963f18..8a29fbe019 100644 --- a/frontend/src/hooks/api/getters/useProjectStatus/useProjectStatus.ts +++ b/frontend/src/hooks/api/getters/useProjectStatus/useProjectStatus.ts @@ -13,6 +13,28 @@ const placeholderData: ProjectStatusSchema = { segments: 0, }, averageHealth: 0, + lifecycleSummary: { + initial: { + currentFlags: 0, + averageDays: null, + }, + preLive: { + currentFlags: 0, + averageDays: null, + }, + live: { + currentFlags: 0, + averageDays: null, + }, + completed: { + currentFlags: 0, + averageDays: null, + }, + archived: { + currentFlags: 0, + last30Days: 0, + }, + }, }; export const useProjectStatus = (projectId: string) => { diff --git a/frontend/src/openapi/models/index.ts b/frontend/src/openapi/models/index.ts index 8e28d287be..72d56823bb 100644 --- a/frontend/src/openapi/models/index.ts +++ b/frontend/src/openapi/models/index.ts @@ -1030,6 +1030,12 @@ export * from './projectSettingsSchemaDefaultStickiness'; export * from './projectSettingsSchemaMode'; export * from './projectStatsSchema'; export * from './projectStatusSchema'; +export * from './projectStatusSchemaLifecycleSummary'; +export * from './projectStatusSchemaLifecycleSummaryArchived'; +export * from './projectStatusSchemaLifecycleSummaryCompleted'; +export * from './projectStatusSchemaLifecycleSummaryInitial'; +export * from './projectStatusSchemaLifecycleSummaryLive'; +export * from './projectStatusSchemaLifecycleSummaryPreLive'; export * from './projectStatusSchemaResources'; export * from './projectUsersSchema'; export * from './projectsSchema'; diff --git a/frontend/src/openapi/models/projectStatusSchema.ts b/frontend/src/openapi/models/projectStatusSchema.ts index 0794d97f1c..87dda22ef4 100644 --- a/frontend/src/openapi/models/projectStatusSchema.ts +++ b/frontend/src/openapi/models/projectStatusSchema.ts @@ -4,6 +4,7 @@ * See `gen:api` script in package.json */ import type { ProjectActivitySchema } from './projectActivitySchema'; +import type { ProjectStatusSchemaLifecycleSummary } from './projectStatusSchemaLifecycleSummary'; import type { ProjectStatusSchemaResources } from './projectStatusSchemaResources'; /** @@ -17,6 +18,8 @@ export interface ProjectStatusSchema { * @minimum 0 */ averageHealth: number; + /** Feature flag lifecycle statistics for this project. */ + lifecycleSummary: ProjectStatusSchemaLifecycleSummary; /** Key resources within the project */ resources: ProjectStatusSchemaResources; } diff --git a/frontend/src/openapi/models/projectStatusSchemaLifecycleSummary.ts b/frontend/src/openapi/models/projectStatusSchemaLifecycleSummary.ts new file mode 100644 index 0000000000..9fe115a232 --- /dev/null +++ b/frontend/src/openapi/models/projectStatusSchemaLifecycleSummary.ts @@ -0,0 +1,26 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ +import type { ProjectStatusSchemaLifecycleSummaryArchived } from './projectStatusSchemaLifecycleSummaryArchived'; +import type { ProjectStatusSchemaLifecycleSummaryCompleted } from './projectStatusSchemaLifecycleSummaryCompleted'; +import type { ProjectStatusSchemaLifecycleSummaryInitial } from './projectStatusSchemaLifecycleSummaryInitial'; +import type { ProjectStatusSchemaLifecycleSummaryLive } from './projectStatusSchemaLifecycleSummaryLive'; +import type { ProjectStatusSchemaLifecycleSummaryPreLive } from './projectStatusSchemaLifecycleSummaryPreLive'; + +/** + * Feature flag lifecycle statistics for this project. + */ +export type ProjectStatusSchemaLifecycleSummary = { + /** Information on archived flags in this project. */ + archived: ProjectStatusSchemaLifecycleSummaryArchived; + /** Statistics on feature flags in a given stage in this project. */ + completed: ProjectStatusSchemaLifecycleSummaryCompleted; + /** Statistics on feature flags in a given stage in this project. */ + initial: ProjectStatusSchemaLifecycleSummaryInitial; + /** Statistics on feature flags in a given stage in this project. */ + live: ProjectStatusSchemaLifecycleSummaryLive; + /** Statistics on feature flags in a given stage in this project. */ + preLive: ProjectStatusSchemaLifecycleSummaryPreLive; +}; diff --git a/frontend/src/openapi/models/projectStatusSchemaLifecycleSummaryArchived.ts b/frontend/src/openapi/models/projectStatusSchemaLifecycleSummaryArchived.ts new file mode 100644 index 0000000000..7ddd3e3205 --- /dev/null +++ b/frontend/src/openapi/models/projectStatusSchemaLifecycleSummaryArchived.ts @@ -0,0 +1,15 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ + +/** + * Information on archived flags in this project. + */ +export type ProjectStatusSchemaLifecycleSummaryArchived = { + /** The number of archived feature flags in this project. If a flag is deleted permanently, it will no longer be counted as part of this statistic. */ + currentFlags: number; + /** The number of flags in this project that have been changed over the last 30 days. */ + last30Days: number; +}; diff --git a/frontend/src/openapi/models/projectStatusSchemaLifecycleSummaryCompleted.ts b/frontend/src/openapi/models/projectStatusSchemaLifecycleSummaryCompleted.ts new file mode 100644 index 0000000000..c00ec173a7 --- /dev/null +++ b/frontend/src/openapi/models/projectStatusSchemaLifecycleSummaryCompleted.ts @@ -0,0 +1,18 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ + +/** + * Statistics on feature flags in a given stage in this project. + */ +export type ProjectStatusSchemaLifecycleSummaryCompleted = { + /** + * The average number of days a feature flag remains in a stage in this project. Will be null if Unleash doesn't have any data for this stage yet. + * @nullable + */ + averageDays: number | null; + /** The number of feature flags currently in a stage in this project. */ + currentFlags: number; +}; diff --git a/frontend/src/openapi/models/projectStatusSchemaLifecycleSummaryInitial.ts b/frontend/src/openapi/models/projectStatusSchemaLifecycleSummaryInitial.ts new file mode 100644 index 0000000000..706b004da6 --- /dev/null +++ b/frontend/src/openapi/models/projectStatusSchemaLifecycleSummaryInitial.ts @@ -0,0 +1,18 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ + +/** + * Statistics on feature flags in a given stage in this project. + */ +export type ProjectStatusSchemaLifecycleSummaryInitial = { + /** + * The average number of days a feature flag remains in a stage in this project. Will be null if Unleash doesn't have any data for this stage yet. + * @nullable + */ + averageDays: number | null; + /** The number of feature flags currently in a stage in this project. */ + currentFlags: number; +}; diff --git a/frontend/src/openapi/models/projectStatusSchemaLifecycleSummaryLive.ts b/frontend/src/openapi/models/projectStatusSchemaLifecycleSummaryLive.ts new file mode 100644 index 0000000000..2377e0932b --- /dev/null +++ b/frontend/src/openapi/models/projectStatusSchemaLifecycleSummaryLive.ts @@ -0,0 +1,18 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ + +/** + * Statistics on feature flags in a given stage in this project. + */ +export type ProjectStatusSchemaLifecycleSummaryLive = { + /** + * The average number of days a feature flag remains in a stage in this project. Will be null if Unleash doesn't have any data for this stage yet. + * @nullable + */ + averageDays: number | null; + /** The number of feature flags currently in a stage in this project. */ + currentFlags: number; +}; diff --git a/frontend/src/openapi/models/projectStatusSchemaLifecycleSummaryPreLive.ts b/frontend/src/openapi/models/projectStatusSchemaLifecycleSummaryPreLive.ts new file mode 100644 index 0000000000..66a37c03fd --- /dev/null +++ b/frontend/src/openapi/models/projectStatusSchemaLifecycleSummaryPreLive.ts @@ -0,0 +1,18 @@ +/** + * Generated by Orval + * Do not edit manually. + * See `gen:api` script in package.json + */ + +/** + * Statistics on feature flags in a given stage in this project. + */ +export type ProjectStatusSchemaLifecycleSummaryPreLive = { + /** + * The average number of days a feature flag remains in a stage in this project. Will be null if Unleash doesn't have any data for this stage yet. + * @nullable + */ + averageDays: number | null; + /** The number of feature flags currently in a stage in this project. */ + currentFlags: number; +}; diff --git a/src/lib/openapi/spec/project-status-schema.test.ts b/src/lib/openapi/spec/project-status-schema.test.ts index f00b6cea52..bad54698db 100644 --- a/src/lib/openapi/spec/project-status-schema.test.ts +++ b/src/lib/openapi/spec/project-status-schema.test.ts @@ -4,6 +4,28 @@ import type { ProjectStatusSchema } from './project-status-schema'; test('projectStatusSchema', () => { const data: ProjectStatusSchema = { averageHealth: 50, + lifecycleSummary: { + initial: { + currentFlags: 0, + averageDays: null, + }, + preLive: { + currentFlags: 0, + averageDays: null, + }, + live: { + currentFlags: 0, + averageDays: null, + }, + completed: { + currentFlags: 0, + averageDays: null, + }, + archived: { + currentFlags: 0, + last30Days: 0, + }, + }, activityCountByDate: [ { date: '2022-12-14', count: 2 }, { date: '2022-12-15', count: 5 }, diff --git a/src/lib/openapi/spec/project-status-schema.ts b/src/lib/openapi/spec/project-status-schema.ts index 808ba4f0ea..5b59f6cdb9 100644 --- a/src/lib/openapi/spec/project-status-schema.ts +++ b/src/lib/openapi/spec/project-status-schema.ts @@ -28,7 +28,12 @@ export const projectStatusSchema = { $id: '#/components/schemas/projectStatusSchema', type: 'object', additionalProperties: false, - required: ['activityCountByDate', 'resources', 'averageHealth'], + required: [ + 'activityCountByDate', + 'resources', + 'averageHealth', + 'lifecycleSummary', + ], description: '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.', properties: {