Remove deprecated & unused SavedObjectsImportFailure.title (#127043)

This commit is contained in:
Alejandro Fernández Haro 2022-03-09 08:00:55 +01:00 committed by GitHub
parent f89d531397
commit b9b4dc0a8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 43 additions and 123 deletions

View file

@ -20,6 +20,5 @@ export interface SavedObjectsImportFailure
| [id](./kibana-plugin-core-public.savedobjectsimportfailure.id.md) | string | |
| [meta](./kibana-plugin-core-public.savedobjectsimportfailure.meta.md) | { title?: string; icon?: string; } | |
| [overwrite?](./kibana-plugin-core-public.savedobjectsimportfailure.overwrite.md) | boolean | <i>(Optional)</i> If <code>overwrite</code> is specified, an attempt was made to overwrite an existing object. |
| [title?](./kibana-plugin-core-public.savedobjectsimportfailure.title.md) | string | <i>(Optional)</i> |
| [type](./kibana-plugin-core-public.savedobjectsimportfailure.type.md) | string | |

View file

@ -1,16 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [SavedObjectsImportFailure](./kibana-plugin-core-public.savedobjectsimportfailure.md) &gt; [title](./kibana-plugin-core-public.savedobjectsimportfailure.title.md)
## SavedObjectsImportFailure.title property
> Warning: This API is now obsolete.
>
> Use `meta.title` instead
>
<b>Signature:</b>
```typescript
title?: string;
```

View file

@ -20,6 +20,5 @@ export interface SavedObjectsImportFailure
| [id](./kibana-plugin-core-server.savedobjectsimportfailure.id.md) | string | |
| [meta](./kibana-plugin-core-server.savedobjectsimportfailure.meta.md) | { title?: string; icon?: string; } | |
| [overwrite?](./kibana-plugin-core-server.savedobjectsimportfailure.overwrite.md) | boolean | <i>(Optional)</i> If <code>overwrite</code> is specified, an attempt was made to overwrite an existing object. |
| [title?](./kibana-plugin-core-server.savedobjectsimportfailure.title.md) | string | <i>(Optional)</i> |
| [type](./kibana-plugin-core-server.savedobjectsimportfailure.type.md) | string | |

View file

@ -1,16 +0,0 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsImportFailure](./kibana-plugin-core-server.savedobjectsimportfailure.md) &gt; [title](./kibana-plugin-core-server.savedobjectsimportfailure.title.md)
## SavedObjectsImportFailure.title property
> Warning: This API is now obsolete.
>
> Use `meta.title` instead
>
<b>Signature:</b>
```typescript
title?: string;
```

View file

@ -1255,8 +1255,6 @@ export interface SavedObjectsImportFailure {
icon?: string;
};
overwrite?: boolean;
// @deprecated (undocumented)
title?: string;
// (undocumented)
type: string;
}

View file

