Skip to content

Commit

Permalink
Merge branch 'master' into savedObjectsBetweenVersionsTest
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Apr 1, 2021
2 parents 410b88c + 3b3ad0e commit ec0333d
Show file tree
Hide file tree
Showing 250 changed files with 913 additions and 892 deletions.
20 changes: 9 additions & 11 deletions .github/ISSUE_TEMPLATE/v8_breaking_change.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: 8.0 Breaking change
about: Breaking changes from 7.x -> 8.0
title: "[Breaking change]"
labels: Team:Elasticsearch UI, Feature:Upgrade Assistant, Breaking Change
labels: Feature:Upgrade Assistant, Breaking Change
assignees: ''

---
Expand All @@ -12,8 +12,8 @@ assignees: ''
******* LABEL CHANGES NECESSARY ********
****************************************
Please add a "NeededFor:${TeamName}" label to denote the team that is
requesting the breaking change to be surfaced in the Upgrade Assistant.
Please add a team label to denote the team that the
breaking change is applicable to.
-->

Expand All @@ -30,16 +30,14 @@ requesting the breaking change to be surfaced in the Upgrade Assistant.
<!-- e.g. Based on telemetry data, roughly 75% of our users will need to make changes to x. -->
<!-- e.g. A majority of users will need to make changes to x. -->

