-
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: UI dashboard #176
Merged
Merged
feat: UI dashboard #176
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
762457b
WIP: UI dashboard
mattrunyon a885eb2
WIP kludge
mattrunyon 28c879d
Loading dashboard from redux
mattrunyon 56293c4
Cleanup
mattrunyon 6a80699
Address review comments
mattrunyon b87f4c4
Fix render update issue
mattrunyon 970b0e8
Change ref to memo
mattrunyon bb80605
Add detecting mixed dashboards and other types
mattrunyon 07ea71c
Add JS unit tests
mattrunyon 3232ff3
Address review comments
mattrunyon 99c9717
Fix dashboard loading with new web-client-ui packages
mattrunyon 12e9dde
Merge remote-tracking branch 'upstream/main' into ui-dashboard
mattrunyon 8f20055
Fix package-lock
mattrunyon 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 __future__ import annotations | ||
|
||
from typing import Any | ||
from ..elements import BaseElement | ||
|
||
|
||
def column(*children: Any, width: float | None = None, **kwargs: Any): | ||
""" | ||
A column is a container that can be used to group elements. | ||
Each element will be placed below its prior sibling. | ||
|
||
Args: | ||
children: Elements to render in the column. | ||
width: The percent width of the column relative to other children of its parent. If not provided, the column will be sized automatically. | ||
""" | ||
return BaseElement( | ||
"deephaven.ui.components.Column", *children, width=width, **kwargs | ||
) |
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,15 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Any | ||
from ..elements import DashboardElement, FunctionElement | ||
|
||
|
||
def dashboard(element: FunctionElement): | ||
""" | ||
A dashboard is the container for an entire layout. | ||
|
||
Args: | ||
element: Element to render as the dashboard. | ||
The element should render a layout that contains 1 root column or row. | ||
""" | ||
return DashboardElement(element) |
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 __future__ import annotations | ||
|
||
from typing import Any | ||
from ..elements import BaseElement | ||
|
||
|
||
def row(*children: Any, height: float | None = None, **kwargs: Any): | ||
""" | ||
A row is a container that can be used to group elements. | ||
Each element will be placed to the right of its prior sibling. | ||
|
||
Args: | ||
children: Elements to render in the row. | ||
height: The percent height of the row relative to other children of its parent. If not provided, the row will be sized automatically. | ||
""" | ||
return BaseElement( | ||
"deephaven.ui.components.Row", *children, height=height, **kwargs | ||
) |
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,30 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Any | ||
from ..elements import BaseElement | ||
|
||
|
||
def stack( | ||
*children: Any, | ||
height: float | None = None, | ||
width: float | None = None, | ||
activeItemIndex: int | None = None, | ||
**kwargs: Any, | ||
): | ||
""" | ||
A stack is a container that can be used to group elements which creates a set of tabs. | ||
Each element will get a tab and only one element can be visible at a time. | ||
|
||
Args: | ||
children: Elements to render in the row. | ||
height: The percent height of the stack relative to other children of its parent. If not provided, the stack will be sized automatically. | ||
width: The percent width of the stack relative to other children of its parent. If not provided, the stack will be sized automatically. | ||
""" | ||
return BaseElement( | ||
"deephaven.ui.components.Stack", | ||
*children, | ||
height=height, | ||
width=width, | ||
activeItemIndex=activeItemIndex, | ||
**kwargs, | ||
) |
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 @@ | ||
from __future__ import annotations | ||
|
||
import logging | ||
from .BaseElement import BaseElement | ||
from .FunctionElement import FunctionElement | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class DashboardElement(BaseElement): | ||
def __init__(self, element: FunctionElement): | ||
super().__init__("deephaven.ui.components.Dashboard", element) |
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 |
---|---|---|
@@ -1,6 +1,14 @@ | ||
from .Element import Element, PropsType | ||
from .BaseElement import BaseElement | ||
from .DashboardElement import DashboardElement | ||
from .FunctionElement import FunctionElement | ||
from .UITable import UITable | ||
|
||
__all__ = ["BaseElement", "Element", "FunctionElement", "PropsType", "UITable"] | ||
__all__ = [ | ||
"BaseElement", | ||
"DashboardElement", | ||
"Element", | ||
"FunctionElement", | ||
"PropsType", | ||
"UITable", | ||
] |
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,17 @@ | ||
from ..elements import DashboardElement | ||
from .._internal import get_component_name | ||
from .ElementMessageStream import ElementMessageStream | ||
from .ElementType import ElementType | ||
|
||
|
||
class DashboardType(ElementType): | ||
""" | ||
Defines the Dashboard type for the Deephaven plugin system. | ||
""" | ||
|
||
@property | ||
def name(self) -> str: | ||
return "deephaven.ui.Dashboard" | ||
|
||
def is_type(self, obj: any) -> bool: | ||
return isinstance(obj, DashboardElement) |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from .DashboardType import DashboardType | ||
from .ElementMessageStream import ElementMessageStream | ||
from .ElementType import ElementType |
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,16 @@ | ||
// Mock LayoutUtils, useListener, and PanelEvent from @deephaven/dashboard package | ||
const mockLayout = { root: { contentItems: [] }, eventHub: {} }; | ||
|
||
const DashboardActual = jest.requireActual('@deephaven/dashboard'); | ||
module.exports = { | ||
...DashboardActual, | ||
LayoutUtils: { | ||
getComponentName: jest.fn(), | ||
openComponent: jest.fn(), | ||
closeComponent: jest.fn(), | ||
}, | ||
useLayoutManager: jest.fn(() => mockLayout), | ||
useListener: jest.fn(), | ||
__esModule: true, | ||
default: jest.fn(), | ||
}; |
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.
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.
A question I"m sure that will come up is how do we give a name to the tabs. I'm guessing you need a
ui.panel
to specify a title. Do we even allow non-ui.panel things here? Should we enforce only passing in PanelElements as the children?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 you'd need to use a panel w/ the title param
In this first pass we don't allow non panels here. This would be something we consider auto-wrapping in an update to make it nicer to use. I think it's reasonable to allow
ui.stack(some_table, some_other_table)
if you're fine with the default panel titles