Skip to content

Commit

Permalink
Address fifth round of feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jportner committed Jul 16, 2020
1 parent ee8a6aa commit 9d7b755
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 20 deletions.
16 changes: 9 additions & 7 deletions docs/api/saved-objects/import.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -231,23 +231,25 @@ The API returns the following:
}
--------------------------------------------------

This result indicates that the import was not successful because the index pattern, visualization, and dashboard each resulted in a conflict error:
This result indicates that the import was not successful because the index pattern, visualization, and dashboard each resulted in a conflict
error:

* An index pattern with the same ID already exists, so this resulted in a conflict error. This can be resolved by overwriting the existing
object, or skipping this object entirely.

* A visualization with a different ID but the same "origin" already exists, so this resulted in a conflict error as well. The
`destinationId` field describes to the other visualization which caused this conflict. This behavior was added to ensure that new objects
which can be shared between <<xpack-spaces,spaces>> behave in a similar way as legacy non-shareable objects. When a shareable object is
exported and then imported into a new space, it retains its origin so that it conflicts will be encountered as expected. This can be
`destinationId` field contains the `id` of the other visualization which caused this conflict. This behavior was added to ensure that new
objects which can be shared between <<xpack-spaces,spaces>> behave in a similar way as legacy non-shareable objects. When a shareable object
is exported and then imported into a new space, it retains its origin so that its conflicts will be encountered as expected. This can be
resolved by overwriting the specified destination object, or skipping this object entirely.

* Two canvases with different IDs but the same "origin" already exist, so this resulted in an ambiguous conflict error. The `destinations`
array describes to the other canvases which caused this conflict. When a shareable object is exported and then imported into a new space,
and is _then_ shared to another space where an object of the same origin exists, this situation may occur. This can be resolved by picking
one of the destination objects to overwrite, or skipping this object entirely.

These errors need to be addressed using the <<saved-objects-api-resolve-import-errors-example-1,Resolve import errors API>>.
No objects will be imported until this error is resolved using the <<saved-objects-api-resolve-import-errors-example-1,Resolve import errors
API>>.

[[saved-objects-api-import-example-4]]
===== 4. Failed import (with missing reference errors)
Expand Down Expand Up @@ -298,5 +300,5 @@ The API returns the following:
]
--------------------------------------------------

This result indicates that the import was not successful because the visualization resulted in a missing references error. This error needs
to be addressed using the <<saved-objects-api-resolve-import-errors-example-2,Resolve import errors API>>.
This result indicates that the import was not successful because the visualization resulted in a missing references error. No objects will
be imported until this error is resolved using the <<saved-objects-api-resolve-import-errors-example-2,Resolve import errors API>>.
6 changes: 3 additions & 3 deletions docs/api/spaces-management/copy_saved_objects.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,9 @@ index pattern, visualization, and dashboard each resulted in a conflict error:
object, or skipping this object entirely.

* A visualization with a different ID but the same "origin" already exists, so this resulted in a conflict error as well. The
`destinationId` field describes to the other visualization which caused this conflict. This behavior was added to ensure that new objects
which can be shared between spaces behave in a similar way as legacy non-shareable objects. When a shareable object is copied into a new
space, it retains its origin so that it conflicts will be encountered as expected. This can be resolved by overwriting the specified
`destinationId` field contains the `id` of the other visualization which caused this conflict. This behavior was added to ensure that new
objects which can be shared between spaces behave in a similar way as legacy non-shareable objects. When a shareable object is copied into a
new space, it retains its origin so that its conflicts will be encountered as expected. This can be resolved by overwriting the specified
destination object, or skipping this object entirely.

* Two canvases with different IDs but the same "origin" already exist, so this resulted in an ambiguous conflict error. The `destinations`
Expand Down
1 change: 1 addition & 0 deletions docs/development/core/public/kibana-plugin-core-public.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [PluginInitializerContext](./kibana-plugin-core-public.plugininitializercontext.md) | The available core services passed to a <code>PluginInitializer</code> |
| [SavedObject](./kibana-plugin-core-public.savedobject.md) | |
| [SavedObjectAttributes](./kibana-plugin-core-public.savedobjectattributes.md) | The data for a Saved Object is stored as an object in the <code>attributes</code> property. |
| [SavedObjectError](./kibana-plugin-core-public.savedobjecterror.md) | |
| [SavedObjectReference](./kibana-plugin-core-public.savedobjectreference.md) | A reference to another saved object. |
| [SavedObjectsBaseOptions](./kibana-plugin-core-public.savedobjectsbaseoptions.md) | |
| [SavedObjectsBatchResponse](./kibana-plugin-core-public.savedobjectsbatchresponse.md) | |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- 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; [SavedObjectError](./kibana-plugin-core-public.savedobjecterror.md) &gt; [error](./kibana-plugin-core-public.savedobjecterror.error.md)

