Skip to content

Commit

Permalink
Add async search notification (#60706)
Browse files Browse the repository at this point in the history
* notifications ui

* increase timeout to 10s

* trigger notification from search interceptor

* added an enhanced interceptor

* added an enhanced interceptor

* docs

* docs

* fix ts

* Fix jest tests for interceptor

* update docs

* docs

* Fix handling syntax error in discover

* docs and translations

* fix scripted fields err

Co-authored-by: Lukas Olson <[email protected]>
  • Loading branch information
Liza Katz and lukasolson authored Mar 24, 2020
1 parent e55ee76 commit c7c6eba
Show file tree
Hide file tree
Showing 28 changed files with 620 additions and 123 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
| [IndexPatternSelect](./kibana-plugin-plugins-data-public.indexpatternselect.md) | |
| [OptionedParamType](./kibana-plugin-plugins-data-public.optionedparamtype.md) | |
| [Plugin](./kibana-plugin-plugins-data-public.plugin.md) | |
| [RequestTimeoutError](./kibana-plugin-plugins-data-public.requesttimeouterror.md) | Class used to signify that a request timed out. Useful for applications to conditionally handle this type of error differently than other errors. |
| [SearchError](./kibana-plugin-plugins-data-public.searcherror.md) | |
| [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) | |
| [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) | |
| [TimeHistory](./kibana-plugin-plugins-data-public.timehistory.md) | |

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

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [RequestTimeoutError](./kibana-plugin-plugins-data-public.requesttimeouterror.md) &gt; [(constructor)](./kibana-plugin-plugins-data-public.requesttimeouterror._constructor_.md)

## RequestTimeoutError.(constructor)

Constructs a new instance of the `RequestTimeoutError` class

<b>Signature:</b>

```typescript
constructor(message?: string);
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| message | <code>string</code> | |

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

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [RequestTimeoutError](./kibana-plugin-plugins-data-public.requesttimeouterror.md)

## RequestTimeoutError class

Class used to signify that a request timed out. Useful for applications to conditionally handle this type of error differently than other errors.

<b>Signature:</b>

```typescript
export declare class RequestTimeoutError extends Error
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(message)](./kibana-plugin-plugins-data-public.requesttimeouterror._constructor_.md) | | Constructs a new instance of the <code>RequestTimeoutError</code> class |
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) &gt; [(constructor)](./kibana-plugin-plugins-data-public.searchinterceptor._constructor_.md)

## SearchInterceptor.(constructor)

This class should be instantiated with a `requestTimeout` corresponding with how many ms after requests are initiated that they should automatically cancel.

<b>Signature:</b>

```typescript
constructor(toasts: ToastsStart, application: ApplicationStart, requestTimeout?: number | undefined);
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| toasts | <code>ToastsStart</code> | |
| application | <code>ApplicationStart</code> | |
| requestTimeout | <code>number &#124; undefined</code> | |

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-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) &gt; [abortController](./kibana-plugin-plugins-data-public.searchinterceptor.abortcontroller.md)

## SearchInterceptor.abortController property

`abortController` used to signal all searches to abort.

<b>Signature:</b>

```typescript
protected abortController: AbortController;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) &gt; [application](./kibana-plugin-plugins-data-public.searchinterceptor.application.md)

## SearchInterceptor.application property

<b>Signature:</b>

```typescript
protected readonly application: ApplicationStart;
```
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-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) &gt; [getPendingCount$](./kibana-plugin-plugins-data-public.searchinterceptor.getpendingcount_.md)

## SearchInterceptor.getPendingCount$ property

Returns an `Observable` over the current number of pending searches. This could mean that one of the search requests is still in flight, or that it has only received partial responses.

<b>Signature:</b>

```typescript
getPendingCount$: () => import("rxjs").Observable<number>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) &gt; [hideToast](./kibana-plugin-plugins-data-public.searchinterceptor.hidetoast.md)

## SearchInterceptor.hideToast property

<b>Signature:</b>

```typescript
protected hideToast: () => void;
```
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-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) &gt; [longRunningToast](./kibana-plugin-plugins-data-public.searchinterceptor.longrunningtoast.md)

## SearchInterceptor.longRunningToast property

The current long-running toast (if there is one).

<b>Signature:</b>

```typescript
protected longRunningToast?: Toast;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md)

## SearchInterceptor class

<b>Signature:</b>

```typescript
export declare class SearchInterceptor
```

## Constructors

| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(toasts, application, requestTimeout)](./kibana-plugin-plugins-data-public.searchinterceptor._constructor_.md) | | This class should be instantiated with a <code>requestTimeout</code> corresponding with how many ms after requests are initiated that they should automatically cancel. |

## Properties

| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [abortController](./kibana-plugin-plugins-data-public.searchinterceptor.abortcontroller.md) | | <code>AbortController</code> | <code>abortController</code> used to signal all searches to abort. |
| [application](./kibana-plugin-plugins-data-public.searchinterceptor.application.md) | | <code>ApplicationStart</code> | |
| [getPendingCount$](./kibana-plugin-plugins-data-public.searchinterceptor.getpendingcount_.md) | | <code>() =&gt; import(&quot;rxjs&quot;).Observable&lt;number&gt;</code> | Returns an <code>Observable</code> over the current number of pending searches. This could mean that one of the search requests is still in flight, or that it has only received partial responses. |
| [hideToast](./kibana-plugin-plugins-data-public.searchinterceptor.hidetoast.md) | | <code>() =&gt; void</code> | |
| [longRunningToast](./kibana-plugin-plugins-data-public.searchinterceptor.longrunningtoast.md) | | <code>Toast</code> | The current long-running toast (if there is one). |
| [requestTimeout](./kibana-plugin-plugins-data-public.searchinterceptor.requesttimeout.md) | | <code>number &#124; undefined</code> | |
| [search](./kibana-plugin-plugins-data-public.searchinterceptor.search.md) | | <code>(search: ISearchGeneric, request: IKibanaSearchRequest, options?: ISearchOptions &#124; undefined) =&gt; import(&quot;rxjs&quot;).Observable&lt;import(&quot;../../common/search&quot;).IEsSearchResponse&lt;unknown&gt;&gt;</code> | Searches using the given <code>search</code> method. Overrides the <code>AbortSignal</code> with one that will abort either when <code>cancelPending</code> is called, when the request times out, or when the original <code>AbortSignal</code> is aborted. Updates the <code>pendingCount</code> when the request is started/finalized. |
| [showToast](./kibana-plugin-plugins-data-public.searchinterceptor.showtoast.md) | | <code>() =&gt; void</code> | |
| [timeoutSubscriptions](./kibana-plugin-plugins-data-public.searchinterceptor.timeoutsubscriptions.md) | | <code>Set&lt;Subscription&gt;</code> | The subscriptions from scheduling the automatic timeout for each request. |
| [toasts](./kibana-plugin-plugins-data-public.searchinterceptor.toasts.md) | | <code>ToastsStart</code> | |

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

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) &gt; [requestTimeout](./kibana-plugin-plugins-data-public.searchinterceptor.requesttimeout.md)

## SearchInterceptor.requestTimeout property

<b>Signature:</b>

```typescript
protected readonly requestTimeout?: number | undefined;
```
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-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) &gt; [search](./kibana-plugin-plugins-data-public.searchinterceptor.search.md)

## SearchInterceptor.search property

Searches using the given `search` method. Overrides the `AbortSignal` with one that will abort either when `cancelPending` is called, when the request times out, or when the original `AbortSignal` is aborted. Updates the `pendingCount` when the request is started/finalized.

<b>Signature:</b>

```typescript
search: (search: ISearchGeneric, request: IKibanaSearchRequest, options?: ISearchOptions | undefined) => import("rxjs").Observable<import("../../common/search").IEsSearchResponse<unknown>>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) &gt; [showToast](./kibana-plugin-plugins-data-public.searchinterceptor.showtoast.md)

## SearchInterceptor.showToast property

<b>Signature:</b>

```typescript
protected showToast: () => void;
```
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-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) &gt; [timeoutSubscriptions](./kibana-plugin-plugins-data-public.searchinterceptor.timeoutsubscriptions.md)

## SearchInterceptor.timeoutSubscriptions property

The subscriptions from scheduling the automatic timeout for each request.

<b>Signature:</b>

```typescript
protected timeoutSubscriptions: Set<Subscription>;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) &gt; [toasts](./kibana-plugin-plugins-data-public.searchinterceptor.toasts.md)

## SearchInterceptor.toasts property

<b>Signature:</b>

```typescript
protected readonly toasts: ToastsStart;
```
2 changes: 2 additions & 0 deletions src/plugins/data/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,8 @@ export {
TabbedAggColumn,
TabbedAggRow,
TabbedTable,
SearchInterceptor,
RequestTimeoutError,
} from './search';

// Search namespace
Expand Down
Loading

0 comments on commit c7c6eba

Please sign in to comment.