Skip to content
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

Regression fix: Show filters in TablePlotter when using lock #655

Merged
merged 2 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [UNRELEASED] - YYYY-MM-DD
### Fixed
- [#655](https://github.com/equinor/webviz-config/pull/655) - Regression fix: Show filters in `TablePlotter` when using `lock` argument.

### Changed
- [#648](https://github.com/equinor/webviz-config/pull/648) - Allow `blob:` in `script-src` CSP in order to enable web worker usage in Dash components.
Expand Down
3 changes: 2 additions & 1 deletion examples/basic_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ layout:
x: Well
y: Initial reservoir pressure (bar)
size: Average permeability (D)
facet_col: Segment
filter_cols:
- Well
contact_person:
name: Kari Nordmann
phone: 12345678
Expand Down
10 changes: 0 additions & 10 deletions tests/test_table_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ def test_table_plotter_filter(dash_duo: DashComposite) -> None:
plot_dd = dash_duo.find_element("#" + page.uuid("plottype"))
assert plot_dd.text == "scatter"

# Checking that only the relevant options are shown
for plot_option in page.plot_args.keys():
plot_option_dd = dash_duo.find_element("#" + page.uuid(f"div-{plot_option}"))
if plot_option not in page.plots["scatter"]:
assert "display: none;" in plot_option_dd.get_attribute("style")

# Checking that options are initialized correctly
for option in ["x", "y"]:
plot_option_dd = dash_duo.find_element("#" + page.uuid(f"dropdown-{option}"))
Expand Down Expand Up @@ -110,7 +104,3 @@ def test_initialized_table_plotter(dash_duo: DashComposite) -> None:
# Checking that plot options are defined
assert page.plot_options == plot_options
assert page.lock

# Checking that the selectors are hidden
selector_row = dash_duo.find_element("#" + page.uuid("selector-row"))
assert "display: none;" in selector_row.get_attribute("style")
14 changes: 9 additions & 5 deletions webviz_config/generic_plugins/_table_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,19 +374,23 @@ def axis_layout(self) -> html.Div:

@property
def layout(self) -> html.Div:
plot_options_style: dict = {"display": "none"} if self.lock else {}
return html.Div(
children=[
wcc.FlexBox(
children=[
html.Div(
id=self.uuid("selector-row"),
style={"display": "none"}
if self.lock
else {"width": "15%"},
children=[
self.plot_option_layout(),
html.Div(
style=plot_options_style,
children=self.plot_option_layout(),
),
self.filter_layout(),
self.axis_layout(),
html.Div(
style=plot_options_style,
children=self.axis_layout(),
),
],
),
wcc.Graph(
Expand Down