1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-09 01:17:06 +02:00

feat: Export segments limited info (#3109)

This commit is contained in:
Mateusz Kwasniewski 2023-02-14 15:35:10 +01:00 committed by GitHub
parent f071922d15
commit b1728c5fe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 10 deletions

View File

@ -156,10 +156,8 @@ export const ValidationStage: FC<{
show={ show={
<ErrorContainer> <ErrorContainer>
<ErrorHeader> <ErrorHeader>
<strong>Conflict!</strong> There are some <strong>Conflict!</strong> There are some errors
configurations that don't exist in the current that need to be fixed before the import.
instance and need to be created before importing
this configuration
</ErrorHeader> </ErrorHeader>
{validationResult.errors.map(error => ( {validationResult.errors.map(error => (
<Box key={error.message} sx={{ p: 2 }}> <Box key={error.message} sx={{ p: 2 }}>

View File

@ -4,7 +4,6 @@ import { featureStrategySchema } from './feature-strategy-schema';
import { featureEnvironmentSchema } from './feature-environment-schema'; import { featureEnvironmentSchema } from './feature-environment-schema';
import { contextFieldSchema } from './context-field-schema'; import { contextFieldSchema } from './context-field-schema';
import { featureTagSchema } from './feature-tag-schema'; import { featureTagSchema } from './feature-tag-schema';
import { segmentSchema } from './segment-schema';
import { parametersSchema } from './parameters-schema'; import { parametersSchema } from './parameters-schema';
import { legalValueSchema } from './legal-value-schema'; import { legalValueSchema } from './legal-value-schema';
import { variantSchema } from './variant-schema'; import { variantSchema } from './variant-schema';
@ -52,7 +51,17 @@ export const exportResultSchema = {
segments: { segments: {
type: 'array', type: 'array',
items: { items: {
$ref: '#/components/schemas/segmentSchema', type: 'object',
additionalProperties: false,
required: ['id'],
properties: {
id: {
type: 'number',
},
name: {
type: 'string',
},
},
}, },
}, },
tagTypes: { tagTypes: {
@ -69,7 +78,6 @@ export const exportResultSchema = {
featureEnvironmentSchema, featureEnvironmentSchema,
contextFieldSchema, contextFieldSchema,
featureTagSchema, featureTagSchema,
segmentSchema,
variantsSchema, variantsSchema,
variantSchema, variantSchema,
overrideSchema, overrideSchema,

View File

@ -150,8 +150,8 @@ export default class ExportImportService {
}), }),
featureTags, featureTags,
segments: filteredSegments.map((item) => { segments: filteredSegments.map((item) => {
const { createdAt, createdBy, ...rest } = item; const { id, name } = item;
return rest; return { id, name };
}), }),
tagTypes: filteredTagTypes, tagTypes: filteredTagTypes,
}; };

View File

@ -1107,7 +1107,19 @@ exports[`should serve the OpenAPI spec 1`] = `
}, },
"segments": { "segments": {
"items": { "items": {
"$ref": "#/components/schemas/segmentSchema", "additionalProperties": false,
"properties": {
"id": {
"type": "number",
},
"name": {
"type": "string",
},
},
"required": [
"id",
],
"type": "object",
}, },
"type": "array", "type": "array",
}, },