Skip to content

Commit

Permalink
add Host statues modal support (#966)
Browse files Browse the repository at this point in the history
* add Host Statues modal support

* address comments

* address comments & fix stuck modal
  • Loading branch information
mstrlc authored Sep 22, 2023
1 parent 01ca4f2 commit f8c114b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
16 changes: 16 additions & 0 deletions airgun/entities/host_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
EnableTracerView,
InstallPackagesView,
ManageHostCollectionModal,
ManageHostStatusesView,
ModuleStreamDialog,
NewHostDetailsView,
ParameterDeleteDialog,
Expand Down Expand Up @@ -44,6 +45,21 @@ def get_details(self, entity_name, widget_names=None):
view.read(widget_names=widget_names)
return view.read(widget_names=widget_names)

def get_host_statuses(self, entity_name):
"""Read host statuses from Host Details page
Args:
entity_name: Name of the host
"""
view = self.navigate_to(self, 'NewDetails', entity_name=entity_name)
view.wait_displayed()
self.browser.plugin.ensure_page_safe()
view.overview.host_status.manage_all_statuses.click()
view = ManageHostStatusesView(self.browser)
values = view.read()
view.close_modal.click()
return values

def edit_system_purpose(
self, entity_name, role=None, sla=None, usage=None, release_ver=None, add_ons=None
):
Expand Down
20 changes: 20 additions & 0 deletions airgun/views/host_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,26 @@ class EditSystemPurposeView(View):
cancel = OUIAButton('cancel-syspurpose')


class ManageHostStatusesView(View):
"""Manage host statuses modal"""

ROOT = './/div[@data-ouia-component-id="statuses-modal"]'
close_modal = Button(locator='.//button[@aria-label="Close"]')
host_statuses_table = PatternflyTable(
component_id='statuses-table',
column_widgets={
'Name': Text('.//td[contains(@data-label, "Name")]'),
'Status': Text('.//td[contains(@data-label, "Status")]'),
'Reported at': Text('.//td[contains(@data-label, "Reported at")]'),
3: Button(locator='.//td[contains(@class, "action")]'),
},
)

def read(self):
# Parses into a dictionary of {name: {status, reported_at}}
return {value.pop('Name'): value for value in self.host_statuses_table.read()}


class EditAnsibleRolesView(View):
"""Edit Ansible Roles Modal"""

Expand Down

0 comments on commit f8c114b

Please sign in to comment.