Skip to content

Commit

Permalink
Merge branch 'master' into migrate_markdown_styles
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Mar 20, 2020
2 parents 28fa098 + c3957d8 commit ebdafad
Show file tree
Hide file tree
Showing 636 changed files with 19,019 additions and 7,057 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 }}


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 ebdafad

Please sign in to comment.