Skip to content

Commit

Permalink
Merge branch 'master' into alerting/webhook-basic-auth-optional
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Feb 5, 2020
2 parents a8f5f5a + e9c31cd commit e33dd8d
Show file tree
Hide file tree
Showing 331 changed files with 5,601 additions and 4,247 deletions.
7 changes: 3 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ Summarize your PR. If it involves visual changes include a screenshot or gif.

### Checklist

Use ~~strikethroughs~~ to remove checklist items you don't feel are applicable to this PR.
Delete any items that are not applicable to this PR.

- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)
- [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)
- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials
- [ ] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios
- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)
- [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)
- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)
- [ ] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)

Binary file added docs/siem/images/detections-ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/siem/images/hosts-ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/siem/images/network-ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/siem/images/overview-ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions docs/siem/siem-ui.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,23 @@ investigation.
[role="screenshot"]
image::siem/images/network-ui.png[]

[float]
[[detections-ui]]
=== Detections

The Detections feature automatically searches for threats and creates
signals when they are detected. Signal detection rules define the conditions
for creating signals. The SIEM app comes with prebuilt rules that search for
suspicious activity on your network and hosts. Additionally, you can
create your own rules.

See {siem-guide}/detection-engine-overview.html[Detections] in the SIEM
Guide for information on managing detection rules and signals via the UI
or the Detections API.

[role="screenshot"]
image::siem/images/detections-ui.png[]

[float]
[[timelines-ui]]
=== Timeline
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"@types/react-grid-layout": "^0.16.7",
"@types/recompose": "^0.30.5",
"JSONStream": "1.3.5",
"abortcontroller-polyfill": "^1.3.0",
"abort-controller": "^3.0.0",
"angular": "^1.7.9",
"angular-aria": "^1.7.8",
"angular-elastic": "^2.5.1",
Expand Down Expand Up @@ -476,7 +476,7 @@
"strip-ansi": "^3.0.1",
"supertest": "^3.1.0",
"supertest-as-promised": "^4.0.2",
"tree-kill": "^1.2.1",
"tree-kill": "^1.2.2",
"typescript": "3.7.2",
"typings-tester": "^0.3.2",
"vinyl-fs": "^3.0.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-dev-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"load-json-file": "^6.2.0",
"moment": "^2.24.0",
"rxjs": "^6.5.3",
"tree-kill": "^1.2.1",
"tree-kill": "^1.2.2",
"tslib": "^1.9.3"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-es/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"node-fetch": "^2.6.0",
"simple-git": "^1.91.0",
"tar-fs": "^1.16.3",
"tree-kill": "^1.2.1",
"tree-kill": "^1.2.2",
"yauzl": "^2.10.0"
}
}
31 changes: 23 additions & 8 deletions packages/kbn-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36382,15 +36382,24 @@ var spawn = childProcess.spawn;
var exec = childProcess.exec;

module.exports = function (pid, signal, callback) {
if (typeof signal === 'function' && callback === undefined) {
callback = signal;
signal = undefined;
}

pid = parseInt(pid);
if (Number.isNaN(pid)) {
if (callback) {
return callback(new Error("pid must be a number"));
} else {
throw new Error("pid must be a number");
}
}

var tree = {};
var pidsToProcess = {};
tree[pid] = [];
pidsToProcess[pid] = 1;

if (typeof signal === 'function' && callback === undefined) {
callback = signal;
signal = undefined;
}

switch (process.platform) {
case 'win32':
Expand Down Expand Up @@ -56572,12 +56581,18 @@ function runScriptInPackageStreaming(script, args, pkg) {
});
}
async function yarnWorkspacesInfo(directory) {
const workspacesInfo = await Object(_child_process__WEBPACK_IMPORTED_MODULE_0__["spawn"])('yarn', ['workspaces', 'info', '--json'], {
const {
stdout
} = await Object(_child_process__WEBPACK_IMPORTED_MODULE_0__["spawn"])('yarn', ['--json', 'workspaces', 'info'], {
cwd: directory,
stdio: 'pipe'
});
const stdout = JSON.parse(workspacesInfo.stdout);
return JSON.parse(stdout.data);

try {
return JSON.parse(JSON.parse(stdout).data);
} catch (error) {
throw new Error(`'yarn workspaces info --json' produced unexpected output: \n${stdout}`);
}
}

/***/ }),
Expand Down
9 changes: 6 additions & 3 deletions packages/kbn-pm/src/utils/scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,14 @@ export function runScriptInPackageStreaming(script: string, args: string[], pkg:
}

