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] Pagination refactor #1037

Merged
merged 1 commit into from
Nov 16, 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
18 changes: 9 additions & 9 deletions airgun/views/ansible_role.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from widgetastic.widget import Checkbox, Table, Text
from widgetastic_patternfly import BreadCrumb
from widgetastic_patternfly4 import Button, PatternflyTable
from widgetastic_patternfly4 import (
Button,
CompactPagination,
Pagination as PF4Pagination,
PatternflyTable,
)

from airgun.views.common import BaseLoggedInView, SearchableViewMixin
from airgun.widgets import ActionsDropdown, Pagination


class ImportPagination(Pagination):
PER_PAGE_BUTTON_DROPDOWN = ".//div[button[@id='pagination-options-menu-toggle-2']]"
total_items = Text("//span[@class='pf-c-optionsmenu__toggle-text']/b[2]")
from airgun.widgets import ActionsDropdown


class AnsibleRolesView(BaseLoggedInView, SearchableViewMixin):
Expand All @@ -26,7 +26,7 @@ class AnsibleRolesView(BaseLoggedInView, SearchableViewMixin):
'Actions': ActionsDropdown("./div[contains(@class, 'btn-group')]"),
},
)
pagination = Pagination()
pagination = PF4Pagination()

@property
def is_displayed(self):
Expand All @@ -45,7 +45,7 @@ class AnsibleRolesImportView(BaseLoggedInView):
0: Checkbox(locator='.//input[@type="checkbox"]'),
},
)
pagination = ImportPagination()
pagination = CompactPagination()
submit = Button('Submit')
cancel = Button('Cancel')

Expand Down
3 changes: 1 addition & 2 deletions airgun/views/ansible_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from widgetastic_patternfly import BreadCrumb

from airgun.views.common import BaseLoggedInView, SatTable, SearchableViewMixinPF4
from airgun.widgets import CustomParameter, FilteredDropdown, Pagination, SatSelect
from airgun.widgets import CustomParameter, FilteredDropdown, SatSelect


class AnsibleVariablesView(BaseLoggedInView, SearchableViewMixinPF4):
Expand All @@ -17,7 +17,6 @@ class AnsibleVariablesView(BaseLoggedInView, SearchableViewMixinPF4):
'Actions': Text(".//a[@data-method='delete']"),
},
)
pagination = Pagination()

@property
def is_displayed(self):
Expand Down
4 changes: 2 additions & 2 deletions airgun/views/cloud_insights.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from widgetastic.widget import Checkbox, Text, TextInput, View
from widgetastic_patternfly4 import Button, Pagination
from widgetastic_patternfly4 import Button, Pagination as PF4Pagination
from widgetastic_patternfly4.dropdown import Dropdown
from widgetastic_patternfly4.ouia import Modal, PatternflyTable, Switch

Expand Down Expand Up @@ -58,7 +58,7 @@ class CloudInsightsView(BaseLoggedInView, SearchableViewMixinPF4):
)
select_all_hits = Button('Select recommendations from all pages')
clear_hits_selection = Button('Clear Selection')
pagination = Pagination()
pagination = PF4Pagination()
remediation_window = View.nested(RemediationView)

@property
Expand Down
4 changes: 2 additions & 2 deletions airgun/views/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
View,
)
from widgetastic_patternfly import BreadCrumb
from widgetastic_patternfly4 import Pagination as PF4Pagination

from airgun.views.common import BaseLoggedInView, SatTab
from airgun.widgets import (
ActionsDropdown,
FilteredDropdown,
MultiSelect,
Pagination,
Search,
)

Expand All @@ -28,7 +28,7 @@ class FiltersView(BaseLoggedInView):
'Actions': ActionsDropdown("./div[contains(@class, 'btn-group')]"),
},
)
pagination = Pagination()
pagination = PF4Pagination()

