Skip to content

Commit

Permalink
Merge remote-tracking branch 'kibana/7.x' into backport/7.x/pr-50046
Browse files Browse the repository at this point in the history
  • Loading branch information
maryia-lapata committed Nov 13, 2019
2 parents a2f933d + 0030dee commit d293511
Show file tree
Hide file tree
Showing 87 changed files with 921 additions and 3,387 deletions.
2 changes: 2 additions & 0 deletions docs/migration.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
This section discusses the changes that you need to be aware of when migrating
your application from one version of Kibana to another.

* <<breaking-changes-7.5, Breaking changes in 7.5>>
* <<breaking-changes-7.4, Breaking changes in 7.4>>
* <<breaking-changes-7.3, Breaking changes in 7.3>>
* <<breaking-changes-7.2, Breaking changes in 7.2>>
Expand All @@ -15,6 +16,7 @@ your application from one version of Kibana to another.
See also <<release-highlights>> and <<release-notes>>.
--

include::migration/migrate_7_5.asciidoc[]
include::migration/migrate_7_4.asciidoc[]
include::migration/migrate_7_3.asciidoc[]
include::migration/migrate_7_2.asciidoc[]
Expand Down
32 changes: 32 additions & 0 deletions docs/migration/migrate_7_5.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[[breaking-changes-7.5]]
== Breaking changes in 7.5
++++
<titleabbrev>7.5</titleabbrev>
++++

This page discusses the breaking changes that you need to be aware of when migrating
your application to Kibana 7.5.

//See also <<release-highlights-7.4.0, release highlights>> and <<release-notes-7.4.0, release notes>>.

//NOTE: The notable-breaking-changes tagged regions are re-used in the
//Installation and Upgrade Guide

////
The following section is re-used in the Installation and Upgrade Guide
[[breaking_70_notable]]
=== Notable breaking changes
////
// tag::notable-breaking-changes[]

[float]
[[breaking_75_search_instead_of-msearch]]
=== The default setting for `courier:batchSearches` is now `false`

*Details:*
Changing the default setting for `courier:batchSearches` to `false` means
that search requests will use the `_search` {es} endpoint rather than `_msearch`.

*Impact:*
Dashboard panels will load individually, and search requests will terminate
when users navigate away or update the query.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@
"chance": "1.0.18",
"cheerio": "0.22.0",
"chokidar": "3.2.1",
"chromedriver": "^78.0.1",
"chromedriver": "^77.0.0",
"classnames": "2.2.6",
"dedent": "^0.7.0",
"delete-empty": "^2.0.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/eslint-config-kibana/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ module.exports = {
from: 'x-pack',
toRelative: 'x-pack',
},
{
from: 'react-router',
to: 'react-router-dom',
},
],
],
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';

import {
Link,
} from 'react-router';
import { Link } from 'react-router'; // eslint-disable-line

import classNames from 'classnames';

Expand Down
5 changes: 1 addition & 4 deletions packages/kbn-ui-framework/doc_site/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ import 'regenerator-runtime/runtime';
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import {
Router,
hashHistory,
} from 'react-router';
import { Router, hashHistory } from 'react-router'; // eslint-disable-line

// Store.
import configureStore from './store/configure_store';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ import {
compose,
} from 'redux';
import thunk from 'redux-thunk';
import { browserHistory } from 'react-router';
import {
routerMiddleware,
routerReducer,
} from 'react-router-redux';
import { browserHistory } from 'react-router'; // eslint-disable-line
import { routerMiddleware, routerReducer } from 'react-router-redux';

import codeViewerReducer from './reducers/code_viewer_reducer';
import sandboxReducer from './reducers/sandbox_reducer';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@

import React from 'react';

import {
Link,
} from 'react-router';
import { Link } from 'react-router'; // eslint-disable-line

