-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Create a new menu for observability links #54847
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
7b47320
Create a new menu for observability links. Use it on inentory page.
phillipb 185b024
Change the order of props for clarity
phillipb f3f07f5
Fix default message
phillipb 789f6c8
Merge branch 'master' of https://github.com/elastic/kibana into obser…
phillipb 6c94d9f
Composition over configuration
phillipb ee68728
Merge branch 'master' of https://github.com/elastic/kibana into obser…
phillipb 6b942e7
Show ids and ips. PR feedback.
phillipb d8b16bf
Don't wrap subtitle. Use fields in inventory model for name
phillipb 6bc748c
Tooltip was becoming hacky. Keep it simple and wrap the id.
phillipb 2efb212
Create observability plugin. Add action menu to it.
phillipb 5eebed9
Fix path
phillipb 11245d0
Merge branch 'master' of https://github.com/elastic/kibana into obser…
phillipb a082b20
Satisfy linter and fix test
phillipb 547c358
Merge branch 'master' into observability-action-menu
elasticmachine 4caf93c
Please the linter
phillipb e39dd19
Merge branch 'observability-action-menu' of github.com:phillipb/kiban…
phillipb 898f304
Update translastions
phillipb 85c8f63
Update test for disabled links
phillipb 0bc5de0
Update more tests
phillipb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
x-pack/legacy/plugins/infra/public/components/waffle/action_menu.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| */ | ||
|
|
||
| import { | ||
| EuiPopover, | ||
| EuiText, | ||
| EuiListGroup, | ||
| EuiSpacer, | ||
| EuiHorizontalRule, | ||
| PopoverAnchorPosition, | ||
| } from '@elastic/eui'; | ||
|
|
||
| import React, { useCallback, ReactNode } from 'react'; | ||
| import { EuiListGroupItemProps } from '@elastic/eui/src/components/list_group/list_group_item'; | ||
|
|
||
| interface Props { | ||
| sections: Section[]; | ||
| otherLinks?: EuiListGroupItemProps[]; | ||
|
|
||
| button: NonNullable<ReactNode>; | ||
| anchorPosition?: PopoverAnchorPosition; | ||
| id?: string; | ||
| isOpen?: boolean; | ||
| closePopover(): void; | ||
| } | ||
|
|
||
| interface Section { | ||
| title: string; | ||
| description: string; | ||
| links: EuiListGroupItemProps[]; | ||
| } | ||
|
|
||
| export const ActionMenu = (props: Props) => { | ||
| const { closePopover, button, anchorPosition, isOpen, id, sections, otherLinks } = props; | ||
|
|
||
| const linkWithDefaults = useCallback((link: EuiListGroupItemProps) => { | ||
| link.style = { ...link.style, padding: 0 }; | ||
| link.size = link.size || 's'; | ||
| return link; | ||
| }, []); | ||
|
|
||
| return ( | ||
| <EuiPopover | ||
| closePopover={closePopover} | ||
| id={id} | ||
| isOpen={isOpen} | ||
| button={button} | ||
| anchorPosition={anchorPosition} | ||
| > | ||
| <> | ||
| {sections.map((s, idx) => ( | ||
| <React.Fragment key={s.title}> | ||
| <EuiText size={'s'} grow={false}> | ||
| <h5>{s.title}</h5> | ||
| </EuiText> | ||
| <EuiSpacer size={'s'} /> | ||
| <EuiText size={'xs'} color={'subdued'} grow={false}> | ||
| <small>{s.description}</small> | ||
| </EuiText> | ||
| <EuiSpacer size={'s'} /> | ||
| <EuiListGroup | ||
| flush={true} | ||
| bordered={false} | ||
| listItems={s.links.map(l => linkWithDefaults(l))} | ||
| /> | ||
| {idx !== sections.length - 1 && <EuiSpacer size={'l'} />} | ||
| </React.Fragment> | ||
| ))} | ||
| {otherLinks?.length && ( | ||
| <div> | ||
| <EuiHorizontalRule margin={'s'} /> | ||
| <EuiListGroup | ||
| flush={true} | ||
| bordered={false} | ||
| listItems={otherLinks.map(l => linkWithDefaults(l))} | ||
| /> | ||
| </div> | ||
| )} | ||
| </> | ||
| </EuiPopover> | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.