mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-18 01:18:23 +02:00
chore: stop using deprecated properties and lean on resourceLimits cfg (#9994)
This removes segmentValuesLimit and strategySegmentsLimit from ui-config-schema, deprecated in 5.11.0
This commit is contained in:
parent
b681702b77
commit
beb29f5b5b
@ -1,16 +1,13 @@
|
|||||||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
||||||
import type { IUiConfig } from 'interfaces/uiConfig';
|
|
||||||
|
|
||||||
type IUseSegmentLimits = Pick<
|
export const useSegmentLimits = (): {
|
||||||
IUiConfig,
|
segmentValuesLimit: number;
|
||||||
'segmentValuesLimit' | 'strategySegmentsLimit'
|
strategySegmentsLimit: number;
|
||||||
>;
|
} => {
|
||||||
|
|
||||||
export const useSegmentLimits = (): IUseSegmentLimits => {
|
|
||||||
const { uiConfig } = useUiConfig();
|
const { uiConfig } = useUiConfig();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
segmentValuesLimit: uiConfig.segmentValuesLimit,
|
segmentValuesLimit: uiConfig.resourceLimits.segmentValues,
|
||||||
strategySegmentsLimit: uiConfig.strategySegmentsLimit,
|
strategySegmentsLimit: uiConfig.resourceLimits.strategySegments,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -29,8 +29,6 @@ export interface IUiConfig {
|
|||||||
prometheusAPIAvailable: boolean;
|
prometheusAPIAvailable: boolean;
|
||||||
maintenanceMode?: boolean;
|
maintenanceMode?: boolean;
|
||||||
toast?: IProclamationToast;
|
toast?: IProclamationToast;
|
||||||
segmentValuesLimit?: number;
|
|
||||||
strategySegmentsLimit?: number;
|
|
||||||
frontendApiOrigins?: string[];
|
frontendApiOrigins?: string[];
|
||||||
resourceLimits: ResourceLimitsSchema;
|
resourceLimits: ResourceLimitsSchema;
|
||||||
oidcConfiguredThroughEnv?: boolean;
|
oidcConfiguredThroughEnv?: boolean;
|
||||||
|
@ -9,8 +9,24 @@ test('uiConfigSchema', () => {
|
|||||||
baseUriPath: 'a',
|
baseUriPath: 'a',
|
||||||
environment: 'a',
|
environment: 'a',
|
||||||
disablePasswordAuth: false,
|
disablePasswordAuth: false,
|
||||||
segmentValuesLimit: 0,
|
resourceLimits: {
|
||||||
strategySegmentsLimit: 0,
|
segmentValues: 0,
|
||||||
|
strategySegments: 0,
|
||||||
|
actionSetActions: 0,
|
||||||
|
actionSetsPerProject: 0,
|
||||||
|
actionSetFilters: 0,
|
||||||
|
actionSetFilterValues: 0,
|
||||||
|
signalEndpoints: 0,
|
||||||
|
signalTokensPerEndpoint: 0,
|
||||||
|
featureEnvironmentStrategies: 0,
|
||||||
|
constraintValues: 0,
|
||||||
|
environments: 1,
|
||||||
|
projects: 1,
|
||||||
|
apiTokens: 0,
|
||||||
|
segments: 0,
|
||||||
|
featureFlags: 1,
|
||||||
|
constraints: 0,
|
||||||
|
},
|
||||||
versionInfo: {
|
versionInfo: {
|
||||||
current: {},
|
current: {},
|
||||||
latest: {},
|
latest: {},
|
||||||
|
@ -72,20 +72,6 @@ export const uiConfigSchema = {
|
|||||||
description: 'Whether maintenance mode is currently active or not.',
|
description: 'Whether maintenance mode is currently active or not.',
|
||||||
example: false,
|
example: false,
|
||||||
},
|
},
|
||||||
segmentValuesLimit: {
|
|
||||||
type: 'number',
|
|
||||||
description:
|
|
||||||
'The maximum number of values that can be used in a single segment.',
|
|
||||||
example: 1000,
|
|
||||||
deprecated: true,
|
|
||||||
},
|
|
||||||
strategySegmentsLimit: {
|
|
||||||
type: 'number',
|
|
||||||
description:
|
|
||||||
'The maximum number of segments that can be applied to a single strategy.',
|
|
||||||
example: 5,
|
|
||||||
deprecated: true,
|
|
||||||
},
|
|
||||||
resourceLimits: {
|
resourceLimits: {
|
||||||
$ref: resourceLimitsSchema.$id,
|
$ref: resourceLimitsSchema.$id,
|
||||||
description: resourceLimitsSchema.description,
|
description: resourceLimitsSchema.description,
|
||||||
|
@ -53,8 +53,12 @@ test('should get ui config', async () => {
|
|||||||
|
|
||||||
expect(body.slogan).toEqual('hello');
|
expect(body.slogan).toEqual('hello');
|
||||||
expect(body.headerBackground).toEqual('red');
|
expect(body.headerBackground).toEqual('red');
|
||||||
expect(body.segmentValuesLimit).toEqual(DEFAULT_SEGMENT_VALUES_LIMIT);
|
expect(body.resourceLimits!.segmentValues).toEqual(
|
||||||
expect(body.strategySegmentsLimit).toEqual(DEFAULT_STRATEGY_SEGMENTS_LIMIT);
|
DEFAULT_SEGMENT_VALUES_LIMIT,
|
||||||
|
);
|
||||||
|
expect(body.resourceLimits!.strategySegments).toEqual(
|
||||||
|
DEFAULT_STRATEGY_SEGMENTS_LIMIT,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should update CORS settings', async () => {
|
test('should update CORS settings', async () => {
|
||||||
|
@ -191,8 +191,6 @@ class ConfigController extends Controller {
|
|||||||
unleashUrl: this.config.server.unleashUrl,
|
unleashUrl: this.config.server.unleashUrl,
|
||||||
baseUriPath: this.config.server.baseUriPath,
|
baseUriPath: this.config.server.baseUriPath,
|
||||||
authenticationType: this.config.authentication?.type,
|
authenticationType: this.config.authentication?.type,
|
||||||
segmentValuesLimit: this.config.resourceLimits.segmentValues,
|
|
||||||
strategySegmentsLimit: this.config.resourceLimits.strategySegments,
|
|
||||||
frontendApiOrigins: frontendSettings.frontendApiOrigins,
|
frontendApiOrigins: frontendSettings.frontendApiOrigins,
|
||||||
versionInfo: await this.versionService.getVersionInfo(),
|
versionInfo: await this.versionService.getVersionInfo(),
|
||||||
prometheusAPIAvailable: this.config.prometheusApi !== undefined,
|
prometheusAPIAvailable: this.config.prometheusApi !== undefined,
|
||||||
|
Loading…
Reference in New Issue
Block a user