Skip to content

Commit

Permalink
Merge branch 'master' into canvas/fix-32937
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Aug 27, 2021
2 parents 786787a + 1274024 commit fe5ed13
Show file tree
Hide file tree
Showing 39 changed files with 757 additions and 359 deletions.
4 changes: 4 additions & 0 deletions packages/kbn-securitysolution-list-api/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["@kbn/babel-preset/node_preset"],
"ignore": ["**/*.test.ts", "**/*.test.tsx"]
}
4 changes: 4 additions & 0 deletions packages/kbn-securitysolution-list-api/.babelrc.browser
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["@kbn/babel-preset/webpack_preset"],
"ignore": ["**/*.test.ts", "**/*.test.tsx"]
}
35 changes: 26 additions & 9 deletions packages/kbn-securitysolution-list-api/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-securitysolution-list-api"

Expand Down Expand Up @@ -27,21 +28,36 @@ NPM_MODULE_EXTRA_FILES = [
"README.md",
]

SRC_DEPS = [
RUNTIME_DEPS = [
"//packages/kbn-securitysolution-io-ts-list-types",
"//packages/kbn-securitysolution-io-ts-utils",
"//packages/kbn-securitysolution-list-constants",
"//packages/kbn-securitysolution-io-ts-list-types",
"@npm//fp-ts",
"@npm//io-ts",
"@npm//tslib",
]

TYPES_DEPS = [
"//packages/kbn-securitysolution-io-ts-list-types",
"//packages/kbn-securitysolution-io-ts-utils",
"//packages/kbn-securitysolution-list-constants",
"@npm//fp-ts",
"@npm//io-ts",
"@npm//@types/jest",
"@npm//@types/node",
]

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

jsts_transpiler(
name = "target_web",
srcs = SRCS,
build_pkg_name = package_name(),
config_file = ".babelrc.browser"
)

ts_config(
name = "tsconfig",
Expand All @@ -53,24 +69,25 @@ ts_config(
)

ts_project(
name = "tsc",
name = "tsc_types",
srcs = SRCS,
deps = TYPES_DEPS,
args = ["--pretty"],
declaration = True,
declaration_map = True,
out_dir = "target",
emit_declaration_only = True,
out_dir = "target_types",
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,
deps = RUNTIME_DEPS + [":target_node", ":target_web", ":tsc_types"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
deps = DEPS + [":tsc"],
)

pkg_npm(
Expand Down
5 changes: 3 additions & 2 deletions packages/kbn-securitysolution-list-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "1.0.0",
"description": "security solution list REST API",
"license": "SSPL-1.0 OR Elastic License 2.0",
"main": "./target/index.js",
"types": "./target/index.d.ts",
"browser": "./target_web/index.js",
"main": "./target_node/index.js",
"types": "./target_types/index.d.ts",
"private": true
}
3 changes: 2 additions & 1 deletion packages/kbn-securitysolution-list-api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"outDir": "target",
"emitDeclarationOnly": true,
"outDir": "target_types",
"rootDir": "src",
"sourceMap": true,
"sourceRoot": "../../../../packages/kbn-securitysolution-list-api/src",
Expand Down
4 changes: 4 additions & 0 deletions packages/kbn-securitysolution-list-constants/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["@kbn/babel-preset/node_preset"],
"ignore": ["**/*.test.ts", "**/*.test.tsx"]
}
4 changes: 4 additions & 0 deletions packages/kbn-securitysolution-list-constants/.babelrc.browser
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["@kbn/babel-preset/webpack_preset"],
"ignore": ["**/*.test.ts", "**/*.test.tsx"]
}
29 changes: 20 additions & 9 deletions packages/kbn-securitysolution-list-constants/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-securitysolution-list-constants"

Expand Down Expand Up @@ -27,16 +28,25 @@ NPM_MODULE_EXTRA_FILES = [
"README.md",
]

SRC_DEPS = [
"@npm//tslib",
]
RUNTIME_DEPS = []

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

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

jsts_transpiler(
name = "target_web",
srcs = SRCS,
build_pkg_name = package_name(),
config_file = ".babelrc.browser"
)

ts_config(
name = "tsconfig",
Expand All @@ -48,24 +58,25 @@ ts_config(
)

ts_project(
name = "tsc",
name = "tsc_types",
srcs = SRCS,
deps = TYPES_DEPS,
args = ["--pretty"],
declaration = True,
declaration_map = True,
out_dir = "target",
emit_declaration_only = True,
out_dir = "target_types",
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,
deps = RUNTIME_DEPS + [":target_node", ":target_web", ":tsc_types"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
deps = DEPS + [":tsc"],
)

pkg_npm(
Expand Down
5 changes: 3 additions & 2 deletions packages/kbn-securitysolution-list-constants/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"version": "1.0.0",
"description": "security solution list constants to use across plugins such lists, security_solution, cases, etc...",
"license": "SSPL-1.0 OR Elastic License 2.0",
"main": "./target/index.js",
"types": "./target/index.d.ts",
"browser": "./target_web/index.js",
"main": "./target_node/index.js",
"types": "./target_types/index.d.ts",
"private": true
}
3 changes: 2 additions & 1 deletion packages/kbn-securitysolution-list-constants/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"outDir": "target",
"emitDeclarationOnly": true,
"outDir": "target_types",
"rootDir": "src",
"sourceMap": true,
"sourceRoot": "../../../../packages/kbn-securitysolution-list-constants/src",
Expand Down
3 changes: 0 additions & 3 deletions src/dev/ci_setup/.bazelrc-ci
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,5 @@ build --bes_backend=grpcs://cloud.buildbuddy.io
build --remote_cache=grpcs://cloud.buildbuddy.io
build --remote_timeout=3600

## Avoid to keep connections to build event backend connections alive across builds
build --keep_backend_build_event_connections_alive=false

## Metadata settings
build --build_metadata=ROLE=CI
3 changes: 3 additions & 0 deletions src/dev/ci_setup/.bazelrc-ci.common
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ build --noshow_progress

# More details on failures
build --verbose_failures=true

## Avoid to keep connections to build event backend connections alive across builds
build --keep_backend_build_event_connections_alive=false
2 changes: 1 addition & 1 deletion src/plugins/expression_error/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"ui": true,
"requiredPlugins": ["expressions", "presentationUtil"],
"optionalPlugins": [],
"requiredBundles": []
"requiredBundles": ["kibanaReact"]
}
22 changes: 15 additions & 7 deletions src/plugins/expression_error/public/components/error/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
*/

import React, { FC } from 'react';
import { EuiCallOut } from '@elastic/eui';
import { EuiButtonIcon, EuiCallOut } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { get } from 'lodash';
import { ShowDebugging } from './show_debugging';
import { Markdown } from '../../../../kibana_react/public';

export interface Props {
payload: {
error: Error;
};
onClose?: () => void;
}

const strings = {
Expand All @@ -29,19 +30,26 @@ const strings = {
}),
};

export const Error: FC<Props> = ({ payload }) => {
const message = get(payload, 'error.message');
export const Error: FC<Props> = ({ payload, onClose }) => {
const message = payload.error?.message;

const CloseIconButton = () => (
<EuiButtonIcon color="danger" iconType="cross" onClick={onClose} aria-hidden />
);

return (
<EuiCallOut
style={{ maxWidth: 500 }}
color="danger"
iconType="cross"
iconType={CloseIconButton}
title={strings.getTitle()}
>
<p>{message ? strings.getDescription() : ''}</p>
{message && <p style={{ padding: '0 16px' }}>{message}</p>}

{message && (
<p style={{ padding: '0 16px' }}>
<Markdown markdown={message} openLinksInNewTab={true} />
</p>
)}
<ShowDebugging payload={payload} />
</EuiCallOut>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function ErrorComponent({ onLoaded, parentNode, error }: ErrorComponentProps) {
const [isPopoverOpen, setPopoverOpen] = useState<boolean>(false);

const handlePopoverClick = () => setPopoverOpen(!isPopoverOpen);

const closePopover = () => setPopoverOpen(false);

const updateErrorView = useCallback(() => {
Expand Down Expand Up @@ -56,7 +57,7 @@ function ErrorComponent({ onLoaded, parentNode, error }: ErrorComponentProps) {
}
isOpen={isPopoverOpen}
>
<Error payload={{ error }} />
<Error payload={{ error }} onClose={closePopover} />
</EuiPopover>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,12 @@ export interface AsyncSearchProviderProgress {
loadedFieldValuePairs: number;
loadedHistograms: number;
}

export interface SearchServiceRawResponse {
ccsWarning: boolean;
log: string[];
overallHistogram?: HistogramItem[];
percentileThresholdValue?: number;
took: number;
values: SearchServiceValue[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ export function CorrelationsEmptyStatePrompt() {
id="xpack.apm.correlations.noCorrelationsTextLine1"
defaultMessage="Correlations will only be identified if they have significant impact."
/>
</p>
<p>
<br />
<FormattedMessage
id="xpack.apm.correlations.noCorrelationsTextLine2"
defaultMessage="Try selecting another time range or remove any added filter."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import { CorrelationsLog } from './correlations_log';
import { CorrelationsEmptyStatePrompt } from './empty_state_prompt';
import { CrossClusterSearchCompatibilityWarning } from './cross_cluster_search_warning';
import { CorrelationsProgressControls } from './progress_controls';
import type { SearchServiceParams } from '../../../../common/search_strategies/correlations/types';
import type { FailedTransactionsCorrelationValue } from '../../../../common/search_strategies/failure_correlations/types';
import { Summary } from '../../shared/Summary';
import { asPercent } from '../../../../common/utils/formatters';
Expand Down Expand Up @@ -70,16 +69,6 @@ export function FailedTransactionsCorrelations({

const inspectEnabled = uiSettings.get<boolean>(enableInspectEsQueries);

const searchServicePrams: SearchServiceParams = {
environment,
kuery,
serviceName,
transactionName,
transactionType,
start,
end,
};

const result = useFailedTransactionsCorrelationsFetcher();

const {
Expand All @@ -93,26 +82,30 @@ export function FailedTransactionsCorrelations({
} = result;

const startFetchHandler = useCallback(() => {
startFetch(searchServicePrams);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [environment, serviceName, kuery, start, end]);
startFetch({
environment,
kuery,
serviceName,
transactionName,
transactionType,
start,
end,
});
}, [
startFetch,
environment,
serviceName,
transactionName,
transactionType,
kuery,
start,
end,
]);

// start fetching on load
// we want this effect to execute exactly once after the component mounts
useEffect(() => {
if (isRunning) {
cancelFetch();
}

startFetchHandler();

return () => {
// cancel any running async partial request when unmounting the component
// we want this effect to execute exactly once after the component mounts
cancelFetch();
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [startFetchHandler]);
return cancelFetch;
}, [cancelFetch, startFetchHandler]);

const [
selectedSignificantTerm,
Expand Down
Loading

0 comments on commit fe5ed13

Please sign in to comment.