[data views] swap_references api improvements#163225
Conversation
|
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
davismcphee
left a comment
There was a problem hiding this comment.
Code-only review, changes look good to me 👍 just have one question regarding testing.
| result: Array<{ id: string; type: string }>; | ||
| preview: boolean; | ||
| deleteSuccess?: boolean; | ||
| deleteStatus?: { |
There was a problem hiding this comment.
Do we have a reliable way to test this functionality? It would be great to have a test that also covers what happens if the delete fails/has refs if possible.
There was a problem hiding this comment.
I added a test. I realized that there's a simpler valid use case for this - when you swap some refs, but not all, and ask it to delete.
There was a problem hiding this comment.
Ah that makes sense and covers exactly what I was looking for. Thanks!
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: cc @mattkime |
davismcphee
left a comment
There was a problem hiding this comment.
API improvements LGTM, thanks for the cleanup!
| result: Array<{ id: string; type: string }>; | ||
| preview: boolean; | ||
| deleteSuccess?: boolean; | ||
| deleteStatus?: { |
There was a problem hiding this comment.
Ah that makes sense and covers exactly what I was looking for. Thanks!
## Summary
Some simple dev UX improvements to the swap_references data views api -
```
POST /api/data_views/swap_references/_preview
{
"fromId" : "abcd-efg",
"toId" : "xyz-123"
}
returns
{
result: [{ id: "123", type: "visualization" }],
}
```
```
POST /api/data_views/swap_references
{
"fromId" : "abcd-efg",
"toId" : "xyz-123",
"delete" : true // optional, removes data view which is no longer referenced
}
returns
{
result: [{ id: "123", type: "visualization" }],
deleteStatus: {
remainingRefs: 0,
deletePerformed: true
}
```
Additional params -
```
fromType: string - specify the saved object type. Default is `index-pattern` for data view
forId: string | string[] - limit the affected saved objects to one or more by id
forType: string - limit the affected saved objects by type
```
Improves upon elastic#157665
Docs will be created in follow up PR
## Summary Docs for the swap references api - #163225 The docs are on the terse side - I think this makes sense since this is a tool that should be used infrequently and only by people who use saved object references. --------- Co-authored-by: amyjtechwriter <61687663+amyjtechwriter@users.noreply.github.com> Co-authored-by: Davis McPhee <davismcphee@hotmail.com>
## Summary Docs for the swap references api - elastic#163225 The docs are on the terse side - I think this makes sense since this is a tool that should be used infrequently and only by people who use saved object references. --------- Co-authored-by: amyjtechwriter <61687663+amyjtechwriter@users.noreply.github.com> Co-authored-by: Davis McPhee <davismcphee@hotmail.com> (cherry picked from commit b371171)
## Summary Docs for the swap references api - elastic#163225 The docs are on the terse side - I think this makes sense since this is a tool that should be used infrequently and only by people who use saved object references. --------- Co-authored-by: amyjtechwriter <61687663+amyjtechwriter@users.noreply.github.com> Co-authored-by: Davis McPhee <davismcphee@hotmail.com> (cherry picked from commit b371171)
## Summary Docs for the swap references api - elastic#163225 The docs are on the terse side - I think this makes sense since this is a tool that should be used infrequently and only by people who use saved object references. --------- Co-authored-by: amyjtechwriter <61687663+amyjtechwriter@users.noreply.github.com> Co-authored-by: Davis McPhee <davismcphee@hotmail.com> (cherry picked from commit b371171)
# Backport This will backport the following commits from `main` to `8.10`: - [[data views] Swap references API docs (#175183)](#175183) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Matthew Kime","email":"matt@mattki.me"},"sourceCommit":{"committedDate":"2024-01-29T21:04:20Z","message":"[data views] Swap references API docs (#175183)\n\n## Summary\r\n\r\nDocs for the swap references api -\r\nhttps://github.com//pull/163225\r\n\r\nThe docs are on the terse side - I think this makes sense since this is\r\na tool that should be used infrequently and only by people who use saved\r\nobject references.\r\n\r\n---------\r\n\r\nCo-authored-by: amyjtechwriter <61687663+amyjtechwriter@users.noreply.github.com>\r\nCo-authored-by: Davis McPhee <davismcphee@hotmail.com>","sha":"b371171d86adc0bcd3a331be8526571370916330","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Data Views","release_note:skip","docs","Team:DataDiscovery","v8.10.0","v8.11.0","v8.12.0","v8.13.0"],"title":"[data views] Swap references API docs","number":175183,"url":"https://github.com/elastic/kibana/pull/175183","mergeCommit":{"message":"[data views] Swap references API docs (#175183)\n\n## Summary\r\n\r\nDocs for the swap references api -\r\nhttps://github.com//pull/163225\r\n\r\nThe docs are on the terse side - I think this makes sense since this is\r\na tool that should be used infrequently and only by people who use saved\r\nobject references.\r\n\r\n---------\r\n\r\nCo-authored-by: amyjtechwriter <61687663+amyjtechwriter@users.noreply.github.com>\r\nCo-authored-by: Davis McPhee <davismcphee@hotmail.com>","sha":"b371171d86adc0bcd3a331be8526571370916330"}},"sourceBranch":"main","suggestedTargetBranches":["8.10","8.11","8.12"],"targetPullRequestStates":[{"branch":"8.10","label":"v8.10.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.11","label":"v8.11.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.12","label":"v8.12.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","branchLabelMappingKey":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/175183","number":175183,"mergeCommit":{"message":"[data views] Swap references API docs (#175183)\n\n## Summary\r\n\r\nDocs for the swap references api -\r\nhttps://github.com//pull/163225\r\n\r\nThe docs are on the terse side - I think this makes sense since this is\r\na tool that should be used infrequently and only by people who use saved\r\nobject references.\r\n\r\n---------\r\n\r\nCo-authored-by: amyjtechwriter <61687663+amyjtechwriter@users.noreply.github.com>\r\nCo-authored-by: Davis McPhee <davismcphee@hotmail.com>","sha":"b371171d86adc0bcd3a331be8526571370916330"}}]}] BACKPORT--> Co-authored-by: Matthew Kime <matt@mattki.me>
# Backport This will backport the following commits from `main` to `8.12`: - [[data views] Swap references API docs (#175183)](#175183) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Matthew Kime","email":"matt@mattki.me"},"sourceCommit":{"committedDate":"2024-01-29T21:04:20Z","message":"[data views] Swap references API docs (#175183)\n\n## Summary\r\n\r\nDocs for the swap references api -\r\nhttps://github.com//pull/163225\r\n\r\nThe docs are on the terse side - I think this makes sense since this is\r\na tool that should be used infrequently and only by people who use saved\r\nobject references.\r\n\r\n---------\r\n\r\nCo-authored-by: amyjtechwriter <61687663+amyjtechwriter@users.noreply.github.com>\r\nCo-authored-by: Davis McPhee <davismcphee@hotmail.com>","sha":"b371171d86adc0bcd3a331be8526571370916330","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Data Views","release_note:skip","docs","Team:DataDiscovery","v8.10.0","v8.11.0","v8.12.0","v8.13.0"],"title":"[data views] Swap references API docs","number":175183,"url":"https://github.com/elastic/kibana/pull/175183","mergeCommit":{"message":"[data views] Swap references API docs (#175183)\n\n## Summary\r\n\r\nDocs for the swap references api -\r\nhttps://github.com//pull/163225\r\n\r\nThe docs are on the terse side - I think this makes sense since this is\r\na tool that should be used infrequently and only by people who use saved\r\nobject references.\r\n\r\n---------\r\n\r\nCo-authored-by: amyjtechwriter <61687663+amyjtechwriter@users.noreply.github.com>\r\nCo-authored-by: Davis McPhee <davismcphee@hotmail.com>","sha":"b371171d86adc0bcd3a331be8526571370916330"}},"sourceBranch":"main","suggestedTargetBranches":["8.10","8.11","8.12"],"targetPullRequestStates":[{"branch":"8.10","label":"v8.10.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.11","label":"v8.11.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.12","label":"v8.12.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","branchLabelMappingKey":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/175183","number":175183,"mergeCommit":{"message":"[data views] Swap references API docs (#175183)\n\n## Summary\r\n\r\nDocs for the swap references api -\r\nhttps://github.com//pull/163225\r\n\r\nThe docs are on the terse side - I think this makes sense since this is\r\na tool that should be used infrequently and only by people who use saved\r\nobject references.\r\n\r\n---------\r\n\r\nCo-authored-by: amyjtechwriter <61687663+amyjtechwriter@users.noreply.github.com>\r\nCo-authored-by: Davis McPhee <davismcphee@hotmail.com>","sha":"b371171d86adc0bcd3a331be8526571370916330"}}]}] BACKPORT--> Co-authored-by: Matthew Kime <matt@mattki.me>
# Backport This will backport the following commits from `main` to `8.11`: - [[data views] Swap references API docs (#175183)](#175183) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Matthew Kime","email":"matt@mattki.me"},"sourceCommit":{"committedDate":"2024-01-29T21:04:20Z","message":"[data views] Swap references API docs (#175183)\n\n## Summary\r\n\r\nDocs for the swap references api -\r\nhttps://github.com//pull/163225\r\n\r\nThe docs are on the terse side - I think this makes sense since this is\r\na tool that should be used infrequently and only by people who use saved\r\nobject references.\r\n\r\n---------\r\n\r\nCo-authored-by: amyjtechwriter <61687663+amyjtechwriter@users.noreply.github.com>\r\nCo-authored-by: Davis McPhee <davismcphee@hotmail.com>","sha":"b371171d86adc0bcd3a331be8526571370916330","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Data Views","release_note:skip","docs","Team:DataDiscovery","v8.10.0","v8.11.0","v8.12.0","v8.13.0"],"title":"[data views] Swap references API docs","number":175183,"url":"https://github.com/elastic/kibana/pull/175183","mergeCommit":{"message":"[data views] Swap references API docs (#175183)\n\n## Summary\r\n\r\nDocs for the swap references api -\r\nhttps://github.com//pull/163225\r\n\r\nThe docs are on the terse side - I think this makes sense since this is\r\na tool that should be used infrequently and only by people who use saved\r\nobject references.\r\n\r\n---------\r\n\r\nCo-authored-by: amyjtechwriter <61687663+amyjtechwriter@users.noreply.github.com>\r\nCo-authored-by: Davis McPhee <davismcphee@hotmail.com>","sha":"b371171d86adc0bcd3a331be8526571370916330"}},"sourceBranch":"main","suggestedTargetBranches":["8.10","8.11","8.12"],"targetPullRequestStates":[{"branch":"8.10","label":"v8.10.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.11","label":"v8.11.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.12","label":"v8.12.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","branchLabelMappingKey":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/175183","number":175183,"mergeCommit":{"message":"[data views] Swap references API docs (#175183)\n\n## Summary\r\n\r\nDocs for the swap references api -\r\nhttps://github.com//pull/163225\r\n\r\nThe docs are on the terse side - I think this makes sense since this is\r\na tool that should be used infrequently and only by people who use saved\r\nobject references.\r\n\r\n---------\r\n\r\nCo-authored-by: amyjtechwriter <61687663+amyjtechwriter@users.noreply.github.com>\r\nCo-authored-by: Davis McPhee <davismcphee@hotmail.com>","sha":"b371171d86adc0bcd3a331be8526571370916330"}}]}] BACKPORT--> Co-authored-by: Matthew Kime <matt@mattki.me>
## Summary Docs for the swap references api - elastic#163225 The docs are on the terse side - I think this makes sense since this is a tool that should be used infrequently and only by people who use saved object references. --------- Co-authored-by: amyjtechwriter <61687663+amyjtechwriter@users.noreply.github.com> Co-authored-by: Davis McPhee <davismcphee@hotmail.com>
## Summary Docs for the swap references api - elastic#163225 The docs are on the terse side - I think this makes sense since this is a tool that should be used infrequently and only by people who use saved object references. --------- Co-authored-by: amyjtechwriter <61687663+amyjtechwriter@users.noreply.github.com> Co-authored-by: Davis McPhee <davismcphee@hotmail.com>
Summary
Some simple dev UX improvements to the swap_references data views api -
Additional params -
Improves upon #157665
Docs will be created in follow up PR