@@ -8,12 +8,13 @@ import {
88 EuiFlexGroup ,
99 EuiFlexItem ,
1010 EuiModal ,
11- EuiModalBody ,
1211 EuiOverlayMask ,
1312 EuiText ,
1413 EuiTextColor ,
1514 EuiToolTip ,
15+ EuiSpacer ,
1616} from '@elastic/eui' ;
17+ import { FormattedMessage } from '@kbn/i18n/react' ;
1718import { noop } from 'lodash' ;
1819import React , { useCallback , useContext , useMemo } from 'react' ;
1920import { LogEntry } from '../../../../common/http_api' ;
@@ -22,6 +23,7 @@ import { useLogSourceContext } from '../../../containers/logs/log_source';
2223import { LogViewConfiguration } from '../../../containers/logs/log_view_configuration' ;
2324import { ViewLogInContext } from '../../../containers/logs/view_log_in_context' ;
2425import { useViewportDimensions } from '../../../utils/use_viewport_dimensions' ;
26+ import { euiStyled } from '../../../../../observability/public' ;
2527
2628const MODAL_MARGIN = 25 ;
2729
@@ -55,7 +57,7 @@ export const PageViewLogInContext: React.FC = () => {
5557 return (
5658 < EuiOverlayMask >
5759 < EuiModal onClose = { closeModal } maxWidth = { false } >
58- < EuiModalBody style = { { width : vw - MODAL_MARGIN * 2 , height : vh - MODAL_MARGIN * 2 } } >
60+ < LogInContextWrapper width = { vw - MODAL_MARGIN * 2 } height = { vh - MODAL_MARGIN * 2 } >
5961 < EuiFlexGroup
6062 direction = "column"
6163 responsive = { false }
@@ -64,6 +66,7 @@ export const PageViewLogInContext: React.FC = () => {
6466 >
6567 < EuiFlexItem grow = { 1 } >
6668 < LogEntryContext context = { contextEntry . context } />
69+ < EuiSpacer size = "m" />
6770 < ScrollableLogTextStreamView
6871 target = { contextEntry . cursor }
6972 columnConfigurations = { columnConfigurations }
@@ -89,37 +92,56 @@ export const PageViewLogInContext: React.FC = () => {
8992 />
9093 </ EuiFlexItem >
9194 </ EuiFlexGroup >
92- </ EuiModalBody >
95+ </ LogInContextWrapper >
9396 </ EuiModal >
9497 </ EuiOverlayMask >
9598 ) ;
9699} ;
97100
101+ const LogInContextWrapper = euiStyled . div < { width : number | string ; height : number | string } > `
102+ padding: 16px;
103+ width: ${ ( props ) => ( typeof props . width === 'number' ? `${ props . width } px` : props . width ) } ;
104+ height: ${ ( props ) => ( typeof props . height === 'number' ? `${ props . height } px` : props . height ) } ;
105+ ` ;
106+
98107const LogEntryContext : React . FC < { context : LogEntry [ 'context' ] } > = ( { context } ) => {
108+ let text ;
99109 if ( 'container.id' in context ) {
100- return < p > Displayed logs are from container { context [ 'container.id' ] } </ p > ;
110+ text = (
111+ < FormattedMessage
112+ id = "xpack.infra.logs.viewInContext.logsFromContainerTitle"
113+ defaultMessage = "Displayed logs are from container {container}"
114+ values = { { container : context [ 'container.id' ] } }
115+ />
116+ ) ;
101117 }
102118
103119 if ( 'host.name' in context ) {
104120 const shortenedFilePath =
105121 context [ 'log.file.path' ] . length > 45
106122 ? context [ 'log.file.path' ] . slice ( 0 , 20 ) + '...' + context [ 'log.file.path' ] . slice ( - 25 )
107123 : context [ 'log.file.path' ] ;
108-
109- return (
110- < EuiText size = "s" >
111- < p >
112- < EuiTextColor color = "subdued" >
113- Displayed logs are from file{ ' ' }
124+ text = (
125+ < FormattedMessage
126+ id = "xpack.infra.logs.viewInContext.logsFromFileTitle"
127+ defaultMessage = "Displayed logs are from file {file} and host {host}"
128+ values = { {
129+ file : (
114130 < EuiToolTip content = { context [ 'log.file.path' ] } >
115131 < span > { shortenedFilePath } </ span >
116- </ EuiToolTip > { ' ' }
117- and host { context [ 'host.name' ] }
118- </ EuiTextColor >
119- </ p >
120- </ EuiText >
132+ </ EuiToolTip >
133+ ) ,
134+ host : context [ 'host.name' ] ,
135+ } }
136+ / >
121137 ) ;
122138 }
123139
124- return null ;
140+ return (
141+ < EuiText size = "s" >
142+ < p >
143+ < EuiTextColor color = "subdued" > { text } </ EuiTextColor >
144+ </ p >
145+ </ EuiText >
146+ ) ;
125147} ;
0 commit comments