Skip to content

Commit

Permalink
Update orval for project status lifecycle (#8716)
Browse files Browse the repository at this point in the history
Update schema and orval for project status to add lifecycle information
  • Loading branch information
thomasheartman authored Nov 12, 2024
1 parent 11d2645 commit 24a30e5
Show file tree
Hide file tree
Showing 11 changed files with 172 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/openapi/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/openapi/models/projectStatusSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

/**
Expand All @@ -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;
}
26 changes: 26 additions & 0 deletions frontend/src/openapi/models/projectStatusSchemaLifecycleSummary.ts
Original file line number Diff line number Diff line change
@@ -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;
};
Original file line number Diff line number Diff line change
@@ -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;
};
Original file line number Diff line number Diff line change
@@ -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;
};
Original file line number Diff line number Diff line change
@@ -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;
};
Original file line number Diff line number Diff line change
@@ -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;
};
Original file line number Diff line number Diff line change
@@ -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;
};
22 changes: 22 additions & 0 deletions src/lib/openapi/spec/project-status-schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
7 changes: 6 additions & 1 deletion src/lib/openapi/spec/project-status-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 24a30e5

Please sign in to comment.