Skip to content

hostgroups: PF5 update & navigation improvements #1819

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

Merged
merged 1 commit into from
Apr 28, 2025
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
5 changes: 4 additions & 1 deletion airgun/entities/hostgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def read(self, entity_name, widget_names=None):
"""Read values from host group edit page"""
view = self.navigate_to(self, 'Edit', entity_name=entity_name)
value = view.read(widget_names=widget_names)
view.submit.click()
return value

def read_all(self):
Expand All @@ -67,6 +66,7 @@ def update(self, entity_name, values):
view.submit.click()
view.flash.assert_no_error()
view.flash.dismiss()
self.browser.plugin.ensure_page_safe()

def total_no_of_assigned_role(self, entity_name):
"""Count of assigned role to the host group"""
Expand Down Expand Up @@ -113,6 +113,7 @@ class ShowAllHostGroups(NavigateStep):
@retry_navigation
def step(self, *args, **kwargs):
self.view.menu.select('Configure', 'Host Groups')
self.view.wait_displayed()


@navigator.register(HostGroupEntity, 'New')
Expand All @@ -128,6 +129,7 @@ def step(self, *args, **kwargs):
self.parent.new.click()
except NoSuchElementException:
self.parent.new_on_blank_page.click()
self.view.wait_displayed()


@navigator.register(HostGroupEntity, 'Edit')
Expand All @@ -147,3 +149,4 @@ def step(self, *args, **kwargs):
entity_name = kwargs.get('entity_name')
self.parent.search(entity_name)
self.parent.table.row(name=entity_name)['Name'].widget.click()
self.view.wait_displayed()
13 changes: 7 additions & 6 deletions airgun/views/hostgroup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from widgetastic.widget import ConditionalSwitchableView, Table, Text, TextInput, View
from widgetastic_patternfly import BreadCrumb
from widgetastic_patternfly4 import Button as PF4Button, Pagination as PF4Pagination
from widgetastic_patternfly4.ouia import Select as OUIASelect
from widgetastic_patternfly5 import Button as PF5Button, Pagination as PF5Pagination

from airgun.views.common import BaseLoggedInView, SatTab, SearchableViewMixinPF4
from airgun.widgets import (
Expand Down Expand Up @@ -32,7 +32,7 @@ class HostGroupsView(BaseLoggedInView, SearchableViewMixinPF4):
"//h1[contains(., 'Host Group Configuration') or normalize-space(.)='Host Groups']"
)
new = Text("//a[contains(@href, '/hostgroups/new')]")
new_on_blank_page = PF4Button('Create Host Group')
new_on_blank_page = PF5Button('Create Host Group')
table = Table(
'.//table',
column_widgets={
Expand All @@ -43,9 +43,10 @@ class HostGroupsView(BaseLoggedInView, SearchableViewMixinPF4):

@property
def is_displayed(self):
return self.browser.wait_for_element(
page_loaded = self.browser.wait_for_element(
self.title, exception=False
) is not None and self.browser.url.endswith('hostgroups')
) or self.browser.wait_for_element(self.new_on_blank_page, exception=False)
return page_loaded and self.browser.url.endswith('hostgroups')


class HostGroupCreateView(BaseLoggedInView):
Expand Down Expand Up @@ -81,7 +82,7 @@ class host_group(SatTab):
class ansible_roles(SatTab):
TAB_NAME = 'Ansible Roles'
resources = MultiSelectNoFilter(id='ansible_roles')
pagination = PF4Pagination()
pagination = PF5Pagination()

@View.nested
class puppet_enc(SatTab):
Expand Down Expand Up @@ -158,4 +159,4 @@ class ansible_roles(SatTab):
no_of_available_role = Text('//span[@class="pf-c-options-menu__toggle-text"]//b[2]')
resources = MultiSelectNoFilter(id='ansible_roles')
submit = Text('//input[@name="commit"]')
pagination = PF4Pagination()
pagination = PF5Pagination()
Loading