-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat: Display deephaven.ui widget errors in a panel so user can see them #436
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
1d00715
fix: Errors not visible when opening deephaven.ui widget
mofojed 636052f
Create an ErrorView to display the errors
mofojed 2669a9e
Display the full stack trace for errors in a panel
mofojed ef25b59
Reload document correctly if there's an error
mofojed bff8f14
Remove the widget onReset stuff
mofojed 5b29a9a
Fix widget closing when it was updating to an error state
mofojed 95958a5
Display an error when a callback throws an error
mofojed d180a22
Remove displaying an error on a callback
mofojed fbb58d3
Add a couple of TODOs
mofojed 3939afe
Make it so the error is expanded by default
mofojed 99f157d
Don't need to update the packages, keep as a separate PR
mofojed 3200e29
Update the JSON schema
mofojed 2eb1140
Clean up based on review
mofojed 177ed22
WIP add e2e tests
mofojed 856c92d
Add react panel content overlay
mofojed 8686d6c
Get rid of the isUpdating ref in DocumentHandler
mofojed 5bebceb
Fix up styling so that it takes up the full height of the panel
mofojed 86c1d30
Update e2e tests for deephaven.ui
mofojed 6ba45e3
Clean up unused import
mofojed 03d79b4
Use ErrorView from @deephaven/components
mofojed 46f7740
Merge remote-tracking branch 'origin/main' into 1949-errors-not-visible
mofojed 51972e2
Update packages
mofojed e6ac2d2
Resolve review comment
mofojed 6ff6810
Update to use bg-opacity
mofojed 8e31040
Merge remote-tracking branch 'origin/main' into 1949-errors-not-visible
mofojed 76ed3f2
Add a little bit of blur
mofojed 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,18 @@ | ||
from enum import Enum | ||
|
||
|
||
class ErrorCode(int, Enum): | ||
""" | ||
ErrorCode is a list of error codes that can be returned by the server. | ||
""" | ||
|
||
# General errors | ||
UNKNOWN = 0 | ||
""" | ||
An unknown error occurred on the server. | ||
""" | ||
|
||
DOCUMENT_ERROR = 1 | ||
""" | ||
There was an error when rendering the document. | ||
""" |
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,12 @@ | ||
import React from 'react'; | ||
import { usePanelContentOverlay } from './usePanelContentOverlay'; | ||
|
||
/** A panel that uses the ReactPanelContentOverlayContext and if that content is set, renders it in a view with a partially transparent background */ | ||
export function ReactPanelContentOverlay(): JSX.Element | null { | ||
const overlayContent = usePanelContentOverlay(); | ||
return overlayContent != null ? ( | ||
<div className="dh-react-panel-overlay">{overlayContent}</div> | ||
) : null; | ||
} | ||
|
||
export default ReactPanelContentOverlay; |
7 changes: 7 additions & 0 deletions
7
plugins/ui/src/js/src/layout/ReactPanelContentOverlayContext.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,7 @@ | ||
import { createContext } from 'react'; | ||
|
||
/** Context that defined a ReactNode to overlay on top of the content in a ReactPanel */ | ||
export const ReactPanelContentOverlayContext = | ||
createContext<React.ReactNode | null>(null); | ||
|
||
export default ReactPanelContentOverlayContext; |
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 @@ | ||
import { useContext } from 'react'; | ||
import { ReactPanelContentOverlayContext } from './ReactPanelContentOverlayContext'; | ||
|
||
/** | ||
* Gets the overlay content from the nearest panel context. | ||
* @returns The overlay content or null if not in a panel | ||
*/ | ||
export function usePanelContentOverlay(): React.ReactNode | null { | ||
return useContext(ReactPanelContentOverlayContext); | ||
} | ||
|
||
export default usePanelContentOverlay; |
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,31 @@ | ||
import React from 'react'; | ||
import { Button, ErrorView } from '@deephaven/components'; | ||
import { vsRefresh } from '@deephaven/icons'; | ||
import { WidgetError } from './WidgetTypes'; | ||
|
||
/** Component that takes a WidgetError and displays the contents in an ErrorView, and has a button to reload the widget from a fresh state. */ | ||
function WidgetErrorView({ | ||
error, | ||
onReload: onReset, | ||
}: { | ||
error: WidgetError; | ||
onReload: () => void; | ||
}): JSX.Element { | ||
const displayMessage = `${error.message.trim()}\n\n${ | ||
error.stack ?? '' | ||
}`.trim(); | ||
return ( | ||
<div className="ui-widget-error-view"> | ||
<div className="widget-error-view-content"> | ||
<ErrorView message={displayMessage} type={error.type} isExpanded /> | ||
</div> | ||
<div className="widget-error-view-footer"> | ||
<Button kind="tertiary" icon={vsRefresh} onClick={onReset}> | ||
Reload | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default WidgetErrorView; |
Oops, something went wrong.
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.
Should this be in the JSON schema? I don't think we're using it really, but probably not bad to keep it updated unless you don't think we should use schema checking at some point in the future
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.
Yes it should be, good call.