-
Notifications
You must be signed in to change notification settings - Fork 57
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
Add Toasts to Observability Dashboards #435
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
c74385b
Fixes
4aa38ac
Toasts use hook from useOpenSearchDashboards context provider
20faeda
Testing for CustomPanel Toast
67d04e0
update catches from comments, minor code cleaning
ps48 1a1edeb
update tests
ps48 485b8a8
remove unused redux slice
ps48 9c6173b
revert cypress changes
ps48 8d9d08b
add toasts to SOflyout
ps48 7ffe655
fix messaging for multiple delete
derek-ho 0b82588
fix up toast and error handling for create and delete flows
derek-ho d06d546
fix up clone
derek-ho d45692f
fix rename in table
derek-ho 642f5e0
fix rename in custom panel so view
derek-ho a20c042
fix up panel toasts
derek-ho 7eba7b4
fix up for flyout
derek-ho f62f1b8
Merge branch '2.7' into toast
derek-ho dbc7976
code cleanup
derek-ho dfd8582
finish merge
derek-ho 6c9e867
fix up PR comments
derek-ho 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
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,37 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { ToastInputFields } from '../../../../../../src/core/public'; | ||
import { coreRefs } from '../../../framework/core_refs'; | ||
|
||
type Color = 'success' | 'primary' | 'warning' | 'danger' | undefined; | ||
|
||
export const useToast = () => { | ||
const toasts = coreRefs.toasts!; | ||
|
||
const setToast = (title: string, color: Color = 'success', text?: string) => { | ||
const newToast: ToastInputFields = { | ||
id: new Date().toISOString(), | ||
title, | ||
text, | ||
}; | ||
switch (color) { | ||
case 'danger': { | ||
toasts.addDanger(newToast); | ||
break; | ||
} | ||
case 'warning': { | ||
toasts.addWarning(newToast); | ||
break; | ||
} | ||
default: { | ||
toasts.addSuccess(newToast); | ||
break; | ||
} | ||
} | ||
}; | ||
|
||
return { setToast }; | ||
}; |
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
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.
what's this for?
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.
For this:
dashboards-observability/public/plugin.ts
Line 116 in dfd8582
Earlier it was hardcoded in
plugin.ts
moved it to constants.