[Fleet] Fix doc hardcoded link (#132989)

This commit is contained in:
Nicolas Chaulet 2022-05-30 10:35:54 +02:00 committed by GitHub
parent a044026920
commit 165be7d309
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 10 deletions

View file

@ -616,6 +616,7 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
apiKeysLearnMore: `${KIBANA_DOCS}api-keys.html`,
onPremRegistry: `${FLEET_DOCS}air-gapped.html`,
secureLogstash: `${FLEET_DOCS}secure-logstash-connections.html`,
agentPolicy: `${FLEET_DOCS}agent-policy.html`,
},
ecs: {
guide: `${ELASTIC_WEBSITE_URL}guide/en/ecs/current/index.html`,

View file

@ -372,6 +372,7 @@ export interface DocLinks {
apiKeysLearnMore: string;
onPremRegistry: string;
secureLogstash: string;
agentPolicy: string;
}>;
readonly ecs: {
readonly guide: string;

View file

@ -26,7 +26,7 @@ import { dataTypes } from '../../../../../../common';
import type { AgentPolicy, NewAgentPolicy } from '../../../types';
import { sendCreateAgentPolicy } from '../../../hooks';
import { sendCreateAgentPolicy, useStartServices } from '../../../hooks';
import { agentPolicyFormValidation } from '.';
@ -50,6 +50,7 @@ export const AgentPolicyCreateInlineForm: React.FunctionComponent<Props> = ({
isFleetServerPolicy,
agentPolicyName,
}) => {
const { docLinks } = useStartServices();
const [touchedFields, setTouchedFields] = useState<{ [key: string]: boolean }>({});
const [withSysMonitoring, setWithSysMonitoring] = useState<boolean>(true);
@ -117,10 +118,7 @@ export const AgentPolicyCreateInlineForm: React.FunctionComponent<Props> = ({
defaultMessage="Type of hosts are controlled by an {agentPolicy}. Create a new agent policy to get started."
values={{
agentPolicy: (
<EuiLink
href={'https://www.elastic.co/guide/en/fleet/current/agent-policy.html'}
target="_blank"
>
<EuiLink href={docLinks.links.fleet.agentPolicy} target="_blank">
<FormattedMessage
id="xpack.fleet.agentPolicyForm.createAgentPolicyDocLink"
defaultMessage="agent policy"

View file

@ -22,7 +22,7 @@ import {
import type { AgentPolicy } from '../../types';
import { AgentPolicyPackageBadges } from '../agent_policy_package_badges';
import { useAuthz } from '../../hooks';
import { useAuthz, useStartServices } from '../../hooks';
import { AdvancedAgentAuthenticationSettings } from './advanced_agent_authentication_settings';
@ -51,6 +51,8 @@ type Props = {
);
export const AgentPolicySelection: React.FC<Props> = (props) => {
const { docLinks } = useStartServices();
const {
agentPolicies,
selectedPolicyId,
@ -81,10 +83,7 @@ export const AgentPolicySelection: React.FC<Props> = (props) => {
defaultMessage="Type of hosts are controlled by an {agentPolicy}. Choose an agent policy or create a new one."
values={{
agentPolicy: (
<EuiLink
href={'https://www.elastic.co/guide/en/fleet/current/agent-policy.html'}
target="_blank"
>
<EuiLink href={docLinks.links.fleet.agentPolicy} target="_blank">
<FormattedMessage
id="xpack.fleet.agentPolicyForm.createAgentPolicyDocLink"
defaultMessage="agent policy"