@ -112,7 +112,6 @@ describe('#importSavedObjectsFromStream', () => {
return {
type: 'foo-type',
id: uuidv4(),
title: 'some-title',
meta: { title },
error: { type: 'conflict' },
};

View file

@ -108,13 +108,11 @@ describe('#checkConflicts', () => {
errors: [
{
...obj2Error,
title: obj2.attributes.title,
meta: { title: obj2.attributes.title },
error: { type: 'conflict' },
},
{
...obj4Error,
title: obj4.attributes.title,
meta: { title: obj4.attributes.title },
error: { ...obj4Error.error, type: 'unknown' },
},
@ -136,7 +134,6 @@ describe('#checkConflicts', () => {
errors: [
{
...obj4Error,
title: obj4.attributes.title,
meta: { title: obj4.attributes.title },
error: { ...obj4Error.error, type: 'unknown' },
},
@ -174,13 +171,11 @@ describe('#checkConflicts', () => {
errors: [
{
...obj2Error,
title: obj2.attributes.title,
meta: { title: obj2.attributes.title },
error: { type: 'conflict', destinationId: 'some-object-id' },
},
{
...obj4Error,
title: obj4.attributes.title,
meta: { title: obj4.attributes.title },
error: { ...obj4Error.error, type: 'unknown' },
},

View file

@ -80,10 +80,10 @@ export async function checkConflicts({
importStateMap.set(`${type}:${id}`, { destinationId: uuidv4(), omitOriginId });
filteredObjects.push(object);
} else if (errorObj && errorObj.statusCode !== 409) {
errors.push({ type, id, title, meta: { title }, error: { ...errorObj, type: 'unknown' } });
errors.push({ type, id, meta: { title }, error: { ...errorObj, type: 'unknown' } });
} else if (errorObj?.statusCode === 409 && !ignoreRegularConflicts && !overwrite) {
const error = { type: 'conflict' as 'conflict', ...(destinationId && { destinationId }) };
errors.push({ type, id, title, meta: { title }, error });
errors.push({ type, id, meta: { title }, error });
} else {
filteredObjects.push(object);
if (errorObj?.statusCode === 409) {

View file

@ -176,7 +176,6 @@ describe('#checkOriginConflicts', () => {
): SavedObjectsImportFailure => ({
type: object.type,
id: object.id,
title: object.attributes.title,
meta: { title: object.attributes.title },
error: {
type: 'ambiguous_conflict',
@ -189,7 +188,6 @@ describe('#checkOriginConflicts', () => {
): SavedObjectsImportFailure => ({
type: object.type,
id: object.id,
title: object.attributes?.title,
meta: { title: object.attributes.title },
error: {
type: 'conflict',

View file

@ -229,7 +229,6 @@ export async function checkOriginConflicts({
errors.push({
type,
id,
title,
meta: { title },
error: {
type: 'conflict',
@ -253,7 +252,6 @@ export async function checkOriginConflicts({
errors.push({
type,
id,
title,
meta: { title },
error: {
type: 'ambiguous_conflict',

View file

@ -157,7 +157,7 @@ describe('collectSavedObjects()', () => {
const error = { type: 'unsupported_type' };
const { title } = obj1.attributes;
const errors = [{ error, type: obj1.type, id: obj1.id, title, meta: { title } }];
const errors = [{ error, type: obj1.type, id: obj1.id, meta: { title } }];
expect(result).toEqual({ collectedObjects: [], errors, importStateMap: new Map() });
});
@ -174,7 +174,7 @@ describe('collectSavedObjects()', () => {
]);
const error = { type: 'unsupported_type' };
const { title } = obj2.attributes;
const errors = [{ error, type: obj2.type, id: obj2.id, title, meta: { title } }];
const errors = [{ error, type: obj2.type, id: obj2.id, meta: { title } }];
expect(result).toEqual({ collectedObjects, errors, importStateMap });
});
@ -192,7 +192,7 @@ describe('collectSavedObjects()', () => {
const error = { type: 'unsupported_type' };
const { title } = obj1.attributes;
const errors = [{ error, type: obj1.type, id: obj1.id, title, meta: { title } }];
const errors = [{ error, type: obj1.type, id: obj1.id, meta: { title } }];
expect(result).toEqual({ collectedObjects: [], errors, importStateMap: new Map() });
});
@ -215,7 +215,7 @@ describe('collectSavedObjects()', () => {
]);
const error = { type: 'unsupported_type' };
const { title } = obj1.attributes;
const errors = [{ error, type: obj1.type, id: obj1.id, title, meta: { title } }];
const errors = [{ error, type: obj1.type, id: obj1.id, meta: { title } }];
expect(result).toEqual({ collectedObjects, errors, importStateMap });
});
});

View file

@ -49,7 +49,6 @@ export async function collectSavedObjects({
errors.push({
id: obj.id,
type: obj.type,
title,
meta: { title },
error: {
type: 'unsupported_type',

View file

@ -51,45 +51,42 @@ describe('extractErrors()', () => {
];
const result = extractErrors(savedObjects, savedObjects);
expect(result).toMatchInlineSnapshot(`
Array [
Object {
"error": Object {
"type": "conflict",
},
"id": "2",
"meta": Object {
"title": "My Dashboard 2",
},
"title": "My Dashboard 2",
"type": "dashboard",
},
Object {
"error": Object {
"error": "Bad Request",
"message": "Bad Request",
"statusCode": 400,
"type": "unknown",
},
"id": "3",
"meta": Object {
"title": "My Dashboard 3",
},
"title": "My Dashboard 3",
"type": "dashboard",
},
Object {
"error": Object {
"destinationId": "foo",
"type": "conflict",
},
"id": "4",
"meta": Object {
"title": "My Dashboard 4",
},
"title": "My Dashboard 4",
"type": "dashboard",
},
]
`);
Array [
Object {
"error": Object {
"type": "conflict",
},
"id": "2",
"meta": Object {
"title": "My Dashboard 2",
},
"type": "dashboard",
},
Object {
"error": Object {
"error": "Bad Request",
"message": "Bad Request",
"statusCode": 400,
"type": "unknown",
},
"id": "3",
"meta": Object {
"title": "My Dashboard 3",
},
"type": "dashboard",
},
Object {
"error": Object {
"destinationId": "foo",
"type": "conflict",
},
"id": "4",
"meta": Object {
"title": "My Dashboard 4",
},
"type": "dashboard",
},
]
`);
});
});

View file

@ -30,7 +30,6 @@ export function extractErrors(
errors.push({
id: savedObject.id,
type: savedObject.type,
title,
meta: { title },
error: {
type: 'conflict',
@ -42,7 +41,6 @@ export function extractErrors(
errors.push({
id: savedObject.id,
type: savedObject.type,
title,
meta: { title },
error: {
...savedObject.error,

View file

@ -116,7 +116,6 @@ export async function validateReferences(params: ValidateReferencesParams) {
errorMap[`${type}:${id}`] = {
id,
type,
title,
meta: { title },
error: { type: 'missing_references', references: missingReferences },
};

View file

@ -138,7 +138,6 @@ describe('#importSavedObjectsFromStream', () => {
return {
type: 'foo-type',
id: uuidv4(),
title: 'some-title',
meta: { title },
error: { type: 'conflict' },
};

View file

@ -89,10 +89,6 @@ export interface SavedObjectsImportMissingReferencesError {
export interface SavedObjectsImportFailure {
id: string;
type: string;
/**
* @deprecated Use `meta.title` instead
*/
title?: string;
meta: { title?: string; icon?: string };
/**
* If `overwrite` is specified, an attempt was made to overwrite an existing object.

View file

@ -229,7 +229,6 @@ describe(`POST ${URL}`, () => {
{
id: mockIndexPattern.id,
type: mockIndexPattern.type,
title: mockIndexPattern.attributes.title,
meta: { title: mockIndexPattern.attributes.title, icon: 'index-pattern-icon' },
error: { type: 'conflict' },
},
@ -322,7 +321,6 @@ describe(`POST ${URL}`, () => {
{
id: 'my-vis',
type: 'visualization',
title: 'my-vis',
meta: { title: 'my-vis', icon: 'visualization-icon' },
error: {
type: 'missing_references',
@ -386,7 +384,6 @@ describe(`POST ${URL}`, () => {
{
id: 'my-vis',
type: 'visualization',
title: 'my-vis',
meta: { title: 'my-vis', icon: 'visualization-icon' },
error: {
type: 'missing_references',
@ -396,7 +393,6 @@ describe(`POST ${URL}`, () => {
{
id: 'my-vis',
type: 'visualization',
title: 'my-vis',
meta: { title: 'my-vis', icon: 'visualization-icon' },
error: { type: 'conflict' },
},
@ -457,7 +453,6 @@ describe(`POST ${URL}`, () => {
{
id: 'my-vis',
type: 'visualization',
title: 'my-vis',
meta: { title: 'my-vis', icon: 'visualization-icon' },
overwrite: true,
error: {

View file

@ -2501,8 +2501,6 @@ export interface SavedObjectsImportFailure {
icon?: string;
};
overwrite?: boolean;
// @deprecated (undocumented)
title?: string;
// (undocumented)
type: string;
}

View file

@ -16,7 +16,6 @@ const createConflictError = (
object: Omit<SavedObjectsImportFailure, 'error'>
): SavedObjectsImportFailure => ({
...object,
title: object.meta.title,
error: { type: 'conflict' },
});
@ -123,7 +122,6 @@ export default function ({ getService }: FtrProviderContext) {
{
id: '1',
type: 'wigwags',
title: 'my title',
meta: { title: 'my title' },
error: { type: 'unsupported_type' },
},
@ -221,7 +219,6 @@ export default function ({ getService }: FtrProviderContext) {
{
type: 'visualization',
id: '1',
title: 'My visualization',
meta: { title: 'My visualization', icon: 'visualizeApp' },
error: {
type: 'missing_references',

View file

@ -72,7 +72,6 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
{
id: 'some-id-1',
type: 'test-hidden-non-importable-exportable',
title: 'my title',
meta: {
title: 'my title',
},

View file

@ -95,7 +95,6 @@ export default function ({ getService }: PluginFunctionalProviderContext) {
{
id: 'op3767a1-9rcg-53u7-jkb3-3dnb74193awc',
type: 'test-hidden-non-importable-exportable',
title: 'new title!',
meta: {
title: 'new title!',
},

View file

@ -416,7 +416,6 @@ export function copyToSpaceTestSuiteFactory(
destinationId: `cts_dashboard_${destination}`, // this conflicted with another dashboard in the destination space because of a shared originId
},
id: `cts_dashboard_${spaceId}`,
title: `This is the ${spaceId} test space CTS dashboard`,
type: 'dashboard',
meta: {
title: `This is the ${spaceId} test space CTS dashboard`,
@ -429,7 +428,6 @@ export function copyToSpaceTestSuiteFactory(
destinationId: `cts_ip_1_${destination}`, // this conflicted with another index pattern in the destination space because of a shared originId
},
id: `cts_ip_1_${spaceId}`,
title: `Copy to Space index pattern 1 from ${spaceId} space`,
type: 'index-pattern',
meta: {
title: `Copy to Space index pattern 1 from ${spaceId} space`,
@ -442,7 +440,6 @@ export function copyToSpaceTestSuiteFactory(
destinationId: `cts_vis_3_${destination}`, // this conflicted with another visualization in the destination space because of a shared originId
},
id: `cts_vis_3_${spaceId}`,
title: `CTS vis 3 from ${spaceId} space`,
type: 'visualization',
meta: {
title: `CTS vis 3 from ${spaceId} space`,
@ -591,7 +588,6 @@ export function copyToSpaceTestSuiteFactory(
error: { type: 'conflict', destinationId },
type,
id: inexactMatchIdA,
title,
meta,
},
]);
@ -633,7 +629,6 @@ export function copyToSpaceTestSuiteFactory(
error: { type: 'conflict', destinationId },
type,
id: inexactMatchIdB,
title,
meta,
},
]);
@ -675,7 +670,6 @@ export function copyToSpaceTestSuiteFactory(
error: { type: 'conflict', destinationId },
type,
id: inexactMatchIdC,
title,
meta,
},
]);
@ -721,7 +715,6 @@ export function copyToSpaceTestSuiteFactory(
error: { type: 'ambiguous_conflict', destinations },
type,
id: ambiguousConflictId,
title,
meta: { title, icon: 'beaker' },
},
]);

View file

@ -163,7 +163,6 @@ export function resolveCopyToSpaceConflictsSuite(
destinationId: `cts_ip_1_${destination}`, // this conflicted with another index pattern in the destination space because of a shared originId
},
id: `cts_ip_1_${sourceSpaceId}`,
title: `Copy to Space index pattern 1 from ${sourceSpaceId} space`,
meta: {
title: `Copy to Space index pattern 1 from ${sourceSpaceId} space`,
icon: 'indexPatternApp',
@ -176,7 +175,6 @@ export function resolveCopyToSpaceConflictsSuite(
destinationId: `cts_vis_3_${destination}`, // this conflicted with another visualization in the destination space because of a shared originId
},
id: `cts_vis_3_${sourceSpaceId}`,
title: `CTS vis 3 from ${sourceSpaceId} space`,
meta: {
title: `CTS vis 3 from ${sourceSpaceId} space`,
icon: 'visualizeApp',
@ -211,7 +209,6 @@ export function resolveCopyToSpaceConflictsSuite(
},
id: `cts_dashboard_${sourceSpaceId}`,
type: 'dashboard',
title: `This is the ${sourceSpaceId} test space CTS dashboard`,
meta: {
title: `This is the ${sourceSpaceId} test space CTS dashboard`,
icon: 'dashboardApp',