export const NotFoundView = () => (
<div className="guideContentPage">
Expand Down
1 change: 0 additions & 1 deletion packages/kbn-ui-framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
"react-dom": "^16.2.0",
"react-redux": "^5.0.6",
"react-router": "^3.2.0",
"react-router-dom": "4.2.2",
"react-router-redux": "^4.0.8",
"redux": "3.7.2",
"redux-thunk": "2.2.0",
Expand Down
51 changes: 2 additions & 49 deletions src/legacy/core_plugins/data/public/shim/legacy_module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { wrapInI18nContext } from 'ui/i18n';
// @ts-ignore
import { uiModules } from 'ui/modules';
import { npStart } from 'ui/new_platform';
import { FilterBar, ApplyFiltersPopover } from '../filter';
import { FilterBar } from '../filter';
import { IndexPatterns } from '../index_patterns/index_patterns';

/** @internal */
Expand Down Expand Up @@ -70,54 +70,7 @@ export const initLegacyModule = once((indexPatterns: IndexPatterns): void => {
['className', { watchDepth: 'reference' }],
['pluginDataStart', { watchDepth: 'reference' }],
]);
})
.directive('applyFiltersPopover', () => {
return {
restrict: 'E',
template: '',
compile: (elem: any) => {
const child = document.createElement('apply-filters-popover-helper');

// Copy attributes to the child directive
for (const attr of elem[0].attributes) {
child.setAttribute(attr.name, attr.value);
}

// Add a key attribute that will force a full rerender every time that
// a filter changes.
child.setAttribute('key', 'key');

// Append helper directive
elem.append(child);

const linkFn = ($scope: any, _: any, $attr: any) => {
// Watch only for filter changes to update key.
$scope.$watch(
() => {
return $scope.$eval($attr.filters) || [];
},
(newVal: any) => {
$scope.key = Date.now();
},
true
);
};

return linkFn;
},
};
})
.directive('applyFiltersPopoverHelper', (reactDirective: any) =>
reactDirective(wrapInI18nContext(ApplyFiltersPopover), [
['filters', { watchDepth: 'collection' }],
['onCancel', { watchDepth: 'reference' }],
['onSubmit', { watchDepth: 'reference' }],
['indexPatterns', { watchDepth: 'collection' }],

// Key is needed to trigger a full rerender of the component
'key',
])
);
});

