Skip to content

Commit

Permalink
modify tests, policy response spacing alts
Browse files Browse the repository at this point in the history
  • Loading branch information
parkiino committed Feb 11, 2021
1 parent 1a75c0a commit 0cb37b0
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export const EndpointDetails = memo(
}),
description: (
<EuiFlexGroup alignItems="center">
<EuiFlexItem>
<EuiFlexItem grow={false}>
<EndpointPolicyLink
policyId={details.Endpoint.policy.applied.id}
data-test-subj="policyDetailsValue"
Expand Down Expand Up @@ -212,7 +212,7 @@ export const EndpointDetails = memo(
// @ts-ignore
<EuiBadge
color={POLICY_STATUS_TO_BADGE_COLOR[policyStatus] || 'default'}
data-test-subj="policyStatusHealth"
data-test-subj="policyStatusValue"
href={policyResponseUri}
onClick={policyStatusClickHandler}
>
Expand Down Expand Up @@ -278,7 +278,6 @@ export const EndpointDetails = memo(
onClick={handleReassignEndpointsClick}
data-test-subj="endpointDetailsLinkToIngest"
>
<EuiIcon type="savedObjectsApp" className="linkToAppIcon" />
<FormattedMessage
id="xpack.securitySolution.endpoint.details.linkToIngestTitle"
defaultMessage="Reassign Policy"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
import { useHistory } from 'react-router-dom';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';
import styled from 'styled-components';
import { useToasts } from '../../../../../common/lib/kibana';
import { useEndpointSelector } from '../hooks';
import { urlFromQueryParams } from '../url_from_query_params';
Expand Down Expand Up @@ -131,6 +132,14 @@ export const EndpointDetailsFlyout = memo(() => {

EndpointDetailsFlyout.displayName = 'EndpointDetailsFlyout';

const PolicyResponseFlyout = styled.div`
.endpointDetailsPolicyResponseFlyoutBody {
.euiFlyoutBody__overflowContent {
padding-top: 0;
}
}
`;

const PolicyResponseFlyoutPanel = memo<{
hostMeta: HostMetadata;
}>(({ hostMeta }) => {
Expand Down Expand Up @@ -171,12 +180,15 @@ const PolicyResponseFlyoutPanel = memo<{
}, [backToDetailsClickHandler, detailsUri]);

return (
<>
<PolicyResponseFlyout>
<FlyoutSubHeader
backButton={backButtonProp}
data-test-subj="endpointDetailsPolicyResponseFlyoutHeader"
/>
<EuiFlyoutBody data-test-subj="endpointDetailsPolicyResponseFlyoutBody">
<EuiFlyoutBody
data-test-subj="endpointDetailsPolicyResponseFlyoutBody"
className="endpointDetailsPolicyResponseFlyoutBody"
>
<EuiText data-test-subj="endpointDetailsPolicyResponseFlyoutTitle">
<h4>
<FormattedMessage
Expand Down Expand Up @@ -209,7 +221,7 @@ const PolicyResponseFlyoutPanel = memo<{
/>
)}
</EuiFlyoutBody>
</>
</PolicyResponseFlyout>
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
*/
const PolicyResponseConfigAccordion = styled(EuiAccordion)`
.euiAccordion__triggerWrapper {
padding: ${(props) => props.theme.eui.paddingSizes.s};
padding: ${(props) => props.theme.eui.paddingSizes.xs};
}
&.euiAccordion-isOpen {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,49 +645,29 @@ describe('when on the list page', () => {

it('should display Success overall policy status', async () => {
const renderResult = await renderAndWaitForData();
const policyStatusLink = await renderResult.findByTestId('policyStatusValue');
expect(policyStatusLink.textContent).toEqual('Success');

const policyStatusHealth = await renderResult.findByTestId('policyStatusHealth');
expect(
policyStatusHealth.querySelector('[data-euiicon-type][color="success"]')
).not.toBeNull();
const policyStatusBadge = await renderResult.findByTestId('policyStatusValue');
expect(policyStatusBadge.textContent).toEqual('Success');
});

it('should display Warning overall policy status', async () => {
mockEndpointListApi(createPolicyResponse(HostPolicyResponseActionStatus.warning));
const renderResult = await renderAndWaitForData();
const policyStatusLink = await renderResult.findByTestId('policyStatusValue');
expect(policyStatusLink.textContent).toEqual('Warning');

const policyStatusHealth = await renderResult.findByTestId('policyStatusHealth');
expect(
policyStatusHealth.querySelector('[data-euiicon-type][color="warning"]')
).not.toBeNull();
const policyStatusBadge = await renderResult.findByTestId('policyStatusValue');
expect(policyStatusBadge.textContent).toEqual('Warning');
});

it('should display Failed overall policy status', async () => {
mockEndpointListApi(createPolicyResponse(HostPolicyResponseActionStatus.failure));
const renderResult = await renderAndWaitForData();
const policyStatusLink = await renderResult.findByTestId('policyStatusValue');
expect(policyStatusLink.textContent).toEqual('Failed');

const policyStatusHealth = await renderResult.findByTestId('policyStatusHealth');
expect(
policyStatusHealth.querySelector('[data-euiicon-type][color="danger"]')
).not.toBeNull();
const policyStatusBadge = await renderResult.findByTestId('policyStatusValue');
expect(policyStatusBadge.textContent).toEqual('Failed');
});

it('should display Unknown overall policy status', async () => {
mockEndpointListApi(createPolicyResponse('' as HostPolicyResponseActionStatus));
const renderResult = await renderAndWaitForData();
const policyStatusLink = await renderResult.findByTestId('policyStatusValue');
expect(policyStatusLink.textContent).toEqual('Unknown');

const policyStatusHealth = await renderResult.findByTestId('policyStatusHealth');
expect(
policyStatusHealth.querySelector('[data-euiicon-type][color="subdued"]')
).not.toBeNull();
const policyStatusBadge = await renderResult.findByTestId('policyStatusValue');
expect(policyStatusBadge.textContent).toEqual('Unknown');
});

it('should include the link to reassignment in Ingest', async () => {
Expand Down

0 comments on commit 0cb37b0

Please sign in to comment.