[Fleet] Only display logs UI for agent >= 7.11 (#87926)
This commit is contained in:
parent
ff17581f45
commit
156fb3d33c
|
@ -15,6 +15,8 @@ import {
|
||||||
EuiFilterGroup,
|
EuiFilterGroup,
|
||||||
EuiPanel,
|
EuiPanel,
|
||||||
EuiButtonEmpty,
|
EuiButtonEmpty,
|
||||||
|
EuiCallOut,
|
||||||
|
EuiLink,
|
||||||
} from '@elastic/eui';
|
} from '@elastic/eui';
|
||||||
import useMeasure from 'react-use/lib/useMeasure';
|
import useMeasure from 'react-use/lib/useMeasure';
|
||||||
import { FormattedMessage } from '@kbn/i18n/react';
|
import { FormattedMessage } from '@kbn/i18n/react';
|
||||||
|
@ -184,7 +186,7 @@ export const AgentLogsUI: React.FunctionComponent<AgentLogsProps> = memo(({ agen
|
||||||
const [logsPanelRef, { height: logPanelHeight }] = useMeasure();
|
const [logsPanelRef, { height: logPanelHeight }] = useMeasure();
|
||||||
|
|
||||||
const agentVersion = agent.local_metadata?.elastic?.agent?.version;
|
const agentVersion = agent.local_metadata?.elastic?.agent?.version;
|
||||||
const isLogLevelSelectionAvailable = useMemo(() => {
|
const isLogFeatureAvailable = useMemo(() => {
|
||||||
if (!agentVersion) {
|
if (!agentVersion) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -195,6 +197,31 @@ export const AgentLogsUI: React.FunctionComponent<AgentLogsProps> = memo(({ agen
|
||||||
return semverGte(agentVersionWithPrerelease, '7.11.0');
|
return semverGte(agentVersionWithPrerelease, '7.11.0');
|
||||||
}, [agentVersion]);
|
}, [agentVersion]);
|
||||||
|
|
||||||
|
if (!isLogFeatureAvailable) {
|
||||||
|
return (
|
||||||
|
<EuiCallOut
|
||||||
|
size="m"
|
||||||
|
color="warning"
|
||||||
|
title={
|
||||||
|
<FormattedMessage
|
||||||
|
id="xpack.fleet.agentLogs.oldAgentWarningTitle"
|
||||||
|
defaultMessage="The Logs view requires Elastic Agent 7.11 or higher. To upgrade an agent, go to the Actions menu, or {downloadLink} a newer version."
|
||||||
|
values={{
|
||||||
|
downloadLink: (
|
||||||
|
<EuiLink href="https://ela.st/download-elastic-agent" external target="_blank">
|
||||||
|
<FormattedMessage
|
||||||
|
id="xpack.fleet.agentLogs.downloadLink"
|
||||||
|
defaultMessage="download"
|
||||||
|
/>
|
||||||
|
</EuiLink>
|
||||||
|
),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<WrapperFlexGroup direction="column" gutterSize="m">
|
<WrapperFlexGroup direction="column" gutterSize="m">
|
||||||
<EuiFlexItem grow={false}>
|
<EuiFlexItem grow={false}>
|
||||||
|
@ -271,11 +298,9 @@ export const AgentLogsUI: React.FunctionComponent<AgentLogsProps> = memo(({ agen
|
||||||
/>
|
/>
|
||||||
</EuiPanel>
|
</EuiPanel>
|
||||||
</EuiFlexItem>
|
</EuiFlexItem>
|
||||||
{isLogLevelSelectionAvailable && (
|
|
||||||
<EuiFlexItem grow={false}>
|
<EuiFlexItem grow={false}>
|
||||||
<SelectLogLevel agent={agent} />
|
<SelectLogLevel agent={agent} />
|
||||||
</EuiFlexItem>
|
</EuiFlexItem>
|
||||||
)}
|
|
||||||
</WrapperFlexGroup>
|
</WrapperFlexGroup>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue