Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into ilm-locators
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Jun 17, 2021
2 parents 08ddc4f + e3454ea commit b8b80e4
Show file tree
Hide file tree
Showing 579 changed files with 8,033 additions and 6,327 deletions.
10 changes: 10 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,16 @@ module.exports = {
},
},

/**
* Cases overrides
*/
{
files: ['x-pack/plugins/cases/**/*.{js,mjs,ts,tsx}'],
rules: {
'no-duplicate-imports': 'error',
},
},

/**
* Security Solution overrides
*/
Expand Down
1 change: 1 addition & 0 deletions docs/developer/getting-started/monorepo-packages.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ yarn kbn watch-bazel
- @kbn/monaco
- @kbn/rule-data-utils
- @kbn/securitysolution-es-utils
- @kbn/securitysolution-hook-utils
- @kbn/securitysolution-io-ts-alerting-types
- @kbn/securitysolution-io-ts-list-types
- @kbn/securitysolution-io-ts-types
Expand Down
40 changes: 18 additions & 22 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -261,52 +261,48 @@ The plugin exposes the static DefaultEditorController class to consume.
|The markdown visualization that can be used to place text panels on dashboards.
|{kib-repo}blob/{branch}/src/plugins/vis_type_metric/README.md[visTypeMetric]
|Contains the metric visualization.
|{kib-repo}blob/{branch}/src/plugins/vis_type_metric[visTypeMetric]
|WARNING: Missing README.
|{kib-repo}blob/{branch}/src/plugins/vis_type_pie/README.md[visTypePie]
|Contains the pie chart implementation using the elastic-charts library. The goal is to eventually deprecate the old implementation and keep only this. Until then, the library used is defined by the Legacy charts library advanced setting.
|{kib-repo}blob/{branch}/src/plugins/vis_type_pie[visTypePie]
|WARNING: Missing README.
|{kib-repo}blob/{branch}/src/plugins/vis_type_table/README.md[visTypeTable]
|Contains the data table visualization, that allows presenting data in a simple table format.
|{kib-repo}blob/{branch}/src/plugins/vis_type_tagcloud/README.md[visTypeTagcloud]
|Contains the tagcloud visualization.
|{kib-repo}blob/{branch}/src/plugins/vis_type_tagcloud[visTypeTagcloud]
|WARNING: Missing README.
|{kib-repo}blob/{branch}/src/plugins/vis_type_timelion/README.md[visTypeTimelion]
|Contains the timelion visualization and the timelion backend.
|{kib-repo}blob/{branch}/src/plugins/vis_type_timeseries/README.md[visTypeTimeseries]
|Contains everything around TSVB (the editor, visualizatin implementations and backends).
|{kib-repo}blob/{branch}/src/plugins/vis_type_timeseries[visTypeTimeseries]
|WARNING: Missing README.
|{kib-repo}blob/{branch}/src/plugins/vis_type_vega/README.md[visTypeVega]
|Contains the Vega visualization.
|{kib-repo}blob/{branch}/src/plugins/vis_type_vega[visTypeVega]
|WARNING: Missing README.
|{kib-repo}blob/{branch}/src/plugins/vis_type_vislib/README.md[visTypeVislib]
|Contains the vislib visualizations. These are the classical area/line/bar, pie, gauge/goal and
heatmap charts.
|{kib-repo}blob/{branch}/src/plugins/vis_type_vislib[visTypeVislib]
|WARNING: Missing README.
|{kib-repo}blob/{branch}/src/plugins/vis_type_xy/README.md[visTypeXy]
|Contains the new xy-axis chart using the elastic-charts library, which will eventually
replace the vislib xy-axis charts including bar, area, and line.
|{kib-repo}blob/{branch}/src/plugins/vis_type_xy[visTypeXy]
|WARNING: Missing README.
|{kib-repo}blob/{branch}/src/plugins/visualizations/README.md[visualizations]
|Contains most of the visualization infrastructure, e.g. the visualization type registry or the
visualization embeddable.
|{kib-repo}blob/{branch}/src/plugins/visualizations[visualizations]
|WARNING: Missing README.
|{kib-repo}blob/{branch}/src/plugins/visualize/README.md[visualize]
|Contains the visualize application which includes the listing page and the app frame,
which will load the visualization's editor.
|{kib-repo}blob/{branch}/src/plugins/visualize[visualize]
|WARNING: Missing README.
|===
Expand Down
Binary file not shown.
7 changes: 3 additions & 4 deletions docs/user/monitoring/kibana-alerts.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ best practices recommended by Elastic. However, you can tailor them to meet your
specific needs.

