Skip to content
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

[SavedObjectClient] Add support to exclude references when searching #142479

Merged
merged 13 commits into from
Oct 4, 2022

Conversation

sebelga
Copy link
Contributor

@sebelga sebelga commented Oct 3, 2022

As part of the UX improvement of the <TableListView /> component we want to allow the user to filter in/out the items with certain tags in the table. For that we need the Saved Object client to accept a list of tag references that must_not be present in the saved object returned.

I've added support for both the OR (default) and AND operators.

savedObjectClient.find({
  type: 'dashboard',
  search: 'foo',
  hasNoReference: [<list of references to exclude>], // new
  hasNoReferenceOperator: 'AND', // new (default "OR")
});

Release note

The saved object client find() methods accepts the new hasNoReference and hasNoReferenceOperator options to filter out saved object containing certain references.

@sebelga sebelga requested a review from a team as a code owner October 3, 2022 14:41
@sebelga sebelga self-assigned this Oct 3, 2022
@sebelga sebelga added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) v8.6.0 labels Oct 3, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@sebelga sebelga added the Feature:Content Management User generated content (saved objects) management label Oct 3, 2022
@sebelga sebelga requested a review from pgayvallet October 3, 2022 14:47
@sebelga sebelga added the release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. label Oct 3, 2022
Copy link
Contributor

@pgayvallet pgayvallet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looking good.

Just have a point to clarify before approval: #142479 (comment)

/**
* The operator to use when searching by multiple references using the `hasNoReference` option. Defaults to `OR`
*/
hasNoReferenceOperator?: 'AND' | 'OR';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for later:

Should be extracted to @kbn/core-saved-objects-api-server

@sebelga
Copy link
Contributor Author

sebelga commented Oct 4, 2022

Thanks for the review @pgayvallet ! I addressed your comments, can you have another look? Cheers!

@sebelga sebelga enabled auto-merge (squash) October 4, 2022 10:14
@sebelga sebelga merged commit 0e6fa00 into elastic:main Oct 4, 2022
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #29 / analytics instrumented events from the browser Loaded Dashboard full loaded dashboard should emit the "Loaded Dashboard" event when done loading complex dashboard

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
core 366.8KB 367.0KB +161.0B
Unknown metric groups

API count

id before after diff
@kbn/core-saved-objects-api-server 308 310 +2
core 2686 2688 +2
total +4

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @sebelga

@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Oct 4, 2022
@sebelga sebelga deleted the core/saved-objects-find-exclude-refs branch October 4, 2022 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Content Management User generated content (saved objects) management release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:SharedUX Team label for AppEx-SharedUX (formerly Global Experience) v8.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants