mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-01 13:47:27 +02:00
fix: project environments have info about required approvals (#9929)
This commit is contained in:
parent
c8ebaa49fc
commit
3865fb41ae
@ -56,3 +56,14 @@ test('querying environments in OSS only returns environments that are included i
|
|||||||
expect(names).toEqual(['default', 'development', 'production']);
|
expect(names).toEqual(['default', 'development', 'production']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('querying project environments in OSS only returns environments that are included in oss', async () => {
|
||||||
|
await app.request
|
||||||
|
.get('/api/admin/environments/project/default')
|
||||||
|
.expect(200)
|
||||||
|
.expect((res) => {
|
||||||
|
expect(res.body.environments).toHaveLength(3);
|
||||||
|
const names = res.body.environments.map((env) => env.name);
|
||||||
|
expect(names).toEqual(['default', 'development', 'production']);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@ -231,15 +231,16 @@ export class EnvironmentsController extends Controller {
|
|||||||
req: Request<ProjectParam>,
|
req: Request<ProjectParam>,
|
||||||
res: Response<EnvironmentsProjectSchema>,
|
res: Response<EnvironmentsProjectSchema>,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
const environments = await this.service.getProjectEnvironments(
|
||||||
|
req.params.projectId,
|
||||||
|
);
|
||||||
this.openApiService.respondWithValidation(
|
this.openApiService.respondWithValidation(
|
||||||
200,
|
200,
|
||||||
res,
|
res,
|
||||||
environmentsProjectSchema.$id,
|
environmentsProjectSchema.$id,
|
||||||
{
|
{
|
||||||
version: 1,
|
version: 1,
|
||||||
environments: (await this.service.getProjectEnvironments(
|
environments,
|
||||||
req.params.projectId,
|
|
||||||
)) as any,
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import type { FromSchema } from 'json-schema-to-ts';
|
import type { FromSchema } from 'json-schema-to-ts';
|
||||||
import { createFeatureStrategySchema } from './create-feature-strategy-schema';
|
import { createFeatureStrategySchema } from './create-feature-strategy-schema';
|
||||||
import { createStrategyVariantSchema } from './create-strategy-variant-schema';
|
import { createStrategyVariantSchema } from './create-strategy-variant-schema';
|
||||||
|
import { constraintSchema } from './constraint-schema';
|
||||||
|
import { parametersSchema } from './parameters-schema';
|
||||||
|
|
||||||
export const environmentProjectSchema = {
|
export const environmentProjectSchema = {
|
||||||
$id: '#/components/schemas/environmentProjectSchema',
|
$id: '#/components/schemas/environmentProjectSchema',
|
||||||
@ -63,11 +65,21 @@ export const environmentProjectSchema = {
|
|||||||
description:
|
description:
|
||||||
'Indicates whether the environment can be enabled for feature flags in the project',
|
'Indicates whether the environment can be enabled for feature flags in the project',
|
||||||
},
|
},
|
||||||
|
requiredApprovals: {
|
||||||
|
type: 'integer',
|
||||||
|
nullable: true,
|
||||||
|
description:
|
||||||
|
'Experimental field. The number of approvals required before a change request can be applied in this environment.',
|
||||||
|
minimum: 1,
|
||||||
|
example: 3,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
schemas: {
|
schemas: {
|
||||||
createFeatureStrategySchema,
|
createFeatureStrategySchema,
|
||||||
createStrategyVariantSchema,
|
createStrategyVariantSchema,
|
||||||
|
constraintSchema,
|
||||||
|
parametersSchema,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
import type { FromSchema } from 'json-schema-to-ts';
|
import type { FromSchema } from 'json-schema-to-ts';
|
||||||
import { environmentProjectSchema } from './environment-project-schema';
|
import { environmentProjectSchema } from './environment-project-schema';
|
||||||
|
import { createFeatureStrategySchema } from './create-feature-strategy-schema';
|
||||||
|
import { createStrategyVariantSchema } from './create-strategy-variant-schema';
|
||||||
|
import { constraintSchema } from './constraint-schema';
|
||||||
|
import { parametersSchema } from './parameters-schema';
|
||||||
|
|
||||||
export const environmentsProjectSchema = {
|
export const environmentsProjectSchema = {
|
||||||
$id: '#/components/schemas/environmentsProjectSchema',
|
$id: '#/components/schemas/environmentsProjectSchema',
|
||||||
@ -24,6 +28,10 @@ export const environmentsProjectSchema = {
|
|||||||
components: {
|
components: {
|
||||||
schemas: {
|
schemas: {
|
||||||
environmentProjectSchema,
|
environmentProjectSchema,
|
||||||
|
createFeatureStrategySchema,
|
||||||
|
createStrategyVariantSchema,
|
||||||
|
constraintSchema,
|
||||||
|
parametersSchema,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
Loading…
Reference in New Issue
Block a user