## SavedObjectError.error property

<b>Signature:</b>

```typescript
error: string;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- 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; [SavedObjectError](./kibana-plugin-core-public.savedobjecterror.md)

## SavedObjectError interface

<b>Signature:</b>

```typescript
export interface SavedObjectError
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [error](./kibana-plugin-core-public.savedobjecterror.error.md) | <code>string</code> | |
| [message](./kibana-plugin-core-public.savedobjecterror.message.md) | <code>string</code> | |
| [metadata](./kibana-plugin-core-public.savedobjecterror.metadata.md) | <code>Record&lt;string, unknown&gt;</code> | |
| [statusCode](./kibana-plugin-core-public.savedobjecterror.statuscode.md) | <code>number</code> | |

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- 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; [SavedObjectError](./kibana-plugin-core-public.savedobjecterror.md) &gt; [message](./kibana-plugin-core-public.savedobjecterror.message.md)

## SavedObjectError.message property

<b>Signature:</b>

```typescript
message: string;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- 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; [SavedObjectError](./kibana-plugin-core-public.savedobjecterror.md) &gt; [metadata](./kibana-plugin-core-public.savedobjecterror.metadata.md)

## SavedObjectError.metadata property

<b>Signature:</b>

```typescript
metadata?: Record<string, unknown>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- 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; [SavedObjectError](./kibana-plugin-core-public.savedobjecterror.md) &gt; [statusCode](./kibana-plugin-core-public.savedobjecterror.statuscode.md)

## SavedObjectError.statusCode property

<b>Signature:</b>

```typescript
statusCode: number;
```
1 change: 1 addition & 0 deletions src/core/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ export {
SavedObjectAttribute,
SavedObjectAttributes,
SavedObjectAttributeSingle,
SavedObjectError,
SavedObjectReference,
SavedObjectsBaseOptions,
SavedObjectsFindOptions,
Expand Down
16 changes: 14 additions & 2 deletions src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1170,8 +1170,6 @@ export type PublicUiSettingsParams = Omit<UiSettingsParams, 'schema'>;
// @public (undocumented)
export interface SavedObject<T = unknown> {
attributes: T;
// Warning: (ae-forgotten-export) The symbol "SavedObjectError" needs to be exported by the entry point index.d.ts
//
// (undocumented)
error?: SavedObjectError;
id: string;
Expand All @@ -1196,6 +1194,20 @@ export interface SavedObjectAttributes {
// @public
export type SavedObjectAttributeSingle = string | number | boolean | null | undefined | SavedObjectAttributes;

// Warning: (ae-missing-release-tag) "SavedObjectError" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface SavedObjectError {
// (undocumented)
error: string;
// (undocumented)
message: string;
// (undocumented)
metadata?: Record<string, unknown>;
// (undocumented)
statusCode: number;
}

// @public
export interface SavedObjectReference {
// (undocumented)
Expand Down
1 change: 1 addition & 0 deletions src/core/public/saved_objects/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ export {
SavedObjectAttribute,
SavedObjectAttributes,
SavedObjectAttributeSingle,
SavedObjectError,
SavedObjectReference,
} from '../../types';
Original file line number Diff line number Diff line change
Expand Up @@ -684,14 +684,12 @@ describe('getSortedObjectsForExport()', () => {
],
});
const response = await readStreamToCompletion(exportStream);
expect(response).toEqual(
expect.arrayContaining([
expect.not.objectContaining({ id: '1', namespaces: expect.anything() }),
expect.not.objectContaining({ id: '2', namespaces: expect.anything() }),
expect.not.objectContaining({ id: '3', namespaces: expect.anything() }),
expect.objectContaining({ exportedCount: 3 }),
])
);
expect(response).toEqual([
createSavedObject({ type: 'multi', id: '1' }),
createSavedObject({ type: 'multi', id: '2' }),
createSavedObject({ type: 'other', id: '3' }),
expect.objectContaining({ exportedCount: 3 }),
]);
});

test('includes nested dependencies when passed in', async () => {
Expand Down

0 comments on commit 9d7b755

Please sign in to comment.