Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SIEM][Detection Engine] - Update UI to read rule exceptions_list #69939

Closed
wants to merge 56 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
3b19da1
Updates list entry schema, exposes exception list client, updates tests
yctercero Jun 22, 2020
3388918
create new de list schema and unit tests
yctercero Jun 22, 2020
e977f00
updated route unit tests and types to match new list schema
yctercero Jun 23, 2020
55e29c9
updated existing DE exceptions code so it should now work as is with …
yctercero Jun 23, 2020
65e47ca
test and types cleanup
yctercero Jun 23, 2020
a2f6286
cleanup
yctercero Jun 23, 2020
6b728fe
Merge branch 'master' of github.com:yctercero/kibana into de_lists
yctercero Jun 23, 2020
53536f8
update unit test
yctercero Jun 23, 2020
1713e7f
Merge branch 'master' of github.com:yctercero/kibana into de_lists
yctercero Jun 24, 2020
373fe8c
updates per feedback
yctercero Jun 25, 2020
60c3e88
updated ui to accept exceptions list
yctercero Jun 25, 2020
4a9a23f
Merge branch 'master' of github.com:yctercero/kibana into exceptions_ui
yctercero Jun 25, 2020
223869e
update unit test
yctercero Jun 25, 2020
1f1761f
Merge branch 'master' of github.com:yctercero/kibana into exceptions_ui
yctercero Jun 25, 2020
042228a
Merge branch 'master' of github.com:yctercero/kibana into exceptions_ui
yctercero Jul 2, 2020
ff28bac
reverted type changes
yctercero Jul 2, 2020
001be67
updated rule exception list param to also include list type
yctercero Jul 2, 2020
e50e831
Merge branch 'master' of github.com:yctercero/kibana into exceptions_ui
yctercero Jul 2, 2020
81d26fc
[Security Solution] Renames the `Investigate in Resolver` Timeline ac…
andrew-goldstein Jul 2, 2020
4f65a02
types cleanup
yctercero Jul 2, 2020
113962e
Update component templates list to render empty prompt inside of cont…
cjcenizal Jul 2, 2020
5fcf803
Fix saved query modal overlay (#68826)
patrykkopycinski Jul 2, 2020
f5b2800
[kbn/optimizer] only build specified themes (#70389)
Jul 2, 2020
23ea7ac
[Maps] Fix cannot select Solid fill-color when removing fields (#70621)
nreese Jul 2, 2020
20237b8
[EPM] Use higher priority than default templates (#70640)
jonathan-buttner Jul 2, 2020
67c70e7
Add Snapshot Restore README with quick-testing steps. (#70494)
cjcenizal Jul 2, 2020
6c62c68
chore(NA): upgrade to lodash@4 (#69868)
mistic Jul 3, 2020
ebcec3a
[Maps] show vector tile labels on top (#69444)
nreese Jul 3, 2020
21efd23
Fixed adding an extra space character on selecting alert variable in …
YulNaumenko Jul 3, 2020
5226ea2
[Alerting] document requirements for developing new action types (#69…
pmuellr Jul 3, 2020
54348a7
[Ingest Manager] Add ability to sort to agent configs and package con…
jen-huang Jul 3, 2020
97ad58c
[ML] Changing shared module setup function parameters (#70589)
jgowdyelastic Jul 3, 2020
169147b
[Uptime] Prevent duplicate requests on load for index status (#70585)
shahzad31 Jul 3, 2020
f1888cd
[Rum Dashbaord] Rum selected service view (#70579)
shahzad31 Jul 3, 2020
5159635
[Ingest Pipelines] Load from json (#70297)
jloleysens Jul 3, 2020
8bc27ec
[APM] Optimize services overview (#69648)
dgieselaar Jul 3, 2020
bc1599e
[Composable template] Create / Edit wizard (#70220)
sebelga Jul 3, 2020
d1e6aa7
[Ingest Manager] Update registry URL to point to snapshot registry (#…
ruflin Jul 3, 2020
fa2f60e
[Uptime] Use elastic charts donut (#70364)
shahzad31 Jul 3, 2020
a916e0a
[Lens] Add ability to set colors for y-axis series (#70311)
mbondyra Jul 3, 2020
571a610
Handle timeouts on creating templates (#70635)
Jul 3, 2020
72b3004
[Ingest Manager] Improve agent unenrollment with unenroll action (#70…
nchaulet Jul 3, 2020
e70fcc7
[Telemetry] Add documentation about Application Usage (#70624)
afharo Jul 3, 2020
bbda3f9
[Lens] Fitting functions (#69820)
flash1293 Jul 3, 2020
f3573f3
[Logs UI] Logs overview queries for the observability dashboard (#70413)
Jul 3, 2020
e1da6a1
Add googlecloud metricbeat module to Kibana Home (#70652)
kaiyan-sheng Jul 3, 2020
97ca7bf
Update dependency @elastic/charts to v19.7.0 (#69791)
renovate[bot] Jul 3, 2020
7ec48fd
[Logs UI] Reorganise log rate anomaly table (#69516)
Kerry350 Jul 3, 2020
78fc9fb
[SECURITY] Bug fix for topN on draggables (#70450)
XavierM Jul 3, 2020
c3cacba
logout from transform_poweruser user in after method of transform tes…
Jul 3, 2020
fd15268
[functional tests] test url field formatter on dashboard and discover…
dmlemeshko Jul 3, 2020
e429670
[Security Solution][Endpoint] Update to new manifest format (without …
madirey Jul 4, 2020
86672a7
skip flaky suite (#70762)
mistic Jul 5, 2020
c96d9b4
skip flaky suite (#70764)
mistic Jul 5, 2020
5418533
Merge branch 'exceptions_ui' of https://github.com/yctercero/kibana i…
yctercero Jul 6, 2020
372c32f
updated failing tests
yctercero Jul 6, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Composable template] Create / Edit wizard (#70220)
sebelga authored Jul 3, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit bc1599ef6b17353990e0304a1dfce3492a34e5a6
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ import { WithMultiContent, useMultiContentContext, HookProps } from '../multi_co

export interface Props<T extends object> {
onSave: (data: T) => void | Promise<void>;
children: JSX.Element | JSX.Element[];
children: JSX.Element | Array<JSX.Element | null | false>;
isEditing?: boolean;
defaultActiveStep?: number;
defaultValue?: HookProps<T>['defaultValue'];
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ export function useMultiContentContext<T extends object = { [key: string]: any }
*
* @param contentId The content id to be added to the "contents" map
*/
export function useContent<T extends object = { [key: string]: any }>(contentId: keyof T) {
export function useContent<T extends object, K extends keyof T>(contentId: K) {
const { updateContentAt, saveSnapshotAndRemoveContent, getData } = useMultiContentContext<T>();

const updateContent = useCallback(
@@ -71,8 +71,11 @@ export function useContent<T extends object = { [key: string]: any }>(contentId:
};
}, [contentId, saveSnapshotAndRemoveContent]);

const data = getData();
const defaultValue = data[contentId];

return {
defaultValue: getData()[contentId]!,
defaultValue,
updateContent,
getData,
};
Original file line number Diff line number Diff line change
@@ -150,6 +150,10 @@ export function useMultiContent<T extends object>({
* Validate the multi-content active content(s) in the DOM
*/
const validate = useCallback(async () => {
if (Object.keys(contents.current).length === 0) {
return Boolean(validation.isValid);
}

const updatedValidation = {} as { [key in keyof T]?: boolean | undefined };

for (const [id, _content] of Object.entries(contents.current)) {
7 changes: 2 additions & 5 deletions src/plugins/es_ui_shared/public/index.ts
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@
* In the future, each top level folder should be exported like that to avoid naming collision
*/
import * as Forms from './forms';
import * as Monaco from './monaco';

export { JsonEditor, OnJsonEditorUpdateHandler } from './components/json_editor';

@@ -53,10 +54,6 @@ export {
expandLiteralStrings,
} from './console_lang';

import * as Monaco from './monaco';

export { Monaco };

export {
AuthorizationContext,
AuthorizationProvider,
@@ -69,7 +66,7 @@ export {
useAuthorizationContext,
} from './authorization';

export { Forms };
export { Monaco, Forms };

/** dummy plugin, we just want esUiShared to have its own bundle */
export function plugin() {
Original file line number Diff line number Diff line change
@@ -21,12 +21,13 @@ import { ValidationFunc } from '../../hook_form_lib';
import { isJSON } from '../../../validators/string';
import { ERROR_CODE } from './types';

export const isJsonField = (message: string) => (
...args: Parameters<ValidationFunc>
): ReturnType<ValidationFunc<any, ERROR_CODE>> => {
export const isJsonField = (
message: string,
{ allowEmptyString = false }: { allowEmptyString?: boolean } = {}
) => (...args: Parameters<ValidationFunc>): ReturnType<ValidationFunc<any, ERROR_CODE>> => {
const [{ value }] = args;

if (typeof value !== 'string') {
if (typeof value !== 'string' || (allowEmptyString && value.trim() === '')) {
return;
}

Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { ReactWrapper } from 'enzyme';
import { act } from 'react-dom/test-utils';

import {
@@ -13,44 +12,21 @@ import {
TestBedConfig,
findTestSubject,
} from '../../../../../test_utils';
// NOTE: We have to use the Home component instead of the TemplateList component because we depend
// upon react router to provide the name of the template to load in the detail panel.
import { IndexManagementHome } from '../../../public/application/sections/home'; // eslint-disable-line @kbn/eslint/no-restricted-paths
import { indexManagementStore } from '../../../public/application/store'; // eslint-disable-line @kbn/eslint/no-restricted-paths
import { TemplateList } from '../../../public/application/sections/home/template_list'; // eslint-disable-line @kbn/eslint/no-restricted-paths
import { TemplateDeserialized } from '../../../common';
import { WithAppDependencies, services, TestSubjects } from '../helpers';
import { WithAppDependencies, TestSubjects } from '../helpers';

const testBedConfig: TestBedConfig = {
store: () => indexManagementStore(services as any),
memoryRouter: {
initialEntries: [`/indices`],
componentRoutePath: `/:section(indices|templates)`,
initialEntries: [`/templates`],
componentRoutePath: `/templates/:templateName?`,
},
doMountAsync: true,
};

const initTestBed = registerTestBed(WithAppDependencies(IndexManagementHome), testBedConfig);

export interface IndexTemplatesTabTestBed extends TestBed<TestSubjects> {
findAction: (action: 'edit' | 'clone' | 'delete') => ReactWrapper;
actions: {
goToTemplatesList: () => void;
selectDetailsTab: (tab: 'summary' | 'settings' | 'mappings' | 'aliases') => void;
clickReloadButton: () => void;
clickTemplateAction: (
name: TemplateDeserialized['name'],
action: 'edit' | 'clone' | 'delete'
) => void;
clickTemplateAt: (index: number) => void;
clickCloseDetailsButton: () => void;
clickActionMenu: (name: TemplateDeserialized['name']) => void;
toggleViewItem: (view: 'composable' | 'system') => void;
};
}

export const setup = async (): Promise<IndexTemplatesTabTestBed> => {
const testBed = await initTestBed();
const initTestBed = registerTestBed<TestSubjects>(WithAppDependencies(TemplateList), testBedConfig);

const createActions = (testBed: TestBed<TestSubjects>) => {
/**
* Additional helpers
*/
@@ -64,11 +40,6 @@ export const setup = async (): Promise<IndexTemplatesTabTestBed> => {
/**
* User Actions
*/

const goToTemplatesList = () => {
testBed.find('templatesTab').simulate('click');
};

const selectDetailsTab = (tab: 'summary' | 'settings' | 'mappings' | 'aliases') => {
const tabs = ['summary', 'settings', 'mappings', 'aliases'];

@@ -136,10 +107,8 @@ export const setup = async (): Promise<IndexTemplatesTabTestBed> => {
};

return {
...testBed,
findAction,
actions: {
goToTemplatesList,
selectDetailsTab,
clickReloadButton,
clickTemplateAction,
@@ -150,3 +119,14 @@ export const setup = async (): Promise<IndexTemplatesTabTestBed> => {
},
};
};

export const setup = async (): Promise<IndexTemplatesTabTestBed> => {
const testBed = await initTestBed();

return {
...testBed,
...createActions(testBed),
};
};

export type IndexTemplatesTabTestBed = TestBed<TestSubjects> & ReturnType<typeof createActions>;
Original file line number Diff line number Diff line change
@@ -30,28 +30,15 @@ describe('Index Templates tab', () => {
server.restore();
});

beforeEach(async () => {
httpRequestsMockHelpers.setLoadIndicesResponse([]);

await act(async () => {
testBed = await setup();
});
});

describe('when there are no index templates', () => {
beforeEach(async () => {
const { actions, component } = testBed;

test('should display an empty prompt', async () => {
httpRequestsMockHelpers.setLoadTemplatesResponse({ templates: [], legacyTemplates: [] });

await act(async () => {
actions.goToTemplatesList();
testBed = await setup();
});
const { exists, component } = testBed;
component.update();
});

test('should display an empty prompt', async () => {
const { exists } = testBed;

expect(exists('sectionLoading')).toBe(false);
expect(exists('emptyPrompt')).toBe(true);
@@ -119,14 +106,12 @@ describe('Index Templates tab', () => {
const legacyTemplates = [template4, template5, template6];

beforeEach(async () => {
const { actions, component } = testBed;

httpRequestsMockHelpers.setLoadTemplatesResponse({ templates, legacyTemplates });

await act(async () => {
actions.goToTemplatesList();
testBed = await setup();
});
component.update();
testBed.component.update();
});

test('should list them in the table', async () => {
@@ -151,6 +136,7 @@ describe('Index Templates tab', () => {
composedOfString,
priorityFormatted,
'M S A', // Mappings Settings Aliases badges
'', // Column of actions
]);
});

@@ -192,8 +178,10 @@ describe('Index Templates tab', () => {
);
});

test('should have a button to create a new template', () => {
test('should have a button to create a template', () => {
const { exists } = testBed;
// Both composable and legacy templates
expect(exists('createTemplateButton')).toBe(true);
expect(exists('createLegacyTemplateButton')).toBe(true);
});

Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@
import React from 'react';
import { act } from 'react-dom/test-utils';

import { CREATE_LEGACY_TEMPLATE_BY_DEFAULT } from '../../../common';
import { setupEnvironment, nextTick } from '../helpers';

import {
@@ -369,7 +368,7 @@ describe.skip('<TemplateCreate />', () => {
aliases: ALIASES,
},
_kbnMeta: {
isLegacy: CREATE_LEGACY_TEMPLATE_BY_DEFAULT,
isLegacy: false,
isManaged: false,
},
};
1 change: 0 additions & 1 deletion x-pack/plugins/index_management/common/constants/index.ts
Original file line number Diff line number Diff line change
@@ -9,7 +9,6 @@ export { BASE_PATH } from './base_path';
export { API_BASE_PATH } from './api_base_path';
export { INVALID_INDEX_PATTERN_CHARS, INVALID_TEMPLATE_NAME_CHARS } from './invalid_characters';
export * from './index_statuses';
export { CREATE_LEGACY_TEMPLATE_BY_DEFAULT } from './index_templates';

export {
UIM_APP_NAME,

This file was deleted.

2 changes: 1 addition & 1 deletion x-pack/plugins/index_management/common/index.ts
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

export { PLUGIN, API_BASE_PATH, CREATE_LEGACY_TEMPLATE_BY_DEFAULT, BASE_PATH } from './constants';
export { PLUGIN, API_BASE_PATH, BASE_PATH } from './constants';

export { getTemplateParameter } from './lib';

4 changes: 3 additions & 1 deletion x-pack/plugins/index_management/common/lib/index.ts
Original file line number Diff line number Diff line change
@@ -7,9 +7,11 @@
export { deserializeDataStream, deserializeDataStreamList } from './data_stream_serialization';

export {
deserializeLegacyTemplateList,
deserializeTemplate,
deserializeTemplateList,
deserializeLegacyTemplate,
deserializeLegacyTemplateList,
serializeTemplate,
serializeLegacyTemplate,
} from './template_serialization';

Original file line number Diff line number Diff line change
@@ -13,14 +13,15 @@ import {
const hasEntries = (data: object = {}) => Object.entries(data).length > 0;

export function serializeTemplate(templateDeserialized: TemplateDeserialized): TemplateSerialized {
const { version, priority, indexPatterns, template, composedOf } = templateDeserialized;
const { version, priority, indexPatterns, template, composedOf, _meta } = templateDeserialized;

return {
version,
priority,
template,
index_patterns: indexPatterns,
composed_of: composedOf,
_meta,
};
}

@@ -34,6 +35,7 @@ export function deserializeTemplate(
index_patterns: indexPatterns,
template = {},
priority,
_meta,
composed_of: composedOf,
} = templateEs;
const { settings } = template;
@@ -46,6 +48,7 @@ export function deserializeTemplate(
template,
ilmPolicy: settings?.index?.lifecycle,
composedOf,
_meta,
_kbnMeta: {
isManaged: Boolean(managedTemplatePrefix && name.startsWith(managedTemplatePrefix)),
},
2 changes: 2 additions & 0 deletions x-pack/plugins/index_management/common/types/templates.ts
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ export interface TemplateSerialized {
composed_of?: string[];
version?: number;
priority?: number;
_meta?: { [key: string]: any };
}

/**
@@ -43,6 +44,7 @@ export interface TemplateDeserialized {
ilmPolicy?: {
name: string;
};
_meta?: { [key: string]: any };
_kbnMeta: {
isManaged: boolean;
isLegacy?: boolean;
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@


/**
* [1] Will center vertically the empty search result
*/

$heightHeader: $euiSizeL * 2;

.componentTemplates {
@include euiBottomShadowFlat;
height: 100%;

&__header {
height: $heightHeader;

.euiFormControlLayout {
max-width: initial;
}
}

&__searchBox {
border-bottom: $euiBorderThin;
box-shadow: none;
max-width: initial;
}

&__listWrapper {
height: calc(100% - #{$heightHeader});

&--is-empty {
display: flex; // [1]
}
}
}
Loading