Skip to content

Commit

Permalink
[SECURITY] Replaces hard-coded links with doc link service (#103823)
Browse files Browse the repository at this point in the history
  • Loading branch information
lcawl authored Aug 5, 2021
1 parent ca6182c commit e160532
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const HelpMenu = React.memo(() => {
content: i18n.translate('xpack.securitySolution.chrome.helpMenu.documentation.ecs', {
defaultMessage: 'ECS documentation',
}),
href: `${docLinks.ELASTIC_WEBSITE_URL}guide/en/ecs/current/index.html`,
href: docLinks.links.ecs.guide,
iconType: 'documents',
linkType: 'custom',
target: '_blank',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export const MlPopover = React.memo(() => {
values={{
mlDocs: (
<a
href={`${docLinks.ELASTIC_WEBSITE_URL}guide/en/security/${docLinks.DOC_LINK_VERSION}/machine-learning.html`}
href={`${docLinks.links.siem.ml}`}
rel="noopener noreferrer"
target="_blank"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ describe('UpdatePrePackagedRulesCallOut', () => {
docLinks: {
ELASTIC_WEBSITE_URL: '',
DOC_LINK_VERSION: '',
links: {
siem: { ruleChangeLog: '' },
},
},
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ const UpdatePrePackagedRulesCallOutComponent: React.FC<UpdatePrePackagedRulesCal
<p>
{prepackagedRulesOrTimelines?.callOutMessage}
<br />
<EuiLink
href={`${services.docLinks.ELASTIC_WEBSITE_URL}guide/en/security/${services.docLinks.DOC_LINK_VERSION}/prebuilt-rules-changelog.html`}
target="_blank"
>
<EuiLink href={`${services.docLinks.links.siem.ruleChangeLog}`} target="_blank">
{i18n.RELEASE_NOTES_HELP}
</EuiLink>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const DetectionEngineNoIndexComponent: React.FC<{
detections: {
icon: 'documents',
label: i18n.GO_TO_DOCUMENTATION,
url: `${docLinks.ELASTIC_WEBSITE_URL}guide/en/security/${docLinks.DOC_LINK_VERSION}/detections-permissions-section.html`,
url: `${docLinks.links.siem.detectionsReq}`,
target: '_blank',
},
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const DetectionEngineUserUnauthenticated = React.memo(() => {
detectionUnauthenticated: {
icon: 'documents',
label: i18n.GO_TO_DOCUMENTATION,
url: `${docLinks.ELASTIC_WEBSITE_URL}guide/en/security/${docLinks.DOC_LINK_VERSION}/detections-permissions-section.html`,
url: `${docLinks.links.siem.detectionsReq}`,
target: '_blank',
},
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import onboardingLogo from '../images/security_administration_onboarding.svg';
import { useKibana } from '../../common/lib/kibana';

const TEXT_ALIGN_CENTER: CSSProperties = Object.freeze({
textAlign: 'center',
Expand All @@ -44,6 +45,7 @@ const PolicyEmptyState = React.memo<{
onActionClick: (event: MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void;
actionDisabled?: boolean;
}>(({ loading, onActionClick, actionDisabled }) => {
const docLinks = useKibana().services.docLinks;
return (
<div data-test-subj="emptyPolicyTable">
{loading ? (
Expand Down Expand Up @@ -83,7 +85,7 @@ const PolicyEmptyState = React.memo<{
id="xpack.securitySolution.endpoint.policyList.onboardingSectionThree"
defaultMessage="To get started, add the Endpoint Security integration to your Agents. For more information, "
/>
<EuiLink external href="https://www.elastic.co/guide/en/security/current/index.html">
<EuiLink external href={`${docLinks.links.siem.guide}`}>
<FormattedMessage
id="xpack.securitySolution.endpoint.policyList.onboardingDocsLink"
defaultMessage="view the Elastic Security documentation"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ jest.mock('../../../common/lib/kibana', () => {
embeddable: {
EmbeddablePanel: jest.fn(() => <div data-test-subj="EmbeddablePanel" />),
},
docLinks: { ELASTIC_WEBSITE_URL: 'ELASTIC_WEBSITE_URL' },
docLinks: {
ELASTIC_WEBSITE_URL: 'ELASTIC_WEBSITE_URL',
links: {
siem: { networkMap: '' },
},
},
},
}),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,7 @@ export const EmbeddedMapComponent = ({
<Embeddable>
<EmbeddableHeader title={i18n.EMBEDDABLE_HEADER_TITLE}>
<EuiText size="xs">
<EuiLink
href={`${services.docLinks.ELASTIC_WEBSITE_URL}guide/en/security/${services.docLinks.DOC_LINK_VERSION}/conf-map-ui.html`}
target="_blank"
>
<EuiLink href={`${services.docLinks.links.siem.networkMap}`} target="_blank">
{i18n.EMBEDDABLE_HEADER_HELP}
</EuiLink>
</EuiText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const IndexPatternsMissingPromptComponent = () => {
),
beats: (
<a
href={`${docLinks.ELASTIC_WEBSITE_URL}guide/en/beats/libbeat/${docLinks.DOC_LINK_VERSION}/getting-started.html`}
href={`${docLinks.links.libbeat.getStarted}`}
rel="noopener noreferrer"
target="_blank"
>
Expand Down

0 comments on commit e160532

Please sign in to comment.