Skip to content

Commit

Permalink
add Host statues modal support (#966) (#986)
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 29, 2023
1 parent 51c3f02 commit 241cf91
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 @@ -2,6 +2,7 @@
from airgun.navigation import NavigateStep, navigator
from airgun.views.host_new import (
InstallPackagesView,
ManageHostStatusesView,
ModuleStreamDialog,
NewHostDetailsView,
)
Expand All @@ -28,6 +29,21 @@ def get_details(self, entity_name, widget_names=None):
self.browser.plugin.ensure_page_safe()
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 schedule_job(self, entity_name, values):
"""Schedule a remote execution on selected host"""
view = self.navigate_to(self, 'NewDetails', entity_name=entity_name)
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 @@ -278,6 +278,26 @@ class InstallPackagesView(View):
cancel = Button('Cancel')


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 ModuleStreamDialog(Pf4ConfirmationDialog):
confirm_dialog = Button(locator='.//button[@aria-label="confirm-module-action"]')
cancel_dialog = Button(locator='.//button[@aria-label="cancel-module-action"]')

0 comments on commit 241cf91

Please sign in to comment.