Skip to content

Commit

Permalink
[Security Solution] Trusted Apps about text updated to add new docs l…
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinlog authored Oct 3, 2022
1 parent fdba8d3 commit 44d028f
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/kbn-doc-links/src/get_doc_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => {
eventFilters: `${SECURITY_SOLUTION_DOCS}event-filters.html`,
blocklist: `${SECURITY_SOLUTION_DOCS}blocklist.html`,
threatIntelInt: `${SECURITY_SOLUTION_DOCS}es-threat-intel-integrations.html`,
endpointArtifacts: `${SECURITY_SOLUTION_DOCS}endpoint-artifacts.html`,
policyResponseTroubleshooting: {
full_disk_access: `${SECURITY_SOLUTION_DOCS}deploy-elastic-endpoint.html#enable-fda-endpoint`,
macos_system_ext: `${SECURITY_SOLUTION_DOCS}deploy-elastic-endpoint.html#system-extension-endpoint`,
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-doc-links/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ export interface DocLinks {
readonly trustedApps: string;
readonly eventFilters: string;
readonly blocklist: string;
readonly endpointArtifacts: string;
readonly policyResponseTroubleshooting: {
full_disk_access: string;
macos_system_ext: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export interface ArtifactListPageProps {
allowCardEditAction?: boolean;
allowCardDeleteAction?: boolean;
allowCardCreateAction?: boolean;
secondaryPageInfo?: React.ReactNode;
}

export const ArtifactListPage = memo<ArtifactListPageProps>(
Expand All @@ -82,6 +83,7 @@ export const ArtifactListPage = memo<ArtifactListPageProps>(
ArtifactFormComponent,
searchableFields = DEFAULT_EXCEPTION_LIST_ITEM_SEARCHABLE_FIELDS,
labels: _labels = {},
secondaryPageInfo,
onFormSubmit,
flyoutSize,
'data-test-subj': dataTestSubj,
Expand Down Expand Up @@ -240,6 +242,24 @@ export const ArtifactListPage = memo<ArtifactListPageProps>(
setSelectedItemForEdit(undefined);
}, []);

const description = useMemo(() => {
const subtitleText = labels.pageAboutInfo ? (
<span data-test-subj="header-panel-subtitle">{labels.pageAboutInfo}</span>
) : undefined;
const detailedPageInfoElement = secondaryPageInfo ? (
<>
<EuiSpacer size="m" />
{secondaryPageInfo}
</>
) : undefined;
return (
<>
{subtitleText}
{detailedPageInfoElement}
</>
);
}, [labels.pageAboutInfo, secondaryPageInfo]);

if (isPageInitializing) {
return <ManagementPageLoader data-test-subj={getTestId('pageLoader')} />;
}
Expand All @@ -249,7 +269,7 @@ export const ArtifactListPage = memo<ArtifactListPageProps>(
headerBackComponent={backButtonHeaderComponent}
hideHeader={!doesDataExist}
title={labels.pageTitle}
subtitle={labels.pageAboutInfo}
subtitle={description}
actions={
allowCardCreateAction && (
<EuiButton
Expand Down Expand Up @@ -300,6 +320,7 @@ export const ArtifactListPage = memo<ArtifactListPageProps>(
primaryButtonLabel={labels.emptyStatePrimaryButtonLabel}
backComponent={backButtonEmptyComponent}
data-test-subj={getTestId('emptyState')}
secondaryAboutInfo={secondaryPageInfo}
/>
) : (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import React, { memo } from 'react';
import styled, { css } from 'styled-components';
import { EuiButton, EuiEmptyPrompt } from '@elastic/eui';
import { EuiButton, EuiEmptyPrompt, EuiSpacer } from '@elastic/eui';
import { ManagementEmptyStateWrapper } from '../../management_empty_state_wrapper';
import { useTestIdGenerator } from '../../../hooks/use_test_id_generator';

Expand All @@ -25,6 +25,7 @@ export const NoDataEmptyState = memo<{
/** Should the Add button be disabled */
isAddDisabled?: boolean;
backComponent?: React.ReactNode;
secondaryAboutInfo?: React.ReactNode;
'data-test-subj'?: string;
}>(
({
Expand All @@ -35,6 +36,7 @@ export const NoDataEmptyState = memo<{
titleLabel,
aboutInfo,
primaryButtonLabel,
secondaryAboutInfo,
}) => {
const getTestId = useTestIdGenerator(dataTestSubj);

Expand All @@ -44,7 +46,17 @@ export const NoDataEmptyState = memo<{
data-test-subj={dataTestSubj}
iconType="plusInCircle"
title={<h2 data-test-subj={getTestId('title')}>{titleLabel}</h2>}
body={<div data-test-subj={getTestId('aboutInfo')}>{aboutInfo}</div>}
body={
<div data-test-subj={getTestId('aboutInfo')}>
{aboutInfo}
{secondaryAboutInfo ? (
<>
<EuiSpacer size="m" />
{secondaryAboutInfo}
</>
) : undefined}
</div>
}
actions={[
<EuiButton
fill
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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, { memo } from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import { EuiLink } from '@elastic/eui';
import { useKibana } from '../../../../../common/lib/kibana';

export const TrustedAppsArtifactsDocsLink = memo(() => {
const {
docLinks: {
links: { securitySolution },
},
} = useKibana().services;

return (
<>
<FormattedMessage
id="xpack.securitySolution.trustedApps.docsLinkInfoStart"
defaultMessage="Have too many alerts? Add an "
/>
<EuiLink target="_blank" href={`${securitySolution.endpointArtifacts}`}>
<FormattedMessage
id="xpack.securitySolution.trustedApps.docsLinkText"
defaultMessage="endpoint alert exception"
/>
</EuiLink>
<FormattedMessage
id="xpack.securitySolution.trustedApps.docsLinkInfoEnd"
defaultMessage=" instead."
/>
</>
);
});

TrustedAppsArtifactsDocsLink.displayName = 'TrustedAppsArtifactsDocsLink';
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import {
} from '../../../../../../common/endpoint/service/artifacts/constants';
import type { ArtifactFormComponentProps } from '../../../../components/artifact_list_page';
import { isGlobalPolicyEffected } from '../../../../components/effected_policy_select/utils';
import { TrustedAppsArtifactsDocsLink } from './artifacts_docs_link';

interface FieldValidationState {
/** If this fields state is invalid. Drives display of errors on the UI */
Expand Down Expand Up @@ -419,7 +420,15 @@ export const TrustedAppsForm = memo<ArtifactFormComponentProps>(
<EuiSpacer size="xs" />
{mode === 'create' && (
<EuiText size="s" data-test-subj={getTestId('about')}>
<p>{DETAILS_HEADER_DESCRIPTION}</p>
<p>
{DETAILS_HEADER_DESCRIPTION}
{
<>
<EuiSpacer size="m" />
<TrustedAppsArtifactsDocsLink />
</>
}
</p>
</EuiText>
)}
<EuiSpacer size="m" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const DETAILS_HEADER_DESCRIPTION = i18n.translate(
'xpack.securitySolution.trustedApps.details.header.description',
{
defaultMessage:
'Trusted applications improve performance or alleviate conflicts with other applications running on your hosts.',
'Add a trusted application to improve performance or alleviate conflicts with other applications running on your hosts. Trusted applications may still generate alerts in some cases.',
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ import { ArtifactListPage } from '../../../components/artifact_list_page';
import { TrustedAppsApiClient } from '../service';
import { TrustedAppsForm } from './components/form';
import { SEARCHABLE_FIELDS } from '../constants';
import { TrustedAppsArtifactsDocsLink } from './components/artifacts_docs_link';

const TRUSTED_APPS_PAGE_LABELS: ArtifactListPageProps['labels'] = {
pageTitle: i18n.translate('xpack.securitySolution.trustedApps.pageTitle', {
defaultMessage: 'Trusted applications',
}),
pageAboutInfo: i18n.translate('xpack.securitySolution.trustedApps.pageAboutInfo', {
defaultMessage:
'Trusted applications improve performance or alleviate conflicts with other applications running on your hosts.',
'Add a trusted application to improve performance or alleviate conflicts with other applications running on your hosts. Trusted applications may still generate alerts in some cases.',
}),
pageAddButtonTitle: i18n.translate('xpack.securitySolution.trustedApps.pageAddButtonTitle', {
defaultMessage: 'Add trusted application',
Expand Down Expand Up @@ -92,7 +93,7 @@ const TRUSTED_APPS_PAGE_LABELS: ArtifactListPageProps['labels'] = {
}),
emptyStateInfo: i18n.translate('xpack.securitySolution.trustedApps.emptyStateInfo', {
defaultMessage:
'Add a trusted application to improve performance or alleviate conflicts with other applications running on your hosts.',
'Add a trusted application to improve performance or alleviate conflicts with other applications running on your hosts. Trusted applications may still generate alerts in some cases.',
}),
emptyStatePrimaryButtonLabel: i18n.translate(
'xpack.securitySolution.trustedApps.emptyStatePrimaryButtonLabel',
Expand All @@ -117,6 +118,7 @@ export const TrustedAppsList = memo(() => {
labels={TRUSTED_APPS_PAGE_LABELS}
data-test-subj="trustedAppsListPage"
searchableFields={SEARCHABLE_FIELDS}
secondaryPageInfo={<TrustedAppsArtifactsDocsLink />}
/>
);
});
Expand Down

0 comments on commit 44d028f

Please sign in to comment.