From 0a83abe10179bfd5679350dfb09c3a5aa33bd5bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivar=20Conradi=20=C3=98sthus?= Date: Wed, 29 Sep 2021 12:22:04 +0200 Subject: [PATCH] fix: add environments to project details (#992) --- src/lib/services/project-health-service.ts | 4 ++++ src/lib/services/project-service.ts | 4 ++++ src/lib/types/model.ts | 1 + src/test/e2e/api/admin/project/project.health.e2e.test.ts | 2 ++ 4 files changed, 11 insertions(+) diff --git a/src/lib/services/project-health-service.ts b/src/lib/services/project-health-service.ts index b65ebee4ce..5d6599de18 100644 --- a/src/lib/services/project-health-service.ts +++ b/src/lib/services/project-health-service.ts @@ -63,6 +63,9 @@ export default class ProjectHealthService { archived: boolean = false, ): Promise { 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, diff --git a/src/lib/services/project-service.ts b/src/lib/services/project-service.ts index 0750215ce4..1f324bba61 100644 --- a/src/lib/services/project-service.ts +++ b/src/lib/services/project-service.ts @@ -310,6 +310,9 @@ export default class ProjectService { archived: boolean = false, ): Promise { 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, diff --git a/src/lib/types/model.ts b/src/lib/types/model.ts index 593520088b..71ece8cc8f 100644 --- a/src/lib/types/model.ts +++ b/src/lib/types/model.ts @@ -135,6 +135,7 @@ export interface IFeatureOverview { export interface IProjectOverview { name: string; description: string; + environments: string[]; features: IFeatureOverview[]; members: number; version: number; diff --git a/src/test/e2e/api/admin/project/project.health.e2e.test.ts b/src/test/e2e/api/admin/project/project.health.e2e.test.ts index 7c3d3eea22..7ed4b1eff5 100644 --- a/src/test/e2e/api/admin/project/project.health.e2e.test.ts +++ b/src/test/e2e/api/admin/project/project.health.e2e.test.ts @@ -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']); }); });