Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/kibana into lens/97421/fo…
Browse files Browse the repository at this point in the history
…cus-fixes
  • Loading branch information
MichaelMarcialis committed Jul 23, 2021
2 parents 1287e98 + a8da74d commit f04db4c
Show file tree
Hide file tree
Showing 126 changed files with 4,584 additions and 3,581 deletions.
1 change: 1 addition & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"paths": {
"autocomplete": "packages/kbn-securitysolution-autocomplete/src",
"console": "src/plugins/console",
"core": "src/core",
"discover": "src/plugins/discover",
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 @@ -91,6 +91,7 @@ yarn kbn watch-bazel
- @kbn/optimizer
- @kbn/plugin-helpers
- @kbn/rule-data-utils
- @kbn/securitysolution-autocomplete
- @kbn/securitysolution-es-utils
- @kbn/securitysolution-hook-utils
- @kbn/securitysolution-io-ts-alerting-types
Expand Down
64 changes: 13 additions & 51 deletions docs/management/upgrade-assistant/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,22 @@
[[upgrade-assistant]]
== Upgrade Assistant

The Upgrade Assistant helps you prepare for your upgrade to the next major {es} version.
For example, if you are using 6.8, the Upgrade Assistant helps you to upgrade to 7.0.
To access the assistant, open the main menu, then click *Stack Management > Upgrade Assistant*.
The Upgrade Assistant helps you prepare for your upgrade
to the next major version of the Elastic Stack.
To access the assistant, open the main menu and go to *Stack Management > Upgrade Assistant*.

The assistant identifies the deprecated settings in your cluster and indices
and guides you through the process of resolving issues, including reindexing.
The assistant identifies deprecated settings in your configuration,
enables you to see if you are using deprecated features,
and guides you through the process of resolving issues.

Before you upgrade, make sure that you are using the latest released minor
version of {es} to see the most up-to-date deprecation issues.
For example, if you want to upgrade to 7.0, make sure that you are using 6.8.
If you have indices that were created prior to 7.0,
you can use the assistant to reindex them so they can be accessed from 8.0.

[float]
IMPORTANT: To see the most up-to-date deprecation information before
upgrading to 8.0, upgrade to the latest 7.n release.

[discrete]
=== Required permissions

The `manage` cluster privilege is required to access the *Upgrade assistant*.
Additional privileges may be needed to perform certain actions.

To add the privilege, open the main menu, then click *Stack Management > Roles*.

[float]
=== Reindexing

The *Indices* page lists the indices that are incompatible with the next
major version of {es}. You can initiate a reindex to resolve the issues.

[role="screenshot"]
image::images/management-upgrade-assistant-9.0.png[]

For a preview of how the data will change during the reindex, select the
index name. A warning appears if the index requires destructive changes.
Back up your index, then proceed with the reindex by accepting each breaking change.

You can follow the progress as the Upgrade Assistant makes the index read-only,
creates a new index, reindexes the documents, and creates an alias that points
from the old index to the new one.

If the reindexing fails or is cancelled, the changes are rolled back, the
new index is deleted, and the original index becomes writable. An error
message explains the reason for the failure.

You can reindex multiple indices at a time, but keep an eye on the
{es} metrics, including CPU usage, memory pressure, and disk usage. If a
metric is so high it affects query performance, cancel the reindex and
continue by reindexing fewer indices at a time.

Additional considerations:

* If you use {alert-features}, when you reindex the internal indices
(`.watches`), the {watcher} process pauses and no alerts are triggered.

* If you use {ml-features}, when you reindex the internal indices (`.ml-state`),
the {ml} jobs pause and models are not trained or updated.

* If you use {security-features}, before you reindex the internal indices
(`.security*`), it is a good idea to create a temporary superuser account in the
`file` realm. For more information, see
{ref}/configuring-file-realm.html[Configuring a file realm].
Additional privileges may be needed to perform certain actions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"@kbn/mapbox-gl": "link:bazel-bin/packages/kbn-mapbox-gl",
"@kbn/monaco": "link:bazel-bin/packages/kbn-monaco",
"@kbn/rule-data-utils": "link:bazel-bin/packages/kbn-rule-data-utils",
"@kbn/securitysolution-autocomplete": "link:bazel-bin/packages/kbn-securitysolution-autocomplete",
"@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-alerting-types": "link:bazel-bin/packages/kbn-securitysolution-io-ts-alerting-types",
Expand Down
1 change: 1 addition & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ filegroup(
"//packages/kbn-plugin-generator:build",
"//packages/kbn-plugin-helpers:build",
"//packages/kbn-rule-data-utils:build",
"//packages/kbn-securitysolution-autocomplete:build",
"//packages/kbn-securitysolution-list-constants:build",
"//packages/kbn-securitysolution-io-ts-types:build",
"//packages/kbn-securitysolution-io-ts-alerting-types:build",
Expand Down
125 changes: 125 additions & 0 deletions packages/kbn-securitysolution-autocomplete/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
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-autocomplete"

PKG_REQUIRE_NAME = "@kbn/securitysolution-autocomplete"

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

SRCS = SOURCE_FILES

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

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

SRC_DEPS = [
"//packages/kbn-babel-preset",
"//packages/kbn-dev-utils",
"//packages/kbn-i18n",
"//packages/kbn-securitysolution-io-ts-list-types",
"//packages/kbn-securitysolution-list-hooks",
"@npm//@babel/core",
"@npm//babel-loader",
"@npm//@elastic/eui",
"@npm//react",
"@npm//resize-observer-polyfill",
"@npm//rxjs",
"@npm//tslib",
]

TYPES_DEPS = [
"@npm//typescript",
"@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_config(
name = "tsconfig_browser",
src = "tsconfig.browser.json",
deps = [
"//:tsconfig.base.json",
"//:tsconfig.browser.json",
],
)

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

ts_project(
name = "tsc_browser",
args = ['--pretty'],
srcs = SRCS,
deps = DEPS,
allow_js = True,
declaration = False,
incremental = True,
out_dir = "target_web",
source_map = True,
root_dir = "src",
tsconfig = ":tsconfig_browser",
)

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

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

filegroup(
name = "build",
srcs = [
":npm_module",
],
visibility = ["//visibility:public"],
)
19 changes: 19 additions & 0 deletions packages/kbn-securitysolution-autocomplete/babel.config.js
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.
*/

module.exports = {
env: {
web: {
presets: ['@kbn/babel-preset/webpack_preset'],
},
node: {
presets: ['@kbn/babel-preset/node_preset'],
},
},
ignore: ['**/*.test.ts', '**/*.test.tsx'],
};
13 changes: 13 additions & 0 deletions packages/kbn-securitysolution-autocomplete/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* 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.
*/

module.exports = {
preset: '@kbn/test',
rootDir: '../..',
roots: ['<rootDir>/packages/kbn-securitysolution-autocomplete'],
};
10 changes: 10 additions & 0 deletions packages/kbn-securitysolution-autocomplete/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@kbn/securitysolution-autocomplete",
"version": "1.0.0",
"description": "Security Solution auto complete",
"license": "SSPL-1.0 OR Elastic License 2.0",
"browser": "./target_web/index.js",
"main": "./target_node/index.js",
"types": "./target_types/index.d.ts",
"private": true
}
5 changes: 5 additions & 0 deletions packages/kbn-securitysolution-autocomplete/react/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"browser": "../target_web/react",
"main": "../target_node/react",
"types": "../target_types/react/index.d.ts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* 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.
*/

// Copied from "src/plugins/data/public/mocks.ts" but without any type information
// TODO: Remove this in favor of the data/public/mocks if/when they become available, https://github.com/elastic/kibana/issues/100715
export const autocompleteStartMock = {
getQuerySuggestions: jest.fn(),
getValueSuggestions: jest.fn(),
hasQuerySuggestions: jest.fn(),
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* 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 { checkEmptyValue } from '.';
import { getField } from '../fields/index.mock';
import * as i18n from '../translations';

describe('check_empty_value', () => {
test('returns no errors if no field has been selected', () => {
const isValid = checkEmptyValue('', undefined, true, false);

expect(isValid).toBeUndefined();
});

test('returns error string if user has touched a required input and left empty', () => {
const isValid = checkEmptyValue(undefined, getField('@timestamp'), true, true);

expect(isValid).toEqual(i18n.FIELD_REQUIRED_ERR);
});

test('returns no errors if required input is empty but user has not yet touched it', () => {
const isValid = checkEmptyValue(undefined, getField('@timestamp'), true, false);

expect(isValid).toBeUndefined();
});

test('returns no errors if user has touched an input that is not required and left empty', () => {
const isValid = checkEmptyValue(undefined, getField('@timestamp'), false, true);

expect(isValid).toBeUndefined();
});

test('returns no errors if user has touched an input that is not required and left empty string', () => {
const isValid = checkEmptyValue('', getField('@timestamp'), false, true);

expect(isValid).toBeUndefined();
});

test('returns null if input value is not empty string or undefined', () => {
const isValid = checkEmptyValue('hellooo', getField('@timestamp'), false, true);

expect(isValid).toBeNull();
});
});
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
* 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 i18n from '../translations';

// TODO: I have to use any here for now, but once this is available below, we should use the correct types, https://github.com/elastic/kibana/issues/105731
// import { IFieldType } from '../../../../../../../src/plugins/data/common';
type IFieldType = any;

/**
* Determines if empty value is ok
*/
export const checkEmptyValue = (
param: string | undefined,
field: IFieldType | undefined,
isRequired: boolean,
touched: boolean
): string | undefined | null => {
if (isRequired && touched && (param == null || param.trim() === '')) {
return i18n.FIELD_REQUIRED_ERR;
}

if (
field == null ||
(isRequired && !touched) ||
(!isRequired && (param == null || param === ''))
) {
return undefined;
}

return null;
};
Loading

0 comments on commit f04db4c

Please sign in to comment.