1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-14 00:19:16 +01:00

fix: add environments to project details (#992)

This commit is contained in:
Ivar Conradi Østhus 2021-09-29 12:22:04 +02:00 committed by GitHub
parent e3cebb21c8
commit 0a83abe101
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 0 deletions

View File

@ -63,6 +63,9 @@ export default class ProjectHealthService {
archived: boolean = false,
): Promise<IProjectOverview> {
const project = await this.projectStore.get(projectId);
const environments = await this.projectStore.getEnvironmentsForProject(
projectId,
);
const features = await this.featureToggleService.getFeatureOverview(
projectId,
archived,
@ -72,6 +75,7 @@ export default class ProjectHealthService {
name: project.name,
description: project.description,
health: project.health,
environments,
features,
members,
version: 1,

View File

@ -310,6 +310,9 @@ export default class ProjectService {
archived: boolean = false,
): Promise<IProjectOverview> {
const project = await this.store.get(projectId);
const environments = await this.store.getEnvironmentsForProject(
projectId,
);
const features = await this.featureToggleService.getFeatureOverview(
projectId,
archived,
@ -317,6 +320,7 @@ export default class ProjectService {
const members = await this.store.getMembers(projectId);
return {
name: project.name,
environments,
description: project.description,
health: project.health,
features,

View File

@ -135,6 +135,7 @@ export interface IFeatureOverview {
export interface IProjectOverview {
name: string;
description: string;
environments: string[];
features: IFeatureOverview[];
members: number;
version: number;

View File

@ -49,6 +49,8 @@ test('Project with no stale toggles should have 100% health rating', async () =>
.expect('Content-Type', /json/)
.expect((res) => {
expect(res.body.health).toBe(100);
expect(res.body.environments).toHaveLength(1);
expect(res.body.environments).toStrictEqual(['default']);
});
});