From 3958c02af0012ef89252784abf25fab18b1c90bf Mon Sep 17 00:00:00 2001 From: Joe Portner <5295965+jportner@users.noreply.github.com> Date: Fri, 21 Aug 2020 16:27:33 -0400 Subject: [PATCH] Changes for first round of PR review feedback. --- docs/api/saved-objects/find.asciidoc | 10 ++- docs/api/saved-objects/import.asciidoc | 72 +++++++++---------- .../resolve_import_errors.asciidoc | 38 +++++----- .../copy_saved_objects.asciidoc | 63 ++++++++-------- ...olve_copy_saved_objects_conflicts.asciidoc | 24 +++---- .../__snapshots__/flyout.test.tsx.snap | 3 + .../objects_table/components/flyout.tsx | 39 +++++----- .../components/overwrite_modal.tsx | 2 +- .../components/copy_to_space_flyout.tsx | 1 + .../copy_to_space_flyout_footer.tsx | 41 +++++++++-- .../components/space_result_details.tsx | 2 +- 11 files changed, 165 insertions(+), 130 deletions(-) diff --git a/docs/api/saved-objects/find.asciidoc b/docs/api/saved-objects/find.asciidoc index 6f293fba2d0ef..c43b58d3aa989 100644 --- a/docs/api/saved-objects/find.asciidoc +++ b/docs/api/saved-objects/find.asciidoc @@ -44,12 +44,10 @@ experimental[] Retrieve a paginated set of {kib} saved objects by various condit (Optional, array|string) The fields to return in the `attributes` key of the response. `sort_field`:: - (Optional, string) The field that sorts the response. There are two kinds of fields: "root" fields that exist for all saved objects (such - as "updated_at"), and "type" fields that are specific to a given object type (e.g. those fields that are returned in the `attributes` key - of the response). - * If a single type is defined in the `type` parameter, both "type" fields and "root" fields are allowed, and validity checks are made in - that order. - * If multiple types are defined in the `type` parameter, only "root" fields are allowed. + (Optional, string) Sorts the response. Includes "root" and "type" fields. "root" fields exist for all saved objects, such as "updated_at". + "type" fields are specific to an object type, such as fields returned in the `attributes` key of the response. When a single type is + defined in the `type` parameter, the "root" and "type" fields are allowed, and validity checks are made in that order. When multiple types + are defined in the `type` parameter, only "root" fields are allowed. `has_reference`:: (Optional, object) Filters to objects that have a relationship with the type and ID combination. diff --git a/docs/api/saved-objects/import.asciidoc b/docs/api/saved-objects/import.asciidoc index 6bdc94879bf15..4df2f07bfcf41 100644 --- a/docs/api/saved-objects/import.asciidoc +++ b/docs/api/saved-objects/import.asciidoc @@ -23,14 +23,14 @@ experimental[] Create sets of {kib} saved objects from a file created by the exp ==== Query parameters `createNewCopies`:: - (Optional, boolean) Creates new copies of saved objects, regenerating each object's ID and resetting its origin in the process. If this - option is used, potential conflict errors will be avoided. + (Optional, boolean) Creates copies of saved objects, regenerates each object ID, and resets the origin. When used, potential conflict + errors are avoided. + NOTE: This cannot be used with the `overwrite` option. `overwrite`:: - (Optional, boolean) Overwrites saved objects if they already exist. If this option is used, potential conflict errors will be - automatically resolved by overwriting the destination object. + (Optional, boolean) Overwrites saved objects when they already exist. When used, potential conflict errors are automatically resolved by + overwriting the destination object. + NOTE: This cannot be used with the `createNewCopies` option. @@ -46,23 +46,23 @@ The request body must include the multipart/form-data type. ==== Response body `success`:: - (boolean) Indicates if the import was completely successful. When set to `false`, some objects may have been copied. For additional - information, refer to the `errors` and `successResults` properties. + (boolean) Indicates when the import was successfully completed. When set to `false`, some objects may not have been created. For + additional information, refer to the `errors` and `successResults` properties. `successCount`:: (number) Indicates the number of successfully imported records. `errors`:: - (array) Indicates the import was unsuccessful and specifies the objects that failed to import. + (Optional, array) Indicates the import was unsuccessful and specifies the objects that failed to import. + -NOTE: One object may result in multiple errors which require separate steps to resolve (for instance, a `missing_references` error and a +NOTE: One object may result in multiple errors, which requires separate steps to resolve. For instance, a `missing_references` error and `conflict` error). `successResults`:: - (array) Indicates the objects that were imported successfully, with any metadata if applicable. + (Optional, array) Indicates the objects that are successfully imported, with any metadata if applicable. + -NOTE: No objects are actually created until all resolvable errors have been addressed! This includes conflict errors and missing references -errors. See the examples below for how to resolve these errors. +NOTE: Objects are only created when all resolvable errors are addressed, including conflicts and missing references. For information on how +to resolve errors, refer to the <>. [[saved-objects-api-import-codes]] ==== Response code @@ -74,7 +74,7 @@ errors. See the examples below for how to resolve these errors. ==== Examples [[saved-objects-api-import-example-1]] -===== 1. Successful import (with `createNewCopies` enabled) +===== Successful import with `createNewCopies` enabled Import an index pattern and dashboard: @@ -122,11 +122,11 @@ The API returns the following: } -------------------------------------------------- -This result indicates that the import was successful, and both objects were created. Since these objects were created as new copies, each -entry in the `successResults` array includes a `destinationId` attribute. +The result indicates a successful import, and both objects are created. Since these objects are created as new copies, each entry in the +`successResults` array includes a `destinationId` attribute. [[saved-objects-api-import-example-2]] -===== 2. Successful import (with `createNewCopies` disabled) +===== Successful import with `createNewCopies` disabled Import an index pattern and dashboard: @@ -172,12 +172,12 @@ The API returns the following: } -------------------------------------------------- -This result indicates that the import was successful, and both objects were created. +The result indicates a successful import, and both objects are created. [[saved-objects-api-import-example-3]] -===== 3. Failed import (with conflict errors) +===== Failed import with conflict errors -Import an index pattern, visualization, canvas, and dashboard, where some objects already exists: +Import an index pattern, visualization, *Canvas* workpad, and dashboard that include saved objects: [source,sh] -------------------------------------------------- @@ -266,30 +266,29 @@ 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 +The result indicates an unsuccessful import because the index pattern, visualization, *Canvas* workpad, and dashboard 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. +* An index pattern with the same ID already exists, which resulted in a conflict error. To resolve the error, overwrite the existing object, +or skip the object. -* A visualization with a different ID but the same "origin" already exists, so this resulted in a conflict error as well. The -`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 <> 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. +* A visualization with a different ID, but the same origin already exists, which resulted in a conflict error. The `destinationId` field +contains the `id` of the other visualization, which caused the conflict. The behavior is added to make sure that new objects that can be +shared between <> 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 the conflicts are encountered as expected. To resolve, overwrite the specified +destination object, or skip the object. -* 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. +* Two *Canvas* workpads with different IDs, but the same origin, already exist, which resulted in a conflict error. The `destinations` array +describes the other workpads which caused the conflict. When a shareable object is exported, imported into a new space, then shared to +another space where an object of the same origin exists, the conflict error occurs. To resolve, pick a destination object to overwrite, or +skip the object. -No objects will be imported until this error is resolved using the <>. +Objects are created when the error is resolved using the <>. [[saved-objects-api-import-example-4]] -===== 4. Failed import (with missing reference errors) +===== Failed import with missing reference errors -Import a visualization and dashboard with an index pattern for the visualization reference that doesn\'t exist: +Import a visualization and dashboard when the index pattern for the visualization doesn't exist: [source,sh] -------------------------------------------------- @@ -364,7 +363,6 @@ The API returns the following: } -------------------------------------------------- -This result indicates that the import was not successful because the visualization and search each resulted in a missing references error. +The result indicates an unsuccessful import because the visualization and search resulted in a missing references error. -No objects will be imported until these errors are resolved using the <>. +Objects are created when the errors are resolved using the <>. diff --git a/docs/api/saved-objects/resolve_import_errors.asciidoc b/docs/api/saved-objects/resolve_import_errors.asciidoc index f5319f4db70d0..13d4ac9bbf7d0 100644 --- a/docs/api/saved-objects/resolve_import_errors.asciidoc +++ b/docs/api/saved-objects/resolve_import_errors.asciidoc @@ -25,14 +25,14 @@ To resolve errors, you can: ==== Path parameters `space_id`:: - (Optional, string) An identifier for the <>. If `space_id` is not provided in the URL, the default space is used. + (Optional, string) An identifier for the <>. When `space_id` is unspecfied in the URL, the default space is used. [[saved-objects-api-resolve-import-errors-query-params]] ==== Query parameters `createNewCopies`:: - (Optional, boolean) Creates new copies of saved objects, regenerating each object's ID and resetting its origin in the process. If this - option was enabled during the initial import, it should also be enabled when resolving import errors. + (Optional, boolean) Creates copies of the saved objects, regenerates each object ID, and resets the origin. When enabled during the + initial import, also enable when resolving import errors. [[saved-objects-api-resolve-import-errors-request-body]] ==== Request body @@ -43,7 +43,7 @@ The request body must include the multipart/form-data type. The same file given to the import API. `retries`:: - (Required, array) The retry operations to attempt, which can specify how to resolve different types of errors. + (Required, array) The retry operations, which can specify how to resolve different types of errors. + .Properties of `` [%collapsible%open] @@ -53,22 +53,22 @@ The request body must include the multipart/form-data type. `id`::: (Required, string) The saved object ID. `overwrite`::: - (Optional, boolean) When set to `true`, the source object overwrites the conflicting destination object. When set to `false`, this does + (Optional, boolean) When set to `true`, the source object overwrites the conflicting destination object. When set to `false`, does nothing. `destinationId`::: - (Optional, string) Specifies which destination ID the imported object should have (if different from the current ID). + (Optional, string) Specifies the destination ID that the imported object should have, if different from the current ID. `replaceReferences`::: (Optional, array) A list of `type`, `from`, and `to` used to change the object references. `ignoreMissingReferences`::: - (Optional, boolean) When set to `true`, any missing references errors are ignored. When set to `false`, this does nothing. + (Optional, boolean) When set to `true`, ignores missing reference errors. When set to `false`, does nothing. ===== [[saved-objects-api-resolve-import-errors-response-body]] ==== Response body `success`:: - (boolean) Indicates if the import was completely successful. When set to `false`, some objects may have been copied. For additional - information, refer to the `errors` and `successResults` properties. + (boolean) Indicates a successful import. When set to `false`, some objects may not have been created. For additional information, refer to + the `errors` and `successResults` properties. `successCount`:: (number) Indicates the number of successfully resolved records. @@ -76,14 +76,14 @@ The request body must include the multipart/form-data type. `errors`:: (Optional, array) Specifies the objects that failed to resolve. + -NOTE: One object may result in multiple errors which require separate steps to resolve (for instance, a `missing_references` error and a -`conflict` error). +NOTE: One object can result in multiple errors, which requires separate steps to resolve. For instance, a `missing_references` error and a +`conflict` error. `successResults`:: - (Optional, array) Indicates the objects that were imported successfully, with any metadata if applicable. + (Optional, array) Indicates the objects that are successfully imported, with any metadata if applicable. + -NOTE: No objects are actually created until all resolvable errors have been addressed! This includes conflict errors and missing references -errors. See the examples below for how to resolve these errors. +NOTE: Objects are only created when all resolvable errors are addressed, including conflict and missing references. To resolve errors, refer +to the <>. [[saved-objects-api-resolve-import-errors-codes]] ==== Response code @@ -95,11 +95,11 @@ errors. See the examples below for how to resolve these errors. ==== Examples [[saved-objects-api-resolve-import-errors-example-1]] -===== 1. Resolve conflict errors +===== Resolve conflict errors This example builds upon the <>. -Resolve conflict errors for an index pattern, visualization, and canvas by overwriting the existing saved objects: +Resolve conflict errors for an index pattern, visualization, and *Canvas* workpad by overwriting the existing saved objects: [source,sh] -------------------------------------------------- @@ -163,13 +163,13 @@ The API returns the following: } -------------------------------------------------- -This result indicates that the import was successful, and all four objects were created. +The result indicates a successful import, and all four objects were created. TIP: If a prior import attempt resulted in resolvable errors, you must include a retry for each object you want to import, including any that were returned in the `successResults` array. In this example, we retried importing the dashboard accordingly. [[saved-objects-api-resolve-import-errors-example-2]] -===== 2. Resolve missing reference errors +===== Resolve missing reference errors This example builds upon the <>. @@ -227,7 +227,7 @@ The API returns the following: } -------------------------------------------------- -This result indicates that the import was successful, and all three objects were created. +The result indicates a successful import, and all three objects were created. TIP: If a prior import attempt resulted in resolvable errors, you must include a retry for each object you want to import, including any that were returned in the `successResults` array. In this example, we retried importing the dashboard accordingly. diff --git a/docs/api/spaces-management/copy_saved_objects.asciidoc b/docs/api/spaces-management/copy_saved_objects.asciidoc index bb6e95c32fb88..853cca035a291 100644 --- a/docs/api/spaces-management/copy_saved_objects.asciidoc +++ b/docs/api/spaces-management/copy_saved_objects.asciidoc @@ -75,8 +75,8 @@ You can request to overwrite any objects that already exist in the target space `errors`::: (Optional, array) The errors that occurred during the copy operation. When errors are reported, the `success` flag is set to `false`. + -NOTE: One object may result in multiple errors which require separate steps to resolve (for instance, a `missing_references` error and a -`conflict` error). +NOTE: One object may result in multiple errors, which requires separate steps to resolve. For instance, a `missing_references` error and a +`conflict` error. + .Properties of `errors` [%collapsible%open] @@ -104,17 +104,17 @@ NOTE: One object may result in multiple errors which require separate steps to r ====== `successResults`::: - (Optional, array) Indicates the objects that were copied successfully, with any metadata if applicable. + (Optional, array) Indicates successfully copied objects, with any applicable metadata. + -NOTE: No objects are actually created until all resolvable errors have been addressed! This includes conflict errors and missing references -errors. See the examples below for how to resolve these errors. +NOTE: Objects are created when all resolvable errors are addressed, including conflict and missing references errors. For more information, +refer to the <>. ===== [[spaces-api-copy-saved-objects-example]] ==== {api-examples-title} [[spaces-api-copy-saved-objects-example-1]] -===== 1. Successful copy (with `createNewCopies` enabled) +===== Successful copy (with `createNewCopies` enabled) Copy a dashboard with the `my-dashboard` ID, including all references from the `default` space to the `marketing` space. In this example, the dashboard has a reference to a visualization, and that has a reference to an index pattern: @@ -175,11 +175,11 @@ The API returns the following: } ---- -This result indicates that the copy was successful, and all three objects were created. Since these objects were created as new copies, each -entry in the `successResults` array includes a `destinationId` attribute. +The result indicates a successful copy, and all three objects are created. Since these objects were created as new copies, each entry in the +`successResults` array includes a `destinationId` attribute. [[spaces-api-copy-saved-objects-example-2]] -===== 2. Successful copy (with `createNewCopies` disabled) +===== Successful copy (with `createNewCopies` disabled) Copy a dashboard with the `my-dashboard` ID, including all references from the `default` space to the `marketing` space. In this example, the dashboard has a reference to a visualization, and that has a reference to an index pattern: @@ -236,13 +236,14 @@ The API returns the following: } ---- -This result indicates that the copy was successful, and all three objects were created. +The result indicates a successful copy, and all three objects are created. [[spaces-api-copy-saved-objects-example-3]] -===== 3. Failed copy (with conflict errors) +===== Failed copy (with conflict errors) Copy a dashboard with the `my-dashboard` ID, including all references from the `default` space to the `marketing` and `sales` spaces. In -this example, the dashboard has a reference to a visualization and a canvas, and the visualization has a reference to an index pattern: +this example, the dashboard has a reference to a visualization and a *Canvas* workpad, and the visualization has a reference to an index +pattern: [source,sh] ---- @@ -369,31 +370,31 @@ The API returns the following: } ---- -This result indicates that the copy was successful for the `marketing` space, but it was not successful for the `sales` space because the -index pattern, visualization, and dashboard each resulted in a conflict error: +The result indicates a successful copy for the `marketing` space, and an unsuccessful copy for the `sales` space because the index pattern, +visualization, and *Canvas* workpad 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. +* An index pattern with the same ID already exists, which resulted in a conflict error. To resolve the error, overwrite the existing object, +or skip the object. -* A visualization with a different ID but the same "origin" already exists, so this resulted in a conflict error as well. The -`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. +* A visualization with a different ID, but the same origin already exists, which resulted in a conflict error. The `destinationId` field +contains the `id` of the other visualization, which caused the conflict. The behavior is added to make sure that new objects that 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 the conflicts are encountered as expected. To resolve, overwrite the specified destination object, or skip the +object. -* 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 copied 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. +* Two *Canvas* workpads with different IDs, but the same origin, already exist, which resulted in a conflict error. The `destinations` array +describes the other workpads which caused the conflict. When a shareable object is copied into a new space, then shared to another space +where an object of the same origin exists, the conflict error occurs. To resolve, pick a destination object to overwrite, or skip the +object. -No objects will be copied until these errors are resolved using the <>. +Objects are created when the error is resolved using the <>. [[spaces-api-copy-saved-objects-example-4]] -===== 4. Failed copy (with missing reference errors) +===== Failed copy (with missing reference errors) Copy a dashboard with the `my-dashboard` ID, including all references from the `default` space to the `marketing` space. In this example, -the dashboard has a reference to a visualization and a canvas, and the visualization has a reference to an index pattern: +the dashboard has a reference to a visualization and a *Canvas* workpad, and the visualization has a reference to an index pattern: [source,sh] ---- @@ -459,7 +460,7 @@ The API returns the following: } ---- -This result indicates that the copy was not successful because the visualization resulted in a missing references error. +The result indicates an unsuccessful copy because the visualization resulted in a missing references error. -No objects will be copied until this error is resolved using the <>. diff --git a/docs/api/spaces-management/resolve_copy_saved_objects_conflicts.asciidoc b/docs/api/spaces-management/resolve_copy_saved_objects_conflicts.asciidoc index d2c76c2bccc36..6d799ebb0014e 100644 --- a/docs/api/spaces-management/resolve_copy_saved_objects_conflicts.asciidoc +++ b/docs/api/spaces-management/resolve_copy_saved_objects_conflicts.asciidoc @@ -66,9 +66,9 @@ Execute the <>, w `overwrite`:::: (Required, boolean) When set to `true`, the saved object from the source space (desigated by the <>) overwrites the conflicting object in the destination space. When set to `false`, this does nothing. `destinationId`:::: - (Optional, string) Specifies which destination ID the copied object should have (if different from the current ID). + (Optional, string) Specifies the destination ID that the copied object should have, if different from the current ID. `ignoreMissingReferences`::: - (Optional, boolean) When set to `true`, any missing references errors are ignored. When set to `false`, this does nothing. + (Optional, boolean) When set to `true`, any missing references errors are ignored. When set to `false`, does nothing. ====== ===== @@ -91,8 +91,8 @@ Execute the <>, w `errors`::: (Optional, array) The errors that occurred during the copy operation. When errors are reported, the `success` flag is set to `false`. + -NOTE: One object may result in multiple errors which require separate steps to resolve (for instance, a `missing_references` error and a -`conflict` error). +NOTE: One object may result in multiple errors, which requires separate steps to resolve. For instance, a `missing_references` error and a +`conflict` error. + .Properties of `errors` @@ -122,10 +122,10 @@ NOTE: One object may result in multiple errors which require separate steps to r ====== `successResults`::: - (Optional, array) Indicates the objects that were copied successfully, with any metadata if applicable. + (Optional, array) Indicates successfully copied objects, with any applicable metadata. + -NOTE: No objects are actually created until all resolvable errors have been addressed! This includes conflict errors and missing references -errors. See the examples below for how to resolve these errors. +NOTE: Objects are created when all resolvable errors are addressed, including conflict and missing references errors. For more information, +refer to the <>. ===== @@ -133,11 +133,11 @@ errors. See the examples below for how to resolve these errors. ==== {api-examples-title} [[spaces-api-resolve-copy-saved-objects-conflicts-example-1]] -===== 1. Resolve conflict errors +===== Resolve conflict errors This example builds upon the <>. -Resolve conflict errors for an index pattern, visualization, and canvas by overwriting the existing saved objects: +Resolve conflict errors for an index pattern, visualization, and *Canvas* workpad by overwriting the existing saved objects: [source,sh] ---- @@ -225,13 +225,13 @@ The API returns the following: } ---- -This result indicates that the copy was successful, and all four objects were created. +The result indicates a successful copy, and all four objects are created. TIP: If a prior copy attempt resulted in resolvable errors, you must include a retry for each object you want to copy, including any that were returned in the `successResults` array. In this example, we retried copying the dashboard accordingly. [[spaces-api-resolve-copy-saved-objects-conflicts-example-2]] -===== 2. Resolve missing reference errors +===== Resolve missing reference errors This example builds upon the <>. @@ -305,7 +305,7 @@ The API returns the following: } ---- -This result indicates that the copy was successful, and all three objects were created. +The result indicates a successful copy and all three objects are created. TIP: If a prior copy attempt resulted in resolvable errors, you must include a retry for each object you want to copy, including any that were returned in the `successResults` array. In this example, we retried copying the dashboard and canvas accordingly. diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/flyout.test.tsx.snap b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/flyout.test.tsx.snap index 400b01e89cf7e..9ad82723c1161 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/flyout.test.tsx.snap +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/__snapshots__/flyout.test.tsx.snap @@ -304,6 +304,9 @@ exports[`Flyout legacy conflicts should allow conflict resolution 1`] = ` />

