-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ContentManagement] Fix Visualize List search and CRUD operations via CM #165485
Conversation
Pinging @elastic/kibana-visualizations (Team:Visualizations) |
export interface MSearchIn<Options extends void | object = object> { | ||
contentTypes: Array<{ contentTypeId: string; version?: Version }>; | ||
query: MSearchQuery; | ||
options?: Options; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that options
make sense, but are they actually used anywhere for msearch
in this pr? It seems they are not used and, as I understand, they won't work because the implementation of the msearch
service wasn't changed to work with options
. Or am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the implementation it seems it's dropped. I can drop it here at search
wrapping function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it. I suggest we revert these changes to msearch interface, because this can't be used in msearch
@@ -66,6 +66,14 @@ const deleteVisualization = async (id: string) => { | |||
}; | |||
|
|||
const search = async (query: SearchQuery = {}, options?: VisualizationSearchQuery) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the return type of this method account for that it could return maps
and lens
objects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not specifically the types of those, but all adhere to a generic interface defined https://github.com/elastic/kibana/pull/165485/files#diff-72eb8e94b67c0c56b5744ac732c6164a66b68e6e4a6fb1857da4d361acb6b149R52
Having the exact types returned by this method, from my understanding, requires either a type cast or a full refactor of the architecture, as types are registered dynamically to Visualizations and there's no static way to detect the correct type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I smoked checked the usage on visualize page and it looks good to me. just that comment amount reverting options change #165485 (comment)
great work 👏 thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vis team changes LGTM and the bug from the listing page has been fixed 🎉
There is only one unit test failing but I am approving as I dont want to block this PR. Great work Marco ❤️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, tested in chrome linux
@@ -161,6 +161,8 @@ export interface SavedObjectSearchOptions { | |||
|
|||
/** Saved Object update options - Pick and Omit to customize */ | |||
export interface SavedObjectUpdateOptions<Attributes = unknown> { | |||
/** Overwrite existing documents (defaults to false) */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this needed ? in the old times we used this as we didnt have the update operation, but now we have full crud operation set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is used by all visualization types but maps right now. I had to introduce it to maps
in order to make it work within the metadata editing in visualize Listing page.
Other visualizations were using the CreateOptions
type on Update in order to validate/pass the overwrite
flag.
I can see how this can be removed, but I would like to move it in a follow up PR unless it's strictly required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here is some context where a related bug in Lens was fixed #160116 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like a more complete explanation of this which might be best done over zoom since its modifying api types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kibana-gis changes LGTM. Thanks for adding functional test verifying map saved object types can be edited in visualize listing table.
code review, tested in chrome
@@ -161,6 +161,8 @@ export interface SavedObjectSearchOptions { | |||
|
|||
/** Saved Object update options - Pick and Omit to customize */ | |||
export interface SavedObjectUpdateOptions<Attributes = unknown> { | |||
/** Overwrite existing documents (defaults to false) */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like a more complete explanation of this which might be best done over zoom since its modifying api types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, looks great, just a question about passing overwrite to to the update method. Its nice that this PR is a net removal of code.
@mattkime as discussed offline I've removed the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes look good to me, thanks!
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
Summary
Fix #163246
This PR fixes the CM problems within the Visualize List page leveraging the services already in place.
The approach here is lighter than #165292 as it passes each client via the TypesService already used to register extensions in the Visualization scope. Also the
search
method now transparently uses themSearch
if more content types are detected without leaking any implementation detail outside theVisualizationClient
interface.More fixes/features:
overwrite
flagmSearch
to accept an options object argumentChecklist