Skip to content

Commit

Permalink
Merge with master and resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
stratoula committed Jul 26, 2021
2 parents aa1b645 + 2392b4f commit 083b708
Show file tree
Hide file tree
Showing 269 changed files with 3,805 additions and 2,798 deletions.
1 change: 1 addition & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"devTools": "src/plugins/dev_tools",
"expressions": "src/plugins/expressions",
"expressionError": "src/plugins/expression_error",
"expressionImage": "src/plugins/expression_image",
"expressionRepeatImage": "src/plugins/expression_repeat_image",
"expressionRevealImage": "src/plugins/expression_reveal_image",
"expressionShape": "src/plugins/expression_shape",
Expand Down
4 changes: 4 additions & 0 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ This API doesn't support angular, for registering angular dev tools, bootstrap a
|Expression Error plugin adds an error renderer to the expression plugin. The renderer will display the error image.
|{kib-repo}blob/{branch}/src/plugins/expression_image/README.md[expressionImage]
|Expression Image plugin adds an image renderer to the expression plugin. The renderer will display the given image.
|{kib-repo}blob/{branch}/src/plugins/expression_repeat_image/README.md[expressionRepeatImage]
|Expression Repeat Image plugin adds a repeatImage function to the expression plugin and an associated renderer. The renderer will display the given image in mutliple instances.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [Executor](./kibana-plugin-plugins-expressions-public.executor.md) &gt; [getAllMigrations](./kibana-plugin-plugins-expressions-public.executor.getallmigrations.md)

## Executor.getAllMigrations() method

<b>Signature:</b>

```typescript
getAllMigrations(): MigrateFunctionsObject;
```
<b>Returns:</b>

