Skip to content

Commit

Permalink
Merge branch 'master' into fix-visualize-shims
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Mar 20, 2020
2 parents 57ea6fa + ef0935f commit 40c15a0
Show file tree
Hide file tree
Showing 594 changed files with 16,628 additions and 7,030 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/pr-project-assigner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ jobs:
name: Assign a PR to project based on label
steps:
- name: Assign to project
uses: elastic/github-actions/project-assigner@v1.0.3
uses: elastic/github-actions/project-assigner@v2.0.0
id: project_assigner
with:
issue-mappings: |
[
]
ghToken: ${{ secrets.PROJECT_ASSIGNER_TOKEN }}

# { "label": "Team:AppArch", "projectName": "kibana-app-arch", "columnId": 6173897 },
# { "label": "Feature:Lens", "projectName": "Lens", "columnId": 6219362 },
# { "label": "Team:Canvas", "projectName": "canvas", "columnId": 6187580 }
# { "label": "Team:AppArch", "projectNumber": 37, "columnName": "Review in progress" },
# { "label": "Feature:Lens", "projectNumber": 32, "columnName": "In progress" },
# { "label": "Team:Canvas", "projectNumber": 38, "columnName": "Review in progress" }
4 changes: 2 additions & 2 deletions .github/workflows/project-assigner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
name: Assign issue or PR to project based on label
steps:
- name: Assign to project
uses: elastic/github-actions/project-assigner@v1.0.3
uses: elastic/github-actions/project-assigner@v2.0.0
id: project_assigner
with:
issue-mappings: '[{"label": "Team:AppArch", "projectName": "kibana-app-arch", "columnId": 6173895}, {"label": "Feature:Lens", "projectName": "Lens", "columnId": 6219363}, {"label": "Team:Canvas", "projectName": "canvas", "columnId": 6187593}]'
issue-mappings: '[{"label": "Team:AppArch", "projectNumber": 37, "columnName": "To triage"}, {"label": "Feature:Lens", "projectNumber": 32, "columnName": "Long-term goals"}, {"label": "Team:Canvas", "projectNumber": 38, "columnName": "Inbox"}]'
ghToken: ${{ secrets.PROJECT_ASSIGNER_TOKEN }}


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

## ErrorToastOptions interface

Options available for [IToasts](./kibana-plugin-core-public.itoasts.md) APIs.
Options available for [IToasts](./kibana-plugin-core-public.itoasts.md) error APIs.

<b>Signature:</b>

```typescript
export interface ErrorToastOptions
export interface ErrorToastOptions extends ToastOptions
```
## Properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ Methods for adding and removing global toast messages. See [ToastsApi](./kibana-
<b>Signature:</b>

```typescript
export declare type IToasts = Pick<ToastsApi, 'get$' | 'add' | 'remove' | 'addSuccess' | 'addWarning' | 'addDanger' | 'addError'>;
export declare type IToasts = Pick<ToastsApi, 'get$' | 'add' | 'remove' | 'addSuccess' | 'addWarning' | 'addDanger' | 'addError' | 'addInfo'>;
```
3 changes: 2 additions & 1 deletion docs/development/core/public/kibana-plugin-core-public.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [CoreStart](./kibana-plugin-core-public.corestart.md) | Core services exposed to the <code>Plugin</code> start lifecycle |
| [DocLinksStart](./kibana-plugin-core-public.doclinksstart.md) | |
| [EnvironmentMode](./kibana-plugin-core-public.environmentmode.md) | |
| [ErrorToastOptions](./kibana-plugin-core-public.errortoastoptions.md) | Options available for [IToasts](./kibana-plugin-core-public.itoasts.md) APIs. |
| [ErrorToastOptions](./kibana-plugin-core-public.errortoastoptions.md) | Options available for [IToasts](./kibana-plugin-core-public.itoasts.md) error APIs. |
| [FatalErrorInfo](./kibana-plugin-core-public.fatalerrorinfo.md) | Represents the <code>message</code> and <code>stack</code> of a fatal Error |
| [FatalErrorsSetup](./kibana-plugin-core-public.fatalerrorssetup.md) | FatalErrors stop the Kibana Public Core and displays a fatal error screen with details about the Kibana build and the error. |
| [HttpFetchOptions](./kibana-plugin-core-public.httpfetchoptions.md) | All options that may be used with a [HttpHandler](./kibana-plugin-core-public.httphandler.md)<!-- -->. |
Expand Down Expand Up @@ -115,6 +115,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [SavedObjectsUpdateOptions](./kibana-plugin-core-public.savedobjectsupdateoptions.md) | |
| [StringValidationRegex](./kibana-plugin-core-public.stringvalidationregex.md) | StringValidation with regex object |
| [StringValidationRegexString](./kibana-plugin-core-public.stringvalidationregexstring.md) | StringValidation as regex string |
| [ToastOptions](./kibana-plugin-core-public.toastoptions.md) | Options available for [IToasts](./kibana-plugin-core-public.itoasts.md) APIs. |
| [UiSettingsParams](./kibana-plugin-core-public.uisettingsparams.md) | UiSettings parameters defined by the plugins. |
| [UiSettingsState](./kibana-plugin-core-public.uisettingsstate.md) | |
| [UserProvidedValues](./kibana-plugin-core-public.userprovidedvalues.md) | Describes the values explicitly set by user. |
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-core-public](./kibana-plugin-core-public.md) &gt; [ToastOptions](./kibana-plugin-core-public.toastoptions.md)