**How can we programmatically determine whether the cluster is affected by this breaking change?**
**Can the change be registered with the [Kibana deprecation service](https://github.com/elastic/kibana/blob/master/docs/development/core/server/kibana-plugin-core-server.deprecationsservicesetup.md)?**

**What can users do to address the change manually?**
<!-- The deprecation service is consumed by the Upgrade Assistant to surface Kibana deprecations.
It provides a way for Kibana deprecations to be resolved automatically via an API
or manually by providing step-by-step instructions for users to follow. -->

<!-- If applicable, describe the manual migration steps and/or link to available docs. -->

**How could we make migration easier with the Upgrade Assistant?**

<!-- This can be as basic as notifying the user about the deprecation and linking to some
migration docs, or as advanced as a dedicated UI for fixing the problem. -->
<!-- Each plugin owner is responsible for registering their deprecations via the service.
Please link to the issue/PR that will add this functionality. -->

**Are there any edge cases?**

Expand Down
4 changes: 2 additions & 2 deletions docs/discover/search.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ image::discover/images/read-only-badge.png[Example of Discover's read only acces
==== Save a search
To save the current search:

. Click *Save* in the Kibana toolbar.
. Click *Save* in the toolbar.
. Enter a name for the search and click *Save*.

To import, export, and delete saved searches, open the main menu,
Expand All @@ -119,7 +119,7 @@ then click *Stack Management > Saved Objects*.
==== Open a saved search
To load a saved search into Discover:

. Click *Open* in the Kibana toolbar.
. Click *Open* in the toolbar.
. Select the search you want to open.

If the saved search is associated with a different index pattern than is currently
Expand Down
6 changes: 6 additions & 0 deletions packages/kbn-cli-dev-mode/src/dev_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,5 +249,11 @@ export class DevServer {
)
.subscribe(subscriber)
);

// complete state subjects when run$ completes
subscriber.add(() => {
this.phase$.complete();
this.ready$.complete();
});
});
}
1 change: 1 addition & 0 deletions packages/kbn-cli-dev-mode/src/optimizer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ it('is ready when optimizer phase is success or issue and logs in familiar forma
"ready: false",
"<issue>",
"ready: true",
"complete",
]
`);

Expand Down
28 changes: 20 additions & 8 deletions packages/kbn-cli-dev-mode/src/optimizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,26 @@ export class Optimizer {
},
]);

this.run$ = runOptimizer(config).pipe(
logOptimizerState(log, config),
tap(({ state }) => {
this.phase$.next(state.phase);
this.ready$.next(state.phase === 'success' || state.phase === 'issue');
}),
ignoreElements()
);
this.run$ = new Rx.Observable<void>((subscriber) => {
subscriber.add(
runOptimizer(config)
.pipe(
logOptimizerState(log, config),
tap(({ state }) => {
this.phase$.next(state.phase);
this.ready$.next(state.phase === 'success' || state.phase === 'issue');
}),
ignoreElements()
)
.subscribe(subscriber)
);

// complete state subjects when run$ completes
subscriber.add(() => {
this.phase$.complete();
this.ready$.complete();
});
});
}

getPhase$() {
Expand Down
5 changes: 5 additions & 0 deletions packages/kbn-cli-dev-mode/src/watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ export class Watcher {
.pipe(ignoreElements())
.subscribe(subscriber)
);

// complete state subjects when run$ completes
subscriber.add(() => {
this.restart$.complete();
});
});

serverShouldRestart$() {
Expand Down
2 changes: 0 additions & 2 deletions packages/kbn-optimizer/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
* Side Public License, v 1.
*/

import 'source-map-support/register';

import Path from 'path';

import { REPO_ROOT } from '@kbn/utils';
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-storybook/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"incremental": false,
"outDir": "target",
Expand Down
1 change: 1 addition & 0 deletions scripts/build_kibana_platform_plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

require('../src/setup_node_env/ensure_node_preserve_symlinks');
require('source-map-support/register');
require('@kbn/optimizer').runKbnOptimizerCli({
defaultLimitsPath: require.resolve('../packages/kbn-optimizer/limits.yml'),
});
2 changes: 1 addition & 1 deletion src/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"extends": "../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
37 changes: 32 additions & 5 deletions src/dev/typescript/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { basename, dirname, relative, resolve } from 'path';

import { memoize } from 'lodash';
import { IMinimatch, Minimatch } from 'minimatch';
import { REPO_ROOT } from '@kbn/utils';

Expand All @@ -26,6 +26,10 @@ function testMatchers(matchers: IMinimatch[], path: string) {
return matchers.some((matcher) => matcher.match(path));
}

const parentProjectFactory = memoize(function (parentConfigPath: string) {
return new Project(parentConfigPath);
});

export class Project {
public directory: string;
public name: string;
Expand All @@ -34,22 +38,24 @@ export class Project {

private readonly include: IMinimatch[];
private readonly exclude: IMinimatch[];
private readonly parent?: Project;

constructor(
public tsConfigPath: string,
options: { name?: string; disableTypeCheck?: boolean } = {}
) {
this.config = parseTsConfig(tsConfigPath);

const { files, include, exclude = [] } = this.config as {
const { files, include, exclude = [], extends: extendsPath } = this.config as {
files?: string[];
include?: string[];
exclude?: string[];
extends?: string;
};

if (files || !include) {
throw new Error(
'tsconfig.json files in the Kibana repo must use "include" keys and not "files"'
`[${tsConfigPath}]: tsconfig.json files in the Kibana repo must use "include" keys and not "files"`
);
}

Expand All @@ -58,9 +64,30 @@ export class Project {
this.name = options.name || relative(REPO_ROOT, this.directory) || basename(this.directory);
this.include = makeMatchers(this.directory, include);
this.exclude = makeMatchers(this.directory, exclude);

if (extendsPath !== undefined) {
const parentConfigPath = resolve(this.directory, extendsPath);
this.parent = parentProjectFactory(parentConfigPath);
}
}

public isAbsolutePathSelected(path: string): boolean {
return this.isExcluded(path) ? false : this.isIncluded(path);
}

public isAbsolutePathSelected(path: string) {
return testMatchers(this.exclude, path) ? false : testMatchers(this.include, path);
public isExcluded(path: string): boolean {
if (testMatchers(this.exclude, path)) return true;
if (this.parent) {
return this.parent.isExcluded(path);
}
return false;
}

public isIncluded(path: string): boolean {
if (testMatchers(this.include, path)) return true;
if (this.parent) {
return this.parent.isIncluded(path);
}
return false;
}
}
2 changes: 1 addition & 1 deletion src/plugins/advanced_settings/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/apm_oss/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/bfetch/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/charts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/console/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
10 changes: 5 additions & 5 deletions src/plugins/dashboard/public/application/dashboard_router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export async function mountApp({

const spacesApi = pluginsStart.spacesOss?.isSpacesAvailable ? pluginsStart.spacesOss : undefined;
const activeSpaceId = spacesApi && (await spacesApi.activeSpace$.pipe(first()).toPromise())?.id;
let globalEmbedSettings: DashboardEmbedSettings | undefined;

const dashboardServices: DashboardAppServices = {
navigation,
Expand Down Expand Up @@ -149,9 +150,6 @@ export async function mountApp({
const getDashboardEmbedSettings = (
routeParams: ParsedQuery<string>
): DashboardEmbedSettings | undefined => {
if (!routeParams.embed) {
return undefined;
}
return {
forceShowTopNavMenu: Boolean(routeParams[dashboardUrlParams.showTopMenu]),
forceShowQueryInput: Boolean(routeParams[dashboardUrlParams.showQueryInput]),
Expand All @@ -162,11 +160,13 @@ export async function mountApp({

const renderDashboard = (routeProps: RouteComponentProps<{ id?: string }>) => {
const routeParams = parse(routeProps.history.location.search);
const embedSettings = getDashboardEmbedSettings(routeParams);
if (routeParams.embed && !globalEmbedSettings) {
globalEmbedSettings = getDashboardEmbedSettings(routeParams);
}
return (
<DashboardApp
history={routeProps.history}
embedSettings={embedSettings}
embedSettings={globalEmbedSettings}
savedDashboardId={routeProps.match.params.id}
redirectTo={(props: RedirectToProps) => redirect(routeProps, props)}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/dashboard/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { createMockContext } from '../../../../expressions/common';
import { createMockContext } from '../../../../expressions/common/mocks';
import { functionWrapper } from './utils';
import { existsFilterFunction } from './exists_filter';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { createMockContext } from '../../../../expressions/common';
import { createMockContext } from '../../../../expressions/common/mocks';
import { functionWrapper } from './utils';
import { kibanaFilterFunction } from './kibana_filter';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { createMockContext } from '../../../../expressions/common';
import { createMockContext } from '../../../../expressions/common/mocks';
import { functionWrapper } from './utils';
import { phraseFilterFunction } from './phrase_filter';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { createMockContext } from '../../../../expressions/common';
import { createMockContext } from '../../../../expressions/common/mocks';
import { functionWrapper } from './utils';
import { rangeFilterFunction } from './range_filter';

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/dev_tools/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/discover/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/embeddable/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/es_ui_shared/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../tsconfig.project.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/expressions/common/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ export const createMockExecutionContext = <ExtraContext extends object = object>
...extraContext,
};
};

export { createMockContext } from './util/test_utils';
1 change: 0 additions & 1 deletion src/plugins/expressions/common/util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ export * from './create_error';
export * from './get_by_alias';
export * from './tables_adapter';
export * from './expressions_inspector_adapter';
export * from './test_utils';
Loading

0 comments on commit ec0333d

Please sign in to comment.