Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into task/resolver-dat…
Browse files Browse the repository at this point in the history
…a-fetching
  • Loading branch information
kqualters-elastic committed Mar 2, 2020
2 parents 2600144 + 45f804c commit 24fb4fe
Show file tree
Hide file tree
Showing 23 changed files with 352 additions and 51 deletions.
1 change: 0 additions & 1 deletion src/legacy/core_plugins/kibana/public/dev_tools/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
This folder is just a left-over of the things that can't be moved to Kibana platform just yet:

* Styling (this can be moved as soon as there is support for styling in Kibana platform)
* Check whether there are no dev tools and hide the link in the nav bar (this can be moved as soon as all dev tools are moved)
3 changes: 0 additions & 3 deletions src/legacy/core_plugins/kibana/public/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
// vis_type_vislib UI styles
@import 'src/legacy/core_plugins/vis_type_vislib/public/index';

// Dev tools styles
@import './dev_tools/index';

// Discover styles
@import 'discover/index';

Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions src/plugins/dev_tools/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import { App, CoreSetup, Plugin } from 'kibana/public';
import { sortBy } from 'lodash';
import { KibanaLegacySetup } from '../../kibana_legacy/public';

import './index.scss';

export interface DevToolsSetup {
/**
* Register a developer tool. It will be available
Expand Down
2 changes: 2 additions & 0 deletions x-pack/legacy/plugins/siem/public/components/link_to/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export {
getCaseDetailsUrl,
getCaseUrl,
getCreateCaseUrl,
getConfigureCasesUrl,
RedirectToCasePage,
RedirectToCreatePage,
RedirectToConfigureCasesPage,
} from './redirect_to_case';
11 changes: 10 additions & 1 deletion x-pack/legacy/plugins/siem/public/components/link_to/link_to.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ import { RedirectToHostsPage, RedirectToHostDetailsPage } from './redirect_to_ho
import { RedirectToNetworkPage } from './redirect_to_network';
import { RedirectToOverviewPage } from './redirect_to_overview';
import { RedirectToTimelinesPage } from './redirect_to_timelines';
import { RedirectToCasePage, RedirectToCreatePage } from './redirect_to_case';
import {
RedirectToCasePage,
RedirectToCreatePage,
RedirectToConfigureCasesPage,
} from './redirect_to_case';
import { DetectionEngineTab } from '../../pages/detection_engine/types';

interface LinkToPageProps {
Expand All @@ -43,6 +47,11 @@ export const LinkToPage = React.memo<LinkToPageProps>(({ match }) => (
component={RedirectToCreatePage}
path={`${match.url}/:pageName(${SiemPageName.case})/create`}
/>
<Route
exact
component={RedirectToConfigureCasesPage}
path={`${match.url}/:pageName(${SiemPageName.case})/configure`}
/>
<Route
component={RedirectToCasePage}
path={`${match.url}/:pageName(${SiemPageName.case})/:detailName`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ export const RedirectToCasePage = ({
);

export const RedirectToCreatePage = () => <RedirectWrapper to={`/${SiemPageName.case}/create`} />;
export const RedirectToConfigureCasesPage = () => (
<RedirectWrapper to={`/${SiemPageName.case}/configure`} />
);

const baseCaseUrl = `#/link-to/${SiemPageName.case}`;

export const getCaseUrl = () => baseCaseUrl;
export const getCaseDetailsUrl = (detailName: string) => `${baseCaseUrl}/${detailName}`;
export const getCreateCaseUrl = () => `${baseCaseUrl}/create`;
export const getConfigureCasesUrl = () => `${baseCaseUrl}/configure`;
27 changes: 13 additions & 14 deletions x-pack/legacy/plugins/siem/public/pages/case/case.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,29 @@

import React from 'react';

import { EuiButton, EuiFlexGroup } from '@elastic/eui';
import { HeaderPage } from '../../components/header_page';
import { EuiButton, EuiButtonIcon, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { CaseHeaderPage } from './components/case_header_page';
import { WrapperPage } from '../../components/wrapper_page';
import { AllCases } from './components/all_cases';
import { SpyRoute } from '../../utils/route/spy_routes';
import * as i18n from './translations';
import { getCreateCaseUrl } from '../../components/link_to';

const badgeOptions = {
beta: true,
text: i18n.PAGE_BADGE_LABEL,
tooltip: i18n.PAGE_BADGE_TOOLTIP,
};
import { getCreateCaseUrl, getConfigureCasesUrl } from '../../components/link_to';

export const CasesPage = React.memo(() => (
<>
<WrapperPage>
<HeaderPage badgeOptions={badgeOptions} subtitle={i18n.PAGE_SUBTITLE} title={i18n.PAGE_TITLE}>
<CaseHeaderPage subtitle={i18n.PAGE_SUBTITLE} title={i18n.PAGE_TITLE}>
<EuiFlexGroup alignItems="center" gutterSize="s" responsive={false} wrap={true}>
<EuiButton fill href={getCreateCaseUrl()} iconType="plusInCircle">
{i18n.CREATE_TITLE}
</EuiButton>
<EuiFlexItem grow={false}>
<EuiButton fill href={getCreateCaseUrl()} iconType="plusInCircle">
{i18n.CREATE_TITLE}
</EuiButton>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon href={getConfigureCasesUrl()} iconType="gear" />
</EuiFlexItem>
</EuiFlexGroup>
</HeaderPage>
</CaseHeaderPage>
<AllCases />
</WrapperPage>
<SpyRoute />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import React from 'react';

import { HeaderPage, HeaderPageProps } from '../../../../components/header_page';
import * as i18n from './translations';

const CaseHeaderPageComponent: React.FC<HeaderPageProps> = props => <HeaderPage {...props} />;

CaseHeaderPageComponent.defaultProps = {
badgeOptions: {
beta: true,
text: i18n.PAGE_BADGE_LABEL,
tooltip: i18n.PAGE_BADGE_TOOLTIP,
},
};

export const CaseHeaderPage = React.memo(CaseHeaderPageComponent);
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { i18n } from '@kbn/i18n';

export const PAGE_BADGE_LABEL = i18n.translate('xpack.siem.case.caseView.pageBadgeLabel', {
defaultMessage: 'Beta',
});

export const PAGE_BADGE_TOOLTIP = i18n.translate('xpack.siem.case.caseView.pageBadgeTooltip', {
defaultMessage:
'Case Workflow is still in beta. Please help us improve by reporting issues or bugs in the Kibana repo.',
});
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { UserActionTree } from '../user_action_tree';
import { UserList } from '../user_list';
import { useUpdateCase } from '../../../../containers/case/use_update_case';
import { WrapperPage } from '../../../../components/wrapper_page';
import { WhitePageWrapper } from '../wrappers';

interface Props {
caseId: string;
Expand All @@ -52,14 +53,6 @@ const MyWrapper = styled(WrapperPage)`
padding-bottom: 0;
`;

const BackgroundWrapper = styled.div`
${({ theme }) => css`
background-color: ${theme.eui.euiColorEmptyShade};
border-top: ${theme.eui.euiBorderThin};
height: 100%;
`}
`;

export interface CaseProps {
caseId: string;
initialData: Case;
Expand Down Expand Up @@ -279,7 +272,7 @@ export const CaseComponent = React.memo<CaseProps>(({ caseId, initialData, isLoa
</EuiFlexGroup>
</HeaderPage>
</MyWrapper>
<BackgroundWrapper>
<WhitePageWrapper>
<MyWrapper>
<EuiFlexGroup>
<EuiFlexItem grow={6}>
Expand All @@ -305,7 +298,7 @@ export const CaseComponent = React.memo<CaseProps>(({ caseId, initialData, isLoa
</EuiFlexItem>
</EuiFlexGroup>
</MyWrapper>
</BackgroundWrapper>
</WhitePageWrapper>
</>
);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import React from 'react';
import {
EuiDescribedFormGroup,
EuiFormRow,
EuiFlexGroup,
EuiFlexItem,
EuiLink,
} from '@elastic/eui';

import styled from 'styled-components';

import { ConnectorsDropdown } from './connectors_dropdown';
import * as i18n from './translations';

const EuiFormRowExtended = styled(EuiFormRow)`
.euiFormRow__labelWrapper {
.euiFormRow__label {
width: 100%;
}
}
`;

const ConnectorsComponent: React.FC = () => {
const dropDownLabel = (
<EuiFlexGroup justifyContent="spaceBetween">
<EuiFlexItem grow={false}>{i18n.INCIDENT_MANAGEMENT_SYSTEM_LABEL}</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiLink>{i18n.ADD_NEW_CONNECTOR}</EuiLink>
</EuiFlexItem>
</EuiFlexGroup>
);

return (
<EuiDescribedFormGroup
fullWidth
title={<h3>{i18n.INCIDENT_MANAGEMENT_SYSTEM_TITLE}</h3>}
description={i18n.INCIDENT_MANAGEMENT_SYSTEM_DESC}
>
<EuiFormRowExtended fullWidth label={dropDownLabel}>
<ConnectorsDropdown />
</EuiFormRowExtended>
</EuiDescribedFormGroup>
);
};

export const Connectors = React.memo(ConnectorsComponent);
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import React, { useState, useCallback } from 'react';
import { EuiSuperSelect, EuiIcon, EuiSuperSelectOption } from '@elastic/eui';
import styled from 'styled-components';

import * as i18n from '../translations';

const ICON_SIZE = 'm';

const EuiIconExtended = styled(EuiIcon)`
margin-right: 13px;
`;

const connectors: Array<EuiSuperSelectOption<string>> = [
{
value: 'no-connector',
inputDisplay: (
<>
<EuiIconExtended type="minusInCircle" size={ICON_SIZE} />
<span>{i18n.NO_CONNECTOR}</span>
</>
),
'data-test-subj': 'no-connector',
},
{
value: 'servicenow-connector',
inputDisplay: (
<>
<EuiIconExtended type="logoWebhook" size={ICON_SIZE} />
<span>{'My ServiceNow connector'}</span>
</>
),
'data-test-subj': 'servicenow-connector',
},
];

const ConnectorsDropdownComponent: React.FC = () => {
const [selectedConnector, selectConnector] = useState(connectors[0].value);
const onChange = useCallback(connector => selectConnector(connector), [selectedConnector]);

return (
<EuiSuperSelect
options={connectors}
valueOfSelected={selectedConnector}
fullWidth
onChange={onChange}
/>
);
};

export const ConnectorsDropdown = React.memo(ConnectorsDropdownComponent);
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { i18n } from '@kbn/i18n';

export const INCIDENT_MANAGEMENT_SYSTEM_TITLE = i18n.translate(
'xpack.siem.case.configureCases.incidentManagementSystemTitle',
{
defaultMessage: 'Connect to third-party incident management system',
}
);

export const INCIDENT_MANAGEMENT_SYSTEM_DESC = i18n.translate(
'xpack.siem.case.configureCases.incidentManagementSystemDesc',
{
defaultMessage:
'You may optionally connect SIEM cases to a third-party incident management system of your choosing. This will allow you to push case data as an incident in your chosen third-party system.',
}
);

export const INCIDENT_MANAGEMENT_SYSTEM_LABEL = i18n.translate(
'xpack.siem.case.configureCases.incidentManagementSystemLabel',
{
defaultMessage: 'Incident management system',
}
);

export const NO_CONNECTOR = i18n.translate('xpack.siem.case.configureCases.noConnector', {
defaultMessage: 'No connector selected',
});

export const ADD_NEW_CONNECTOR = i18n.translate('xpack.siem.case.configureCases.addNewConnector', {
defaultMessage: 'Add new connector option',
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import styled, { css } from 'styled-components';

export const WhitePageWrapper = styled.div`
${({ theme }) => css`
background-color: ${theme.eui.euiColorEmptyShade};
border-top: ${theme.eui.euiBorderThin};
height: 100%;
min-height: 100vh;
`}
`;

export const SectionWrapper = styled.div`
box-sizing: content-box;
margin: 0 auto;
max-width: 1175px;
`;
Loading

0 comments on commit 24fb4fe

Please sign in to comment.