mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
parent
6cb1070fda
commit
7cb65c5548
3 changed files with 32 additions and 10 deletions
|
@ -30,7 +30,11 @@ export const AgentDetailsContent: React.FunctionComponent<{
|
|||
title: i18n.translate('xpack.ingestManager.agentDetails.hostNameLabel', {
|
||||
defaultMessage: 'Host name',
|
||||
}),
|
||||
description: agent.local_metadata['host.hostname'],
|
||||
description:
|
||||
typeof agent.local_metadata.host === 'object' &&
|
||||
typeof agent.local_metadata.host.hostname === 'string'
|
||||
? agent.local_metadata.host.hostname
|
||||
: '-',
|
||||
},
|
||||
{
|
||||
title: i18n.translate('xpack.ingestManager.agentDetails.hostIdLabel', {
|
||||
|
@ -60,13 +64,22 @@ export const AgentDetailsContent: React.FunctionComponent<{
|
|||
title: i18n.translate('xpack.ingestManager.agentDetails.versionLabel', {
|
||||
defaultMessage: 'Agent version',
|
||||
}),
|
||||
description: agent.local_metadata['agent.version'],
|
||||
description:
|
||||
typeof agent.local_metadata.elastic === 'object' &&
|
||||
typeof agent.local_metadata.elastic.agent === 'object' &&
|
||||
typeof agent.local_metadata.elastic.agent.version === 'string'
|
||||
? agent.local_metadata.elastic.agent.version
|
||||
: '-',
|
||||
},
|
||||
{
|
||||
title: i18n.translate('xpack.ingestManager.agentDetails.platformLabel', {
|
||||
defaultMessage: 'Platform',
|
||||
}),
|
||||
description: agent.local_metadata['os.platform'],
|
||||
description:
|
||||
typeof agent.local_metadata.os === 'object' &&
|
||||
typeof agent.local_metadata.os.platform === 'string'
|
||||
? agent.local_metadata.os.platform
|
||||
: '-',
|
||||
},
|
||||
].map(({ title, description }) => {
|
||||
return (
|
||||
|
|
|
@ -75,7 +75,10 @@ export const AgentDetailsPage: React.FunctionComponent = () => {
|
|||
<EuiFlexItem>
|
||||
<EuiText>
|
||||
<h1>
|
||||
{agentData?.item?.local_metadata['host.hostname'] || (
|
||||
{typeof agentData?.item?.local_metadata?.host === 'object' &&
|
||||
typeof agentData?.item?.local_metadata?.host?.hostname === 'string' ? (
|
||||
agentData.item.local_metadata.host.hostname
|
||||
) : (
|
||||
<FormattedMessage
|
||||
id="xpack.ingestManager.agentDetails.agentDetailsTitle"
|
||||
defaultMessage="Agent '{id}'"
|
||||
|
|
|
@ -146,6 +146,13 @@ const RowActions = React.memo<{ agent: Agent; onReassignClick: () => void; refre
|
|||
}
|
||||
);
|
||||
|
||||
function safeMetadata(val: any) {
|
||||
if (typeof val !== 'string') {
|
||||
return '-';
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
export const AgentListPage: React.FunctionComponent<{}> = () => {
|
||||
const defaultKuery: string = (useUrlParams().urlParams.kuery as string) || '';
|
||||
const hasWriteCapabilites = useCapabilities().write;
|
||||
|
@ -238,13 +245,13 @@ export const AgentListPage: React.FunctionComponent<{}> = () => {
|
|||
|
||||
const columns = [
|
||||
{
|
||||
field: 'local_metadata.host',
|
||||
field: 'local_metadata.host.hostname',
|
||||
name: i18n.translate('xpack.ingestManager.agentList.hostColumnTitle', {
|
||||
defaultMessage: 'Host',
|
||||
}),
|
||||
render: (host: string, agent: Agent) => (
|
||||
<ConnectedLink color="primary" path={`${FLEET_AGENT_DETAIL_PATH}${agent.id}`}>
|
||||
{agent.local_metadata['host.hostname'] || host || ''}
|
||||
{safeMetadata(host)}
|
||||
</ConnectedLink>
|
||||
),
|
||||
},
|
||||
|
@ -308,13 +315,12 @@ export const AgentListPage: React.FunctionComponent<{}> = () => {
|
|||
},
|
||||
},
|
||||
{
|
||||
field: 'local_metadata.version',
|
||||
field: 'local_metadata.elastic.agent.version',
|
||||
width: '100px',
|
||||
name: i18n.translate('xpack.ingestManager.agentList.versionTitle', {
|
||||
defaultMessage: 'Version',
|
||||
}),
|
||||
render: (version: string, agent: Agent) =>
|
||||
agent.local_metadata['agent.version'] || version || '',
|
||||
render: (version: string, agent: Agent) => safeMetadata(version),
|
||||
},
|
||||
{
|
||||
field: 'last_checkin',
|
||||
|
@ -505,7 +511,7 @@ export const AgentListPage: React.FunctionComponent<{}> = () => {
|
|||
loading={isLoading && agentsRequest.isInitialRequest}
|
||||
hasActions={true}
|
||||
noItemsMessage={
|
||||
isLoading ? (
|
||||
isLoading && agentsRequest.isInitialRequest ? (
|
||||
<FormattedMessage
|
||||
id="xpack.ingestManager.agentList.loadingAgentsMessage"
|
||||
defaultMessage="Loading agents…"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue