-
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
[SecuritySolution] Replace dashboard listing with Kibana dashboard listing #155716
Conversation
…-ref HEAD~1..HEAD --fix'
…-ref HEAD~1..HEAD --fix'
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.
Looked through the code and tested this locally by making sure that the Dashboard Listing page still works the same way, and by checking out the design of the Security dashboard listing page. Everything LGTM from the Presentation team side of things! Left a few followup comments and nits.
Also a note, I created a dashboard from the top right link in the security solution and it wasn't automatically assigned the security-solution
tag at first. As I tried again a few more times it started being assigned consistently. Is that functionality flaky? I tested in 8.7 and when I navigated via the security solution create dashboard
link the new dashboard was automatically assigned the security-solution
tag every time.
x-pack/plugins/security_solution/public/dashboards/pages/landing_page/index.tsx
Outdated
Show resolved
Hide resolved
@@ -143,7 +152,7 @@ export const TagFilterPanel: FC<Props> = ({ | |||
renderOption={(option) => option.view} | |||
emptyMessage="There aren't any tags" | |||
noMatchesMessage="No tag matches the search" | |||
onChange={onSelectChange} | |||
onChange={!disableActions ? onSelectChange : noop} |
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.
Maybe as a future enhancement here instead of disabling the actions entirely, we could treat the fixedTag
as a special entry, not allowing it to be de-selected, but allowing all other tag systems to work.
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.
Screen.Recording.2023-05-18.at.15.37.34.mov
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.
Yup, updated, rest of the tags are still listed and working.
Pinging @elastic/security-threat-hunting (Team:Threat Hunting) |
Pinging @elastic/security-solution (Team: SecuritySolution) |
clearTagSelection={clearTagSelection} | ||
tableSort={tableSort} | ||
tagsToTableItemMap={tagsToTableItemMap} | ||
fixedTagReferences={fixedTagReferences} |
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.
It seems that you wanted to sort the props by alphabetic order.. but added the new prop at the end 😊 Is that correct? Is there any new prop to the component?
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.
IMO it would be easier to review if prop order was not changed (here or in the Props interface)
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.
Sorry for the confusion, fixedTagReferences is the new prop.
💚 Build Succeeded
Metrics [docs]Module Count
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 @angorayc |
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'm half way through the code review and I have some concerns with the UX of the feature.
Rendering a tag in the tag panel that is not actionable seems like a UX bug. The user will wonder "Why can't I unselect this tag?"
I think a better UI would be to:
- filter out the "fixed" tags from the tag panel list.
- not to fill the search bar with the
"tag:("Security Solution")"
text - hide the tags in the table row (here too, those tags are actionable but now don't do anything)
The prop to configure the table could be withTags
<DashboardListingTable
withTags={{
tags: [tag1, tag2],
hideFromTable: true, // default "true"
hideFromSearch: true, // default "true"
}}
disableCreateDashboardButton={loadingCreateDashboardUrl}
getDashboardUrl={getSecuritySolutionDashboardUrl}
...
The <TableListView />
is already a bloated component (I know, it should be refactored). I wouldn't just push another prop to block behaviour but think how a nice UX would be if it is used in a new context.
Here what we really want is a table with specific items that can't be removed and we use the tag mechanism for this filtering. Let's hide our internals (the "Security Solution" tag) from the user. 😊
@@ -53,21 +64,31 @@ export const useTagFilterPanel = ({ | |||
const [isInUse, setIsInUse] = useState(false); | |||
const [options, setOptions] = useState<TagOptionItem[]>([]); | |||
const [tagSelection, setTagSelection] = useState<TagSelection>({}); | |||
const totalActiveFilters = Object.keys(tagSelection).length; | |||
const totalActiveFilters = useMemo( | |||
() => getTotalActiveFilters(options, fixedTagReferences), |
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 do we pass options
and not tagSelection
? I would also pass an array if fixedTagReferences
is undefined or null to make getTotalActiveFilters
simpler
const getTotalActiveFilters = (
tagSelection: TagSelection,
fixedTagReferences: TagReference[]
) =>
Math.max(
fixedTagReferences.length,
Object.keys(tagSelection).length
);
const totalActiveFilters = useMemo(
() => getTotalActiveFilters(tagSelection, fixedTagReferences ?? []),
[fixedTagReferences, tagSelection]
);
...
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.
It could really just be this
const totalActiveFilters = useMemo(() => (
Math.max((fixedTagReferences ?? []).length, Object.keys(tagSelection).length)
)),
[fixedTagReferences, tagSelection]
);
...
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.
As the tagSelection seemed to have problem displaying the actual count when a few tags sharing the same name.
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.
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.
Nice work, excellent job on test coverage. Desk testing went perfectly, LGTM. Thanks @angorayc
After talking to the team, we decide to give the non-removable tag request. What we will do is to select |
Summary
#155089
1. Header styles fitted into SecuritySolution's layout.
2. Allow for Non-Removable
Security Solution
Tags in Portable Dashboard Listing PageFor example here are all the dashboards and attached tags:
Before:
https://kibana.siem.estc.dev/s/dashboard-test/app/security/dashboards?sourcerer=(default:(id:security-solution-dashboard-test,selectedPatterns:!(%27auditbeat-*%27,%27filebeat-*%27,%27logs-*%27,%27packetbeat-*%27,%27winlogbeat-*%27)))
After:
Screen.Recording.2023-05-18.at.15.37.34.mov
This is the dashboards and tags I used to test. Please download it and rename
txt
tondjson
and import them fromstack management > saved objects
export.txt
Checklist
Delete any items that are not applicable to this PR.