`MigrateFunctionsObject`

Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ export declare class Executor<Context extends Record<string, unknown> = Record<s
| [extendContext(extraContext)](./kibana-plugin-plugins-expressions-public.executor.extendcontext.md) | | |
| [extract(ast)](./kibana-plugin-plugins-expressions-public.executor.extract.md) | | |
| [fork()](./kibana-plugin-plugins-expressions-public.executor.fork.md) | | |
| [getAllMigrations()](./kibana-plugin-plugins-expressions-public.executor.getallmigrations.md) | | |
| [getFunction(name)](./kibana-plugin-plugins-expressions-public.executor.getfunction.md) | | |
| [getFunctions()](./kibana-plugin-plugins-expressions-public.executor.getfunctions.md) | | |
| [getType(name)](./kibana-plugin-plugins-expressions-public.executor.gettype.md) | | |
| [getTypes()](./kibana-plugin-plugins-expressions-public.executor.gettypes.md) | | |
| [inject(ast, references)](./kibana-plugin-plugins-expressions-public.executor.inject.md) | | |
| [migrate(ast, version)](./kibana-plugin-plugins-expressions-public.executor.migrate.md) | | |
| [migrateToLatest(state)](./kibana-plugin-plugins-expressions-public.executor.migratetolatest.md) | | |
| [registerFunction(functionDefinition)](./kibana-plugin-plugins-expressions-public.executor.registerfunction.md) | | |
| [registerType(typeDefinition)](./kibana-plugin-plugins-expressions-public.executor.registertype.md) | | |
| [run(ast, input, params)](./kibana-plugin-plugins-expressions-public.executor.run.md) | | Execute expression and return result. |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [Executor](./kibana-plugin-plugins-expressions-public.executor.md) &gt; [migrate](./kibana-plugin-plugins-expressions-public.executor.migrate.md)
[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [Executor](./kibana-plugin-plugins-expressions-public.executor.md) &gt; [migrateToLatest](./kibana-plugin-plugins-expressions-public.executor.migratetolatest.md)

## Executor.migrate() method
## Executor.migrateToLatest() method

<b>Signature:</b>

```typescript
migrate(ast: SerializableState, version: string): ExpressionAstExpression;
migrateToLatest(state: VersionedState): ExpressionAstExpression;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| ast | <code>SerializableState</code> | |
| version | <code>string</code> | |
| state | <code>VersionedState</code> | |

<b>Returns:</b>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [ExpressionsService](./kibana-plugin-plugins-expressions-public.expressionsservice.md) &gt; [getAllMigrations](./kibana-plugin-plugins-expressions-public.expressionsservice.getallmigrations.md)

## ExpressionsService.getAllMigrations property

gets an object with semver mapped to a migration function

<b>Signature:</b>

```typescript
getAllMigrations: () => import("../../../kibana_utils/common").MigrateFunctionsObject;
```
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ export declare class ExpressionsService implements PersistableStateService<Expre
| [executor](./kibana-plugin-plugins-expressions-public.expressionsservice.executor.md) | | <code>Executor</code> | |
| [extract](./kibana-plugin-plugins-expressions-public.expressionsservice.extract.md) | | <code>(state: ExpressionAstExpression) =&gt; {</code><br/><code> state: ExpressionAstExpression;</code><br/><code> references: SavedObjectReference[];</code><br/><code> }</code> | Extracts saved object references from expression AST |
| [fork](./kibana-plugin-plugins-expressions-public.expressionsservice.fork.md) | | <code>() =&gt; ExpressionsService</code> | |
| [getAllMigrations](./kibana-plugin-plugins-expressions-public.expressionsservice.getallmigrations.md) | | <code>() =&gt; import(&quot;../../../kibana_utils/common&quot;).MigrateFunctionsObject</code> | gets an object with semver mapped to a migration function |
| [getFunction](./kibana-plugin-plugins-expressions-public.expressionsservice.getfunction.md) | | <code>ExpressionsServiceStart['getFunction']</code> | |
| [getFunctions](./kibana-plugin-plugins-expressions-public.expressionsservice.getfunctions.md) | | <code>() =&gt; ReturnType&lt;Executor['getFunctions']&gt;</code> | Returns POJO map of all registered expression functions, where keys are names of the functions and values are <code>ExpressionFunction</code> instances. |
| [getRenderer](./kibana-plugin-plugins-expressions-public.expressionsservice.getrenderer.md) | | <code>ExpressionsServiceStart['getRenderer']</code> | |
| [getRenderers](./kibana-plugin-plugins-expressions-public.expressionsservice.getrenderers.md) | | <code>() =&gt; ReturnType&lt;ExpressionRendererRegistry['toJS']&gt;</code> | Returns POJO map of all registered expression renderers, where keys are names of the renderers and values are <code>ExpressionRenderer</code> instances. |
| [getType](./kibana-plugin-plugins-expressions-public.expressionsservice.gettype.md) | | <code>ExpressionsServiceStart['getType']</code> | |
| [getTypes](./kibana-plugin-plugins-expressions-public.expressionsservice.gettypes.md) | | <code>() =&gt; ReturnType&lt;Executor['getTypes']&gt;</code> | Returns POJO map of all registered expression types, where keys are names of the types and values are <code>ExpressionType</code> instances. |
| [inject](./kibana-plugin-plugins-expressions-public.expressionsservice.inject.md) | | <code>(state: ExpressionAstExpression, references: SavedObjectReference[]) =&gt; ExpressionAstExpression</code> | Injects saved object references into expression AST |
| [migrate](./kibana-plugin-plugins-expressions-public.expressionsservice.migrate.md) | | <code>(state: SerializableState, version: string) =&gt; ExpressionAstExpression</code> | Runs the migration (if it exists) for specified version. This will run a single migration step (ie from 7.10.0 to 7.10.1) |
| [migrateToLatest](./kibana-plugin-plugins-expressions-public.expressionsservice.migratetolatest.md) | | <code>(state: VersionedState) =&gt; ExpressionAstExpression</code> | migrates an old expression to latest version |
| [registerFunction](./kibana-plugin-plugins-expressions-public.expressionsservice.registerfunction.md) | | <code>(functionDefinition: AnyExpressionFunctionDefinition &#124; (() =&gt; AnyExpressionFunctionDefinition)) =&gt; void</code> | Register an expression function, which will be possible to execute as part of the expression pipeline.<!-- -->Below we register a function which simply sleeps for given number of milliseconds to delay the execution and outputs its input as-is.
```ts
expressions.registerFunction({
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-public](./kibana-plugin-plugins-expressions-public.md) &gt; [ExpressionsService](./kibana-plugin-plugins-expressions-public.expressionsservice.md) &gt; [migrateToLatest](./kibana-plugin-plugins-expressions-public.expressionsservice.migratetolatest.md)

## ExpressionsService.migrateToLatest property

migrates an old expression to latest version

<b>Signature:</b>

```typescript
migrateToLatest: (state: VersionedState) => ExpressionAstExpression;
```
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface IExpressionLoaderParams
| [searchContext](./kibana-plugin-plugins-expressions-public.iexpressionloaderparams.searchcontext.md) | <code>SerializableState</code> | |
| [searchSessionId](./kibana-plugin-plugins-expressions-public.iexpressionloaderparams.searchsessionid.md) | <code>string</code> | |
| [syncColors](./kibana-plugin-plugins-expressions-public.iexpressionloaderparams.synccolors.md) | <code>boolean</code> | |
| [throttle](./kibana-plugin-plugins-expressions-public.iexpressionloaderparams.throttle.md) | <code>number</code> | Throttling of partial results in milliseconds. By default, throttling is disabled. |
| [throttle](./kibana-plugin-plugins-expressions-public.iexpressionloaderparams.throttle.md) | <code>number</code> | Throttling of partial results in milliseconds. 0 is disabling the throttling. By default, it equals 1000. |
| [uiState](./kibana-plugin-plugins-expressions-public.iexpressionloaderparams.uistate.md) | <code>unknown</code> | |
| [variables](./kibana-plugin-plugins-expressions-public.iexpressionloaderparams.variables.md) | <code>Record&lt;string, any&gt;</code> | |

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## IExpressionLoaderParams.throttle property

Throttling of partial results in milliseconds. By default, throttling is disabled.
Throttling of partial results in milliseconds. 0 is disabling the throttling. By default, it equals 1000.

<b>Signature:</b>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) &gt; [Executor](./kibana-plugin-plugins-expressions-server.executor.md) &gt; [getAllMigrations](./kibana-plugin-plugins-expressions-server.executor.getallmigrations.md)

## Executor.getAllMigrations() method

<b>Signature:</b>

```typescript
getAllMigrations(): MigrateFunctionsObject;
```
<b>Returns:</b>

`MigrateFunctionsObject`

Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ export declare class Executor<Context extends Record<string, unknown> = Record<s
| [extendContext(extraContext)](./kibana-plugin-plugins-expressions-server.executor.extendcontext.md) | | |
| [extract(ast)](./kibana-plugin-plugins-expressions-server.executor.extract.md) | | |
| [fork()](./kibana-plugin-plugins-expressions-server.executor.fork.md) | | |
| [getAllMigrations()](./kibana-plugin-plugins-expressions-server.executor.getallmigrations.md) | | |
| [getFunction(name)](./kibana-plugin-plugins-expressions-server.executor.getfunction.md) | | |
| [getFunctions()](./kibana-plugin-plugins-expressions-server.executor.getfunctions.md) | | |
| [getType(name)](./kibana-plugin-plugins-expressions-server.executor.gettype.md) | | |
| [getTypes()](./kibana-plugin-plugins-expressions-server.executor.gettypes.md) | | |
| [inject(ast, references)](./kibana-plugin-plugins-expressions-server.executor.inject.md) | | |
| [migrate(ast, version)](./kibana-plugin-plugins-expressions-server.executor.migrate.md) | | |
| [migrateToLatest(state)](./kibana-plugin-plugins-expressions-server.executor.migratetolatest.md) | | |
| [registerFunction(functionDefinition)](./kibana-plugin-plugins-expressions-server.executor.registerfunction.md) | | |
| [registerType(typeDefinition)](./kibana-plugin-plugins-expressions-server.executor.registertype.md) | | |
| [run(ast, input, params)](./kibana-plugin-plugins-expressions-server.executor.run.md) | | Execute expression and return result. |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) &gt; [Executor](./kibana-plugin-plugins-expressions-server.executor.md) &gt; [migrate](./kibana-plugin-plugins-expressions-server.executor.migrate.md)
[Home](./index.md) &gt; [kibana-plugin-plugins-expressions-server](./kibana-plugin-plugins-expressions-server.md) &gt; [Executor](./kibana-plugin-plugins-expressions-server.executor.md) &gt; [migrateToLatest](./kibana-plugin-plugins-expressions-server.executor.migratetolatest.md)

