Skip to content

Commit

Permalink
Merge branch 'master' into task/add-supported-field-ransomware
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored May 18, 2021
2 parents fa919b2 + 79c94d3 commit d906611
Show file tree
Hide file tree
Showing 460 changed files with 5,190 additions and 6,886 deletions.
4 changes: 2 additions & 2 deletions docs/user/dashboard/timelion.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Instead of using a visual editor to create charts, you define a graph by chaining functions together, using the *Timelion*-specific syntax.
The syntax enables some features that classical point series charts don't offer, such as pulling data from different indices or data sources into one graph.

deprecated::[7.0.0,"*Timelion* is still supported. The *Timelion app* is deprecated in 7.0, replaced by dashboard features. In 8.0 and later, the *Timelion app* is removed from {kib}. To prepare for the removal of *Timelion app*, you must migrate *Timelion app* worksheets to a dashboard. For information on how to migrate *Timelion app* worksheets, refer to the link:https://www.elastic.co/guide/en/kibana/7.10/release-notes-7.10.0.html#deprecation-v7.10.0[7.10.0 Release Notes]."]
deprecated::[7.0.0,"*Timelion* is still supported. The *Timelion app* is deprecated in 7.0, replaced by dashboard features. In the last 7.x minor version and later, the *Timelion app* is removed from {kib}. To prepare for the removal of *Timelion app*, you must migrate *Timelion app* worksheets to a dashboard. For information on how to migrate *Timelion app* worksheets, refer to the link:https://www.elastic.co/guide/en/kibana/7.10/release-notes-7.10.0.html#deprecation-v7.10.0[7.10.0 Release Notes]."]

[float]
==== Timelion expressions
Expand Down Expand Up @@ -554,4 +554,4 @@ Save and add the panel to the dashboard.

. Click *Save and return*.

For more information about *Timelion* conditions, refer to https://www.elastic.co/blog/timeseries-if-then-else-with-timelion[I have but one .condition()].
For more information about *Timelion* conditions, refer to https://www.elastic.co/blog/timeseries-if-then-else-with-timelion[I have but one .condition()].
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pageLoadAssetSize:
searchprofiler: 67080
security: 95864
securityOss: 30806
securitySolution: 187863
securitySolution: 76000
share: 99061
snapshotRestore: 79032
spaces: 57868
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/*
* 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.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { ElasticsearchClient } from 'src/core/server';
import { ElasticsearchClient } from '../elasticsearch_client';

interface AliasesResponse {
[indexName: string]: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/*
* 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.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { ElasticsearchClient } from 'src/core/server';
import { ElasticsearchClient } from '../elasticsearch_client';

/**
* Retrieves the count of documents in a given index
Expand Down
3 changes: 3 additions & 0 deletions packages/kbn-securitysolution-es-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ export * from './delete_all_index';
export * from './delete_policy';
export * from './delete_template';
export * from './elasticsearch_client';
export * from './get_index_aliases';
export * from './get_index_count';
export * from './get_index_exists';
export * from './get_policy_exists';
export * from './get_template_exists';
export * from './read_index';
export * from './read_privileges';
export * from './set_policy';
export * from './set_template';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/*
* 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.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { ElasticsearchClient } from 'kibana/server';
import { ElasticsearchClient } from '../elasticsearch_client';

export const readIndex = async (esClient: ElasticsearchClient, index: string): Promise<unknown> => {
return esClient.indices.get({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ export const from = new t.Type<string, string, unknown>(
t.identity
);
export type From = t.TypeOf<typeof from>;

export const fromOrUndefined = t.union([from, t.undefined]);
export type FromOrUndefined = t.TypeOf<typeof fromOrUndefined>;
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export * from './default_to_string';
export * from './default_uuid';
export * from './from';
export * from './language';
export * from './machine_learning_job_id';
export * from './max_signals';
export * from './normalized_ml_job_id';
export * from './references_default_array';
Expand All @@ -38,3 +39,4 @@ export * from './threat_subtechnique';
export * from './threat_tactic';
export * from './threat_technique';
export * from './throttle';
export * from './type';
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ import * as t from 'io-ts';

export const language = t.keyof({ eql: null, kuery: null, lucene: null });
export type Language = t.TypeOf<typeof language>;

export const languageOrUndefined = t.union([language, t.undefined]);
export type LanguageOrUndefined = t.TypeOf<typeof languageOrUndefined>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* 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 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

/* eslint-disable @typescript-eslint/naming-convention */

import * as t from 'io-ts';

import { machine_learning_job_id_normalized } from '../normalized_ml_job_id';

export const machine_learning_job_id = t.union([t.string, machine_learning_job_id_normalized]);
export type MachineLearningJobId = t.TypeOf<typeof machine_learning_job_id>;

