Skip to content

Commit

Permalink
Merge branch 'master' into kertal-pr-2020-03-13-remove-StateManagemen…
Browse files Browse the repository at this point in the history
…tConfigProvider
  • Loading branch information
elasticmachine committed Mar 20, 2020
2 parents fcdf8c6 + b841526 commit 2f84a30
Show file tree
Hide file tree
Showing 1,233 changed files with 42,042 additions and 16,603 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. |
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ esFilters: {
getPhraseFilterField: (filter: import("../common").PhraseFilter) => string;
getPhraseFilterValue: (filter: import("../common").PhraseFilter) => string | number | boolean;
getDisplayValueFromFilter: typeof getDisplayValueFromFilter;
compareFilters: (first: import("../common").Filter | import("../common").Filter[], second: import("../common").Filter | import("../common").Filter[], comparatorOptions?: import("./query/filter_manager/lib/compare_filters").FilterCompareOptions) => boolean;
COMPARE_ALL_OPTIONS: import("./query/filter_manager/lib/compare_filters").FilterCompareOptions;
compareFilters: (first: import("../common").Filter | import("../common").Filter[], second: import("../common").Filter | import("../common").Filter[], comparatorOptions?: import("../common").FilterCompareOptions) => boolean;
COMPARE_ALL_OPTIONS: import("../common").FilterCompareOptions;
generateFilters: typeof generateFilters;
onlyDisabledFiltersChanged: (newFilters?: import("../common").Filter[] | undefined, oldFilters?: import("../common").Filter[] | undefined) => boolean;
changeTimeFilter: typeof changeTimeFilter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
| [esQuery](./kibana-plugin-plugins-data-server.esquery.md) | |
| [fieldFormats](./kibana-plugin-plugins-data-server.fieldformats.md) | |
| [indexPatterns](./kibana-plugin-plugins-data-server.indexpatterns.md) | |
| [search](./kibana-plugin-plugins-data-server.search.md) | |

## Type Aliases

Expand All @@ -70,6 +69,5 @@
| [IFieldFormatsRegistry](./kibana-plugin-plugins-data-server.ifieldformatsregistry.md) | |
| [ISearch](./kibana-plugin-plugins-data-server.isearch.md) | |
| [ISearchCancel](./kibana-plugin-plugins-data-server.isearchcancel.md) | |
| [ParsedInterval](./kibana-plugin-plugins-data-server.parsedinterval.md) | |
| [TSearchStrategyProvider](./kibana-plugin-plugins-data-server.tsearchstrategyprovider.md) | Search strategy provider creates an instance of a search strategy with the request handler context bound to it. This way every search strategy can use whatever information they require from the request context. |

5 changes: 5 additions & 0 deletions examples/alerting_example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Alerting Example

This example plugin shows you how to create a custom Alert Type, create alerts based on that type and corresponding UI for viewing the details of all the alerts within the custom plugin.

To run this example, use the command `yarn start --run-examples`.
34 changes: 34 additions & 0 deletions examples/alerting_example/common/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export const ALERTING_EXAMPLE_APP_ID = 'AlertingExample';

// always firing
export const DEFAULT_INSTANCES_TO_GENERATE = 5;

// Astros
export enum Craft {
OuterSpace = 'Outer Space',
ISS = 'ISS',
}
export enum Operator {
AreAbove = 'Are above',
AreBelow = 'Are below',
AreExactly = 'Are exactly',
}
10 changes: 10 additions & 0 deletions examples/alerting_example/kibana.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"id": "alertingExample",
"version": "0.0.1",
"kibanaVersion": "kibana",
"configPath": ["alerting_example"],
"server": true,
"ui": true,
"requiredPlugins": ["triggers_actions_ui", "charts", "data", "alerting", "actions"],
"optionalPlugins": []
}
17 changes: 17 additions & 0 deletions examples/alerting_example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "alerting_example",
"version": "1.0.0",
"main": "target/examples/alerting_example",
"kibana": {
"version": "kibana",
"templateVersion": "1.0.0"
},
"license": "Apache-2.0",
"scripts": {
"kbn": "node ../../scripts/kbn.js",
"build": "rm -rf './target' && tsc"
},
"devDependencies": {
"typescript": "3.7.2"
}
}
82 changes: 82 additions & 0 deletions examples/alerting_example/public/alert_types/always_firing.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import React, { Fragment } from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiFieldNumber, EuiFormRow } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { AlertTypeModel } from '../../../../x-pack/plugins/triggers_actions_ui/public';
import { DEFAULT_INSTANCES_TO_GENERATE } from '../../common/constants';

interface AlwaysFiringParamsProps {
alertParams: { instances?: number };
setAlertParams: (property: string, value: any) => void;
errors: { [key: string]: string[] };
}

export function getAlertType(): AlertTypeModel {
return {
id: 'example.always-firing',
name: 'Always Fires',
iconClass: 'bolt',
alertParamsExpression: AlwaysFiringExpression,
validate: (alertParams: AlwaysFiringParamsProps['alertParams']) => {
const { instances } = alertParams;
const validationResult = {
errors: {
instances: new Array<string>(),
},
};
if (instances && instances < 0) {
validationResult.errors.instances.push(
i18n.translate('AlertingExample.addAlert.error.invalidRandomInstances', {
defaultMessage: 'instances must be equal or greater than zero.',
})
);
}
return validationResult;
},
};
}

export const AlwaysFiringExpression: React.FunctionComponent<AlwaysFiringParamsProps> = ({
alertParams,
setAlertParams,
}) => {
const { instances = DEFAULT_INSTANCES_TO_GENERATE } = alertParams;
return (
<Fragment>
<EuiFlexGroup gutterSize="s" wrap direction="column">
<EuiFlexItem grow={true}>
<EuiFormRow
label="Random Instances to generate"
helpText="How many randomly generated Alert Instances do you wish to activate on each alert run?"
>
<EuiFieldNumber
name="instances"
value={instances}
onChange={event => {
setAlertParams('instances', event.target.valueAsNumber);
}}
/>
</EuiFormRow>
</EuiFlexItem>
</EuiFlexGroup>
</Fragment>
);
};
Loading

0 comments on commit 2f84a30

Please sign in to comment.