export async function yarnWorkspacesInfo(directory: string): Promise<WorkspacesInfo> {
const workspacesInfo = await spawn('yarn', ['workspaces', 'info', '--json'], {
const { stdout } = await spawn('yarn', ['--json', 'workspaces', 'info'], {
cwd: directory,
stdio: 'pipe',
});

const stdout = JSON.parse(workspacesInfo.stdout);
return JSON.parse(stdout.data);
try {
return JSON.parse(JSON.parse(stdout).data);
} catch (error) {
throw new Error(`'yarn workspaces info --json' produced unexpected output: \n${stdout}`);
}
}
6 changes: 3 additions & 3 deletions packages/kbn-ui-shared-deps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"kbn:watch": "node scripts/build --watch"
},
"devDependencies": {
"abort-controller": "^3.0.0",
"@elastic/eui": "18.3.0",
"@elastic/charts": "^16.1.0",
"@kbn/dev-utils": "1.0.0",
"@kbn/i18n": "1.0.0",
"@yarnpkg/lockfile": "^1.1.0",
"abortcontroller-polyfill": "^1.3.0",
"angular": "^1.7.9",
"core-js": "^3.2.1",
"css-loader": "^2.1.1",
Expand All @@ -24,13 +24,13 @@
"mini-css-extract-plugin": "0.8.0",
"moment": "^2.24.0",
"moment-timezone": "^0.5.27",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-intl": "^2.8.0",
"react": "^16.12.0",
"read-pkg": "^5.2.0",
"regenerator-runtime": "^0.13.3",
"symbol-observable": "^1.2.0",
"webpack": "4.41.0",
"whatwg-fetch": "^3.0.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/kbn-ui-shared-deps/polyfills.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ require('core-js/stable');
require('regenerator-runtime/runtime');
require('custom-event-polyfill');
require('whatwg-fetch');
require('abortcontroller-polyfill/dist/polyfill-patch-fetch');
require('abort-controller/polyfill');
require('./vendor/childnode_remove_polyfill');
require('symbol-observable');
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ const unknownSchema: Schema = {
defaults: {},
editor: false,
group: AggGroupNames.Metrics,
aggSettings: {
top_hits: {
allowStrings: true,
},
},
};

const getTypeFromRegistry = (type: string): IAggType => {
Expand Down Expand Up @@ -438,7 +443,7 @@ export class AggConfig {

if (fieldParam) {
// @ts-ignore
availableFields = fieldParam.getAvailableFields(this.getIndexPattern().fields);
availableFields = fieldParam.getAvailableFields(this);
}

// clear out the previous params except for a few special ones
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ import { AggParamType } from '../param_types/agg';
import { AggConfig } from '../agg_config';
import { METRIC_TYPES } from './metric_agg_types';
import { KBN_FIELD_TYPES } from '../../../../../../../plugins/data/public';
import { FilterFieldTypes } from '../param_types/field';

export interface IMetricAggConfig extends AggConfig {
type: InstanceType<typeof MetricAggType>;
}

export interface MetricAggParam<TMetricAggConfig extends AggConfig>
extends AggParamType<TMetricAggConfig> {
filterFieldTypes?: KBN_FIELD_TYPES | KBN_FIELD_TYPES[] | '*';
filterFieldTypes?: FilterFieldTypes;
onlyAggregatable?: boolean;
}

Expand Down
17 changes: 4 additions & 13 deletions src/legacy/core_plugins/data/public/search/aggs/metrics/top_hit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import _ from 'lodash';
import { i18n } from '@kbn/i18n';
import { IMetricAggConfig, MetricAggType } from './metric_agg_type';
import { aggTypeFieldFilters } from '../param_types/filter';
import { METRIC_TYPES } from './metric_agg_types';
import { KBN_FIELD_TYPES } from '../../../../../../../plugins/data/public';

Expand All @@ -33,17 +32,6 @@ const isNumericFieldSelected = (agg: IMetricAggConfig) => {
return field && field.type && field.type === KBN_FIELD_TYPES.NUMBER;
};

aggTypeFieldFilters.addFilter((field, aggConfig) => {
if (
aggConfig.type.name !== METRIC_TYPES.TOP_HITS ||
_.get(aggConfig.schema, 'aggSettings.top_hits.allowStrings', false)
) {
return true;
}

return field.type === KBN_FIELD_TYPES.NUMBER;
});

export const topHitMetricAgg = new MetricAggType({
name: METRIC_TYPES.TOP_HITS,
title: i18n.translate('data.search.aggs.metrics.topHitTitle', {
Expand Down Expand Up @@ -75,7 +63,10 @@ export const topHitMetricAgg = new MetricAggType({
name: 'field',
type: 'field',
onlyAggregatable: false,
filterFieldTypes: '*',
filterFieldTypes: (aggConfig: IMetricAggConfig) =>
_.get(aggConfig.schema, 'aggSettings.top_hits.allowStrings', false)
? '*'
: KBN_FIELD_TYPES.NUMBER,
write(agg, output) {
const field = agg.getParam('field');
output.params = {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@
* under the License.
*/

import { get } from 'lodash';
import { BaseParamType } from './base';
import { FieldParamType } from './field';
import { ES_FIELD_TYPES, KBN_FIELD_TYPES } from '../../../../../../../plugins/data/public';
import { IAggConfig } from '../agg_config';
import { IMetricAggConfig } from '../metrics/metric_agg_type';
import { Schema } from '../schemas';

jest.mock('ui/new_platform');

Expand All @@ -45,7 +49,11 @@ describe('Field', () => {
searchable: true,
},
],
} as any;
};

const agg = ({
getIndexPattern: jest.fn(() => indexPattern),
} as unknown) as IAggConfig;

describe('constructor', () => {
it('it is an instance of BaseParamType', () => {
Expand All @@ -65,7 +73,7 @@ describe('Field', () => {
type: 'field',
});

const fields = aggParam.getAvailableFields(indexPattern.fields);
const fields = aggParam.getAvailableFields(agg);

expect(fields.length).toBe(1);

Expand All @@ -82,7 +90,58 @@ describe('Field', () => {

aggParam.onlyAggregatable = false;

const fields = aggParam.getAvailableFields(indexPattern.fields);
const fields = aggParam.getAvailableFields(agg);

expect(fields.length).toBe(2);
});

it('should return all fields if filterFieldTypes was not specified', () => {
const aggParam = new FieldParamType({
name: 'field',
type: 'field',
});

indexPattern.fields[1].aggregatable = true;

const fields = aggParam.getAvailableFields(agg);

expect(fields.length).toBe(2);
});

it('should return only numeric fields if filterFieldTypes was specified as a function', () => {
const aggParam = new FieldParamType({
name: 'field',
type: 'field',
filterFieldTypes: (aggConfig: IMetricAggConfig) =>
get(aggConfig.schema, 'aggSettings.top_hits.allowStrings', false)
? '*'
: KBN_FIELD_TYPES.NUMBER,
});
const fields = aggParam.getAvailableFields(agg);

expect(fields.length).toBe(1);
expect(fields[0].type).toBe(KBN_FIELD_TYPES.NUMBER);
});

it('should return all fields if filterFieldTypes was specified as a function and aggSettings allow string type fields', () => {
const aggParam = new FieldParamType({
name: 'field',
type: 'field',
filterFieldTypes: (aggConfig: IMetricAggConfig) =>
get(aggConfig.schema, 'aggSettings.top_hits.allowStrings', false)
? '*'
: KBN_FIELD_TYPES.NUMBER,
});

agg.schema = {
aggSettings: {
top_hits: {
allowStrings: true,
},
},
} as Schema;

const fields = aggParam.getAvailableFields(agg);

expect(fields.length).toBe(2);
});
Expand Down
Loading

0 comments on commit e33dd8d

Please sign in to comment.