Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
gbamparop committed Dec 10, 2024
1 parent c482f69 commit b86a52a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/monitoring/public/components/logs/logs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface LogsProps {
}>;
enabled: boolean;
limit: number;
reason: IReason;
reason?: IReason;
};
nodeId?: string;
indexUuid?: string;
Expand Down
20 changes: 10 additions & 10 deletions x-pack/plugins/monitoring/public/components/logs/reason.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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',
});
Expand All @@ -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',
Expand All @@ -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',
});
Expand All @@ -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',
});
Expand All @@ -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',
});
Expand All @@ -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',
});
Expand All @@ -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',
});
Expand All @@ -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',
});
Expand Down

0 comments on commit b86a52a

Please sign in to comment.