@property
def is_displayed(self):
Expand Down
18 changes: 12 additions & 6 deletions airgun/views/host_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
from selenium.webdriver.common.keys import Keys
from widgetastic.widget import Checkbox, Text, TextInput, View, Widget
from widgetastic.widget.table import Table
from widgetastic_patternfly4 import Button, Dropdown, Pagination, Select, Tab
from widgetastic_patternfly4 import (
Button,
Dropdown,
Pagination as PF4Pagination,
Select,
Tab,
)
from widgetastic_patternfly4.ouia import (
BreadCrumb,
Button as OUIAButton,
Expand Down Expand Up @@ -164,7 +170,7 @@ class packages(Tab):
5: Dropdown(locator='.//div[contains(@class, "pf-c-dropdown")]'),
},
)
pagination = Pagination()
pagination = PF4Pagination()

@View.nested
class errata(Tab):
Expand All @@ -191,7 +197,7 @@ class errata(Tab):
8: Dropdown(locator='./div'),
},
)
pagination = Pagination()
pagination = PF4Pagination()

@View.nested
class module_streams(Tab):
Expand All @@ -217,7 +223,7 @@ class module_streams(Tab):
5: DropdownWithDescripton(locator='.//div[contains(@class, "pf-c-dropdown")]'),
},
)
pagination = Pagination()
pagination = PF4Pagination()

@View.nested
class repository_sets(Tab):
Expand All @@ -241,7 +247,7 @@ class repository_sets(Tab):
5: Dropdown(locator='.//div[contains(@class, "pf-c-dropdown")]'),
},
)
pagination = Pagination()
pagination = PF4Pagination()

@View.nested
class traces(Tab):
Expand Down Expand Up @@ -272,7 +278,7 @@ class InstallPackagesView(View):
'Version': Text('./parent::td'),
},
)
pagination = Pagination()
pagination = PF4Pagination()

install = Button(locator='.//button[(normalize-space(.)="Install")]')
cancel = Button('Cancel')
Expand Down
2 changes: 2 additions & 0 deletions airgun/views/location.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from widgetastic.widget import Checkbox, Table, Text, TextInput, View
from widgetastic_patternfly import BreadCrumb
from widgetastic_patternfly4 import Pagination as PF4Pagination

from airgun.views.common import BaseLoggedInView, SatVerticalTab, SearchableViewMixinPF4
from airgun.widgets import (
Expand All @@ -20,6 +21,7 @@ class LocationsView(BaseLoggedInView, SearchableViewMixinPF4):
'Actions': ActionsDropdown("./div[contains(@class, 'btn-group')]"),
},
)
pagination = PF4Pagination()

@property
def is_displayed(self):
Expand Down
2 changes: 0 additions & 2 deletions airgun/views/task.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from wait_for import wait_for
from widgetastic.widget import Table, Text, View
from widgetastic_patternfly import BreadCrumb
from widgetastic_patternfly4 import Pagination

from airgun.views.common import BaseLoggedInView, SatTab, SearchableViewMixinPF4
from airgun.widgets import (
Expand Down Expand Up @@ -33,7 +32,6 @@ class TasksView(BaseLoggedInView, SearchableViewMixinPF4):
'Action': Text('./a'),
},
)
pagination = Pagination()

@property
def is_displayed(self):
Expand Down
11 changes: 4 additions & 7 deletions airgun/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
Kebab,
VerticalNavigation,
)
from widgetastic_patternfly4 import Pagination as PF4Pagination
from widgetastic_patternfly4.ouia import (
BaseSelect,
Button as PF4Button,
Expand Down Expand Up @@ -1670,12 +1671,6 @@ def fill(self, values):
widget.fill(value)


class SatTablePagination(Pagination):
"""Paginator widget for use within SatTable."""

ROOT = "//form[contains(@class, 'content-view-pf-pagination')]"


class SatTable(Table):
"""Satellite version of table.

Expand Down Expand Up @@ -1716,7 +1711,9 @@ class SatTable(Table):
"contains(@data-block, 'no-search-results-message')]"
)
tbody_row = Text('./tbody/tr')
pagination = SatTablePagination()
pagination = PF4Pagination(
locator="//div[contains(@class, 'pf-c-pagination') and not(contains(@class, 'pf-m-compact'))]"
)

@property
def has_rows(self):
Expand Down
Loading