+ { let legacyFileWarning; if (this.state.isLegacyFile) { legacyFileWarning = ( - - } - color="warning" - iconType="help" - > -

- -

-
+ <> + + } + color="warning" + iconType="help" + > +

+ +

+
+ + ); } diff --git a/src/plugins/saved_objects_management/public/management_section/objects_table/components/overwrite_modal.tsx b/src/plugins/saved_objects_management/public/management_section/objects_table/components/overwrite_modal.tsx index 3f6820ce24fe6..dbe95161cbeae 100644 --- a/src/plugins/saved_objects_management/public/management_section/objects_table/components/overwrite_modal.tsx +++ b/src/plugins/saved_objects_management/public/management_section/objects_table/components/overwrite_modal.tsx @@ -82,7 +82,7 @@ export const OverwriteModal = ({ conflict, onFinish }: OverwriteModalProps) => { options={selectProps.options} valueOfSelected={destinationId} onChange={selectProps.onChange} - append={i18n.translate( + prepend={i18n.translate( 'savedObjectsManagement.objectsTable.overwriteModal.selectControlLabel', { defaultMessage: 'Object ID' } )} diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.tsx index d82e00535e3d0..f9b81be2d6b4b 100644 --- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.tsx +++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout.tsx @@ -282,6 +282,7 @@ export const CopySavedObjectsToSpaceFlyout = (props: Props) => { copyResult={copyResult} numberOfSelectedSpaces={copyOptions.selectedSpaceIds.length} retries={retries} + onClose={onClose} onCopyStart={startCopy} onCopyFinish={finishCopy} /> diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout_footer.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout_footer.tsx index 54c47502458d6..524361bf6ef1d 100644 --- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout_footer.tsx +++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/copy_to_space_flyout_footer.tsx @@ -5,7 +5,14 @@ */ import React, { Fragment } from 'react'; -import { EuiButton, EuiFlexGroup, EuiFlexItem, EuiStat, EuiHorizontalRule } from '@elastic/eui'; +import { + EuiButton, + EuiButtonEmpty, + EuiFlexGroup, + EuiFlexItem, + EuiStat, + EuiHorizontalRule, +} from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; import { ProcessedImportResponse, FailedImport } from 'src/plugins/saved_objects_management/public'; @@ -18,6 +25,7 @@ interface Props { copyResult: Record; retries: Record; numberOfSelectedSpaces: number; + onClose: () => void; onCopyStart: () => void; onCopyFinish: () => void; } @@ -27,7 +35,13 @@ const isResolvableError = ({ error: { type } }: FailedImport) => const isUnresolvableError = (failure: FailedImport) => !isResolvableError(failure); export const CopyToSpaceFlyoutFooter = (props: Props) => { - const { copyInProgress, initialCopyFinished, copyResult, retries } = props; + const { + copyInProgress, + conflictResolutionInProgress, + initialCopyFinished, + copyResult, + retries, + } = props; let summarizedResults = { successCount: 0, @@ -83,10 +97,10 @@ export const CopyToSpaceFlyoutFooter = (props: Props) => { actionButton = ( { } return ( - + + + props.onClose()} + data-test-subj="cts-cancel-button" + disabled={ + // Cannot cancel while the operation is in progress, or after some objects have already been created + (copyInProgress && !initialCopyFinished) || + conflictResolutionInProgress || + summarizedResults.successCount > 0 + } + > + + + {actionButton} ); diff --git a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/space_result_details.tsx b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/space_result_details.tsx index c37d40ec0a9f7..776ed99c41120 100644 --- a/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/space_result_details.tsx +++ b/x-pack/plugins/spaces/public/copy_saved_objects_to_space/components/space_result_details.tsx @@ -178,7 +178,7 @@ export const SpaceCopyResultDetails = (props: Props) => { options={selectProps.options} valueOfSelected={destinationMap.get(`${type}:${id}`)} onChange={selectProps.onChange} - append={i18n.translate( + prepend={i18n.translate( 'xpack.spaces.management.copyToSpace.copyDetail.selectControlLabel', { defaultMessage: 'Object ID' } )}