-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Logs UI] Log stream row rendering #60773
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
afgomez
merged 17 commits into
elastic:master
from
afgomez:58487-log-stream-row-rendering
Mar 31, 2020
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
2fdfabc
Use `focusBackgroundColor` for hovered lines
4675126
Set hover styles using CSS
5e3a20e
Set highlighted styles in the row
27708a3
Rename icon column to actions column
c948b9a
Turn expand button into a menu
a7e21d6
Remove outdated props from `CategoryExampleMessage`
6b063e3
Cleanup translations
d6de0d4
Rename callbacks for consistency
0da6be8
Extract menu label outside the component
3366ede
Use shared menu components
57fb77d
Keep menu open when user hovers away
7fa2f8b
Cosmetic changes
43045ea
Merge branch 'master' into 58487-log-stream-row-rendering
elasticmachine 5477c65
Remove unused component
cd79a15
Remove unused import
86a8fc2
Tweak copy
cb17032
Merge branch 'master' into 58487-log-stream-row-rendering
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
98 changes: 98 additions & 0 deletions
98
x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_actions_column.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,98 @@ | ||
| /* | ||
| * 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 React, { useCallback } from 'react'; | ||
| import { EuiButtonIcon } from '@elastic/eui'; | ||
| import { i18n } from '@kbn/i18n'; | ||
| import { FormattedMessage } from '@kbn/i18n/react'; | ||
|
|
||
| import { LogEntryColumnContent } from './log_entry_column'; | ||
| import { | ||
| euiStyled, | ||
| ActionMenu, | ||
| Section, | ||
| SectionTitle, | ||
| SectionLinks, | ||
| SectionLink, | ||
| } from '../../../../../observability/public'; | ||
|
|
||
| interface LogEntryActionsColumnProps { | ||
| isHovered: boolean; | ||
| isMenuOpen: boolean; | ||
| onOpenMenu: () => void; | ||
| onCloseMenu: () => void; | ||
| onViewDetails: () => void; | ||
| } | ||
|
|
||
| const MENU_LABEL = i18n.translate('xpack.infra.logEntryItemView.logEntryActionsMenuToolTip', { | ||
| defaultMessage: 'View Details', | ||
| }); | ||
|
|
||
| const LOG_DETAILS_LABEL = i18n.translate('xpack.infra.logs.logEntryActionsDetailsButton', { | ||
| defaultMessage: 'View actions for line', | ||
| }); | ||
|
|
||
| export const LogEntryActionsColumn: React.FC<LogEntryActionsColumnProps> = ({ | ||
| isHovered, | ||
| isMenuOpen, | ||
| onOpenMenu, | ||
| onCloseMenu, | ||
| onViewDetails, | ||
| }) => { | ||
| const handleClickViewDetails = useCallback(() => { | ||
| onCloseMenu(); | ||
| onViewDetails(); | ||
| }, [onCloseMenu, onViewDetails]); | ||
|
|
||
| const button = ( | ||
| <ButtonWrapper> | ||
| <EuiButtonIcon | ||
| aria-label={MENU_LABEL} | ||
| color="ghost" | ||
| iconType="boxesHorizontal" | ||
| onClick={onOpenMenu} | ||
| /> | ||
| </ButtonWrapper> | ||
| ); | ||
|
|
||
| return ( | ||
| <ActionsColumnContent> | ||
| {isHovered || isMenuOpen ? ( | ||
| <AbsoluteWrapper> | ||
| <ActionMenu closePopover={onCloseMenu} isOpen={isMenuOpen} button={button}> | ||
| <Section> | ||
| <SectionTitle> | ||
| <FormattedMessage | ||
| id="xpack.infra.logs.logEntryActionsMenuTitle" | ||
| defaultMessage="Log line details" | ||
| /> | ||
| </SectionTitle> | ||
| <SectionLinks> | ||
| <SectionLink label={LOG_DETAILS_LABEL} onClick={handleClickViewDetails} /> | ||
| </SectionLinks> | ||
| </Section> | ||
| </ActionMenu> | ||
| </AbsoluteWrapper> | ||
| ) : null} | ||
| </ActionsColumnContent> | ||
| ); | ||
| }; | ||
|
|
||
| const ActionsColumnContent = euiStyled(LogEntryColumnContent)` | ||
| overflow: hidden; | ||
| user-select: none; | ||
| `; | ||
|
|
||
| const ButtonWrapper = euiStyled.div` | ||
| background: ${props => props.theme.eui.euiColorPrimary}; | ||
| border-radius: 50%; | ||
| `; | ||
|
|
||
| // this prevents the button from influencing the line height | ||
| const AbsoluteWrapper = euiStyled.div` | ||
| overflow: hidden; | ||
| position: absolute; | ||
| `; | ||
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
67 changes: 0 additions & 67 deletions
67
x-pack/plugins/infra/public/components/logging/log_text_stream/log_entry_icon_column.tsx
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.
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.