diff --git a/frontend/src/component/project/Project/ProjectStatus/ProjectResources.tsx b/frontend/src/component/project/Project/ProjectStatus/ProjectResources.tsx index d8b7bfdd176b..419d3d4051a0 100644 --- a/frontend/src/component/project/Project/ProjectStatus/ProjectResources.tsx +++ b/frontend/src/component/project/Project/ProjectStatus/ProjectResources.tsx @@ -5,7 +5,6 @@ import UsersIcon from '@mui/icons-material/Group'; import { Link } from 'react-router-dom'; import ApiKeyIcon from '@mui/icons-material/Key'; import SegmentsIcon from '@mui/icons-material/DonutLarge'; -import ConnectedIcon from '@mui/icons-material/Cable'; import { useProjectStatus } from 'hooks/api/getters/useProjectStatus/useProjectStatus'; import useLoading from 'hooks/useLoading'; import { HealthGridTile } from './ProjectHealthGrid.styles'; @@ -90,7 +89,6 @@ const useProjectResources = (projectId: string) => { resources: { members: 0, apiTokens: 0, - connectedEnvironments: 0, segments: 0, }, }; @@ -130,15 +128,6 @@ export const ProjectResources = () => { {resources.apiTokens} API key(s) - } - > - {resources.connectedEnvironments} connected - environment(s) - - `api/admin/projects/${projectId}/status`; const placeholderData: ProjectStatusSchema = { activityCountByDate: [], resources: { - connectedEnvironments: 0, members: 0, apiTokens: 0, segments: 0, diff --git a/frontend/src/openapi/models/projectStatusSchemaResources.ts b/frontend/src/openapi/models/projectStatusSchemaResources.ts index bb028781dd35..268e82103ec7 100644 --- a/frontend/src/openapi/models/projectStatusSchemaResources.ts +++ b/frontend/src/openapi/models/projectStatusSchemaResources.ts @@ -13,11 +13,6 @@ export type ProjectStatusSchemaResources = { * @minimum 0 */ apiTokens: number; - /** - * The number of environments that have received SDK traffic in this project. - * @minimum 0 - */ - connectedEnvironments: number; /** * The number of users who have been granted roles in this project. Does not include users who have access via groups. * @minimum 0 diff --git a/src/lib/features/project-status/project-status-service.ts b/src/lib/features/project-status/project-status-service.ts index aae6c02fc36c..28f21d946fb5 100644 --- a/src/lib/features/project-status/project-status-service.ts +++ b/src/lib/features/project-status/project-status-service.ts @@ -44,7 +44,6 @@ export class ProjectStatusService { async getProjectStatus(projectId: string): Promise { const [ - connectedEnvironments, members, apiTokens, segments, @@ -53,7 +52,6 @@ export class ProjectStatusService { lifecycleSummary, staleFlagCount, ] = await Promise.all([ - this.projectStore.getConnectedEnvironmentCountForProject(projectId), this.projectStore.getMembersCountByProject(projectId), this.apiTokenStore.countProjectTokens(projectId), this.segmentStore.getProjectSegmentCount(projectId), @@ -74,7 +72,6 @@ export class ProjectStatusService { return { resources: { - connectedEnvironments, members, apiTokens, segments, diff --git a/src/lib/features/project-status/projects-status.e2e.test.ts b/src/lib/features/project-status/projects-status.e2e.test.ts index e3b1f2697bde..73966d7dab15 100644 --- a/src/lib/features/project-status/projects-status.e2e.test.ts +++ b/src/lib/features/project-status/projects-status.e2e.test.ts @@ -127,51 +127,6 @@ test('project insights should return correct count for each day', async () => { }); }); -test('project status should return environments with connected SDKs', async () => { - const flagName = randomId(); - await app.createFeature(flagName); - - const envs = - await app.services.environmentService.getProjectEnvironments('default'); - expect(envs.some((env) => env.name === 'default')).toBeTruthy(); - - const appName = 'blah'; - const environment = 'default'; - await db.stores.clientMetricsStoreV2.batchInsertMetrics([ - { - featureName: `flag-doesnt-exist`, - appName, - environment, - timestamp: new Date(), - yes: 5, - no: 2, - }, - { - featureName: flagName, - appName: `web2`, - environment, - timestamp: new Date(), - yes: 5, - no: 2, - }, - { - featureName: flagName, - appName, - environment: 'not-a-real-env', - timestamp: new Date(), - yes: 2, - no: 2, - }, - ]); - - const { body } = await app.request - .get('/api/admin/projects/default/status') - .expect('Content-Type', /json/) - .expect(200); - - expect(body.resources.connectedEnvironments).toBe(1); -}); - test('project resources should contain the right data', async () => { const { body: noResourcesBody } = await app.request .get('/api/admin/projects/default/status') @@ -182,7 +137,6 @@ test('project resources should contain the right data', async () => { members: 0, apiTokens: 0, segments: 0, - connectedEnvironments: 0, }); const flagName = randomId(); @@ -239,7 +193,6 @@ test('project resources should contain the right data', async () => { members: 1, apiTokens: 1, segments: 1, - connectedEnvironments: 1, }); }); diff --git a/src/lib/features/project/project-store-type.ts b/src/lib/features/project/project-store-type.ts index 33218f5d9487..9f3a190a27c4 100644 --- a/src/lib/features/project/project-store-type.ts +++ b/src/lib/features/project/project-store-type.ts @@ -93,8 +93,6 @@ export interface IProjectStore extends Store { getEnvironmentsForProject(id: string): Promise; - getConnectedEnvironmentCountForProject(id: string): Promise; - getMembersCountByProject(projectId: string): Promise; getMembersCountByProjectAfterDate( diff --git a/src/lib/features/project/project-store.ts b/src/lib/features/project/project-store.ts index 6f213782f160..5df93193c63e 100644 --- a/src/lib/features/project/project-store.ts +++ b/src/lib/features/project/project-store.ts @@ -390,22 +390,6 @@ class ProjectStore implements IProjectStore { return rows.map(this.mapProjectEnvironmentRow); } - async getConnectedEnvironmentCountForProject(id: string): Promise { - const [{ count }] = (await this.db - .countDistinct('cme.environment') - .from('client_metrics_env as cme') - .innerJoin('features', 'cme.feature_name', 'features.name') - .innerJoin('projects', 'features.project', 'projects.id') - .innerJoin( - 'project_environments', - 'cme.environment', - 'project_environments.environment_name', - ) - .where('features.project', id)) as { count: string }[]; - - return Number(count); - } - async getMembersCountByProject(projectId: string): Promise { const members = await this.db .from((db) => { diff --git a/src/lib/openapi/spec/project-status-schema.test.ts b/src/lib/openapi/spec/project-status-schema.test.ts index b5db36a885da..2f753cf8ff53 100644 --- a/src/lib/openapi/spec/project-status-schema.test.ts +++ b/src/lib/openapi/spec/project-status-schema.test.ts @@ -31,7 +31,6 @@ test('projectStatusSchema', () => { { date: '2022-12-15', count: 5 }, ], resources: { - connectedEnvironments: 2, apiTokens: 2, members: 1, segments: 0, diff --git a/src/lib/openapi/spec/project-status-schema.ts b/src/lib/openapi/spec/project-status-schema.ts index 21b3ae026731..5f51f037212a 100644 --- a/src/lib/openapi/spec/project-status-schema.ts +++ b/src/lib/openapi/spec/project-status-schema.ts @@ -52,20 +52,9 @@ export const projectStatusSchema = { resources: { type: 'object', additionalProperties: false, - required: [ - 'connectedEnvironments', - 'apiTokens', - 'members', - 'segments', - ], + required: ['apiTokens', 'members', 'segments'], description: 'Key resources within the project', properties: { - connectedEnvironments: { - type: 'integer', - minimum: 0, - description: - 'The number of environments that have received SDK traffic in this project.', - }, apiTokens: { type: 'integer', minimum: 0, diff --git a/src/test/fixtures/fake-project-store.ts b/src/test/fixtures/fake-project-store.ts index 438c04ec735d..7338bc6575bb 100644 --- a/src/test/fixtures/fake-project-store.ts +++ b/src/test/fixtures/fake-project-store.ts @@ -214,8 +214,4 @@ export default class FakeProjectStore implements IProjectStore { project.id === id ? { ...project, archivedAt: null } : project, ); } - - async getConnectedEnvironmentCountForProject(): Promise { - return 0; - } }