-
Notifications
You must be signed in to change notification settings - Fork 81
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 SearchDisplayMode layout hints #3512
Conversation
- Ported over from Enterprise, where these are already implemented - Not sure how best to handle the enum from the Python API, just using a String right now. Will get Jianfeng/Chip to review. - Tested in Python and Groovy, ensuring you could bring up the Search Bar (from the side menu) in table `canSearch`, and it was not available in `cannotSearch`. Python: ```python from deephaven import empty_table t = empty_table(100).update(["a=`abc`"]) canSearch = t.layout_hints(search_display_mode="Show") cannotSearch = t.layout_hints(search_display_mode="Hide") ``` Groovy: ```groovy import io.deephaven.engine.util.LayoutHintBuilder import io.deephaven.engine.util.LayoutHintBuilder.SearchDisplayModes t = emptyTable(5).updateView("a=`abc`") canSearch = t.setLayoutHints(LayoutHintBuilder.get().setSearchBarAccess(SearchDisplayModes.Show).build()) cannotSearch = t.setLayoutHints(LayoutHintBuilder.get().setSearchBarAccess(SearchDisplayModes.Hide).build()) ```
py/server/deephaven/table.py
Outdated
@@ -1852,7 +1852,7 @@ def format_row_where(self, cond: str, formula: str) -> Table: | |||
|
|||
def layout_hints(self, front: Union[str, List[str]] = None, back: Union[str, List[str]] = None, | |||
freeze: Union[str, List[str]] = None, hide: Union[str, List[str]] = None, | |||
column_groups: List[dict] = None) -> Table: | |||
column_groups: List[dict] = None, search_display_mode: str = None) -> Table: |
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.
@jmao-denver is there a better way to use an enum
from in python? I tried using jpy.get_type("io.deephaven.engine.util.LayoutHintBuilder.SearchDisplayModes")
but I get a Class not found error.
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.
it is an inner class, the JNI syntax is to use '$' notation.
io.deephaven.engine.util.LayoutHintBuilder$SearchDisplayModes
Please see this file for an example wrapping of an Enum.
py/server/deephaven/plot/linestyle.py
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.
I am actually not very sure about introducing an Enum in this case. I am fine with the parameter being a string with 3 valid, self-evident values.
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.
Okay, I've used an Enum, let me know if you want me to revert to string. I think @chipkent has previously said he prefers enums, not sure. Downside is you need a from deephaven.table import SearchDisplayMode
before this.
Or I could make it accept both a string or the enum?
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.
Approved js api changes
- Added tests as well, but not sure how to run them - Tests now verify all layout hints, instead of just checking if the table had blown up
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.
LGTM
Labels indicate documentation is required. Issues for documentation have been opened: How-to: https://github.com/deephaven/deephaven.io/issues/2436 |
canSearch
, and it was not available incannotSearch
.Python:
Groovy: