You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/saved-objects/resolve.asciidoc
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,6 +70,8 @@ The `outcome` field may be any of the following:
70
70
* `"aliasMatch"` -- One document with a legacy URL alias matched the given ID; in this case the `saved_object.id` field is different than the given ID.
71
71
* `"conflict"` -- Two documents matched the given ID, one was an exact match and another with a legacy URL alias; in this case the `saved_object` object is the exact match, and the `saved_object.id` field is the same as the given ID.
72
72
73
+
If the outcome is `"aliasMatch"` or `"conflict"`, the response will also include an `alias_target_id` field. This means that an alias was found for another object, and it describes that other object's ID.
74
+
73
75
Retrieve a dashboard object in the `testspace` by ID:
74
76
75
77
[source,sh]
@@ -125,6 +127,7 @@ The API returns the following:
Copy file name to clipboardExpand all lines: docs/developer/advanced/sharing-saved-objects.asciidoc
+28-24Lines changed: 28 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,7 +67,8 @@ you read this guide, you can https://github.com/elastic/kibana/pull/107256[follo
67
67
68
68
> *Do these objects contain links to other objects?*
69
69
70
-
If your objects store _any_ links to other objects (with an object type/ID), you need to take specific steps to ensure that these links continue functioning after the 8.0 upgrade.
70
+
If your objects store _any_ links to other objects (with an object type/ID), you need to take specific steps to ensure that these links
71
+
continue functioning after the 8.0 upgrade.
71
72
72
73
[[sharing-saved-objects-step-1]]
73
74
=== Step 1
@@ -79,11 +80,13 @@ If your objects store _any_ links to other objects (with an object type/ID), you
79
80
If you answered "Yes" to <<sharing-saved-objects-q1>>, you need to make sure that your object links are _only_ stored in the root-level
80
81
`references` field. When a given object's ID is changed, this field will be updated accordingly for other objects.
81
82
82
-
The image below shows two different examples of object links from a "case" object to an "action" object. The top shows the incorrect way to link to another object, and the bottom shows the correct way.
83
+
The image below shows two different examples of object links from a "case" object to an "action" object. The top shows the incorrect way to
84
+
link to another object, and the bottom shows the correct way.
If your objects _do not_ use the root-level `references` field, you'll need to <<saved-objects-service-writing-migrations,add a migration>> _before the 8.0 release_ to fix that. Here's a migration function for the example above:
88
+
If your objects _do not_ use the root-level `references` field, you'll need to <<saved-objects-service-writing-migrations,add a migration>>
89
+
_before the 8.0 release_ to fix that. Here's a migration function for the example above:
87
90
88
91
```ts
89
92
function migrateCaseToV716(
@@ -148,23 +151,26 @@ You'll need to change it to this:
TIP: See an example of this in https://github.com/elastic/kibana/pull/107256/commits/8abaf9fcf59f27cd7cdc44ddbb5515bae56b9d3d[step 2 of the
155
-
POC]!
157
+
TIP: See an example of this in https://github.com/elastic/kibana/pull/107256#user-content-example-steps[step 2 of the POC]!
156
158
157
-
The https://github.com/elastic/kibana/blob/master/docs/development/core/server/kibana-plugin-core-server.savedobjectsresolveresponse.md[SavedObjectsResolveResponse interface] has three fields, summarized below:
* `savedObject` - The saved object that was found.
163
+
* `saved_object` - The saved object that was found.
160
164
* `outcome` - One of the following values: `'exactMatch' | 'aliasMatch' | 'conflict'`
161
-
* `aliasTargetId` - This is defined if the outcome is `'aliasMatch'` or `'conflict'`. It means that a legacy URL alias with this ID points to an object with a _different_ ID.
165
+
* `alias_target_id` - This is defined if the outcome is `'aliasMatch'` or `'conflict'`. It means that a legacy URL alias with this ID points
166
+
to an object with a _different_ ID.
162
167
163
168
The SavedObjectsClient is available both on the server-side and the client-side. You may be fetching the object on the server-side via a
164
-
custom HTTP route, or you may be fetching it on the client-side directly. Either way, the `outcome` and `aliasTargetId` fields need to be
169
+
custom HTTP route, or you may be fetching it on the client-side directly. Either way, the `outcome` and `alias_target_id` fields need to be
165
170
passed to your client-side code, and you should update your UI accordingly in the next step.
166
171
167
-
NOTE: You don't need to use `resolve()` everywhere, <<sharing-saved-objects-faq-resolve-instead-of-get,you should only use it for deep links>>!
172
+
NOTE: You don't need to use `resolve()` everywhere, <<sharing-saved-objects-faq-resolve-instead-of-get,you should only use it for deep
173
+
links>>!
168
174
169
175
[[sharing-saved-objects-step-3]]
170
176
=== Step 3
@@ -180,8 +186,7 @@ Your page should change <<sharing-saved-objects-faq-resolve-outcomes,according t
_Note that `OBJECT_NOUN` is optional, it just changes "object" in the toast to whatever you specify -- you may want the toast to say "dashboard" or "index pattern" instead!_
245
+
_Note that `OBJECT_NOUN` is optional, it just changes "object" in the toast to whatever you specify -- you may want the toast to say
246
+
"dashboard" or "index pattern" instead!_
244
247
245
248
5. And finally, in your deep link page, add a function that will create a callout in the case of a `'conflict'` outcome:
246
249
+
247
250
```tsx
248
251
const getLegacyUrlConflictCallout = () => {
249
252
// This function returns a callout component *if* we have encountered a "legacy URL conflict" scenario
250
-
if (spacesApi && outcome === 'conflict') {
253
+
if (spacesApi && resolveResult.outcome === 'conflict') {
251
254
// We have resolved to one object, but another object has a legacy URL alias associated with this ID/page. We should display a
252
255
// callout with a warning for the user, and provide a way for them to navigate to the other object.
253
256
const currentObjectId = savedObject.id;
254
-
const otherObjectId = aliasTargetId!; // This is always defined if outcome === 'conflict'
257
+
const otherObjectId = resolveResult.alias_target_id!; // This is always defined if outcome === 'conflict'
@@ -298,12 +301,13 @@ After <<sharing-saved-objects-step-3>> is complete, you can add the code to conv
298
301
WARNING: The previous steps can be backported to the 7.x branch, but this step -- the conversion itself -- can only take place in 8.0!
299
302
You should use a separate pull request for this.
300
303
301
-
When you register your object, you need to change the `namespaceType` and also add a `convertToMultiNamespaceTypeVersion` field. This special field will trigger the actual conversion that will take place during the Core migration upgrade process when a user installs the Kibana 8.0 release:
304
+
When you register your object, you need to change the `namespaceType` and also add a `convertToMultiNamespaceTypeVersion` field. This
305
+
special field will trigger the actual conversion that will take place during the Core migration upgrade process when a user installs the
0 commit comments