Skip to content

Commit

Permalink
Update sharing saved objects dev docs (#114395)
Browse files Browse the repository at this point in the history
  • Loading branch information
jportner authored Oct 10, 2021
1 parent 961fe75 commit 5285858
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/developer/advanced/images/sharing-saved-objects-step-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 9 additions & 6 deletions docs/developer/advanced/sharing-saved-objects.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,7 @@ export class MyPlugin implements Plugin<{}, {}, {}, PluginStartDeps> {
if (spacesApi && resolveResult.outcome === 'aliasMatch') {
// We found this object by a legacy URL alias from its old ID; redirect the user to the page with its new ID, preserving any URL hash
const newObjectId = resolveResult.alias_target_id!; // This is always defined if outcome === 'aliasMatch'
const newPath = http.basePath.prepend(
`path/to/this/page/${newObjectId}${window.location.hash}`
);
const newPath = `/this/page/${newObjectId}${window.location.hash}`; // Use the *local* path within this app (do not include the "/app/appId" prefix)
await spacesApi.ui.redirectLegacyUrl(newPath, OBJECT_NOUN);
return;
}
Expand All @@ -255,9 +253,7 @@ const getLegacyUrlConflictCallout = () => {
// callout with a warning for the user, and provide a way for them to navigate to the other object.
const currentObjectId = savedObject.id;
const otherObjectId = resolveResult.alias_target_id!; // This is always defined if outcome === 'conflict'
const otherObjectPath = http.basePath.prepend(
`path/to/this/page/${otherObjectId}${window.location.hash}`
);
const otherObjectPath = `/this/page/${otherObjectId}${window.location.hash}`; // Use the *local* path within this app (do not include the "/app/appId" prefix)
return (
<>
{spacesApi.ui.components.getLegacyUrlConflict({
Expand Down Expand Up @@ -391,6 +387,13 @@ These should be handled on a case-by-case basis at the plugin owner's discretion
* Any "secondary" objects on the page may handle the outcomes differently. If the secondary object ID is not important (for example, it just
functions as a page anchor), it may make more sense to ignore the different outcomes. If the secondary object _is_ important but it is not
directly represented in the UI, it may make more sense to throw a descriptive error when a `'conflict'` outcome is encountered.
- Embeddables should use `spacesApi.ui.components.getEmbeddableLegacyUrlConflict` to render conflict errors:
+
image::images/sharing-saved-objects-faq-multiple-deep-link-objects-1.png["Sharing Saved Objects embeddable legacy URL conflict"]
Viewing details shows the user how to disable the alias and fix the problem using the
<<spaces-api-disable-legacy-url-aliases,_disable_legacy_url_aliases API>>:
+
image::images/sharing-saved-objects-faq-multiple-deep-link-objects-2.png["Sharing Saved Objects embeddable legacy URL conflict (showing details)"]
- If the secondary object is resolved by an external service (such as the index pattern service), the service should simply make the full
outcome available to consumers.

Expand Down

0 comments on commit 5285858

Please sign in to comment.