Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const AgentCollectorConfig: React.FunctionComponent<{ agent: Agent }> = (

return (
<>
<CollectorConfigView config={agentData?.effective_config ?? {}} />
<CollectorConfigView config={agentData?.effective_config ?? {}} health={agent.health} />
<EuiSpacer size="l" />
</>
);
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved this to his own module

* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import React, { useMemo } from 'react';
import { EuiCodeBlock, EuiText } from '@elastic/eui';
import { dump } from 'js-yaml';
import { i18n } from '@kbn/i18n';

interface ComponentConfigTabProps {
componentId: string;
componentConfig: unknown;
}

export const ComponentConfigTab: React.FunctionComponent<ComponentConfigTabProps> = ({
componentId,
componentConfig,
}) => {
const yamlContent = useMemo(() => {
if (componentConfig == null) {
return null;
}
return dump({ [componentId]: componentConfig }, { lineWidth: -1, quotingType: '"' });
}, [componentId, componentConfig]);

if (!yamlContent) {
return (
<EuiText size="s" color="subdued">
{i18n.translate('xpack.fleet.otelUi.componentDetail.noConfiguration', {
defaultMessage: 'No additional configuration',
})}
</EuiText>
);
}

return (
<EuiCodeBlock overflowHeight="390px" language="yaml" isCopyable fontSize="m" paddingSize="s">
{yamlContent}
</EuiCodeBlock>
);
};
Loading
Loading