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.15.z] Basic host statuses page #1388

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
24 changes: 24 additions & 0 deletions airgun/entities/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
HostsDeleteTaskDetailsView,
HostsJobInvocationCreateView,
HostsJobInvocationStatusView,
HostStatusesView,
HostsUnassignCompliancePolicy,
HostsView,
RecommendationListView,
Expand Down Expand Up @@ -248,6 +249,19 @@ def export(self):
view.export.click()
return self.browser.save_downloaded_file()

def host_statuses(self):
view = self.navigate_to(self, 'Host Statuses')
view.wait_displayed()
statuses = []
view.status_green_total.wait_displayed()
statuses.append({'name': 'green_total', 'count': view.status_green_total.read()})
statuses.append({'name': 'green_owned', 'count': view.status_green_owned.read()})
statuses.append({'name': 'yellow_total', 'count': view.status_yellow_total.read()})
statuses.append({'name': 'yellow_owned', 'count': view.status_yellow_owned.read()})
statuses.append({'name': 'red_total', 'count': view.status_red_total.read()})
statuses.append({'name': 'red_owned', 'count': view.status_red_owned.read()})
return statuses

def schedule_remote_job(self, entities_list, values, timeout=60, wait_for_results=True):
"""Apply Schedule Remote Job action to the hosts names in entities_list

Expand Down Expand Up @@ -544,3 +558,13 @@ def prerequisite(self, *args, **kwargs):
def step(self, *args, **kwargs):
"""Open the Manage columns dialog"""
self.parent.manage_columns.click()


@navigator.register(HostEntity, 'Host Statuses')
class HostStatuses(NavigateStep):

VIEW = HostStatusesView

def step(self, *args, **kwargs):
"""Navigate to Monitor -> Host Statuses"""
self.view.menu.select('Monitor', 'Host Statuses')
14 changes: 14 additions & 0 deletions airgun/views/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,20 @@ def is_displayed(self):
return self.browser.wait_for_element(self.title, visible=True, exception=False) is not None


class HostStatusesView(BaseLoggedInView):
title = Text("//h5[normalize-space(.)='Host Status Overview']")
status_green_total = Text("//div[contains(@class, 'status-count')][1]/a[1]")
status_green_owned = Text("//div[contains(@class, 'status-count')][1]/a[2]")
status_yellow_total = Text("//div[contains(@class, 'status-count')][2]/span[1]")
status_yellow_owned = Text("//div[contains(@class, 'status-count')][2]/span[2]")
status_red_total = Text("//div[contains(@class, 'status-count')][3]/a[1]")
status_red_owned = Text("//div[contains(@class, 'status-count')][3]/a[2]")

@property
def is_displayed(self):
return self.browser.wait_for_element(self.title, exception=False) is not None


class HostsView(BaseLoggedInView, SearchableViewMixinPF4):
title = Text("//h1[normalize-space(.)='Hosts']")
manage_columns = PF4Button('manage-columns-button')
Expand Down