-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Uptime] Add Alerting UI #57919
Merged
justinkambic
merged 120 commits into
elastic:master
from
justinkambic:uptime_alerting-ui
Mar 19, 2020
Merged
[Uptime] Add Alerting UI #57919
Changes from 119 commits
Commits
Show all changes
120 commits
Select commit
Hold shift + click to select a range
8f43e13
WIP trying things.
justinkambic 4778670
Port adapter function to dedicated file.
justinkambic 724fea8
WIP.
justinkambic 3f17b51
Working on parameter selection.
justinkambic b62d15b
Selector expressions working.
justinkambic 5814074
Working on actions.
justinkambic 99abd50
Change anchor prop for popovers.
justinkambic 8e07e73
Reference migrated alerting plugin.
justinkambic 92ff59d
Clean up code for draft.
justinkambic 7adcfc4
Add button to expose flyout. Clean up some client code.
justinkambic 33ca971
Add test for requests function, add support for filters.
justinkambic 9ec182f
Reorganize and clean up files.
justinkambic 06fe939
Add location and filter support to monitor status request function.
justinkambic 5302078
Add tests for monitor status request function.
justinkambic 103cb46
Specify default action group id in alert registration.
justinkambic b9eb062
Extract repeated string value to a constant.
justinkambic e2c9429
Move test file to server in NP plugin.
justinkambic adfe4c9
Update imports after NP migration.
justinkambic c465503
Fix UI bug that caused incorrect location selections in alert creation.
justinkambic 8e21ba7
Change alert expression language to clarify meaning.
justinkambic 96befca
Add ability for user to select timerange units.
justinkambic fc9e349
Add code that fixes active item highlighting.
justinkambic babf36f
Add better default value for active index selection.
justinkambic 57c0115
Introduce dedicated field number component.
justinkambic 714d571
Add message to status check alert.
justinkambic 7c6124a
Add tests for context message.
justinkambic 41252e8
Formalize alert action group definitions.
justinkambic 06fcfc2
Extract monitor id squashing from context message generator.
justinkambic ec5c65d
Write test for monitor ID uniqueness function.
justinkambic f16265b
Add alert state creator function and tests.
justinkambic 91cc166
Update action group id value.
justinkambic 51903c5
Add tests for alert factory and executor function.
justinkambic 883982d
Rename alert context props to be more domain-specific.
justinkambic 02ad172
Clean up unnecessary type markup.
justinkambic 7e1334d
Clean up alert ui controls file.
justinkambic 7066560
Better organize new registration code.
justinkambic 5c1e2ce
Simplify some logic code.
justinkambic eaf5096
Clean up bootstrap code.
justinkambic b1cf040
Add unit tests for alert type.
justinkambic eefe631
Delete temporary test code from triggers_actions_ui.
justinkambic 4b10372
Rename a test file.
justinkambic 2b3b01d
Add some comments to annotate a file.
justinkambic 47e4a52
Add io-ts type checking to alert create validation and alert executor.
justinkambic a15d33f
Add translation of plaintext content string.
justinkambic d40f65c
Merge branch 'master' into uptime_alerting-ui
justinkambic 6ef25fc
Further simplify monitor status alert validation.
justinkambic 56b8d8f
Add io-ts type checking to alert params.
justinkambic 0b94255
Update a comment.
justinkambic 5e9a258
Prefer inline snapshots to more error-prone assertions.
justinkambic f4e5247
Clean up and comment request function.
justinkambic c3dd218
Rename a symbol.
justinkambic e0800b6
Fix broken types in reducer file and add a test.
justinkambic e67a7a1
Fix a validation logic error and add tests.
justinkambic 469abe7
Delete unused import.
justinkambic 687546d
Delete obsolete dependency.
justinkambic 5a83c95
Fix function call to have correct parameters.
justinkambic 100fc0b
Fixing some import weirdness.
justinkambic 373dfb7
Reintroduce accidentally-deleted code.
justinkambic 3fec4b5
Delete unneeded require from legacy entry file.
justinkambic d1df7ca
Merge branch 'master' into uptime_alerting-ui
justinkambic 40f1789
Remove unneeded connected component.
justinkambic a736b8b
Merge branch 'master' into uptime_alerting-ui
justinkambic f6efd0d
Update flyout controls for new interface and delete connected compone…
justinkambic e592846
Remove unneeded require from app index file.
justinkambic 7b144e4
Introduce data-test-subj attributes to various components to assist w…
justinkambic 3825b33
Introduce functional test helpers for alert flyout.
justinkambic dc9a468
Add functional test arch and a test for alerting UI to ES SSL test su…
justinkambic 645b7d1
Add explicit exports to module index.
justinkambic eaa4d19
Reorganize file to keep interfaces closer to their implementations.
justinkambic cb6bde1
Move create alert button to better position.
justinkambic 7136922
Merge branch 'master' into uptime_alerting-ui
justinkambic 3865f0e
Clean up a file.
justinkambic c88e5a9
Update a functional test attribute, clean up a file, rename a selecto…
justinkambic 8681a5d
Add a comment.
justinkambic eaf6771
Make better default alert message, translate messages, add/update tests.
justinkambic 90bdf9a
Fix broken type.
justinkambic ca51e87
Update obsolete snapshot.
justinkambic 2f3f524
Introduce mock provider to tests and update snapshots.
justinkambic 86f0712
Reduce a strange type to `any`.
justinkambic 7d888a2
Merge branch 'master' into uptime_alerting-ui
justinkambic 10f1ff7
Add alert flyout button connected component.
justinkambic 420eac8
Add alert flyout wrapper connected component.
justinkambic 6d40608
Create connected component for alert monitor status alert.
justinkambic 93516e1
Clean up index files.
justinkambic 150a07c
Update i18nrc file to cover translation in server plugin code.
justinkambic ec342ba
Merge branch 'master' into uptime_alerting-ui
justinkambic c9244bc
Fix broken imports.
justinkambic bba9c7c
Update test snapshots.
justinkambic 0740913
Merge branch 'master' into uptime_alerting-ui
elasticmachine 671b5ed
Prefer more descriptive type.
justinkambic 5d597e4
Merge branch 'uptime_alerting-ui' of github.com:justinkambic/kibana i…
justinkambic ca1de1a
Prefer more descriptive type.
justinkambic 5884832
Prefer built-in React propType to custom.
justinkambic 6584d3f
Prefer simpler validation.
justinkambic c205f6f
Add whitespace to clean up file.
justinkambic 62ed1c6
Extract function and write tests.
justinkambic 1946435
Simplify validation function.
justinkambic 65ccd47
Add navigate to alerting button.
justinkambic 3de3932
Move context item inside the items list.
justinkambic c73de94
Clean up alert creation component.
justinkambic 25c8068
Update type check parsing and error messaging, and update snapshot/te…
justinkambic ef3f3e7
Update broken snapshot.
justinkambic 49162bd
Update README for running functional tests.
justinkambic 605cee8
Update functional test service to reflect improved UX.
justinkambic 4e0b9b4
Merge branch 'master' into uptime_alerting-ui
justinkambic e444618
Fix broken type that resulted from a mistake during a merge resolution.
justinkambic ef6b687
Add spacer between alert title and kuery bar.
justinkambic e482f08
Update the id and name of our alert type because it was never changed…
justinkambic ab40de8
Rename alert keys.
justinkambic 42a3a5d
Fix broken unit tests.
justinkambic 65e6519
Merge branch 'master' into uptime_alerting-ui
justinkambic f0066db
Merge branch 'master' into uptime_alerting-ui
elasticmachine 04c5fff
Merge branch 'master' into uptime_alerting-ui
justinkambic d7d8905
Merge branch 'master' into uptime_alerting-ui
justinkambic 74006e2
Add aria-labels to alert UI.
justinkambic 2519a8c
Implement design feedback.
justinkambic 7034654
Merge branch 'master' into uptime_alerting-ui
justinkambic 7006288
Fix broken test snapshots.
justinkambic d1e3d19
Add missing props to unit tests to staisfy updated types.
justinkambic 4329fc6
Merge branch 'master' into uptime_alerting-ui
elasticmachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
interface ActionGroupDefinition { | ||
id: string; | ||
name: string; | ||
} | ||
|
||
type ActionGroupDefinitions = Record<string, ActionGroupDefinition>; | ||
|
||
export const ACTION_GROUP_DEFINITIONS: ActionGroupDefinitions = { | ||
MONITOR_STATUS: { | ||
id: 'xpack.uptime.alerts.actionGroups.monitorStatus', | ||
name: 'Uptime Down Monitor', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
x-pack/legacy/plugins/uptime/common/runtime_types/alerts/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export { | ||
StatusCheckAlertStateType, | ||
StatusCheckAlertState, | ||
StatusCheckExecutorParamsType, | ||
StatusCheckExecutorParams, | ||
} from './status_check'; |
39 changes: 39 additions & 0 deletions
39
x-pack/legacy/plugins/uptime/common/runtime_types/alerts/status_check.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
export const StatusCheckAlertStateType = t.intersection([ | ||
t.partial({ | ||
currentTriggerStarted: t.string, | ||
firstTriggeredAt: t.string, | ||
lastTriggeredAt: t.string, | ||
lastResolvedAt: t.string, | ||
}), | ||
t.type({ | ||
firstCheckedAt: t.string, | ||
lastCheckedAt: t.string, | ||
isTriggered: t.boolean, | ||
}), | ||
]); | ||
|
||
export type StatusCheckAlertState = t.TypeOf<typeof StatusCheckAlertStateType>; | ||
|
||
export const StatusCheckExecutorParamsType = t.intersection([ | ||
t.partial({ | ||
filters: t.string, | ||
}), | ||
t.type({ | ||
locations: t.array(t.string), | ||
numTimes: t.number, | ||
timerange: t.type({ | ||
from: t.string, | ||
to: t.string, | ||
}), | ||
}), | ||
]); | ||
|
||
export type StatusCheckExecutorParams = t.TypeOf<typeof StatusCheckExecutorParamsType>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
x-pack/legacy/plugins/uptime/public/components/connected/alerts/alert_monitor_status.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { useSelector } from 'react-redux'; | ||
import { DataPublicPluginSetup } from 'src/plugins/data/public'; | ||
import { selectMonitorStatusAlert } from '../../../state/selectors'; | ||
import { AlertMonitorStatusComponent } from '../../functional/alerts/alert_monitor_status'; | ||
|
||
interface Props { | ||
autocomplete: DataPublicPluginSetup['autocomplete']; | ||
enabled: boolean; | ||
numTimes: number; | ||
setAlertParams: (key: string, value: any) => void; | ||
shahzad31 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
timerange: { | ||
from: string; | ||
to: string; | ||
}; | ||
} | ||
|
||
export const AlertMonitorStatus = ({ | ||
autocomplete, | ||
enabled, | ||
numTimes, | ||
setAlertParams, | ||
timerange, | ||
}: Props) => { | ||
const { filters, locations } = useSelector(selectMonitorStatusAlert); | ||
return ( | ||
<AlertMonitorStatusComponent | ||
autocomplete={autocomplete} | ||
enabled={enabled} | ||
filters={filters} | ||
locations={locations} | ||
numTimes={numTimes} | ||
setAlertParams={setAlertParams} | ||
timerange={timerange} | ||
/> | ||
); | ||
}; |
9 changes: 9 additions & 0 deletions
9
x-pack/legacy/plugins/uptime/public/components/connected/alerts/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export { AlertMonitorStatus } from './alert_monitor_status'; | ||
export { ToggleAlertFlyoutButton } from './toggle_alert_flyout_button'; | ||
export { UptimeAlertsFlyoutWrapper } from './uptime_alerts_flyout_wrapper'; |
19 changes: 19 additions & 0 deletions
19
...k/legacy/plugins/uptime/public/components/connected/alerts/toggle_alert_flyout_button.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { useDispatch } from 'react-redux'; | ||
import { ToggleAlertFlyoutButtonComponent } from '../../functional'; | ||
import { setAlertFlyoutVisible } from '../../../state/actions'; | ||
|
||
export const ToggleAlertFlyoutButton = () => { | ||
const dispatch = useDispatch(); | ||
return ( | ||
<ToggleAlertFlyoutButtonComponent | ||
setAlertFlyoutVisible={(value: boolean) => dispatch(setAlertFlyoutVisible(value))} | ||
/> | ||
); | ||
}; |
34 changes: 34 additions & 0 deletions
34
...legacy/plugins/uptime/public/components/connected/alerts/uptime_alerts_flyout_wrapper.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
import { UptimeAlertsFlyoutWrapperComponent } from '../../functional'; | ||
import { setAlertFlyoutVisible } from '../../../state/actions'; | ||
import { selectAlertFlyoutVisibility } from '../../../state/selectors'; | ||
|
||
interface Props { | ||
alertTypeId?: string; | ||
canChangeTrigger?: boolean; | ||
} | ||
|
||
export const UptimeAlertsFlyoutWrapper = ({ alertTypeId, canChangeTrigger }: Props) => { | ||
const dispatch = useDispatch(); | ||
const setAddFlyoutVisiblity = (value: React.SetStateAction<boolean>) => | ||
// @ts-ignore the value here is a boolean, and it works with the action creator function | ||
dispatch(setAlertFlyoutVisible(value)); | ||
|
||
const alertFlyoutVisible = useSelector(selectAlertFlyoutVisibility); | ||
|
||
return ( | ||
<UptimeAlertsFlyoutWrapperComponent | ||
alertFlyoutVisible={alertFlyoutVisible} | ||
alertTypeId={alertTypeId} | ||
canChangeTrigger={canChangeTrigger} | ||
setAlertFlyoutVisibility={setAddFlyoutVisiblity} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very helfpul.