Skip to content

Commit

Permalink
Merge branch 'master' into alerting/tls-warning
Browse files Browse the repository at this point in the history
* master: (39 commits)
  [SIEM][CASE]  Configuration page action bar (elastic#60608)
  [Remote clusters] Update copy (elastic#60382)
  Sort by name when fetching alerts and connectors (elastic#60506)
  Make slack param validation handle empty messages (elastic#60468)
  [Alerting] Adds navigation by consumer and alert type to alerting (elastic#58997)
  Introduce search interceptor (elastic#60523)
  [ML] Add functional tests for file data visualizer (elastic#60413)
  [APM] Optimize service map query (elastic#60412)
  [SIEM][Detection Engine] Adds lists feature flag and list values to the REST interfaces
  Enhancement/update esdocs datasource (elastic#59512)
  [junit] only include stdout in report for failures (elastic#60530)
  Update dependency nock to v12 (elastic#60422)
  upgrade execa to get stdout/stderr in error messages (elastic#60537)
  skip flaky suite (elastic#60471)
  [Ingest] Agent Config Details - Data sources list ui (elastic#60429)
  [SIEM] Create ML Rules (elastic#58053)
  skip flaky suite (elastic#60559)
  fix agent type (elastic#60554)
  Fixed default message for index threshold includes both threshold values (elastic#60545)
  [Ingest] Add support for `yaml` field types (elastic#60440)
  ...
  • Loading branch information
gmmorris committed Mar 19, 2020
2 parents 38c5e1e + 6ed2918 commit 18dc4ee
Show file tree
Hide file tree
Showing 505 changed files with 21,412 additions and 5,213 deletions.
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 18dc4ee

Please sign in to comment.