File tree Expand file tree Collapse file tree 5 files changed +10
-17
lines changed
common/http_api/log_sources
containers/logs/log_source
server/routes/log_sources Expand file tree Collapse file tree 5 files changed +10
-17
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ export type LogIndexField = rt.TypeOf<typeof logIndexFieldRT>;
4242
4343const logSourceStatusRT = rt . strict ( {
4444 logIndexFields : rt . array ( logIndexFieldRT ) ,
45- logIndexNames : rt . array ( rt . string ) ,
45+ logIndicesExist : rt . boolean ,
4646} ) ;
4747
4848export type LogSourceStatus = rt . TypeOf < typeof logSourceStatusRT > ;
Original file line number Diff line number Diff line change @@ -78,11 +78,6 @@ export const useLogSource = ({
7878 [ sourceId , fetch ]
7979 ) ;
8080
81- /* eslint-disable-next-line react-hooks/exhaustive-deps */
82- const logIndicesExist = useMemo ( ( ) => ( sourceStatus ?. logIndexNames ?. length ?? 0 ) > 0 , [
83- sourceStatus ,
84- ] ) ;
85-
8681 const derivedIndexPattern = useMemo (
8782 ( ) => ( {
8883 fields : sourceStatus ?. logIndexFields ?? [ ] ,
@@ -160,7 +155,6 @@ export const useLogSource = ({
160155 loadSourceFailureMessage,
161156 loadSourceConfiguration,
162157 loadSourceStatus,
163- logIndicesExist,
164158 sourceConfiguration,
165159 sourceId,
166160 sourceStatus,
Original file line number Diff line number Diff line change @@ -18,14 +18,14 @@ export const StreamPageContent: React.FunctionComponent = () => {
1818 isUninitialized,
1919 loadSource,
2020 loadSourceFailureMessage,
21- logIndicesExist ,
21+ sourceStatus ,
2222 } = useLogSourceContext ( ) ;
2323
2424 if ( isLoading || isUninitialized ) {
2525 return < SourceLoadingPage /> ;
2626 } else if ( hasFailedLoadingSource ) {
2727 return < SourceErrorPage errorMessage = { loadSourceFailureMessage ?? '' } retry = { loadSource } /> ;
28- } else if ( logIndicesExist ) {
28+ } else if ( sourceStatus ?. logIndicesExist ) {
2929 return < LogsPageLogsContent /> ;
3030 } else {
3131 return < LogsPageNoIndicesContent /> ;
Original file line number Diff line number Diff line change @@ -104,10 +104,10 @@ const LogHighlightsStateProvider: React.FC = ({ children }) => {
104104} ;
105105
106106export const LogsPageProviders : React . FunctionComponent = ( { children } ) => {
107- const { logIndicesExist } = useLogSourceContext ( ) ;
107+ const { sourceStatus } = useLogSourceContext ( ) ;
108108
109109 // The providers assume the source is loaded, so short-circuit them otherwise
110- if ( ! logIndicesExist ) {
110+ if ( ! sourceStatus ?. logIndicesExist ) {
111111 return < > { children } </ > ;
112112 }
113113
Original file line number Diff line number Diff line change @@ -31,17 +31,16 @@ export const initLogSourceStatusRoutes = ({
3131 const { sourceId } = request . params ;
3232
3333 try {
34- const logIndexNames = await sourceStatus . getLogIndexNames ( requestContext , sourceId ) ;
35- const logIndexFields =
36- logIndexNames . length > 0
37- ? await fields . getFields ( requestContext , sourceId , InfraIndexType . LOGS )
38- : [ ] ;
34+ const logIndicesExist = await sourceStatus . hasLogIndices ( requestContext , sourceId ) ;
35+ const logIndexFields = logIndicesExist
36+ ? await fields . getFields ( requestContext , sourceId , InfraIndexType . LOGS )
37+ : [ ] ;
3938
4039 return response . ok ( {
4140 body : getLogSourceStatusSuccessResponsePayloadRT . encode ( {
4241 data : {
42+ logIndicesExist,
4343 logIndexFields,
44- logIndexNames,
4544 } ,
4645 } ) ,
4746 } ) ;
You can’t perform that action at this time.
0 commit comments