[role="screenshot"]
image::user/monitoring/images/monitoring-kibana-alerts.png["{kib} alerts in {stack-monitor-app}"]
image::user/monitoring/images/monitoring-kibana-alerting-notification.png["{kib} alerting notifications in {stack-monitor-app}"]

When you open *{stack-monitor-app}*, the preconfigured rules are created
automatically. They are initially configured to detect and notify on various
Expand All @@ -23,9 +23,8 @@ been recreated as rules in {kib} {alert-features}. For this reason, the existing
The default action for all {stack-monitor-app} rules is to write to {kib} logs
and display a notification in the UI.

[role="screenshot"]
image::user/monitoring/images/monitoring-kibana-alerting-notification.png["{kib} alerting notifications in {stack-monitor-app}"]

To review and modify all available rules, use *Enter setup mode* on the
*Cluster overview* page in *{stack-monitor-app}*:

[role="screenshot"]
image::user/monitoring/images/monitoring-kibana-alerting-setup-mode.png["Modify {kib} alerting rules in {stack-monitor-app}"]
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"@kbn/rule-data-utils": "link:bazel-bin/packages/kbn-rule-data-utils",
"@kbn/securitysolution-list-constants": "link:bazel-bin/packages/kbn-securitysolution-list-constants",
"@kbn/securitysolution-es-utils": "link:bazel-bin/packages/kbn-securitysolution-es-utils",
"@kbn/securitysolution-hook-utils": "link:bazel-bin/packages/kbn-securitysolution-hook-utils",
"@kbn/securitysolution-io-ts-types": "link:bazel-bin/packages/kbn-securitysolution-io-ts-types",
"@kbn/securitysolution-io-ts-alerting-types": "link:bazel-bin/packages/kbn-securitysolution-io-ts-alerting-types",
"@kbn/securitysolution-io-ts-list-types": "link:bazel-bin/packages/kbn-securitysolution-io-ts-list-types",
Expand Down
1 change: 1 addition & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ filegroup(
"//packages/kbn-securitysolution-list-utils:build",
"//packages/kbn-securitysolution-utils:build",
"//packages/kbn-securitysolution-es-utils:build",
"//packages/kbn-securitysolution-hook-utils:build",
"//packages/kbn-server-http-tools:build",
"//packages/kbn-server-route-repository:build",
"//packages/kbn-std:build",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,6 @@ pageLoadAssetSize:
banners: 17946
mapsEms: 26072
timelines: 28613
cases: 162385
screenshotMode: 17856
visTypePie: 35583
cases: 144442
87 changes: 87 additions & 0 deletions packages/kbn-securitysolution-hook-utils/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")

PKG_BASE_NAME = "kbn-securitysolution-hook-utils"

PKG_REQUIRE_NAME = "@kbn/securitysolution-hook-utils"

SOURCE_FILES = glob(
[
"src/**/*.ts",
],
exclude = [
"**/*.test.*",
"**/*.mock.*",
],
)

SRCS = SOURCE_FILES

filegroup(
name = "srcs",
srcs = SRCS,
)

NPM_MODULE_EXTRA_FILES = [
"package.json",
"README.md",
]

SRC_DEPS = [
"@npm//react",
"@npm//rxjs",
"@npm//tslib",
]

TYPES_DEPS = [
"@npm//@types/jest",
"@npm//@types/node",
"@npm//@types/react",
]

DEPS = SRC_DEPS + TYPES_DEPS

ts_config(
name = "tsconfig",
src = "tsconfig.json",
deps = [
"//:tsconfig.base.json",
],
)

ts_project(
name = "tsc",
srcs = SRCS,
args = ["--pretty"],
declaration = True,
declaration_map = True,
incremental = True,
out_dir = "target",
root_dir = "src",
source_map = True,
tsconfig = ":tsconfig",
deps = DEPS,
)

js_library(
name = PKG_BASE_NAME,
package_name = PKG_REQUIRE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
visibility = ["//visibility:public"],
deps = DEPS + [":tsc"],
)

pkg_npm(
name = "npm_module",
deps = [
":%s" % PKG_BASE_NAME,
],
)

filegroup(
name = "build",
srcs = [
":npm_module",
],
visibility = ["//visibility:public"],
)
3 changes: 3 additions & 0 deletions packages/kbn-securitysolution-hook-utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# kbn-securitysolution-hook-utils

This package contains shared utilities for React hooks.
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
* Side Public License, v 1.
*/

export { QueryActionsProvider } from './actions';
export { createInitialLoadingStatusState } from './state';
module.exports = {
preset: '@kbn/test',
rootDir: '../..',
roots: ['<rootDir>/packages/kbn-securitysolution-hook-utils'],
};
9 changes: 9 additions & 0 deletions packages/kbn-securitysolution-hook-utils/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "@kbn/securitysolution-hook-utils",
"version": "1.0.0",
"description": "Security Solution utilities for React hooks",
"license": "SSPL-1.0 OR Elastic License 2.0",
"main": "./target/index.js",
"types": "./target/index.d.ts",
"private": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Side Public License, v 1.
*/

export { getQueryParameterActions } from './actions';
export { MAX_CONTEXT_SIZE, MIN_CONTEXT_SIZE, QUERY_PARAMETER_KEYS } from './constants';
export { createInitialQueryParametersState } from './state';
export * from './use_async';
export * from './use_is_mounted';
export * from './use_observable';
export * from './with_optional_signal';
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
* Side Public License, v 1.
*/

import { LoadingStatus, LoadingStatusState } from '../../context_app_state';

export function createInitialLoadingStatusState(): LoadingStatusState {
return {
anchor: LoadingStatus.UNINITIALIZED,
predecessors: LoadingStatus.UNINITIALIZED,
successors: LoadingStatus.UNINITIALIZED,
};
/**
* Represents the state of an asynchronous task, along with an initiator
* function to kick off the work.
*/
export interface Task<Args extends unknown[], Result> {
loading: boolean;
error: unknown | undefined;
result: Result | undefined;
start: (...args: Args) => void;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@

import { useCallback, useState } from 'react';

import { Task } from '../types';
import { useIsMounted } from '../use_is_mounted';

// TODO: This is probably better off in another package such as kbn-securitysolution-hook-utils

export interface Async<Args extends unknown[], Result> {
loading: boolean;
error: unknown | undefined;
result: Result | undefined;
start: (...args: Args) => void;
}

/**
*
* @param fn Async function
* This hook wraps a promise-returning thunk (task) in order to conditionally
* initiate the work, and automatically provide state corresponding to the
* task's status.
*
* In order to function properly and not rerender unnecessarily, ensure that
* your task is a stable function reference.
*
* @param fn a function returning a promise.
*
* @returns An {@link AsyncTask} containing the underlying task's state along with a start callback
* @returns An {@link Task} containing the task's current state along with a
* start callback
*/
export const useAsync = <Args extends unknown[], Result>(
fn: (...args: Args) => Promise<Result>
): Async<Args, Result> => {
): Task<Args, Result> => {
const isMounted = useIsMounted();
const [loading, setLoading] = useState(false);
const [error, setError] = useState<unknown | undefined>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import { useCallback, useEffect, useRef } from 'react';

type GetIsMounted = () => boolean;

// TODO: This is probably better off in another package such as kbn-securitysolution-hook-utils

/**
*
* @returns A {@link GetIsMounted} getter function returning whether the component is currently mounted
Expand Down
Loading

0 comments on commit b8b80e4

Please sign in to comment.