diff --git a/x-pack/plugins/monitoring/public/components/logs/logs.tsx b/x-pack/plugins/monitoring/public/components/logs/logs.tsx index 828a342ea2f02..d0345be0ff0ae 100644 --- a/x-pack/plugins/monitoring/public/components/logs/logs.tsx +++ b/x-pack/plugins/monitoring/public/components/logs/logs.tsx @@ -31,7 +31,7 @@ interface LogsProps { }>; enabled: boolean; limit: number; - reason: IReason; + reason?: IReason; }; nodeId?: string; indexUuid?: string; diff --git a/x-pack/plugins/monitoring/public/components/logs/reason.tsx b/x-pack/plugins/monitoring/public/components/logs/reason.tsx index 63c3241cd448b..82a4f788df98b 100644 --- a/x-pack/plugins/monitoring/public/components/logs/reason.tsx +++ b/x-pack/plugins/monitoring/public/components/logs/reason.tsx @@ -24,7 +24,7 @@ export interface IReason { correctIndexName?: boolean; } -export const Reason = ({ reason }: { reason: IReason }) => { +export const Reason = ({ reason }: { reason?: IReason }) => { const filebeatUrl = Legacy.shims.docLinks.links.filebeat.installation; const elasticsearchUrl = Legacy.shims.docLinks.links.filebeat.elasticsearchModule; const troubleshootUrl = Legacy.shims.docLinks.links.monitoring.troubleshootKibana; @@ -48,7 +48,7 @@ export const Reason = ({ reason }: { reason: IReason }) => { /> ); - if (false === reason.indexPatternExists) { + if (false === reason?.indexPatternExists) { title = i18n.translate('xpack.monitoring.logs.reason.noIndexPatternTitle', { defaultMessage: 'No log data found', }); @@ -68,8 +68,8 @@ export const Reason = ({ reason }: { reason: IReason }) => { /> ); } else if ( - false === reason.indexPatternInTimeRangeExists || - (false === reason.typeExists && reason.typeExistsAtAnyTime) + false === reason?.indexPatternInTimeRangeExists || + (false === reason?.typeExists && reason.typeExistsAtAnyTime) ) { title = i18n.translate('xpack.monitoring.logs.reason.noIndexPatternInTimePeriodTitle', { defaultMessage: 'No logs for the selected time', @@ -80,7 +80,7 @@ export const Reason = ({ reason }: { reason: IReason }) => { defaultMessage="Use the time filter to adjust your timeframe." /> ); - } else if (false === reason.typeExists) { + } else if (false === reason?.typeExists) { title = i18n.translate('xpack.monitoring.logs.reason.noTypeTitle', { defaultMessage: 'No logs for Elasticsearch', }); @@ -99,7 +99,7 @@ export const Reason = ({ reason }: { reason: IReason }) => { }} /> ); - } else if (false === reason.usingStructuredLogs) { + } else if (false === reason?.usingStructuredLogs) { title = i18n.translate('xpack.monitoring.logs.reason.notUsingStructuredLogsTitle', { defaultMessage: 'No structured logs found', }); @@ -119,7 +119,7 @@ export const Reason = ({ reason }: { reason: IReason }) => { }} /> ); - } else if (false === reason.clusterExists) { + } else if (false === reason?.clusterExists) { title = i18n.translate('xpack.monitoring.logs.reason.noClusterTitle', { defaultMessage: 'No logs for this cluster', }); @@ -138,7 +138,7 @@ export const Reason = ({ reason }: { reason: IReason }) => { }} /> ); - } else if (false === reason.nodeExists) { + } else if (false === reason?.nodeExists) { title = i18n.translate('xpack.monitoring.logs.reason.noNodeTitle', { defaultMessage: 'No logs for this Elasticsearch node', }); @@ -157,7 +157,7 @@ export const Reason = ({ reason }: { reason: IReason }) => { }} /> ); - } else if (false === reason.indexExists) { + } else if (false === reason?.indexExists) { title = i18n.translate('xpack.monitoring.logs.reason.noIndexTitle', { defaultMessage: 'No logs for this index', }); @@ -176,7 +176,7 @@ export const Reason = ({ reason }: { reason: IReason }) => { }} /> ); - } else if (false === reason.correctIndexName) { + } else if (false === reason?.correctIndexName) { title = i18n.translate('xpack.monitoring.logs.reason.correctIndexNameTitle', { defaultMessage: 'Corrupted filebeat index', });