## Executor.migrate() method
## Executor.migrateToLatest() method

<b>Signature:</b>

```typescript
migrate(ast: SerializableState, version: string): ExpressionAstExpression;
migrateToLatest(state: VersionedState): ExpressionAstExpression;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| ast | <code>SerializableState</code> | |
| version | <code>string</code> | |
| state | <code>VersionedState</code> | |

<b>Returns:</b>

Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
"@elastic/request-crypto": "1.1.4",
"@elastic/safer-lodash-set": "link:bazel-bin/packages/elastic-safer-lodash-set",
"@elastic/search-ui-app-search-connector": "^1.6.0",
"@elastic/ui-ace": "0.2.3",
"@emotion/react": "^11.4.0",
"@hapi/accept": "^5.0.2",
"@hapi/boom": "^9.1.1",
Expand Down Expand Up @@ -194,7 +193,6 @@
"angular-route": "^1.8.0",
"angular-sanitize": "^1.8.0",
"angular-sortable-view": "^0.0.17",
"angular-ui-ace": "0.2.3",
"antlr4ts": "^0.5.0-alpha.3",
"archiver": "^5.2.0",
"axios": "^0.21.1",
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,6 @@ pageLoadAssetSize:
cases: 144442
expressionError: 22127
expressionRepeatImage: 22341
expressionImage: 19288
expressionShape: 30033
userSetup: 18532
1 change: 1 addition & 0 deletions src/dev/storybook/aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const storybookAliases = {
data_enhanced: 'x-pack/plugins/data_enhanced/.storybook',
embeddable: 'src/plugins/embeddable/.storybook',
expression_error: 'src/plugins/expression_error/.storybook',
expression_image: 'src/plugins/expression_image/.storybook',
expression_repeat_image: 'src/plugins/expression_repeat_image/.storybook',
expression_reveal_image: 'src/plugins/expression_reveal_image/.storybook',
expression_shape: 'src/plugins/expression_shape/.storybook',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,5 +202,11 @@ describe('createSearchSessionRestorationDataProvider', () => {
expect(initialState.timeRange).toBe(relativeTime);
expect(restoreState.timeRange).toBe(absoluteTime);
});

test('restoreState has paused autoRefresh', async () => {
const { initialState, restoreState } = await searchSessionInfoProvider.getUrlGeneratorData();
expect(initialState.refreshInterval).toBe(undefined);
expect(restoreState.refreshInterval?.pause).toBe(true);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,12 @@ function createUrlGeneratorState({
sort: appState.sort,
savedQuery: appState.savedQuery,
interval: appState.interval,
refreshInterval: shouldRestoreSearchSession
? {
pause: true, // force pause refresh interval when restoring a session
value: 0,
}
: undefined,
useHash: false,
};
}

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

13 changes: 13 additions & 0 deletions src/plugins/embeddable/public/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,19 @@ describe('embeddable factory', () => {
start.getAllMigrations!()['7.11.0']!(containerState);
expect(embeddableFactory.migrations['7.11.0']).toBeCalledWith(embeddableState);
});

test('migrateToLatest returns list of all migrations', () => {
const migrations = start.getAllMigrations();
expect(migrations).toMatchSnapshot();
});

test('migrateToLatest calls correct migrate functions', () => {
start.migrateToLatest!({
state: embeddableState,
version: '7.11.0',
});
expect(embeddableFactory.migrations['7.11.0']).toBeCalledWith(embeddableState);
});
});

describe('embeddable enhancements', () => {
Expand Down
23 changes: 16 additions & 7 deletions src/plugins/embeddable/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ import {
import { EmbeddableFactoryDefinition } from './lib/embeddables/embeddable_factory_definition';
import { EmbeddableStateTransfer } from './lib/state_transfer';
import { Storage } from '../../kibana_utils/public';
import { PersistableStateService, SerializableState } from '../../kibana_utils/common';
import {
migrateToLatest,
PersistableStateService,
SerializableState,
} from '../../kibana_utils/common';
import { ATTRIBUTE_SERVICE_KEY, AttributeService } from './lib/attribute_service';
import { AttributeServiceOptions } from './lib/attribute_service/attribute_service';
import { EmbeddableStateWithType } from '../common/types';
Expand Down Expand Up @@ -181,6 +185,13 @@ export class EmbeddablePublicPlugin implements Plugin<EmbeddableSetup, Embeddabl
getEnhancement: this.getEnhancement,
};

const getAllMigrationsFn = () =>
getAllMigrations(
Array.from(this.embeddableFactories.values()),
Array.from(this.enhancements.values()),
getMigrateFunction(commonContract)
);

return {
getEmbeddableFactory: this.getEmbeddableFactory,
getEmbeddableFactories: this.getEmbeddableFactories,
Expand All @@ -206,12 +217,10 @@ export class EmbeddablePublicPlugin implements Plugin<EmbeddableSetup, Embeddabl
telemetry: getTelemetryFunction(commonContract),
extract: getExtractFunction(commonContract),
inject: getInjectFunction(commonContract),
getAllMigrations: () =>
getAllMigrations(
Array.from(this.embeddableFactories.values()),
Array.from(this.enhancements.values()),
getMigrateFunction(commonContract)
),
getAllMigrations: getAllMigrationsFn,
migrateToLatest: (state) => {
return migrateToLatest(getAllMigrationsFn(), state) as EmbeddableStateWithType;
},
};
}

Expand Down
10 changes: 10 additions & 0 deletions src/plugins/expression_image/.storybook/main.js
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
* 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.
*/

// eslint-disable-next-line import/no-commonjs
module.exports = require('@kbn/storybook').defaultConfig;
Loading

0 comments on commit 083b708

Please sign in to comment.