## ToastOptions interface

Options available for [IToasts](./kibana-plugin-core-public.itoasts.md) APIs.

<b>Signature:</b>

```typescript
export interface ToastOptions
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [toastLifeTimeMs](./kibana-plugin-core-public.toastoptions.toastlifetimems.md) | <code>number</code> | How long should the toast remain on screen. |

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-core-public](./kibana-plugin-core-public.md) &gt; [ToastOptions](./kibana-plugin-core-public.toastoptions.md) &gt; [toastLifeTimeMs](./kibana-plugin-core-public.toastoptions.toastlifetimems.md)

## ToastOptions.toastLifeTimeMs property

How long should the toast remain on screen.

<b>Signature:</b>

```typescript
toastLifeTimeMs?: number;
```
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ Adds a new toast pre-configured with the danger color and alert icon.
<b>Signature:</b>

```typescript
addDanger(toastOrTitle: ToastInput): Toast;
addDanger(toastOrTitle: ToastInput, options?: ToastOptions): Toast;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| toastOrTitle | <code>ToastInput</code> | a [ToastInput](./kibana-plugin-core-public.toastinput.md) |
| options | <code>ToastOptions</code> | a [ToastOptions](./kibana-plugin-core-public.toastoptions.md) |

<b>Returns:</b>

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

[Home](./index.md) &gt; [kibana-plugin-core-public](./kibana-plugin-core-public.md) &gt; [ToastsApi](./kibana-plugin-core-public.toastsapi.md) &gt; [addInfo](./kibana-plugin-core-public.toastsapi.addinfo.md)

## ToastsApi.addInfo() method

Adds a new toast pre-configured with the info color and info icon.

<b>Signature:</b>

```typescript
addInfo(toastOrTitle: ToastInput, options?: ToastOptions): Toast;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| toastOrTitle | <code>ToastInput</code> | a [ToastInput](./kibana-plugin-core-public.toastinput.md) |
| options | <code>ToastOptions</code> | a [ToastOptions](./kibana-plugin-core-public.toastoptions.md) |

<b>Returns:</b>

`Toast`

a [Toast](./kibana-plugin-core-public.toast.md)

Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ Adds a new toast pre-configured with the success color and check icon.
<b>Signature:</b>

```typescript
addSuccess(toastOrTitle: ToastInput): Toast;
addSuccess(toastOrTitle: ToastInput, options?: ToastOptions): Toast;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| toastOrTitle | <code>ToastInput</code> | a [ToastInput](./kibana-plugin-core-public.toastinput.md) |
| options | <code>ToastOptions</code> | a [ToastOptions](./kibana-plugin-core-public.toastoptions.md) |

<b>Returns:</b>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ Adds a new toast pre-configured with the warning color and help icon.
<b>Signature:</b>

