-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Logs UI] Log stream row rendering (#60773)
- Loading branch information
Alejandro Fernández
authored
Mar 31, 2020
1 parent
65e8f2b
commit 4632f3e
Showing
11 changed files
with
131 additions
and
166 deletions.
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 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 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 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 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.