uiModules.get('kibana/index_patterns').value('indexPatterns', indexPatterns);
});
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,18 @@ export class ExpressionDataHandler {
private inspectorAdapters: Adapters;
private promise: Promise<IInterpreterResult>;

public isPending: boolean = true;
constructor(expression: string | ExpressionAST, params: IExpressionLoaderParams) {
if (typeof expression === 'string') {
this.expression = expression;
this.ast = fromExpression(expression) as ExpressionAST;
} else {
this.ast = expression;
this.expression = toExpression(expression);
this.expression = toExpression(this.ast);
}

this.abortController = new AbortController();
this.inspectorAdapters = this.getActiveInspectorAdapters();
this.inspectorAdapters = params.inspectorAdapters || this.getActiveInspectorAdapters();

const getInitialContext = () => ({
type: 'kibana_context',
Expand All @@ -58,11 +59,21 @@ export class ExpressionDataHandler {
const defaultContext = { type: 'null' };

const interpreter = getInterpreter();
this.promise = interpreter.interpretAst(this.ast, params.context || defaultContext, {
getInitialContext,
inspectorAdapters: this.inspectorAdapters,
abortSignal: this.abortController.signal,
});
this.promise = interpreter
.interpretAst(this.ast, params.context || defaultContext, {
getInitialContext,
inspectorAdapters: this.inspectorAdapters,
abortSignal: this.abortController.signal,
})
.then(
(v: IInterpreterResult) => {
this.isPending = false;
return v;
},
() => {
this.isPending = false;
}
);
}

cancel = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('execute helper function', () => {
});

describe('ExpressionLoader', () => {
const expressionString = 'test';
const expressionString = 'demodata';

describe('constructor', () => {
it('accepts expression string', () => {
Expand Down Expand Up @@ -134,6 +134,8 @@ describe('ExpressionLoader', () => {
(ExpressionDataHandler as jest.Mock).mockImplementationOnce(() => ({
getData: () => true,
cancel: cancelMock,
isPending: () => true,
inspect: () => {},
}));

const expressionLoader = new ExpressionLoader(element, expressionString, {});
Expand All @@ -160,10 +162,15 @@ describe('ExpressionLoader', () => {
(ExpressionDataHandler as jest.Mock).mockImplementationOnce(() => ({
getData,
cancel: cancelMock,
isPending: () => true,
inspect: () => {},
}));

(ExpressionDataHandler as jest.Mock).mockImplementationOnce(() => ({
getData,
cancel: cancelMock,
isPending: () => true,
inspect: () => {},
}));

const expressionLoader = new ExpressionLoader(element, expressionString, {});
Expand Down Expand Up @@ -193,6 +200,8 @@ describe('ExpressionLoader', () => {
(ExpressionDataHandler as jest.Mock).mockImplementationOnce(() => ({
getData,
cancel: cancelMock,
isPending: () => true,
inspect: () => {},
}));

const expressionLoader = new ExpressionLoader(element, expressionString, {});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ export class ExpressionLoader {
private loadingSubject: Subject<void>;
private data: Data;
private params: IExpressionLoaderParams = {};
private ignoreNextResponse = false;

constructor(
element: HTMLElement,
expression: string | ExpressionAST,
params: IExpressionLoaderParams
expression?: string | ExpressionAST,
params?: IExpressionLoaderParams
) {
this.dataSubject = new Subject();
this.data$ = this.dataSubject.asObservable().pipe(share());
Expand All @@ -65,7 +66,9 @@ export class ExpressionLoader {

this.setParams(params);

this.loadData(expression, this.params);
if (expression) {
this.loadData(expression, this.params);
}
}

destroy() {
Expand Down Expand Up @@ -117,9 +120,10 @@ export class ExpressionLoader {
update(expression?: string | ExpressionAST, params?: IExpressionLoaderParams): void {
this.setParams(params);

this.loadingSubject.next();
if (expression) {
this.loadData(expression, this.params);
} else {
} else if (this.data) {
this.render(this.data);
}
}
Expand All @@ -128,18 +132,22 @@ export class ExpressionLoader {
expression: string | ExpressionAST,
params: IExpressionLoaderParams
): Promise<void> => {
this.loadingSubject.next();
if (this.dataHandler) {
if (this.dataHandler && this.dataHandler.isPending) {
this.ignoreNextResponse = true;
this.dataHandler.cancel();
}
this.setParams(params);
this.dataHandler = new ExpressionDataHandler(expression, params);
if (!params.inspectorAdapters) params.inspectorAdapters = this.dataHandler.inspect();
const data = await this.dataHandler.getData();
if (this.ignoreNextResponse) {
this.ignoreNextResponse = false;
return;
}
this.dataSubject.next(data);
};

private render(data: Data): void {
this.loadingSubject.next();
this.renderHandler.render(data, this.params.extraHandlers);
}

Expand All @@ -148,23 +156,16 @@ export class ExpressionLoader {
return;
}

if (params.searchContext && this.params.searchContext) {
if (params.searchContext) {
this.params.searchContext = _.defaults(
{},
params.searchContext,
this.params.searchContext
this.params.searchContext || {}
) as any;
}
if (params.extraHandlers && this.params) {
this.params.extraHandlers = params.extraHandlers;
}

if (!Object.keys(this.params).length) {
this.params = {
...params,
searchContext: { type: 'kibana_context', ...(params.searchContext || {}) },
};
}
}
}

Expand Down
Loading

0 comments on commit d293511

Please sign in to comment.