export const machineLearningJobIdOrUndefined = t.union([machine_learning_job_id, t.undefined]);
export type MachineLearningJobIdOrUndefined = t.TypeOf<typeof machineLearningJobIdOrUndefined>;
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ import { PositiveIntegerGreaterThanZero } from '@kbn/securitysolution-io-ts-type

export const max_signals = PositiveIntegerGreaterThanZero;
export type MaxSignals = t.TypeOf<typeof max_signals>;

export const maxSignalsOrUndefined = t.union([max_signals, t.undefined]);
export type MaxSignalsOrUndefined = t.TypeOf<typeof maxSignalsOrUndefined>;
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* Side Public License, v 1.
*/

/* eslint-disable @typescript-eslint/naming-convention */

import * as t from 'io-ts';
import { Either } from 'fp-ts/lib/Either';

Expand All @@ -26,3 +28,9 @@ export const RiskScore = new t.Type<number, number, unknown>(
);

export type RiskScoreC = typeof RiskScore;

export const risk_score = RiskScore;
export type RiskScore = t.TypeOf<typeof risk_score>;

export const riskScoreOrUndefined = t.union([risk_score, t.undefined]);
export type RiskScoreOrUndefined = t.TypeOf<typeof riskScoreOrUndefined>;
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@

import * as t from 'io-ts';
import { operator } from '@kbn/securitysolution-io-ts-types';
import { RiskScore } from '../risk_score';

export const riskScoreOrUndefined = t.union([RiskScore, t.undefined]);
export type RiskScoreOrUndefined = t.TypeOf<typeof riskScoreOrUndefined>;
import { riskScoreOrUndefined } from '../risk_score';

export const risk_score_mapping_field = t.string;
export const risk_score_mapping_value = t.string;
Expand All @@ -28,3 +25,6 @@ export const risk_score_mapping_item = t.exact(

export const risk_score_mapping = t.array(risk_score_mapping_item);
export type RiskScoreMapping = t.TypeOf<typeof risk_score_mapping>;

export const riskScoreMappingOrUndefined = t.union([risk_score_mapping, t.undefined]);
export type RiskScoreMappingOrUndefined = t.TypeOf<typeof riskScoreMappingOrUndefined>;
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ export type Threat = t.TypeOf<typeof threat>;

export const threats = t.array(threat);
export type Threats = t.TypeOf<typeof threats>;

export const threatsOrUndefined = t.union([threats, t.undefined]);
export type ThreatsOrUndefined = t.TypeOf<typeof threatsOrUndefined>;
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ export const threat_subtechnique = t.type({
});

export const threat_subtechniques = t.array(threat_subtechnique);

export type ThreatSubtechnique = t.TypeOf<typeof threat_subtechnique>;
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ export const threat_technique = t.intersection([
),
]);
export const threat_techniques = t.array(threat_technique);

export type ThreatTechnique = t.TypeOf<typeof threat_technique>;
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
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import * as t from 'io-ts';

export const type = t.keyof({
eql: null,
machine_learning: null,
query: null,
saved_query: null,
threshold: null,
threat_match: null,
});
export type Type = t.TypeOf<typeof type>;

