mirror of
https://github.com/Unleash/unleash.git
synced 2025-03-18 00:19:49 +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:
parent
fb9c754008
commit
a55a956772
@ -5,7 +5,6 @@ import UsersIcon from '@mui/icons-material/Group';
|
|||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import ApiKeyIcon from '@mui/icons-material/Key';
|
import ApiKeyIcon from '@mui/icons-material/Key';
|
||||||
import SegmentsIcon from '@mui/icons-material/DonutLarge';
|
import SegmentsIcon from '@mui/icons-material/DonutLarge';
|
||||||
import ConnectedIcon from '@mui/icons-material/Cable';
|
|
||||||
import { useProjectStatus } from 'hooks/api/getters/useProjectStatus/useProjectStatus';
|
import { useProjectStatus } from 'hooks/api/getters/useProjectStatus/useProjectStatus';
|
||||||
import useLoading from 'hooks/useLoading';
|
import useLoading from 'hooks/useLoading';
|
||||||
import { HealthGridTile } from './ProjectHealthGrid.styles';
|
import { HealthGridTile } from './ProjectHealthGrid.styles';
|
||||||
@ -90,7 +89,6 @@ const useProjectResources = (projectId: string) => {
|
|||||||
resources: {
|
resources: {
|
||||||
members: 0,
|
members: 0,
|
||||||
apiTokens: 0,
|
apiTokens: 0,
|
||||||
connectedEnvironments: 0,
|
|
||||||
segments: 0,
|
segments: 0,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -130,15 +128,6 @@ export const ProjectResources = () => {
|
|||||||
{resources.apiTokens} API key(s)
|
{resources.apiTokens} API key(s)
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|
||||||
<ListItem
|
|
||||||
linkUrl={`/projects/${projectId}/settings/placeholder`}
|
|
||||||
linkText='View connections'
|
|
||||||
icon={<ConnectedIcon />}
|
|
||||||
>
|
|
||||||
{resources.connectedEnvironments} connected
|
|
||||||
environment(s)
|
|
||||||
</ListItem>
|
|
||||||
|
|
||||||
<ListItem
|
<ListItem
|
||||||
linkUrl={`/projects/${projectId}/settings/segments`}
|
linkUrl={`/projects/${projectId}/settings/segments`}
|
||||||
linkText='Add segments'
|
linkText='Add segments'
|
||||||
|
@ -7,7 +7,6 @@ const path = (projectId: string) => `api/admin/projects/${projectId}/status`;
|
|||||||
const placeholderData: ProjectStatusSchema = {
|
const placeholderData: ProjectStatusSchema = {
|
||||||
activityCountByDate: [],
|
activityCountByDate: [],
|
||||||
resources: {
|
resources: {
|
||||||
connectedEnvironments: 0,
|
|
||||||
members: 0,
|
members: 0,
|
||||||
apiTokens: 0,
|
apiTokens: 0,
|
||||||
segments: 0,
|
segments: 0,
|
||||||
|
@ -13,11 +13,6 @@ export type ProjectStatusSchemaResources = {
|
|||||||
* @minimum 0
|
* @minimum 0
|
||||||
*/
|
*/
|
||||||
apiTokens: number;
|
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.
|
* The number of users who have been granted roles in this project. Does not include users who have access via groups.
|
||||||
* @minimum 0
|
* @minimum 0
|
||||||
|
@ -44,7 +44,6 @@ export class ProjectStatusService {
|
|||||||
|
|
||||||
async getProjectStatus(projectId: string): Promise<ProjectStatusSchema> {
|
async getProjectStatus(projectId: string): Promise<ProjectStatusSchema> {
|
||||||
const [
|
const [
|
||||||
connectedEnvironments,
|
|
||||||
members,
|
members,
|
||||||
apiTokens,
|
apiTokens,
|
||||||
segments,
|
segments,
|
||||||
@ -53,7 +52,6 @@ export class ProjectStatusService {
|
|||||||
lifecycleSummary,
|
lifecycleSummary,
|
||||||
staleFlagCount,
|
staleFlagCount,
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
this.projectStore.getConnectedEnvironmentCountForProject(projectId),
|
|
||||||
this.projectStore.getMembersCountByProject(projectId),
|
this.projectStore.getMembersCountByProject(projectId),
|
||||||
this.apiTokenStore.countProjectTokens(projectId),
|
this.apiTokenStore.countProjectTokens(projectId),
|
||||||
this.segmentStore.getProjectSegmentCount(projectId),
|
this.segmentStore.getProjectSegmentCount(projectId),
|
||||||
@ -74,7 +72,6 @@ export class ProjectStatusService {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
resources: {
|
resources: {
|
||||||
connectedEnvironments,
|
|
||||||
members,
|
members,
|
||||||
apiTokens,
|
apiTokens,
|
||||||
segments,
|
segments,
|
||||||
|
@ -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 () => {
|
test('project resources should contain the right data', async () => {
|
||||||
const { body: noResourcesBody } = await app.request
|
const { body: noResourcesBody } = await app.request
|
||||||
.get('/api/admin/projects/default/status')
|
.get('/api/admin/projects/default/status')
|
||||||
@ -182,7 +137,6 @@ test('project resources should contain the right data', async () => {
|
|||||||
members: 0,
|
members: 0,
|
||||||
apiTokens: 0,
|
apiTokens: 0,
|
||||||
segments: 0,
|
segments: 0,
|
||||||
connectedEnvironments: 0,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const flagName = randomId();
|
const flagName = randomId();
|
||||||
@ -239,7 +193,6 @@ test('project resources should contain the right data', async () => {
|
|||||||
members: 1,
|
members: 1,
|
||||||
apiTokens: 1,
|
apiTokens: 1,
|
||||||
segments: 1,
|
segments: 1,
|
||||||
connectedEnvironments: 1,
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -93,8 +93,6 @@ export interface IProjectStore extends Store<IProject, string> {
|
|||||||
|
|
||||||
getEnvironmentsForProject(id: string): Promise<ProjectEnvironment[]>;
|
getEnvironmentsForProject(id: string): Promise<ProjectEnvironment[]>;
|
||||||
|
|
||||||
getConnectedEnvironmentCountForProject(id: string): Promise<number>;
|
|
||||||
|
|
||||||
getMembersCountByProject(projectId: string): Promise<number>;
|
getMembersCountByProject(projectId: string): Promise<number>;
|
||||||
|
|
||||||
getMembersCountByProjectAfterDate(
|
getMembersCountByProjectAfterDate(
|
||||||
|
@ -390,22 +390,6 @@ class ProjectStore implements IProjectStore {
|
|||||||
return rows.map(this.mapProjectEnvironmentRow);
|
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> {
|
async getMembersCountByProject(projectId: string): Promise<number> {
|
||||||
const members = await this.db
|
const members = await this.db
|
||||||
.from((db) => {
|
.from((db) => {
|
||||||
|
@ -31,7 +31,6 @@ test('projectStatusSchema', () => {
|
|||||||
{ date: '2022-12-15', count: 5 },
|
{ date: '2022-12-15', count: 5 },
|
||||||
],
|
],
|
||||||
resources: {
|
resources: {
|
||||||
connectedEnvironments: 2,
|
|
||||||
apiTokens: 2,
|
apiTokens: 2,
|
||||||
members: 1,
|
members: 1,
|
||||||
segments: 0,
|
segments: 0,
|
||||||
|
@ -52,20 +52,9 @@ export const projectStatusSchema = {
|
|||||||
resources: {
|
resources: {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
additionalProperties: false,
|
additionalProperties: false,
|
||||||
required: [
|
required: ['apiTokens', 'members', 'segments'],
|
||||||
'connectedEnvironments',
|
|
||||||
'apiTokens',
|
|
||||||
'members',
|
|
||||||
'segments',
|
|
||||||
],
|
|
||||||
description: 'Key resources within the project',
|
description: 'Key resources within the project',
|
||||||
properties: {
|
properties: {
|
||||||
connectedEnvironments: {
|
|
||||||
type: 'integer',
|
|
||||||
minimum: 0,
|
|
||||||
description:
|
|
||||||
'The number of environments that have received SDK traffic in this project.',
|
|
||||||
},
|
|
||||||
apiTokens: {
|
apiTokens: {
|
||||||
type: 'integer',
|
type: 'integer',
|
||||||
minimum: 0,
|
minimum: 0,
|
||||||
|
4
src/test/fixtures/fake-project-store.ts
vendored
4
src/test/fixtures/fake-project-store.ts
vendored
@ -214,8 +214,4 @@ export default class FakeProjectStore implements IProjectStore {
|
|||||||
project.id === id ? { ...project, archivedAt: null } : project,
|
project.id === id ? { ...project, archivedAt: null } : project,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getConnectedEnvironmentCountForProject(): Promise<number> {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user