Skip to content

Commit

Permalink
Merge branch '7.8' into backport/7.8/pr-65532
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored May 7, 2020
2 parents 906bb48 + 97c0bd6 commit c1580a4
Show file tree
Hide file tree
Showing 46 changed files with 695 additions and 287 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,14 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut
this.abortController.abort();
}
this.abortController = new AbortController();
const abortController = this.abortController;
this.expression = await buildPipeline(this.vis, {
timefilter: this.timefilter,
timeRange: this.timeRange,
abortSignal: this.abortController!.signal,
});

if (this.handler) {
if (this.handler && !abortController.signal.aborted) {
this.handler.update(this.expression, expressionParams);
}
}
Expand Down
13 changes: 13 additions & 0 deletions x-pack/plugins/actions/server/action_type_registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ describe('register()', () => {
`);
});

test('shallow clones the given action type', () => {
const myType: ActionType = {
id: 'my-action-type',
name: 'My action type',
minimumLicenseRequired: 'basic',
executor,
};
const actionTypeRegistry = new ActionTypeRegistry(actionTypeRegistryParams);
actionTypeRegistry.register(myType);
myType.name = 'Changed';
expect(actionTypeRegistry.get('my-action-type').name).toEqual('My action type');
});

test('throws error if action type already registered', () => {
const actionTypeRegistry = new ActionTypeRegistry(actionTypeRegistryParams);
actionTypeRegistry.register({
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/actions/server/action_type_registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class ActionTypeRegistry {
)
);
}
this.actionTypes.set(actionType.id, actionType);
this.actionTypes.set(actionType.id, { ...actionType });
this.taskManager.registerTaskDefinitions({
[`actions:${actionType.id}`]: {
title: actionType.name,
Expand Down
19 changes: 19 additions & 0 deletions x-pack/plugins/alerting/server/alert_type_registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,25 @@ describe('register()', () => {
`);
});

test('shallow clones the given alert type', () => {
const alertType: AlertType = {
id: 'test',
name: 'Test',
actionGroups: [
{
id: 'default',
name: 'Default',
},
],
defaultActionGroupId: 'default',
executor: jest.fn(),
};
const registry = new AlertTypeRegistry(alertTypeRegistryParams);
registry.register(alertType);
alertType.name = 'Changed';
expect(registry.get('test').name).toEqual('Test');
});

