Skip to content

Commit

Permalink
Merge branch 'master' into update-alert-status-usage
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Aug 19, 2021
2 parents a3e44b5 + e14f814 commit 736b94b
Show file tree
Hide file tree
Showing 82 changed files with 6,851 additions and 1,279 deletions.
4 changes: 4 additions & 0 deletions docs/settings/monitoring-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ For more information, see
monitoring back-end does not run and {kib} stats are not sent to the monitoring
cluster.

| `monitoring.ui.ccs.enabled`
| Set to `true` (default) to enable {ref}/modules-cross-cluster-search.html[cross-cluster search] of your monitoring data. The {ref}/modules-remote-clusters.html#remote-cluster-settings[`remote_cluster_client`] role must exist on each node.


| `monitoring.ui.elasticsearch.hosts`
| Specifies the location of the {es} cluster where your monitoring data is stored.
By default, this is the same as <<elasticsearch-hosts, `elasticsearch.hosts`>>. This setting enables
Expand Down
4 changes: 4 additions & 0 deletions packages/kbn-optimizer/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["@kbn/babel-preset/node_preset"],
"ignore": ["**/*.test.js"]
}
34 changes: 28 additions & 6 deletions packages/kbn-optimizer/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
load("//src/dev/bazel:index.bzl", "jsts_transpiler")

PKG_BASE_NAME = "kbn-optimizer"
PKG_REQUIRE_NAME = "@kbn/optimizer"
Expand Down Expand Up @@ -29,7 +30,7 @@ NPM_MODULE_EXTRA_FILES = [
"README.md"
]

