Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.12.z] add Host statuses modal support (#966) #986

Merged
merged 1 commit into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]')
Loading