1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

1-3120: remove project connected environments (#8775)

Remove everything related to the connected environment count for project
status. We decided that because we don't have anywhere to link it to at
the moment, we don't want to show it yet.
This commit is contained in:
Thomas Heartman 2024-11-18 12:01:25 +01:00 committed by GitHub
parent fb9c754008
commit a55a956772
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 1 additions and 102 deletions

View File

@ -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)
</ListItem>
<ListItem
linkUrl={`/projects/${projectId}/settings/placeholder`}
linkText='View connections'
icon={<ConnectedIcon />}
>
{resources.connectedEnvironments} connected
environment(s)
</ListItem>
<ListItem
linkUrl={`/projects/${projectId}/settings/segments`}
linkText='Add segments'

View File

@ -7,7 +7,6 @@ const path = (projectId: string) => `api/admin/projects/${projectId}/status`;
const placeholderData: ProjectStatusSchema = {
activityCountByDate: [],
resources: {
connectedEnvironments: 0,
members: 0,
apiTokens: 0,
segments: 0,

View File

@ -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

View File

@ -44,7 +44,6 @@ export class ProjectStatusService {
async getProjectStatus(projectId: string): Promise<ProjectStatusSchema> {
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,

View File

@ -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,
});
});

View File

@ -93,8 +93,6 @@ export interface IProjectStore extends Store<IProject, string> {
getEnvironmentsForProject(id: string): Promise<ProjectEnvironment[]>;
getConnectedEnvironmentCountForProject(id: string): Promise<number>;
getMembersCountByProject(projectId: string): Promise<number>;
getMembersCountByProjectAfterDate(

View File

@ -390,22 +390,6 @@ class ProjectStore implements IProjectStore {
return rows.map(this.mapProjectEnvironmentRow);
}
async getConnectedEnvironmentCountForProject(id: string): Promise<number> {
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<number> {
const members = await this.db
.from((db) => {

View File

@ -31,7 +31,6 @@ test('projectStatusSchema', () => {
{ date: '2022-12-15', count: 5 },
],
resources: {
connectedEnvironments: 2,
apiTokens: 2,
members: 1,
segments: 0,

View File

@ -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,

View File

@ -214,8 +214,4 @@ export default class FakeProjectStore implements IProjectStore {
project.id === id ? { ...project, archivedAt: null } : project,
);
}
async getConnectedEnvironmentCountForProject(): Promise<number> {
return 0;
}
}