Skip to content

Commit

Permalink
Merge branch '7.x' into backport/7.x/pr-90678
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Feb 9, 2021
2 parents c9acc32 + 4fe5fe0 commit 07c7d60
Show file tree
Hide file tree
Showing 949 changed files with 12,695 additions and 6,696 deletions.
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import %workspace%/.bazelrc.common

# BuildBuddy
## Metadata settings
build --workspace_status_command=$(pwd)/src/dev/bazel_workspace_status.sh
build --workspace_status_command="node ./src/dev/bazel_workspace_status.js"
# Enable this in case you want to share your build info
# build --build_metadata=VISIBILITY=PUBLIC
build --build_metadata=TEST_GROUPS=//packages
Expand Down
33 changes: 33 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1123,6 +1123,39 @@ module.exports = {
// All files
files: ['x-pack/plugins/enterprise_search/**/*.{ts,tsx}'],
rules: {
'import/order': [
'error',
{
groups: ['unknown', ['builtin', 'external'], 'internal', 'parent', 'sibling', 'index'],
pathGroups: [
{
pattern:
'{../../../../../../,../../../../../,../../../../,../../../,../../,../}{common/,*}__mocks__{*,/**}',
group: 'unknown',
},
{
pattern: '{**,.}/*.mock',
group: 'unknown',
},
{
pattern: 'react*',
group: 'external',
position: 'before',
},
{
pattern: '{@elastic/**,@kbn/**,src/**}',
group: 'internal',
},
],
pathGroupsExcludedImportTypes: [],
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
'newlines-between': 'always-and-inside-groups',
},
],
'import/newline-after-import': 'error',
'react-hooks/exhaustive-deps': 'off',
'react/jsx-boolean-value': ['error', 'never'],
},
Expand Down
9 changes: 7 additions & 2 deletions docs/user/dashboard/vega-reference.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -251,17 +251,22 @@ experimental[] To enable *Maps*, the graph must specify `type=map` in the host c
"longitude": -74, // default 0
"zoom": 7, // default 2
// defaults to "default". Use false to disable base layer.
// Defaults to 'true', disables the base map layer.
"mapStyle": false,
// When 'mapStyle' is 'undefined' or 'true', sets the EMS-layer for the map.
// May either be: "road_map", "road_map_desaturated", "dark_map".
// If 'emsTileServiceId' is 'undefined', it falls back to the auto-switch-dark-light behavior.
"emsTileServiceId": "road_map",
// default 0
"minZoom": 5,
// defaults to the maximum for the given style,
// or 25 when base is disabled
"maxZoom": 13,
// defaults to true, shows +/- buttons to zoom in/out
// Defaults to 'true', shows +/- buttons to zoom in/out
"zoomControl": false,
// Defaults to 'false', disables mouse wheel zoom. If set to
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,6 @@
"leaflet": "1.5.1",
"leaflet-draw": "0.4.14",
"leaflet-responsive-popup": "0.6.4",
"leaflet-vega": "^0.8.6",
"leaflet.heat": "0.2.0",
"less": "npm:@elastic/less@2.7.3-kibana",
"license-checker": "^16.0.0",
Expand Down Expand Up @@ -831,6 +830,7 @@
"val-loader": "^1.1.1",
"vega": "^5.19.1",
"vega-lite": "^4.17.0",
"vega-spec-injector": "^0.0.2",
"vega-schema-url-parser": "^2.1.0",
"vega-tooltip": "^0.25.0",
"venn.js": "0.2.20",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-es/src/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ exports.Cluster = class Cluster {
this._log.info(chalk.bold('Starting'));
this._log.indent(4);

const esArgs = [].concat(options.esArgs || []);
const esArgs = ['action.destructive_requires_name=true'].concat(options.esArgs || []);
// Add to esArgs if ssl is enabled
if (this._ssl) {
esArgs.push('xpack.security.http.ssl.enabled=true');
Expand Down
8 changes: 6 additions & 2 deletions packages/kbn-es/src/integration_tests/cluster.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ describe('#start(installPath)', () => {
expect(extractConfigFiles.mock.calls).toMatchInlineSnapshot(`
Array [
Array [
Array [],
Array [
"action.destructive_requires_name=true",
],
undefined,
Object {
"log": <ToolingLog>,
Expand Down Expand Up @@ -340,7 +342,9 @@ describe('#run()', () => {
expect(extractConfigFiles.mock.calls).toMatchInlineSnapshot(`
Array [
Array [
Array [],
Array [
"action.destructive_requires_name=true",
],
undefined,
Object {
"log": <ToolingLog>,
Expand Down
22 changes: 9 additions & 13 deletions packages/kbn-std/src/promise.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,36 @@ const delay = (ms: number, resolveValue?: any) =>
new Promise((resolve) => setTimeout(resolve, ms, resolveValue));

describe('withTimeout', () => {
it('resolves with a promise value if resolved in given timeout', async () => {
it('resolves with a promise value and "timedout: false" if resolved in given timeout', async () => {
await expect(
withTimeout({
promise: delay(10, 'value'),
timeout: 200,
errorMessage: 'error-message',
timeoutMs: 200,
})
).resolves.toBe('value');
).resolves.toStrictEqual({ value: 'value', timedout: false });
});

it('rejects with errorMessage if not resolved in given time', async () => {
it('resolves with "timedout: false" if not resolved in given time', async () => {
await expect(
withTimeout({
promise: delay(200, 'value'),
timeout: 10,
errorMessage: 'error-message',
timeoutMs: 10,
})
).rejects.toMatchInlineSnapshot(`[Error: error-message]`);
).resolves.toStrictEqual({ timedout: true });

await expect(
withTimeout({
promise: new Promise((i) => i),
timeout: 10,
errorMessage: 'error-message',
timeoutMs: 10,
})
).rejects.toMatchInlineSnapshot(`[Error: error-message]`);
).resolves.toStrictEqual({ timedout: true });
});

it('does not swallow promise error', async () => {
await expect(
withTimeout({
promise: Promise.reject(new Error('from-promise')),
timeout: 10,
errorMessage: 'error-message',
timeoutMs: 10,
})
).rejects.toMatchInlineSnapshot(`[Error: from-promise]`);
});
Expand Down
27 changes: 17 additions & 10 deletions packages/kbn-std/src/promise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,26 @@
* Side Public License, v 1.
*/

export function withTimeout<T>({
export async function withTimeout<T>({
promise,
timeout,
errorMessage,
timeoutMs,
}: {
promise: Promise<T>;
timeout: number;
errorMessage: string;
}) {
return Promise.race([
promise,
new Promise((resolve, reject) => setTimeout(() => reject(new Error(errorMessage)), timeout)),
]) as Promise<T>;
timeoutMs: number;
}): Promise<{ timedout: true } | { timedout: false; value: T }> {
let timeout: NodeJS.Timeout | undefined;
try {
return (await Promise.race([
promise.then((v) => ({ value: v, timedout: false })),
new Promise((resolve) => {
timeout = setTimeout(() => resolve({ timedout: true }), timeoutMs);
}),
])) as Promise<{ timedout: true } | { timedout: false; value: T }>;
} finally {
if (timeout !== undefined) {
clearTimeout(timeout);
}
}
}

export function isPromise<T>(maybePromise: T | Promise<T>): maybePromise is Promise<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const schema = Joi.object()

esTestCluster: Joi.object()
.keys({
license: Joi.string().default('oss'),
license: Joi.string().default('basic'),
from: Joi.string().default('snapshot'),
serverArgs: Joi.array(),
serverEnvVars: Joi.object(),
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-test/src/legacy_es/legacy_es_test_cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function createLegacyEsTestCluster(options = {}) {
const {
port = esTestConfig.getPort(),
password = 'changeme',
license = 'oss',
license = 'basic',
log,
basePath = resolve(KIBANA_ROOT, '.es'),
esFrom = esTestConfig.getBuildFrom(),
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-tinymath/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"license": "SSPL-1.0 OR Elastic License 2.0",
"private": true,
"main": "src/index.js",
"types": "tinymath.d.ts",
"scripts": {
"kbn:bootstrap": "yarn build",
"build": "../../node_modules/.bin/pegjs -o src/grammar.js src/grammar.pegjs"
Expand Down
Loading

0 comments on commit 07c7d60

Please sign in to comment.