```typescript
addWarning(toastOrTitle: ToastInput): Toast;
addWarning(toastOrTitle: ToastInput, options?: ToastOptions): Toast;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| toastOrTitle | <code>ToastInput</code> | a [ToastInput](./kibana-plugin-core-public.toastinput.md) |
| options | <code>ToastOptions</code> | a [ToastOptions](./kibana-plugin-core-public.toastoptions.md) |

<b>Returns:</b>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ export declare class ToastsApi implements IToasts
| Method | Modifiers | Description |
| --- | --- | --- |
| [add(toastOrTitle)](./kibana-plugin-core-public.toastsapi.add.md) | | Adds a new toast to current array of toast. |
| [addDanger(toastOrTitle)](./kibana-plugin-core-public.toastsapi.adddanger.md) | | Adds a new toast pre-configured with the danger color and alert icon. |
| [addDanger(toastOrTitle, options)](./kibana-plugin-core-public.toastsapi.adddanger.md) | | Adds a new toast pre-configured with the danger color and alert icon. |
| [addError(error, options)](./kibana-plugin-core-public.toastsapi.adderror.md) | | Adds a new toast that displays an exception message with a button to open the full stacktrace in a modal. |
| [addSuccess(toastOrTitle)](./kibana-plugin-core-public.toastsapi.addsuccess.md) | | Adds a new toast pre-configured with the success color and check icon. |
| [addWarning(toastOrTitle)](./kibana-plugin-core-public.toastsapi.addwarning.md) | | Adds a new toast pre-configured with the warning color and help icon. |
| [addInfo(toastOrTitle, options)](./kibana-plugin-core-public.toastsapi.addinfo.md) | | Adds a new toast pre-configured with the info color and info icon. |
| [addSuccess(toastOrTitle, options)](./kibana-plugin-core-public.toastsapi.addsuccess.md) | | Adds a new toast pre-configured with the success color and check icon. |
| [addWarning(toastOrTitle, options)](./kibana-plugin-core-public.toastsapi.addwarning.md) | | Adds a new toast pre-configured with the warning color and help icon. |
| [get$()](./kibana-plugin-core-public.toastsapi.get_.md) | | Observable of the toast messages to show to the user. |
| [remove(toastOrId)](./kibana-plugin-core-public.toastsapi.remove.md) | | Removes a toast from the current array of toasts if present. |
1 change: 1 addition & 0 deletions src/core/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export {
ToastInputFields,
ToastsSetup,
ToastsStart,
ToastOptions,
ErrorToastOptions,
} from './notifications';

Expand Down
1 change: 1 addition & 0 deletions src/core/public/notifications/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

export {
ErrorToastOptions,
ToastOptions,
Toast,
ToastInput,
IToasts,
Expand Down
1 change: 1 addition & 0 deletions src/core/public/notifications/toasts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
export { ToastsService, ToastsSetup, ToastsStart } from './toasts_service';
export {
ErrorToastOptions,
ToastOptions,
ToastsApi,
ToastInput,
IToasts,
Expand Down
15 changes: 15 additions & 0 deletions src/core/public/notifications/toasts/toasts_api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,21 @@ describe('#remove()', () => {
});
});

describe('#addInfo()', () => {
it('adds a info toast', async () => {
const toasts = new ToastsApi(toastDeps());
expect(toasts.addInfo({})).toHaveProperty('color', 'primary');
});

it('returns the created toast', async () => {
const toasts = new ToastsApi(toastDeps());
const toast = toasts.addInfo({}, { toastLifeTimeMs: 1 });
const currentToasts = await getCurrentToasts(toasts);
expect(currentToasts[0].toastLifeTimeMs).toBe(1);
expect(currentToasts[0]).toBe(toast);
});
});

describe('#addSuccess()', () => {
it('adds a success toast', async () => {
const toasts = new ToastsApi(toastDeps());
Expand Down
45 changes: 39 additions & 6 deletions src/core/public/notifications/toasts/toasts_api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,18 @@ export type ToastInput = string | ToastInputFields;
* Options available for {@link IToasts} APIs.
* @public
*/
export interface ErrorToastOptions {
export interface ToastOptions {
/**
* How long should the toast remain on screen.
*/
toastLifeTimeMs?: number;
}

/**
* Options available for {@link IToasts} error APIs.
* @public
*/
export interface ErrorToastOptions extends ToastOptions {
/**
* The title of the toast and the dialog when expanding the message.
*/
Expand Down Expand Up @@ -84,7 +95,7 @@ const normalizeToast = (toastOrTitle: ToastInput): ToastInputFields => {
*/
export type IToasts = Pick<
ToastsApi,
'get$' | 'add' | 'remove' | 'addSuccess' | 'addWarning' | 'addDanger' | 'addError'
'get$' | 'add' | 'remove' | 'addSuccess' | 'addWarning' | 'addDanger' | 'addError' | 'addInfo'
>;

/**
Expand Down Expand Up @@ -145,47 +156,69 @@ export class ToastsApi implements IToasts {
}
}

/**
* Adds a new toast pre-configured with the info color and info icon.
*
* @param toastOrTitle - a {@link ToastInput}
* @param options - a {@link ToastOptions}
* @returns a {@link Toast}
*/
public addInfo(toastOrTitle: ToastInput, options?: ToastOptions) {
return this.add({
color: 'primary',
iconType: 'iInCircle',
...normalizeToast(toastOrTitle),
...options,
});
}

/**
* Adds a new toast pre-configured with the success color and check icon.
*
* @param toastOrTitle - a {@link ToastInput}
* @param options - a {@link ToastOptions}
* @returns a {@link Toast}
*/
public addSuccess(toastOrTitle: ToastInput) {
public addSuccess(toastOrTitle: ToastInput, options?: ToastOptions) {
return this.add({
color: 'success',
iconType: 'check',
...normalizeToast(toastOrTitle),
...options,
});
}

/**
* Adds a new toast pre-configured with the warning color and help icon.
*
* @param toastOrTitle - a {@link ToastInput}
* @param options - a {@link ToastOptions}
* @returns a {@link Toast}
*/
public addWarning(toastOrTitle: ToastInput) {
public addWarning(toastOrTitle: ToastInput, options?: ToastOptions) {
return this.add({
color: 'warning',
iconType: 'help',
toastLifeTimeMs: this.uiSettings.get('notifications:lifetime:warning'),
...normalizeToast(toastOrTitle),
...options,
});
}

/**
* Adds a new toast pre-configured with the danger color and alert icon.
*
* @param toastOrTitle - a {@link ToastInput}
* @param options - a {@link ToastOptions}
* @returns a {@link Toast}
*/
public addDanger(toastOrTitle: ToastInput) {
public addDanger(toastOrTitle: ToastInput, options?: ToastOptions) {
return this.add({
color: 'danger',
iconType: 'alert',
toastLifeTimeMs: this.uiSettings.get('notifications:lifetime:warning'),
...normalizeToast(toastOrTitle),
...options,
});
}

Expand All @@ -201,7 +234,6 @@ export class ToastsApi implements IToasts {
return this.add({
color: 'danger',
iconType: 'alert',
title: options.title,
toastLifeTimeMs: this.uiSettings.get('notifications:lifetime:error'),
text: mountReactNode(
<ErrorToast
Expand All @@ -212,6 +244,7 @@ export class ToastsApi implements IToasts {
i18nContext={() => this.i18n!.Context}
/>
),
...options,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const createToastsApiMock = () => {
get$: jest.fn(() => new Observable()),
add: jest.fn(),
remove: jest.fn(),
addInfo: jest.fn(),
addSuccess: jest.fn(),
addWarning: jest.fn(),
addDanger: jest.fn(),
Expand Down
1 change: 1 addition & 0 deletions src/core/public/overlays/modal/modal_service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export interface OverlayModalConfirmOptions {
closeButtonAriaLabel?: string;
'data-test-subj'?: string;
defaultFocusedButton?: EuiConfirmModalProps['defaultFocusedButton'];
buttonColor?: EuiConfirmModalProps['buttonColor'];
}

/**
Expand Down
Loading

0 comments on commit 40c15a0

Please sign in to comment.