SRC_DEPS = [
RUNTIME_DEPS = [
"//packages/kbn-config",
"//packages/kbn-dev-utils",
"//packages/kbn-std",
Expand Down Expand Up @@ -59,6 +60,22 @@ SRC_DEPS = [
]

TYPES_DEPS = [
"//packages/kbn-config",
"//packages/kbn-dev-utils",
"//packages/kbn-std",
"//packages/kbn-ui-shared-deps",
"//packages/kbn-utils",
"@npm//chalk",
"@npm//clean-webpack-plugin",
"@npm//cpy",
"@npm//del",
"@npm//execa",
"@npm//jest-diff",
"@npm//lmdb-store",
"@npm//pirates",
"@npm//resize-observer-polyfill",
"@npm//rxjs",
"@npm//zlib",
"@npm//@types/compression-webpack-plugin",
"@npm//@types/jest",
"@npm//@types/json-stable-stringify",
Expand All @@ -72,7 +89,11 @@ TYPES_DEPS = [
"@npm//@types/webpack-sources",
]

DEPS = SRC_DEPS + TYPES_DEPS
jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
)

ts_config(
name = "tsconfig",
Expand All @@ -84,13 +105,14 @@ ts_config(
)

ts_project(
name = "tsc",
name = "tsc_types",
args = ['--pretty'],
srcs = SRCS,
deps = DEPS,
deps = TYPES_DEPS,
declaration = True,
declaration_map = True,
out_dir = "target",
emit_declaration_only = True,
out_dir = "target_types",
source_map = True,
root_dir = "src",
tsconfig = ":tsconfig",
Expand All @@ -99,7 +121,7 @@ ts_project(
js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = DEPS + [":tsc"],
deps = RUNTIME_DEPS + [":target_node", ":tsc_types"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
Expand Down
12 changes: 0 additions & 12 deletions packages/kbn-optimizer/babel.config.js

This file was deleted.

4 changes: 2 additions & 2 deletions packages/kbn-optimizer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"version": "1.0.0",
"private": true,
"license": "SSPL-1.0 OR Elastic License 2.0",
"main": "./target/index.js",
"types": "./target/index.d.ts"
"main": "./target_node/index.js",
"types": "./target_types/index.d.ts"
}
3 changes: 2 additions & 1 deletion packages/kbn-optimizer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"extends": "../../tsconfig.bazel.json",
"compilerOptions": {
"outDir": "./target/types",
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"outDir": "./target_types",
"rootDir": "./src",
"sourceMap": true,
"sourceRoot": "../../../../packages/kbn-optimizer/src",
Expand Down
3 changes: 3 additions & 0 deletions packages/kbn-plugin-helpers/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@kbn/babel-preset/node_preset"]
}
25 changes: 19 additions & 6 deletions packages/kbn-plugin-helpers/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
load("//src/dev/bazel:index.bzl", "jsts_transpiler")

PKG_BASE_NAME = "kbn-plugin-helpers"
PKG_REQUIRE_NAME = "@kbn/plugin-helpers"
Expand All @@ -26,7 +27,7 @@ NPM_MODULE_EXTRA_FILES = [
"README.md"
]

SRC_DEPS = [
RUNTIME_DEPS = [
"//packages/kbn-dev-utils",
"//packages/kbn-optimizer",
"//packages/kbn-utils",
Expand All @@ -41,6 +42,13 @@ SRC_DEPS = [
]

TYPES_DEPS = [
"//packages/kbn-dev-utils",
"//packages/kbn-optimizer",
"//packages/kbn-utils",
"@npm//del",
"@npm//execa",
"@npm//globby",
"@npm//load-json-file",
"@npm//@types/extract-zip",
"@npm//@types/gulp-zip",
"@npm//@types/inquirer",
Expand All @@ -49,7 +57,11 @@ TYPES_DEPS = [
"@npm//@types/vinyl-fs",
]

DEPS = SRC_DEPS + TYPES_DEPS
jsts_transpiler(
name = "target_node",
srcs = SRCS,
build_pkg_name = package_name(),
)

ts_config(
name = "tsconfig",
Expand All @@ -61,13 +73,14 @@ ts_config(
)

ts_project(
name = "tsc",
name = "tsc_types",
args = ['--pretty'],
srcs = SRCS,
deps = DEPS,
deps = TYPES_DEPS,
declaration = True,
declaration_map = True,
out_dir = "target",
emit_declaration_only = True,
out_dir = "target_types",
source_map = True,
root_dir = "src",
tsconfig = ":tsconfig",
Expand All @@ -76,7 +89,7 @@ ts_project(
js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = DEPS + [":tsc"],
deps = RUNTIME_DEPS + [":target_node", ":tsc_types"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-plugin-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"kibana": {
"devOnly": true
},
"main": "target/index.js",
"types": "target/index.d.ts",
"main": "target_node/index.js",
"types": "target_types/index.d.ts",
"bin": {
"plugin-helpers": "bin/plugin-helpers.js"
}
Expand Down
5 changes: 3 additions & 2 deletions packages/kbn-plugin-helpers/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"extends": "../../tsconfig.bazel.json",
"compilerOptions": {
"outDir": "target",
"target": "ES2018",
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"outDir": "target_types",
"sourceMap": true,
"sourceRoot": "../../../../packages/kbn-plugin-helpers/src",
"target": "ES2018",
"types": [
"jest",
"node"
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-test/src/jest/setup/babel_polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
// Note: In theory importing the polyfill should not be needed, as Babel should
// include the necessary polyfills when using `@babel/preset-env`, but for some
// reason it did not work. See https://github.com/elastic/kibana/issues/14506
import '@kbn/optimizer/target/node/polyfill';
import '@kbn/optimizer/target_node/node/polyfill';
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ const apmRoutes = route([
}),
}),
]),
defaults: {
query: {
rangeFrom: 'now-15m',
rangeTo: 'now',
},
},
},
{
path: '/',
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/apm/public/components/routing/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { i18n } from '@kbn/i18n';
import { Outlet } from '@kbn/typed-react-router-config';
import * as t from 'io-ts';
import React from 'react';
import { Redirect } from 'react-router-dom';
import { RedirectTo } from '../redirect_to';
import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values';
import { environmentRt } from '../../../../common/environment_rt';
import { BackendDetailOverview } from '../../app/backend_detail_overview';
Expand Down Expand Up @@ -121,7 +121,7 @@ export const home = {
},
{
path: '/',
element: <Redirect to="/services" />,
element: <RedirectTo pathname="/services" />,
},
],
} as const;
63 changes: 40 additions & 23 deletions x-pack/plugins/apm/public/components/routing/redirect_to.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,50 @@
*/

import React from 'react';
import { Redirect, RouteComponentProps } from 'react-router-dom';
import { Location } from 'history';
import { Redirect, useLocation, RouteComponentProps } from 'react-router-dom';

/**
* Given a path, redirect to that location, preserving the search and maintaining
* backward-compatibilty with legacy (pre-7.9) hash-based URLs.
* Function that returns a react component to redirect to a given pathname removing hash-based URLs
* @param pathname
*/
export function redirectTo(to: string) {
export function redirectTo(pathname: string) {
return ({ location }: RouteComponentProps<{}>) => {
let resolvedUrl: URL | undefined;
return <RenderRedirectTo location={location} pathname={pathname} />;
};
}

// Redirect root URLs with a hash to support backward compatibility with URLs
// from before we switched to the non-hash platform history.
if (location.pathname === '' && location.hash.length > 0) {
// We just want the search and pathname so the host doesn't matter
resolvedUrl = new URL(location.hash.slice(1), 'http://localhost');
to = resolvedUrl.pathname;
}
/**
* React component to redirect to a given pathname removing hash-based URLs
* @param param0
*/
export function RedirectTo({ pathname }: { pathname: string }) {
const location = useLocation();
return <RenderRedirectTo location={location} pathname={pathname} />;
}

return (
<Redirect
to={{
...location,
hash: '',
pathname: to,
search: resolvedUrl ? resolvedUrl.search : location.search,
}}
/>
);
};
interface Props {
location: Location;
pathname: string;
}

/**
* Given a pathname, redirect to that location, preserving the search and maintaining
* backward-compatibilty with legacy (pre-7.9) hash-based URLs.
*/
function RenderRedirectTo(props: Props) {
const { location } = props;
let search = location.search;
let pathname = props.pathname;

// Redirect root URLs with a hash to support backward compatibility with URLs
// from before we switched to the non-hash platform history.
if (location.pathname === '' && location.hash.length > 0) {
// We just want the search and pathname so the host doesn't matter
const resolvedUrl = new URL(location.hash.slice(1), 'http://localhost');
search = resolvedUrl.search;
pathname = resolvedUrl.pathname;
}

return <Redirect to={{ ...location, hash: '', pathname, search }} />;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

import { APMPlugin, APMRouteHandlerResources } from '../..';
import {
ExternalCallback,
PostPackagePolicyDeleteCallback,
PostPackagePolicyCreateCallback,
PutPackagePolicyUpdateCallback,
} from '../../../../fleet/server';
import {
Expand Down Expand Up @@ -60,7 +59,9 @@ export async function registerFleetPolicyCallbacks({
});
}

type ExternalCallbackParams = Parameters<ExternalCallback[1]>;
type ExternalCallbackParams =
| Parameters<PostPackagePolicyCreateCallback>
| Parameters<PutPackagePolicyUpdateCallback>;
export type PackagePolicy = NewPackagePolicy | UpdatePackagePolicy;
type Context = ExternalCallbackParams[1];
type Request = ExternalCallbackParams[2];
Expand All @@ -81,7 +82,7 @@ function registerPackagePolicyExternalCallback({
logger: NonNullable<APMPlugin['logger']>;
}) {
const callbackFn:
| PostPackagePolicyDeleteCallback
| PostPackagePolicyCreateCallback
| PutPackagePolicyUpdateCallback = async (
packagePolicy: PackagePolicy,
context: Context,
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/cases/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"id":"cases",
"kibanaVersion":"kibana",
"optionalPlugins":[
"ruleRegistry",
"security",
"spaces"
],
Expand Down
Loading

0 comments on commit 736b94b

Please sign in to comment.