export const typeOrUndefined = t.union([type, t.undefined]);
export type TypeOrUndefined = t.TypeOf<typeof typeOrUndefined>;
2 changes: 0 additions & 2 deletions packages/kbn-securitysolution-io-ts-list-types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export * from './default_create_comments_array';
export * from './default_namespace';
export * from './default_namespace_array';
export * from './default_update_comments_array';
export * from './default_version_number';
export * from './description';
export * from './endpoint';
export * from './entries';
Expand All @@ -43,4 +42,3 @@ export * from './type';
export * from './update_comment';
export * from './updated_at';
export * from './updated_by';
export * from './version';
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ export const type = t.keyof({

export const typeOrUndefined = t.union([type, t.undefined]);
export type Type = t.TypeOf<typeof type>;
export type TypeOrUndefined = t.TypeOf<typeof typeOrUndefined>;
2 changes: 2 additions & 0 deletions packages/kbn-securitysolution-io-ts-types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export * from './default_empty_string';
export * from './default_string_array';
export * from './default_string_boolean_false';
export * from './default_uuid';
export * from './default_version_number';
export * from './empty_string_array';
export * from './iso_date_string';
export * from './non_empty_array';
Expand All @@ -26,3 +27,4 @@ export * from './positive_integer';
export * from './positive_integer_greater_than_zero';
export * from './string_to_positive_number';
export * from './uuid';
export * from './version';
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import * as t from 'io-ts';
import { PositiveIntegerGreaterThanZero } from '@kbn/securitysolution-io-ts-types';
import { PositiveIntegerGreaterThanZero } from '../positive_integer_greater_than_zero';

/**
* Note this is just a positive number, but we use it as a type here which is still ok.
Expand All @@ -16,3 +16,6 @@ import { PositiveIntegerGreaterThanZero } from '@kbn/securitysolution-io-ts-type
*/
export const version = PositiveIntegerGreaterThanZero;
export type Version = t.TypeOf<typeof version>;

export const versionOrUndefined = t.union([version, t.undefined]);
export type VersionOrUndefined = t.TypeOf<typeof versionOrUndefined>;
3 changes: 3 additions & 0 deletions src/plugins/dashboard/common/saved_dashboard_references.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ export function extractReferences(
}

const { panels, state } = dashboardAttributesToState(attributes);
if (!Array.isArray(panels)) {
return { attributes, references };
}

if (((panels as unknown) as Array<Record<string, string>>).some(isPre730Panel)) {
return pre730ExtractReferences({ attributes, references }, deps);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,17 @@
* Side Public License, v 1.
*/

import { find, template } from 'lodash';
import { find } from 'lodash';
import $ from 'jquery';
import openRowHtml from './table_row/open.html';
import detailsHtml from './table_row/details.html';
import { dispatchRenderComplete } from '../../../../../../kibana_utils/public';
import { DOC_HIDE_TIME_COLUMN_SETTING } from '../../../../../common';
import cellTemplateHtml from '../components/table_row/cell.html';
import truncateByHeightTemplateHtml from '../components/table_row/truncate_by_height.html';
import { getServices } from '../../../../kibana_services';
import { getContextUrl } from '../../../helpers/get_context_url';
import { formatRow, formatTopLevelObject } from '../../helpers';

const TAGS_WITH_WS = />\s+</g;

/**
* Remove all of the whitespace between html tags
* so that inline elements don't have extra spaces.
*/
export function noWhiteSpace(html: string): string {
return html.replace(TAGS_WITH_WS, '><');
}
import { truncateByHeight } from './table_row/truncate_by_height';
import { cell } from './table_row/cell';

// guesstimate at the minimum number of chars wide cells in the table should be
const MIN_LINE_LENGTH = 20;
Expand All @@ -37,9 +27,6 @@ interface LazyScope extends ng.IScope {
}

export function createTableRowDirective($compile: ng.ICompileService) {
const cellTemplate = template(noWhiteSpace(cellTemplateHtml));
const truncateByHeightTemplate = template(noWhiteSpace(truncateByHeightTemplateHtml));

return {
restrict: 'A',
scope: {
Expand Down Expand Up @@ -133,7 +120,7 @@ export function createTableRowDirective($compile: ng.ICompileService) {
const hideTimeColumn = getServices().uiSettings.get(DOC_HIDE_TIME_COLUMN_SETTING, false);
if (indexPattern.timeFieldName && !hideTimeColumn) {
newHtmls.push(
cellTemplate({
cell({
timefield: true,
formatted: _displayField(row, indexPattern.timeFieldName),
filterable: mapping(indexPattern.timeFieldName).filterable && $scope.filter,
Expand All @@ -146,7 +133,7 @@ export function createTableRowDirective($compile: ng.ICompileService) {
const formatted = formatRow(row, indexPattern);

newHtmls.push(
cellTemplate({
cell({
timefield: false,
sourcefield: true,
formatted,
Expand All @@ -164,7 +151,7 @@ export function createTableRowDirective($compile: ng.ICompileService) {
})
);
newHtmls.push(
cellTemplate({
cell({
timefield: false,
sourcefield: true,
formatted: formatTopLevelObject(row, innerColumns, indexPattern),
Expand All @@ -174,7 +161,7 @@ export function createTableRowDirective($compile: ng.ICompileService) {
);
} else {
newHtmls.push(
cellTemplate({
cell({
timefield: false,
sourcefield: column === '_source',
formatted: _displayField(row, column, true),
Expand All @@ -191,8 +178,8 @@ export function createTableRowDirective($compile: ng.ICompileService) {
const $cell = $cells.eq(i);
if ($cell.data('discover:html') === html) return;

const reuse = find($cells.slice(i + 1), (cell) => {
return $.data(cell, 'discover:html') === html;
const reuse = find($cells.slice(i + 1), (c) => {
return $.data(c, 'discover:html') === html;
});

const $target = reuse ? $(reuse).detach() : $(html);
Expand Down Expand Up @@ -231,7 +218,7 @@ export function createTableRowDirective($compile: ng.ICompileService) {
const text = indexPattern.formatField(row, fieldName);

if (truncate && text.length > MIN_LINE_LENGTH) {
return truncateByHeightTemplate({
return truncateByHeight({
body: text,
});
}
Expand Down
Loading

0 comments on commit d906611

Please sign in to comment.