forked from opensearch-project/dashboards-query-workbench
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UI fixes for loading state, empty tree, added toast for error, fixed …
…no indicies error (opensearch-project#176) (opensearch-project#178) * sample query button * added toasts for failure cases * added changes for error loading message, fixed initial loading screen, added badge for no indicies * ui changes to curb sidebar * added fix for error from async query * updated snapshots * added changes for for mocking toasts, changed table test * pr requested changes * fix main.tsx tests --------- (cherry picked from commit 015cab8) Signed-off-by: Paul Sebastian <paulstn@amazon.com> Signed-off-by: sumukhswamy <sumukhhs@amazon.com> Signed-off-by: Shenoy Pratik <sgguruda@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Paul Sebastian <paulstn@amazon.com> Co-authored-by: Shenoy Pratik <sgguruda@amazon.com>
- Loading branch information
1 parent
0198fa7
commit 3c47d47
Showing
18 changed files
with
10,165 additions
and
5,505 deletions.
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
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 '../../public/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
Oops, something went wrong.