Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/kibana into es_client_mig…
Browse files Browse the repository at this point in the history
…ration/painless_lab
  • Loading branch information
alisonelizabeth committed Jan 25, 2021
2 parents 683f624 + 43db7e3 commit 62ed955
Show file tree
Hide file tree
Showing 25 changed files with 499 additions and 171 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Delete any items that are not applicable to this PR.
- [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
- [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be whitelisted in the [cloud](https://github.com/elastic/cloud) and added to the [docker list](https://github.com/elastic/kibana/blob/c29adfef29e921cc447d2a5ed06ac2047ceab552/src/dev/build/tasks/os_packages/docker_generator/resources/bin/kibana-docker)
- [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the [cloud](https://github.com/elastic/cloud) and added to the [docker list](https://github.com/elastic/kibana/blob/c29adfef29e921cc447d2a5ed06ac2047ceab552/src/dev/build/tasks/os_packages/docker_generator/resources/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

Expand Down
179 changes: 112 additions & 67 deletions x-pack/plugins/actions/README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion x-pack/plugins/apm/common/ui_settings_keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const enableSignificantTerms = 'apm:enableSignificantTerms';
export const enableCorrelations = 'apm:enableCorrelations';
export const enableServiceOverview = 'apm:enableServiceOverview';
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export function LatencyCorrelations() {
<EuiFormRow
fullWidth={true}
label="Field"
helpText="Fields to analyse for significant terms"
helpText="Fields to analyse for correlations"
>
<EuiComboBox
fullWidth={true}
Expand Down
10 changes: 5 additions & 5 deletions x-pack/plugins/apm/public/components/app/Correlations/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
import { useHistory } from 'react-router-dom';
import { EuiSpacer } from '@elastic/eui';
import { isActivePlatinumLicense } from '../../../../common/license_check';
import { enableSignificantTerms } from '../../../../common/ui_settings_keys';
import { enableCorrelations } from '../../../../common/ui_settings_keys';
import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
import { LatencyCorrelations } from './LatencyCorrelations';
import { ErrorCorrelations } from './ErrorCorrelations';
Expand All @@ -35,7 +35,7 @@ export function Correlations() {
const history = useHistory();
const [isFlyoutVisible, setIsFlyoutVisible] = useState(false);
if (
!uiSettings.get(enableSignificantTerms) ||
!uiSettings.get(enableCorrelations) ||
!isActivePlatinumLicense(license)
) {
return null;
Expand All @@ -48,7 +48,7 @@ export function Correlations() {
setIsFlyoutVisible(true);
}}
>
View significant terms
View correlations
</EuiButton>

<EuiSpacer size="s" />
Expand All @@ -62,7 +62,7 @@ export function Correlations() {
>
<EuiFlyoutHeader hasBorder aria-labelledby="correlations-flyout">
<EuiTitle>
<h2 id="correlations-flyout">Significant terms</h2>
<h2 id="correlations-flyout">Correlations</h2>
</EuiTitle>
</EuiFlyoutHeader>
<EuiFlyoutBody>
Expand All @@ -88,7 +88,7 @@ export function Correlations() {
iconType="alert"
>
<p>
Significant terms is an experimental feature and in active
Correlations is an experimental feature and in active
development. Bugs and surprises are to be expected but let us
know your feedback so we can improve it.
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import React, { useContext } from 'react';
import React, { useContext, useMemo } from 'react';
import {
EuiFlexGroup,
EuiFlexItem,
Expand All @@ -17,7 +17,7 @@ import { I18LABELS } from '../translations';
import { KeyUXMetrics } from './KeyUXMetrics';
import { useFetcher } from '../../../../hooks/use_fetcher';
import { useUxQuery } from '../hooks/useUxQuery';
import { CoreVitals } from '../../../../../../observability/public';
import { getCoreVitalsComponent } from '../../../../../../observability/public';
import { CsmSharedContext } from '../CsmSharedContext';
import { useUrlParams } from '../../../../context/url_params_context/use_url_params';
import { getPercentileLabel } from './translations';
Expand Down Expand Up @@ -48,6 +48,18 @@ export function UXMetrics() {
sharedData: { totalPageViews },
} = useContext(CsmSharedContext);

const CoreVitals = useMemo(
() =>
getCoreVitalsComponent({
data,
totalPageViews,
loading: status !== 'success',
displayTrafficMetric: true,
}),
// eslint-disable-next-line react-hooks/exhaustive-deps
[status]
);

return (
<EuiPanel>
<EuiFlexGroup justifyContent="spaceBetween" wrap>
Expand All @@ -67,12 +79,7 @@ export function UXMetrics() {
<EuiFlexGroup justifyContent="spaceBetween" wrap>
<EuiFlexItem grow={1} data-cy={`client-metrics`}>
<EuiSpacer size="s" />
<CoreVitals
data={data}
totalPageViews={totalPageViews}
loading={status !== 'success'}
displayTrafficMetric={true}
/>
{CoreVitals}
</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
Expand Down
9 changes: 4 additions & 5 deletions x-pack/plugins/apm/server/ui_settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,24 @@ import { schema } from '@kbn/config-schema';
import { i18n } from '@kbn/i18n';
import { UiSettingsParams } from '../../../../src/core/types';
import {
enableSignificantTerms,
enableCorrelations,
enableServiceOverview,
} from '../common/ui_settings_keys';

/**
* uiSettings definitions for APM.
*/
export const uiSettings: Record<string, UiSettingsParams<boolean>> = {
[enableSignificantTerms]: {
[enableCorrelations]: {
category: ['observability'],
name: i18n.translate('xpack.apm.enableCorrelationsExperimentName', {
defaultMessage: 'APM Significant terms (Platinum required)',
defaultMessage: 'APM correlations (Platinum required)',
}),
value: false,
description: i18n.translate(
'xpack.apm.enableCorrelationsExperimentDescription',
{
defaultMessage:
'Enable the experimental Significant terms feature in APM',
defaultMessage: 'Enable the experimental correlations feature in APM',
}
),
schema: schema.boolean(),
Expand Down
40 changes: 23 additions & 17 deletions x-pack/plugins/case/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

Elastic is developing a Case Management Workflow. Follow our progress:

- [Case API Documentation](https://documenter.getpostman.com/view/172706/SW7c2SuF?version=latest)
- [Github Meta](https://github.com/elastic/kibana/issues/50103)
- [Case API Documentation](https://www.elastic.co/guide/en/security/master/cases-overview.html)


# Action types
Expand Down Expand Up @@ -42,27 +41,28 @@ This action type has no `secrets` properties.
| description | The case’s description. | string |
| tags | String array containing words and phrases that help categorize cases. | string[] |
| connector | Object containing the connector’s configuration. | [connector](#connector) |
| settings | Object containing the case’s settings. | [settings](#settings) |

#### `subActionParams (update)`

| Property | Description | Type |
| ----------- | ---------------------------------------------------------- | ----------------------- |
| id | The ID of the case being updated. | string |
| tile | The updated case title. | string |
| description | The updated case description. | string |
| tags | The updated case tags. | string |
| connector | Object containing the connector’s configuration. | [connector](#connector) |
| status | The updated case status, which can be: `open` or `closed`. | string |
| version | The current case version. | string |
| Property | Description | Type |
| ----------- | ------------------------------------------------------------------------- | ----------------------- |
| id | The ID of the case being updated. | string |
| tile | The updated case title. | string |
| description | The updated case description. | string |
| tags | The updated case tags. | string |
| connector | Object containing the connector’s configuration. | [connector](#connector) |
| status | The updated case status, which can be: `open`, `in-progress` or `closed`. | string |
| settings | Object containing the case’s settings. | [settings](#settings) |
| version | The current case version. | string |

#### `subActionParams (addComment)`

| Property | Description | Type |
| -------- | ----------------------------------------------------------------------- | ----------------- |
| type | The type of the comment | `user` \| `alert` |
| comment | The comment. Valid only when type is `user`. | string |
| alertId | The alert ID. Valid only when the type is `alert` | string |
| index | The index where the alert is saved. Valid only when the type is `alert` | string |
| Property | Description | Type |
| -------- | ------------------------ | ------ |
| type | The type of the comment. | `user` |
| comment | The comment. | string |

#### `connector`

| Property | Description | Type |
Expand Down Expand Up @@ -96,3 +96,9 @@ For IBM Resilient connectors:
| ------------ | ------------------------------- | -------- |
| issueTypes | The issue types of the issue. | string[] |
| severityCode | The severity code of the issue. | string |

#### `settings`

| Property | Description | Type |
| ---------- | ------------------------------ | ------- |
| syncAlerts | Turn on or off alert synching. | boolean |
37 changes: 24 additions & 13 deletions x-pack/plugins/ml/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export interface MlSetupDependencies {
export type MlCoreSetup = CoreSetup<MlStartDependencies, MlPluginStart>;

export class MlPlugin implements Plugin<MlPluginSetup, MlPluginStart> {
private appUpdater = new BehaviorSubject<AppUpdater>(() => ({}));
private appUpdater$ = new BehaviorSubject<AppUpdater>(() => ({}));
private urlGenerator: undefined | UrlGeneratorContract<typeof ML_APP_URL_GENERATOR>;

constructor(private initializerContext: PluginInitializerContext) {}
Expand All @@ -85,7 +85,7 @@ export class MlPlugin implements Plugin<MlPluginSetup, MlPluginStart> {
euiIconType: PLUGIN_ICON_SOLUTION,
appRoute: '/app/ml',
category: DEFAULT_APP_CATEGORIES.kibana,
updater$: this.appUpdater,
updater$: this.appUpdater$,
mount: async (params: AppMountParameters) => {
const [coreStart, pluginsStart] = await core.getStartServices();
const kibanaVersion = this.initializerContext.env.packageInfo.version;
Expand Down Expand Up @@ -133,23 +133,34 @@ export class MlPlugin implements Plugin<MlPluginSetup, MlPluginStart> {
});
} else {
// if ml is disabled in elasticsearch, disable ML in kibana
this.appUpdater.next(() => ({
this.appUpdater$.next(() => ({
status: AppStatus.inaccessible,
}));
}

// register various ML plugin features which require a full license
const { registerEmbeddables, registerManagementSection, registerMlUiActions } = await import(
'./register_helper'
);

if (isMlEnabled(license) && isFullLicense(license)) {
const canManageMLJobs = capabilities.management?.insightsAndAlerting?.jobsListLink ?? false;
if (canManageMLJobs && pluginsSetup.management !== undefined) {
registerManagementSection(pluginsSetup.management, core).enable();
// note including registerFeature in register_helper would cause the page bundle size to increase significantly
const {
registerEmbeddables,
registerManagementSection,
registerMlUiActions,
registerSearchLinks,
} = await import('./register_helper');

const mlEnabled = isMlEnabled(license);
const fullLicense = isFullLicense(license);
if (mlEnabled) {
registerSearchLinks(this.appUpdater$, fullLicense);

if (fullLicense) {
const canManageMLJobs =
capabilities.management?.insightsAndAlerting?.jobsListLink ?? false;
if (canManageMLJobs && pluginsSetup.management !== undefined) {
registerManagementSection(pluginsSetup.management, core).enable();
}
registerEmbeddables(pluginsSetup.embeddable, core);
registerMlUiActions(pluginsSetup.uiActions, core);
}
registerEmbeddables(pluginsSetup.embeddable, core);
registerMlUiActions(pluginsSetup.uiActions, core);
}
});

Expand Down
10 changes: 10 additions & 0 deletions x-pack/plugins/ml/public/register_helper/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export { registerEmbeddables } from '../embeddables';
export { registerManagementSection } from '../application/management';
export { registerMlUiActions } from '../ui_actions';
export { registerSearchLinks } from './register_search_links';
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/

export { registerEmbeddables } from './embeddables';
export { registerFeature } from './register_feature';
export { registerManagementSection } from './application/management';
export { registerMlUiActions } from './ui_actions';
export { registerSearchLinks } from './register_search_links';
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { i18n } from '@kbn/i18n';
import { BehaviorSubject } from 'rxjs';

import { AppUpdater } from 'src/core/public';
import { getSearchDeepLinks } from './search_deep_links';

export function registerSearchLinks(
appUpdater: BehaviorSubject<AppUpdater>,
isFullLicense: boolean
) {
appUpdater.next(() => ({
meta: {
keywords: [
i18n.translate('xpack.ml.keyword.ml', {
defaultMessage: 'ML',
}),
],
searchDeepLinks: getSearchDeepLinks(isFullLicense),
},
}));
}
Loading

0 comments on commit 62ed955

Please sign in to comment.