test('should throw an error if type is already registered', () => {
const registry = new AlertTypeRegistry(alertTypeRegistryParams);
registry.register({
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/alerting/server/alert_type_registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class AlertTypeRegistry {
);
}
alertType.actionVariables = normalizedActionVariables(alertType.actionVariables);
this.alertTypes.set(alertType.id, alertType);
this.alertTypes.set(alertType.id, { ...alertType });
this.taskManager.registerTaskDefinitions({
[`alerting:${alertType.id}`]: {
title: alertType.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

import { Location } from 'history';
import { BreadcrumbRoute, getBreadcrumbs } from '../ProvideBreadcrumbs';
import { RouteName } from '../route_config/route_names';
import { BreadcrumbRoute, getBreadcrumbs } from './ProvideBreadcrumbs';
import { RouteName } from './route_config/route_names';

describe('getBreadcrumbs', () => {
const getTestRoutes = (): BreadcrumbRoute[] => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,18 @@ function getTitleFromBreadCrumbs(breadcrumbs: Breadcrumb[]) {

class UpdateBreadcrumbsComponent extends React.Component<Props> {
public updateHeaderBreadcrumbs() {
const breadcrumbs = this.props.breadcrumbs.map(({ value, match }) => ({
text: value,
href: getAPMHref(match.url, this.props.location.search)
}));
const breadcrumbs = this.props.breadcrumbs.map(
({ value, match }, index) => {
const isLastBreadcrumbItem =
index === this.props.breadcrumbs.length - 1;
return {
text: value,
href: isLastBreadcrumbItem
? undefined // makes the breadcrumb item not clickable
: getAPMHref(match.url, this.props.location.search)
};
}
);

document.title = getTitleFromBreadCrumbs(this.props.breadcrumbs);
this.props.core.chrome.setBreadcrumbs(breadcrumbs);
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { EuiErrorBoundary } from '@elastic/eui';
import React from 'react';

import { ColumnarPage } from '../../../components/page';
import { LogEntryCategoriesPageContent } from './page_content';
import { LogEntryCategoriesPageProviders } from './page_providers';

export const LogEntryCategoriesPage = () => {
return (
<LogEntryCategoriesPageProviders>
<ColumnarPage data-test-subj="logsLogEntryCategoriesPage">
<LogEntryCategoriesPageContent />
</ColumnarPage>
</LogEntryCategoriesPageProviders>
<EuiErrorBoundary>
<LogEntryCategoriesPageProviders>
<ColumnarPage data-test-subj="logsLogEntryCategoriesPage">
<LogEntryCategoriesPageContent />
</ColumnarPage>
</LogEntryCategoriesPageProviders>
</EuiErrorBoundary>
);
};
14 changes: 8 additions & 6 deletions x-pack/plugins/infra/public/pages/logs/log_entry_rate/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { EuiErrorBoundary } from '@elastic/eui';
import React from 'react';

import { ColumnarPage } from '../../../components/page';
import { LogEntryRatePageContent } from './page_content';
import { LogEntryRatePageProviders } from './page_providers';

export const LogEntryRatePage = () => {
return (
<LogEntryRatePageProviders>
<ColumnarPage data-test-subj="logsLogEntryRatePage">
<LogEntryRatePageContent />
</ColumnarPage>
</LogEntryRatePageProviders>
<EuiErrorBoundary>
<LogEntryRatePageProviders>
<ColumnarPage data-test-subj="logsLogEntryRatePage">
<LogEntryRatePageContent />
</ColumnarPage>
</LogEntryRatePageProviders>
</EuiErrorBoundary>
);
};
12 changes: 7 additions & 5 deletions x-pack/plugins/infra/public/pages/logs/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { EuiErrorBoundary } from '@elastic/eui';
import React from 'react';
import { RouteComponentProps } from 'react-router-dom';

import { LogsPageContent } from './page_content';
import { LogsPageProviders } from './page_providers';

export const LogsPage: React.FunctionComponent<RouteComponentProps> = ({ match }) => {
export const LogsPage: React.FunctionComponent<RouteComponentProps> = () => {
return (
<LogsPageProviders>
<LogsPageContent />
</LogsPageProviders>
<EuiErrorBoundary>
<LogsPageProviders>
<LogsPageContent />
</LogsPageProviders>
</EuiErrorBoundary>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import {
EuiButton,
EuiCallOut,
EuiErrorBoundary,
EuiFlexGroup,
EuiFlexItem,
EuiPanel,
Expand Down Expand Up @@ -74,7 +75,7 @@ export const LogsSettingsPage = () => {
}

return (
<>
<EuiErrorBoundary>
<EuiPage>
<EuiPageBody
className="eui-displayBlock"
Expand Down Expand Up @@ -181,7 +182,7 @@ export const LogsSettingsPage = () => {
</EuiFlexGroup>
</EuiPageBody>
</EuiPage>
</>
</EuiErrorBoundary>
);
};

Expand Down
15 changes: 9 additions & 6 deletions x-pack/plugins/infra/public/pages/logs/stream/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { EuiErrorBoundary } from '@elastic/eui';
import React from 'react';
import { useTrackPageview } from '../../../../../observability/public';
import { ColumnarPage } from '../../../components/page';
Expand All @@ -15,11 +16,13 @@ export const StreamPage = () => {
useTrackPageview({ app: 'infra_logs', path: 'stream' });
useTrackPageview({ app: 'infra_logs', path: 'stream', delay: 15000 });
return (
<LogsPageProviders>
<ColumnarPage data-test-subj="infraLogsPage">
<StreamPageHeader />
<StreamPageContent />
</ColumnarPage>
</LogsPageProviders>
<EuiErrorBoundary>
<LogsPageProviders>
<ColumnarPage data-test-subj="infraLogsPage">
<StreamPageHeader />
<StreamPageContent />
</ColumnarPage>
</LogsPageProviders>
</EuiErrorBoundary>
);
};
Loading

0 comments on commit c1580a4

Please sign in to comment.