Skip to content

Commit

Permalink
hosts: new widget for Hosts table (#1465) (#1468)
Browse files Browse the repository at this point in the history
The `SatTable` widget is modified to ignore hidden headers and columns in the table.
Hidden duplicate columns cause the widget to work incorrectly internally,
while on the outside everything seems in order.

This behavior is especially present in the Hosts table,
where instead of seemingly interacting with the visible columns,
the widget interacts with the hidden ones.

The table widget for Hosts somehow worked properly(-ish),
until commit 886a1a8 exposed this flaw.

Excluding the hidden columns during the table cells collection
by the widget solves the problem.

(cherry picked from commit 71a745e)

Co-authored-by: Pavel Novotny <pnovotny@users.noreply.github.com>
  • Loading branch information
Satellite-QE and pnovotny authored Jul 24, 2024
1 parent b4db444 commit d27049d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions airgun/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1881,6 +1881,8 @@ class SatTable(Table):
If the table is empty, there might be only one column with an appropriate message in the table
body, or it may have no columns or rows at all. This subclass handles both possibilities.
It also ignores all hidden columns, which some tables might contain, like the Hosts table.
Example html representation::
<table bst-table="table" ...>
Expand All @@ -1907,6 +1909,10 @@ class SatTable(Table):
"""

HEADERS = "./thead/tr/th[not(@hidden)]|./tr/th[not(@hidden)]|./thead/tr/td[not(@hidden)]"
COLUMN_RESOLVER_PATH = "/td[not(@hidden)]"
COLUMN_AT_POSITION = "./td[not(@hidden)][{0}]"

no_rows_message = (
".//td/span[contains(@data-block, 'no-rows-message') or "
"contains(@data-block, 'no-search-results-message')]"
Expand Down

0 comments on commit d27049d

Please sign in to comment.