mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-10 01:16:39 +02:00
feat: stale flags count per project (#6043)
This commit is contained in:
parent
6ee4d2724e
commit
9b281ca508
@ -141,7 +141,10 @@ class ProjectStore implements IProjectStore {
|
|||||||
|
|
||||||
let selectColumns = [
|
let selectColumns = [
|
||||||
this.db.raw(
|
this.db.raw(
|
||||||
'projects.id, projects.name, projects.description, projects.health, projects.updated_at, projects.created_at, count(features.name) FILTER (WHERE features.archived_at is null) AS number_of_features',
|
'projects.id, projects.name, projects.description, projects.health, projects.updated_at, projects.created_at, ' +
|
||||||
|
'count(features.name) FILTER (WHERE features.archived_at is null) AS number_of_features, ' +
|
||||||
|
'count(features.name) FILTER (WHERE features.archived_at is null and features.stale IS TRUE) AS stale_feature_count, ' +
|
||||||
|
'count(features.name) FILTER (WHERE features.archived_at is null and features.potentially_stale IS TRUE) AS potentially_stale_feature_count',
|
||||||
),
|
),
|
||||||
'project_settings.default_stickiness',
|
'project_settings.default_stickiness',
|
||||||
'project_settings.project_mode',
|
'project_settings.project_mode',
|
||||||
@ -203,6 +206,9 @@ class ProjectStore implements IProjectStore {
|
|||||||
health: row.health,
|
health: row.health,
|
||||||
favorite: row.favorite,
|
favorite: row.favorite,
|
||||||
featureCount: Number(row.number_of_features) || 0,
|
featureCount: Number(row.number_of_features) || 0,
|
||||||
|
staleFeatureCount: Number(row.stale_feature_count) || 0,
|
||||||
|
potentiallyStaleFeatureCount:
|
||||||
|
Number(row.potentially_stale_feature_count) || 0,
|
||||||
memberCount: Number(row.number_of_users) || 0,
|
memberCount: Number(row.number_of_users) || 0,
|
||||||
updatedAt: row.updated_at,
|
updatedAt: row.updated_at,
|
||||||
createdAt: row.created_at,
|
createdAt: row.created_at,
|
||||||
|
@ -35,6 +35,17 @@ export const projectSchema = {
|
|||||||
example: 10,
|
example: 10,
|
||||||
description: 'The number of features this project has',
|
description: 'The number of features this project has',
|
||||||
},
|
},
|
||||||
|
staleFeatureCount: {
|
||||||
|
type: 'number',
|
||||||
|
example: 10,
|
||||||
|
description: 'The number of stale features this project has',
|
||||||
|
},
|
||||||
|
potentiallyStaleFeatureCount: {
|
||||||
|
type: 'number',
|
||||||
|
example: 10,
|
||||||
|
description:
|
||||||
|
'The number of potentially stale features this project has',
|
||||||
|
},
|
||||||
memberCount: {
|
memberCount: {
|
||||||
type: 'number',
|
type: 'number',
|
||||||
example: 4,
|
example: 4,
|
||||||
|
@ -497,6 +497,8 @@ export interface ICustomRole extends IRole {
|
|||||||
|
|
||||||
export interface IProjectWithCount extends IProject {
|
export interface IProjectWithCount extends IProject {
|
||||||
featureCount: number;
|
featureCount: number;
|
||||||
|
staleFeatureCount: number;
|
||||||
|
potentiallyStaleFeatureCount: number;
|
||||||
memberCount: number;
|
memberCount: number;
|
||||||
favorite?: boolean;
|
favorite?: boolean;
|
||||||
}
|
}
|
||||||
|
8
src/test/fixtures/fake-project-store.ts
vendored
8
src/test/fixtures/fake-project-store.ts
vendored
@ -42,7 +42,13 @@ export default class FakeProjectStore implements IProjectStore {
|
|||||||
|
|
||||||
async getProjectsWithCounts(): Promise<IProjectWithCount[]> {
|
async getProjectsWithCounts(): Promise<IProjectWithCount[]> {
|
||||||
return this.projects.map((project) => {
|
return this.projects.map((project) => {
|
||||||
return { ...project, memberCount: 0, featureCount: 0 };
|
return {
|
||||||
|
...project,
|
||||||
|
memberCount: 0,
|
||||||
|
featureCount: 0,
|
||||||
|
staleFeatureCount: 0,
|
||||||
|
potentiallyStaleFeatureCount: 0,
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user