Skip to content

Commit

Permalink
Merge branch 'main' into controls/relevantDataViewId
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine committed Mar 28, 2022
2 parents a13dc7f + a0518b6 commit 25509c9
Show file tree
Hide file tree
Showing 299 changed files with 7,660 additions and 4,269 deletions.
1 change: 0 additions & 1 deletion WORKSPACE.bazel
Expand Up @@ -58,7 +58,6 @@ yarn_install(
data = [
"//:.yarnrc",
"//:preinstall_check.js",
"//:node_modules/.yarn-integrity",
],
exports_directories_only = True,
symlink_node_modules = True,
Expand Down
26 changes: 19 additions & 7 deletions docs/settings/alert-action-settings.asciidoc
Expand Up @@ -185,13 +185,6 @@ For example, `20m`, `24h`, `7d`, `1w`. Default: `60s`.
`xpack.alerting.maxEphemeralActionsPerAlert`::
Sets the number of actions that will be executed ephemerally. To use this, enable ephemeral tasks in task manager first with <<task-manager-settings,`xpack.task_manager.ephemeral_tasks.enabled`>>

`xpack.alerting.defaultRuleTaskTimeout`::
Specifies the default timeout for the all rule types tasks. The time is formatted as:
+
`<count>[ms,s,m,h,d,w,M,Y]`
+
For example, `20m`, `24h`, `7d`, `1w`. Default: `5m`.

`xpack.alerting.cancelAlertsOnRuleTimeout`::
Specifies whether to skip writing alerts and scheduling actions if rule execution is cancelled due to timeout. Default: `true`. This setting can be overridden by individual rule types.

Expand All @@ -207,3 +200,22 @@ Specifies the behavior when a new or changed rule has a schedule interval less t

`xpack.alerting.rules.execution.actions.max`::
Specifies the maximum number of actions that a rule can trigger each time detection checks run.

`xpack.alerting.rules.execution.timeout`::
Specifies the default timeout for tasks associated with all types of rules. The time is formatted as:
+
`<count>[ms,s,m,h,d,w,M,Y]`
+
For example, `20m`, `24h`, `7d`, `1w`. Default: `5m`.

`xpack.alerting.rules.execution.ruleTypeOverrides`::
Overrides the configs under `xpack.alerting.rules.execution` for the rule type with the given ID. List the rule identifier and its settings in an array of objects.
+
For example:
```
xpack.alerting.rules.execution:
timeout: '5m'
ruleTypeOverrides:
- id: '.index-threshold'
timeout: '15m'
```
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -108,7 +108,7 @@
"@elastic/charts": "45.0.1",
"@elastic/datemath": "link:bazel-bin/packages/elastic-datemath",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@8.2.0-canary.1",
"@elastic/ems-client": "8.1.0",
"@elastic/ems-client": "8.2.0",
"@elastic/eui": "51.1.0",
"@elastic/filesaver": "1.1.2",
"@elastic/node-crypto": "1.2.1",
Expand Down Expand Up @@ -418,7 +418,7 @@
"usng.js": "^0.4.5",
"utility-types": "^3.10.0",
"uuid": "3.3.2",
"vega": "^5.22.0",
"vega": "^5.22.1",
"vega-interpreter": "^1.0.4",
"vega-lite": "^5.2.0",
"vega-schema-url-parser": "^2.2.0",
Expand Down
605 changes: 290 additions & 315 deletions packages/kbn-pm/dist/index.js

Large diffs are not rendered by default.

21 changes: 5 additions & 16 deletions packages/kbn-pm/src/commands/bootstrap.ts
Expand Up @@ -17,12 +17,7 @@ import { ICommand } from './';
import { readYarnLock } from '../utils/yarn_lock';
import { sortPackageJson } from '../utils/sort_package_json';
import { validateDependencies } from '../utils/validate_dependencies';
import {
ensureYarnIntegrityFileExists,
installBazelTools,
runBazel,
yarnIntegrityFileExists,
} from '../utils/bazel';
import { installBazelTools, removeYarnIntegrityFileIfExists, runBazel } from '../utils/bazel';
import { setupRemoteCache } from '../utils/bazel/setup_remote_cache';

export const BootstrapCommand: ICommand = {
Expand Down Expand Up @@ -54,16 +49,8 @@ export const BootstrapCommand: ICommand = {
}
};

// Force install is set in case a flag is passed or
// if the `.yarn-integrity` file is not found which
// will be indicated by the return of yarnIntegrityFileExists.
const forceInstall =
(!!options && options['force-install'] === true) ||
!(await yarnIntegrityFileExists(resolve(kibanaProjectPath, 'node_modules')));

// Ensure we have a `node_modules/.yarn-integrity` file as we depend on it
// for bazel to know it has to re-install the node_modules after a reset or a clean
await ensureYarnIntegrityFileExists(resolve(kibanaProjectPath, 'node_modules'));
// Force install is set in case a flag `--force-install` is passed into kbn bootstrap
const forceInstall = !!options && options['force-install'] === true;

// Install bazel machinery tools if needed
await installBazelTools(rootPath);
Expand All @@ -83,6 +70,8 @@ export const BootstrapCommand: ICommand = {

if (forceInstall) {
await time('force install dependencies', async () => {
await removeYarnIntegrityFileIfExists(resolve(kibanaProjectPath, 'node_modules'));
await runBazel(['clean']);
await runBazel(['run', '@nodejs//:yarn'], runOffline, {
env: {
SASS_BINARY_SITE:
Expand Down
15 changes: 5 additions & 10 deletions packages/kbn-pm/src/commands/clean.ts
Expand Up @@ -17,7 +17,7 @@ import { log } from '../utils/log';
import { ICommand } from './';

export const CleanCommand: ICommand = {
description: 'Deletes output directories, node_modules and resets internal caches.',
description: 'Deletes output directories and resets internal caches.',
name: 'clean',

reportTiming: {
Expand All @@ -27,20 +27,15 @@ export const CleanCommand: ICommand = {

async run(projects) {
log.warning(dedent`
This command is only necessary for the rare circumstance where you need to recover a consistent
This command is only necessary for the circumstance where you need to recover a consistent
state when problems arise. If you need to run this command often, please let us know by
filling out this form: https://ela.st/yarn-kbn-clean
filling out this form: https://ela.st/yarn-kbn-clean.
Please not it might not solve problems with node_modules. To solve problems around node_modules
you might need to run 'yarn kbn reset'.
`);

const toDelete = [];
for (const project of projects.values()) {
if (await isDirectory(project.nodeModulesLocation)) {
toDelete.push({
cwd: project.path,
pattern: relative(project.path, project.nodeModulesLocation),
});
}

if (await isDirectory(project.targetLocation)) {
toDelete.push({
cwd: project.path,
Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-pm/src/commands/reset.ts
Expand Up @@ -34,7 +34,8 @@ export const ResetCommand: ICommand = {
async run(projects) {
log.warning(dedent`
In most cases, 'yarn kbn clean' is all that should be needed to recover a consistent state when
problems arise. If you need to use this command, please let us know, as it should not be necessary.
problems arise. However for the rare cases where something get corrupt on node_modules you might need this command.
If you think you need to use this command very often (which is not normal), please let us know.
`);

const toDelete = [];
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-pm/src/utils/bazel/index.ts
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

export * from './yarn_integrity';
export * from './get_cache_folders';
export * from './install_tools';
export * from './run';
export * from './yarn_integrity';
25 changes: 4 additions & 21 deletions packages/kbn-pm/src/utils/bazel/yarn_integrity.ts
Expand Up @@ -7,35 +7,18 @@
*/

import { join } from 'path';
import { isFile, mkdirp, tryRealpath, writeFile } from '../fs';
import { isFile, tryRealpath, unlink } from '../fs';

export async function yarnIntegrityFileExists(nodeModulesPath: string) {
export async function removeYarnIntegrityFileIfExists(nodeModulesPath: string) {
try {
const nodeModulesRealPath = await tryRealpath(nodeModulesPath);
const yarnIntegrityFilePath = join(nodeModulesRealPath, '.yarn-integrity');

// check if the file already exists
// check if the file exists and delete it in that case
if (await isFile(yarnIntegrityFilePath)) {
return true;
await unlink(yarnIntegrityFilePath);
}
} catch {
// no-op
}

return false;
}

export async function ensureYarnIntegrityFileExists(nodeModulesPath: string) {
try {
const nodeModulesRealPath = await tryRealpath(nodeModulesPath);
const yarnIntegrityFilePath = join(nodeModulesRealPath, '.yarn-integrity');

// ensure node_modules folder is created
await mkdirp(nodeModulesRealPath);

// write a blank file in case it doesn't exists
await writeFile(yarnIntegrityFilePath, '', { flag: 'wx' });
} catch {
// no-op
}
}
17 changes: 17 additions & 0 deletions packages/kbn-shared-ux-components/src/index.ts
Expand Up @@ -94,3 +94,20 @@ export const LazyIconButtonGroup = React.lazy(() =>
* The IconButtonGroup component that is wrapped by the `withSuspence` HOC.
*/
export const IconButtonGroup = withSuspense(LazyIconButtonGroup);

/**
* The Lazily-loaded `KibanaSolutionAvatar` component. Consumers should use `React.Suspense` or
* the withSuspense` HOC to load this component.
*/
export const KibanaSolutionAvatarLazy = React.lazy(() =>
import('./solution_avatar').then(({ KibanaSolutionAvatar }) => ({
default: KibanaSolutionAvatar,
}))
);

/**
* A `KibanaSolutionAvatar` component that is wrapped by the `withSuspense` HOC. This component can
* be used directly by consumers and will load the `KibanaPageTemplateSolutionNavAvatarLazy` component lazily with
* a predefined fallback and error boundary.
*/
export const KibanaSolutionAvatar = withSuspense(KibanaSolutionAvatarLazy);

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,9 @@
/*
* 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.
*/

export { KibanaSolutionAvatar } from './solution_avatar';
@@ -0,0 +1,14 @@
.kbnSolutionAvatar {
@include euiBottomShadowSmall;

&--xxl {
@include euiBottomShadowMedium;
@include size(100px);
line-height: 100px;
border-radius: 100px;
display: inline-block;
background: $euiColorEmptyShade url('/assets/texture.svg') no-repeat;
background-size: cover, 125%;
text-align: center;
}
}
@@ -0,0 +1,33 @@
/*
* 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 React from 'react';
import { KibanaSolutionAvatar, KibanaSolutionAvatarProps } from './solution_avatar';

export default {
title: 'Solution Avatar',
description: 'A wrapper around EuiAvatar, specifically to stylize Elastic Solutions',
};

type Params = Pick<KibanaSolutionAvatarProps, 'size' | 'name'>;

export const PureComponent = (params: Params) => {
return <KibanaSolutionAvatar {...params} />;
};

PureComponent.argTypes = {
name: {
control: 'text',
defaultValue: 'Kibana',
},
size: {
control: 'radio',
options: ['s', 'm', 'l', 'xl', 'xxl'],
defaultValue: 'xxl',
},
};
@@ -0,0 +1,18 @@
/*
* 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 React from 'react';
import { shallow } from 'enzyme';
import { KibanaSolutionAvatar } from './solution_avatar';

describe('KibanaSolutionAvatar', () => {
test('renders', () => {
const component = shallow(<KibanaSolutionAvatar name="Solution" iconType="logoElastic" />);
expect(component).toMatchSnapshot();
});
});
@@ -0,0 +1,44 @@
/*
* 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 './solution_avatar.scss';

import React from 'react';
import classNames from 'classnames';

import { DistributiveOmit, EuiAvatar, EuiAvatarProps } from '@elastic/eui';

export type KibanaSolutionAvatarProps = DistributiveOmit<EuiAvatarProps, 'size'> & {
/**
* Any EuiAvatar size available, or `xxl` for custom large, brand-focused version
*/
size?: EuiAvatarProps['size'] | 'xxl';
};

/**
* Applies extra styling to a typical EuiAvatar;
* The `name` value will be appended to 'logo' to configure the `iconType` unless `iconType` is provided.
*/
export const KibanaSolutionAvatar = ({ className, size, ...rest }: KibanaSolutionAvatarProps) => {
return (
// @ts-ignore Complains about ExclusiveUnion between `iconSize` and `iconType`, but works fine
<EuiAvatar
className={classNames(
'kbnSolutionAvatar',
{
[`kbnSolutionAvatar--${size}`]: size,
},
className
)}
color="plain"
size={size === 'xxl' ? 'xl' : size}
iconSize={size}
iconType={`logo${rest.name}`}
{...rest}
/>
);
};
2 changes: 1 addition & 1 deletion packages/kbn-test/jest-preset.js
Expand Up @@ -16,7 +16,7 @@ module.exports = {
coverageDirectory: '<rootDir>/target/kibana-coverage/jest',

// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: ['/node_modules/', '.*\\.d\\.ts'],
coveragePathIgnorePatterns: ['/node_modules/', '.*\\.d\\.ts', 'jest\\.config\\.js'],

// A list of reporter names that Jest uses when writing coverage reports
coverageReporters: !!process.env.CODE_COVERAGE
Expand Down
4 changes: 3 additions & 1 deletion src/core/public/core_system.ts
Expand Up @@ -134,8 +134,11 @@ export class CoreSystem {
// Setup FatalErrorsService and it's dependencies first so that we're
// able to render any errors.
const injectedMetadata = this.injectedMetadata.setup();
const theme = this.theme.setup({ injectedMetadata });

this.fatalErrorsSetup = this.fatalErrors.setup({
injectedMetadata,
theme,
i18n: this.i18n.getContext(),
});
await this.integrations.setup();
Expand All @@ -149,7 +152,6 @@ export class CoreSystem {
});
const uiSettings = this.uiSettings.setup({ http, injectedMetadata });
const notifications = this.notifications.setup({ uiSettings });
const theme = this.theme.setup({ injectedMetadata });

const application = this.application.setup({ http });
this.coreApp.setup({ application, http, injectedMetadata, notifications });
Expand Down

0 comments on commit 25509c9

Please sign in to comment.