Skip to content

Commit

Permalink
Merge pull request #559 from mrllama123/bugfix/query-screen-scan
Browse files Browse the repository at this point in the history
do not unmount keyFilter widget when scanning table
  • Loading branch information
mrllama123 authored Jun 5, 2024
2 parents 5f76367 + 14db4f4 commit 54fffbc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 3 additions & 3 deletions dyno_viewer/components/screens/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ def on_mount(self):
@on(Switch.Changed, "#scanToggleSwitch")
def toggle_scan_mode(self, changed: Switch.Changed) -> None:
self.scan_mode = changed.value
key_filter = self.query_one(KeyFilter)
if changed.value:
key_filter = self.query_one(KeyFilter)
key_filter.remove()
key_filter.display = False
else:
self.mount(KeyFilter(id="keyFilter"), after="#scanToggle")
key_filter.display = True

# watcher methods

Expand Down
11 changes: 9 additions & 2 deletions tests/unit/screens/test_query_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,11 @@ async def test_run_query_scan(screen_app, ddb_table, ddb_table_with_data):
"tab",
)

assert not pilot.app.query(KeyFilter)
key_filter = pilot.app.query_one(KeyFilter)

assert key_filter
assert not key_filter.display

await assert_filter_one(pilot, "test", "test1")

# send run query message back to root app
Expand Down Expand Up @@ -311,7 +315,10 @@ async def test_run_query_scan_no_filters(screen_app, ddb_table, ddb_table_with_d
"tab",
)

assert not pilot.app.query(KeyFilter)
key_filter = pilot.app.query_one(KeyFilter)

assert key_filter
assert not key_filter.display

# send run query message back to root app
await type_commands(["tab", "r"], pilot)
Expand Down

0 comments on commit 54fffbc

Please sign in to comment.