-
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
[TableListView] Fix tag selection when passing initialFilter #160871
[TableListView] Fix tag selection when passing initialFilter #160871
Conversation
@@ -618,12 +624,67 @@ function TableListViewTableComp<T extends UserContentCommonSchema>({ | |||
// ------------ | |||
// Callbacks | |||
// ------------ | |||
const buildQueryFromText = useCallback( |
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 handler has been extracted from updateQueryFromURL()
below
@@ -206,6 +206,14 @@ export const DashboardListing = ({ | |||
|
|||
const { getEntityName, getTableListTitle, getEntityNamePlural } = dashboardListingTableStrings; | |||
|
|||
const savedObjectsTaggingFakePlugin = useMemo(() => { |
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.
We need a stable reference of the savedObjectsTagging
dep.
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.
UseMemo addition makes sense. We'll be introducing a simpler services mechanic at some point, and will remove this.
Pinging @elastic/appex-sharedux (Team:SharedUX) |
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.
Dashboard listing changes LGTM
@@ -206,6 +206,14 @@ export const DashboardListing = ({ | |||
|
|||
const { getEntityName, getTableListTitle, getEntityNamePlural } = dashboardListingTableStrings; | |||
|
|||
const savedObjectsTaggingFakePlugin = useMemo(() => { |
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.
UseMemo addition makes sense. We'll be introducing a simpler services mechanic at some point, and will remove this.
How about adding a functional test to prevent regression? For dashboard, the tag is passed in the URL like |
Here we are testing the other direction. An initial filter is passed through prop to the component, which updates the URL (if URL state is enabled). This functional test that you mention should be added once the security team adds this filter when consuming the dashboard table in security (#160540) |
💚 Build Succeeded
Metrics [docs]Async chunks
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @sebelga |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…160871) (#162169) # Backport This will backport the following commits from `main` to `8.9`: - [[TableListView] Fix tag selection when passing initialFilter (#160871)](#160871) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Sébastien Loix","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-06-30T12:00:54Z","message":"[TableListView] Fix tag selection when passing initialFilter (#160871)","sha":"aec3a4bee3456d3d0ff06802c74caa13545fe2f3","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:skip","Team:SharedUX","Feature:Content Management","Component:TableListView","v8.10.0"],"number":160871,"url":"https://github.com/elastic/kibana/pull/160871","mergeCommit":{"message":"[TableListView] Fix tag selection when passing initialFilter (#160871)","sha":"aec3a4bee3456d3d0ff06802c74caa13545fe2f3"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/160871","number":160871,"mergeCommit":{"message":"[TableListView] Fix tag selection when passing initialFilter (#160871)","sha":"aec3a4bee3456d3d0ff06802c74caa13545fe2f3"}}]}] BACKPORT-->
## Summary 1. Align dashboard listing UI with Kibana dashboard. 2. `Security Solution` tags are selected by default and removable by users. **Prerequisite:** This PR is waiting for #160871 to be merged **Steps to verify:** 1. Visit Security > Dashboards, and create a dashboard from this page. 2. Back to Security Dashboards page, you should see the dashboard you just created and Security Solution tag should be selected by default in the tag filters. 3. Open the tag options, click the Security Solution tag. Observe that it should be removable, and it should display all the dashboards you have in the table. **Known issues:** #160540 (comment) **Before:** <img width="2545" alt="Screenshot 2023-06-27 at 09 24 19" src="https://github.com/elastic/kibana/assets/6295984/bc0fa0b1-96ad-43b0-afc1-48444dfb5691"> **After:** <img width="2543" alt="Screenshot 2023-06-27 at 09 22 21" src="https://github.com/elastic/kibana/assets/6295984/82d0a868-bda2-431f-b0b5-9cbc34d3ae71"> ### Checklist Delete any items that are not applicable to this PR. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Pablo Neves Machado <[email protected]>
## Summary 1. Align dashboard listing UI with Kibana dashboard. 2. `Security Solution` tags are selected by default and removable by users. **Prerequisite:** This PR is waiting for elastic#160871 to be merged **Steps to verify:** 1. Visit Security > Dashboards, and create a dashboard from this page. 2. Back to Security Dashboards page, you should see the dashboard you just created and Security Solution tag should be selected by default in the tag filters. 3. Open the tag options, click the Security Solution tag. Observe that it should be removable, and it should display all the dashboards you have in the table. **Known issues:** elastic#160540 (comment) **Before:** <img width="2545" alt="Screenshot 2023-06-27 at 09 24 19" src="https://github.com/elastic/kibana/assets/6295984/bc0fa0b1-96ad-43b0-afc1-48444dfb5691"> **After:** <img width="2543" alt="Screenshot 2023-06-27 at 09 22 21" src="https://github.com/elastic/kibana/assets/6295984/82d0a868-bda2-431f-b0b5-9cbc34d3ae71"> ### Checklist Delete any items that are not applicable to this PR. - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <[email protected]> Co-authored-by: Pablo Neves Machado <[email protected]>
In #160540 we discovered that the tag selection was not applied correctly when passing an
initialFilter
to the TableListView.This PR fixes this behaviour.
While debugging I also found another bug in the DashboardListing page, the "clear tag selection" was not working correctly because of an unstable reference to the saved object tagging plugin.
How to test
dashboard_listing.tsx
file (src/plugins/dashboard/public/dashboard_listing/dashboard_listing.tsx)