Skip to content

Commit

Permalink
fixed in method for discovery rule and updated it's entities (#1480)
Browse files Browse the repository at this point in the history
  • Loading branch information
amolpati30 authored Aug 26, 2024
1 parent fe9ce9e commit e7ec818
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 8 additions & 4 deletions airgun/entities/discoveryrule.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,17 @@ def read(self, entity_name, widget_names=None):
return view.read(widget_names=widget_names)

def read_all(self):
"""Reads the whole discovery rules table.
"""Reads the entire discovery rules page
:return: list of table rows, each row is dict,
attribute as key with correct value
:return:
1) list of table rows, each row is dict, attribute as key with correct value
2) After deleting the rule, the page context is displayed
"""
view = self.navigate_to(self, 'All')
return view.table.read()
if view.table.is_displayed:
return view.table.read()
elif view.page_info.is_displayed:
return view.page_info.read()

def update(self, entity_name, values):
"""Update existing Discovery rule
Expand Down
8 changes: 4 additions & 4 deletions airgun/views/discoveryrule.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from widgetastic.widget import Checkbox, Text, TextInput, View
from widgetastic.widget import Checkbox, Table, Text, TextInput, View
from widgetastic_patternfly import BreadCrumb
from widgetastic_patternfly4 import Button as PF4Button

Expand All @@ -8,18 +8,18 @@
AutoCompleteTextInput,
FilteredDropdown,
MultiSelect,
SatTable,
)


class DiscoveryRulesView(BaseLoggedInView, SearchableViewMixinPF4):
title = Text("//h1[normalize-space(.)='Discovery Rules']")
page_info = Text("//foreman-react-component[contains(@name, 'DiscoveryRules')]/div/div")
new = Text("//a[contains(@href, '/discovery_rules/new')]")
new_on_blank_page = PF4Button('Create Rule')
table = SatTable(
table = Table(
'.//table',
column_widgets={
'Name': Text('./a'),
'Name': Text('.//a'),
'Actions': ActionsDropdown("./div[contains(@class, 'btn-group')]"),
},
)
Expand Down

0 comments on commit e7ec818

Please sign in to comment.