mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-20 00:08:02 +01:00
chore: remove featureSearchAPI flag (#6081)
This commit is contained in:
parent
aae1d0576f
commit
d7eb950f3a
@ -64,7 +64,6 @@ export type UiFlags = {
|
|||||||
doraMetrics?: boolean;
|
doraMetrics?: boolean;
|
||||||
dependentFeatures?: boolean;
|
dependentFeatures?: boolean;
|
||||||
scheduledConfigurationChanges?: boolean;
|
scheduledConfigurationChanges?: boolean;
|
||||||
featureSearchAPI?: boolean;
|
|
||||||
newStrategyConfiguration?: boolean;
|
newStrategyConfiguration?: boolean;
|
||||||
incomingWebhooks?: boolean;
|
incomingWebhooks?: boolean;
|
||||||
automatedActions?: boolean;
|
automatedActions?: boolean;
|
||||||
|
@ -95,7 +95,6 @@ exports[`should create default config 1`] = `
|
|||||||
"executiveDashboard": false,
|
"executiveDashboard": false,
|
||||||
"extendedUsageMetrics": false,
|
"extendedUsageMetrics": false,
|
||||||
"extendedUsageMetricsUI": false,
|
"extendedUsageMetricsUI": false,
|
||||||
"featureSearchAPI": true,
|
|
||||||
"featureSearchFeedback": false,
|
"featureSearchFeedback": false,
|
||||||
"featureSearchFeedbackPosting": false,
|
"featureSearchFeedbackPosting": false,
|
||||||
"featuresExportImport": true,
|
"featuresExportImport": true,
|
||||||
|
@ -15,7 +15,6 @@ import {
|
|||||||
searchFeaturesSchema,
|
searchFeaturesSchema,
|
||||||
} from '../../openapi';
|
} from '../../openapi';
|
||||||
import { IAuthRequest } from '../../routes/unleash-types';
|
import { IAuthRequest } from '../../routes/unleash-types';
|
||||||
import { InvalidOperationError } from '../../error';
|
|
||||||
import {
|
import {
|
||||||
FeatureSearchQueryParameters,
|
FeatureSearchQueryParameters,
|
||||||
featureSearchQueryParameters,
|
featureSearchQueryParameters,
|
||||||
@ -75,68 +74,65 @@ export default class FeatureSearchController extends Controller {
|
|||||||
req: IAuthRequest<any, any, any, FeatureSearchQueryParameters>,
|
req: IAuthRequest<any, any, any, FeatureSearchQueryParameters>,
|
||||||
res: Response,
|
res: Response,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
if (this.config.flagResolver.isEnabled('featureSearchAPI')) {
|
const {
|
||||||
const {
|
query,
|
||||||
query,
|
project,
|
||||||
project,
|
type,
|
||||||
type,
|
tag,
|
||||||
tag,
|
segment,
|
||||||
segment,
|
createdAt,
|
||||||
createdAt,
|
state,
|
||||||
state,
|
status,
|
||||||
status,
|
offset,
|
||||||
offset,
|
limit = '50',
|
||||||
limit = '50',
|
sortOrder,
|
||||||
sortOrder,
|
sortBy,
|
||||||
sortBy,
|
favoritesFirst,
|
||||||
favoritesFirst,
|
} = req.query;
|
||||||
} = req.query;
|
const userId = req.user.id;
|
||||||
const userId = req.user.id;
|
const normalizedQuery = query
|
||||||
const normalizedQuery = query
|
?.split(',')
|
||||||
?.split(',')
|
.map((query) => query.trim())
|
||||||
.map((query) => query.trim())
|
.filter((query) => query);
|
||||||
.filter((query) => query);
|
const normalizedStatus = status
|
||||||
const normalizedStatus = status
|
?.map((tag) => tag.split(':'))
|
||||||
?.map((tag) => tag.split(':'))
|
.filter(
|
||||||
.filter(
|
(tag) =>
|
||||||
(tag) =>
|
tag.length === 2 &&
|
||||||
tag.length === 2 &&
|
['enabled', 'disabled'].includes(tag[1]),
|
||||||
['enabled', 'disabled'].includes(tag[1]),
|
);
|
||||||
);
|
const normalizedLimit =
|
||||||
const normalizedLimit =
|
Number(limit) > 0 && Number(limit) <= 100 ? Number(limit) : 25;
|
||||||
Number(limit) > 0 && Number(limit) <= 100 ? Number(limit) : 25;
|
const normalizedOffset = Number(offset) > 0 ? Number(offset) : 0;
|
||||||
const normalizedOffset = Number(offset) > 0 ? Number(offset) : 0;
|
const normalizedSortBy: string = sortBy ? sortBy : 'createdAt';
|
||||||
const normalizedSortBy: string = sortBy ? sortBy : 'createdAt';
|
const normalizedSortOrder =
|
||||||
const normalizedSortOrder =
|
sortOrder === 'asc' || sortOrder === 'desc' ? sortOrder : 'asc';
|
||||||
sortOrder === 'asc' || sortOrder === 'desc' ? sortOrder : 'asc';
|
const normalizedFavoritesFirst = favoritesFirst === 'true';
|
||||||
const normalizedFavoritesFirst = favoritesFirst === 'true';
|
const { features, total } = await this.featureSearchService.search({
|
||||||
const { features, total } = await this.featureSearchService.search({
|
searchParams: normalizedQuery,
|
||||||
searchParams: normalizedQuery,
|
project,
|
||||||
project,
|
type,
|
||||||
type,
|
userId,
|
||||||
userId,
|
tag,
|
||||||
tag,
|
segment,
|
||||||
segment,
|
state,
|
||||||
state,
|
createdAt,
|
||||||
createdAt,
|
status: normalizedStatus,
|
||||||
status: normalizedStatus,
|
offset: normalizedOffset,
|
||||||
offset: normalizedOffset,
|
limit: normalizedLimit,
|
||||||
limit: normalizedLimit,
|
sortBy: normalizedSortBy,
|
||||||
sortBy: normalizedSortBy,
|
sortOrder: normalizedSortOrder,
|
||||||
sortOrder: normalizedSortOrder,
|
favoritesFirst: normalizedFavoritesFirst,
|
||||||
favoritesFirst: normalizedFavoritesFirst,
|
});
|
||||||
});
|
|
||||||
|
|
||||||
this.openApiService.respondWithValidation(
|
this.openApiService.respondWithValidation(
|
||||||
200,
|
200,
|
||||||
res,
|
res,
|
||||||
searchFeaturesSchema.$id,
|
searchFeaturesSchema.$id,
|
||||||
serializeDates({ features, total }),
|
serializeDates({
|
||||||
);
|
features,
|
||||||
} else {
|
total,
|
||||||
throw new InvalidOperationError(
|
}),
|
||||||
'Feature Search API is not enabled',
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ beforeAll(async () => {
|
|||||||
experimental: {
|
experimental: {
|
||||||
flags: {
|
flags: {
|
||||||
strictSchemaValidation: true,
|
strictSchemaValidation: true,
|
||||||
featureSearchAPI: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -27,7 +27,6 @@ export type IFlagKey =
|
|||||||
| 'filterInvalidClientMetrics'
|
| 'filterInvalidClientMetrics'
|
||||||
| 'customRootRolesKillSwitch'
|
| 'customRootRolesKillSwitch'
|
||||||
| 'disableMetrics'
|
| 'disableMetrics'
|
||||||
| 'featureSearchAPI'
|
|
||||||
| 'scheduledConfigurationChanges'
|
| 'scheduledConfigurationChanges'
|
||||||
| 'detectSegmentUsageInChangeRequests'
|
| 'detectSegmentUsageInChangeRequests'
|
||||||
| 'stripClientHeadersOn304'
|
| 'stripClientHeadersOn304'
|
||||||
@ -130,10 +129,6 @@ const flags: IFlags = {
|
|||||||
process.env.UNLEASH_EXPERIMENTAL_DISABLE_METRICS,
|
process.env.UNLEASH_EXPERIMENTAL_DISABLE_METRICS,
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
featureSearchAPI: parseEnvVarBoolean(
|
|
||||||
process.env.UNLEASH_EXPERIMENTAL_FEATURE_SEARCH_API,
|
|
||||||
true,
|
|
||||||
),
|
|
||||||
scheduledConfigurationChanges: parseEnvVarBoolean(
|
scheduledConfigurationChanges: parseEnvVarBoolean(
|
||||||
process.env.UNLEASH_EXPERIMENTAL_SCHEDULED_CONFIGURATION_CHANGES,
|
process.env.UNLEASH_EXPERIMENTAL_SCHEDULED_CONFIGURATION_CHANGES,
|
||||||
false,
|
false,
|
||||||
|
@ -40,7 +40,6 @@ process.nextTick(async () => {
|
|||||||
embedProxyFrontend: true,
|
embedProxyFrontend: true,
|
||||||
anonymiseEventLog: false,
|
anonymiseEventLog: false,
|
||||||
responseTimeWithAppNameKillSwitch: false,
|
responseTimeWithAppNameKillSwitch: false,
|
||||||
featureSearchAPI: true,
|
|
||||||
stripClientHeadersOn304: true,
|
stripClientHeadersOn304: true,
|
||||||
newStrategyConfiguration: true,
|
newStrategyConfiguration: true,
|
||||||
stripHeadersOnAPI: true,
|
stripHeadersOnAPI: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user