From 265af3fe90fee11f7b596882db9a2404086cc0a1 Mon Sep 17 00:00:00 2001 From: Matyas Strelec Date: Tue, 29 Aug 2023 16:21:39 +0200 Subject: [PATCH 1/5] update views to use Widgetastic's PF4 Pagination --- airgun/views/ansible_role.py | 2 +- airgun/views/ansible_variable.py | 1 + airgun/views/filter.py | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/airgun/views/ansible_role.py b/airgun/views/ansible_role.py index fcb524db9..2506c7006 100644 --- a/airgun/views/ansible_role.py +++ b/airgun/views/ansible_role.py @@ -45,7 +45,7 @@ class AnsibleRolesImportView(BaseLoggedInView): 0: Checkbox(locator='.//input[@type="checkbox"]'), }, ) - pagination = ImportPagination() + pagination = Pagination() submit = Button('Submit') cancel = Button('Cancel') diff --git a/airgun/views/ansible_variable.py b/airgun/views/ansible_variable.py index 2b23f0afe..f8fa1ab0c 100644 --- a/airgun/views/ansible_variable.py +++ b/airgun/views/ansible_variable.py @@ -1,5 +1,6 @@ from widgetastic.widget import Checkbox, Select, Text, TextInput, View from widgetastic_patternfly import BreadCrumb +from widgetastic_patternfly4 import Pagination from airgun.views.common import BaseLoggedInView, SatTable, SearchableViewMixinPF4 from airgun.widgets import CustomParameter, FilteredDropdown, Pagination, SatSelect diff --git a/airgun/views/filter.py b/airgun/views/filter.py index 61e0b766c..98f3b99a6 100644 --- a/airgun/views/filter.py +++ b/airgun/views/filter.py @@ -7,6 +7,7 @@ View, ) from widgetastic_patternfly import BreadCrumb +from widgetastic_patternfly4 import Pagination from airgun.views.common import BaseLoggedInView, SatTab from airgun.widgets import ( From 53a1ccf0fcd70b3122dcc7d6b57f80bb8eda198b Mon Sep 17 00:00:00 2001 From: Matyas Strelec Date: Wed, 20 Sep 2023 15:23:44 +0200 Subject: [PATCH 2/5] rename to PF4Pagination --- airgun/views/acs.py | 4 ++-- airgun/views/ansible_role.py | 18 +++++++------- airgun/views/ansible_variable.py | 6 ++--- airgun/views/cloud_insights.py | 4 ++-- airgun/views/filter.py | 8 +++---- airgun/views/host_new.py | 40 ++++++++++++++++++-------------- airgun/views/task.py | 4 ++-- airgun/widgets.py | 9 ++----- 8 files changed, 47 insertions(+), 46 deletions(-) diff --git a/airgun/views/acs.py b/airgun/views/acs.py index 5f9001dd7..b17f5fc4d 100644 --- a/airgun/views/acs.py +++ b/airgun/views/acs.py @@ -4,7 +4,7 @@ Drawer, Dropdown, FormSelect, - Pagination, + Pagination as PF4Pagination, Radio, Switch, ) @@ -364,7 +364,7 @@ class acs_drawer(Drawer): ) clear_search = OUIAButton('empty-state-secondary-action-router-link') - pagination = Pagination() + pagination = PF4Pagination() @property def is_displayed(self): diff --git a/airgun/views/ansible_role.py b/airgun/views/ansible_role.py index 2506c7006..8f6729196 100644 --- a/airgun/views/ansible_role.py +++ b/airgun/views/ansible_role.py @@ -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): @@ -26,7 +26,7 @@ class AnsibleRolesView(BaseLoggedInView, SearchableViewMixin): 'Actions': ActionsDropdown("./div[contains(@class, 'btn-group')]"), }, ) - pagination = Pagination() + pagination = PF4Pagination() @property def is_displayed(self): @@ -45,7 +45,7 @@ class AnsibleRolesImportView(BaseLoggedInView): 0: Checkbox(locator='.//input[@type="checkbox"]'), }, ) - pagination = Pagination() + pagination = CompactPagination() submit = Button('Submit') cancel = Button('Cancel') diff --git a/airgun/views/ansible_variable.py b/airgun/views/ansible_variable.py index f8fa1ab0c..9886a63d0 100644 --- a/airgun/views/ansible_variable.py +++ b/airgun/views/ansible_variable.py @@ -1,9 +1,9 @@ from widgetastic.widget import Checkbox, Select, Text, TextInput, View from widgetastic_patternfly import BreadCrumb -from widgetastic_patternfly4 import Pagination +from widgetastic_patternfly4 import Pagination as PF4Pagination 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): @@ -18,7 +18,7 @@ class AnsibleVariablesView(BaseLoggedInView, SearchableViewMixinPF4): 'Actions': Text(".//a[@data-method='delete']"), }, ) - pagination = Pagination() + pagination = PF4Pagination() @property def is_displayed(self): diff --git a/airgun/views/cloud_insights.py b/airgun/views/cloud_insights.py index 88d66c8eb..71fb3db51 100644 --- a/airgun/views/cloud_insights.py +++ b/airgun/views/cloud_insights.py @@ -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 @@ -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 diff --git a/airgun/views/filter.py b/airgun/views/filter.py index 98f3b99a6..ede0a4a75 100644 --- a/airgun/views/filter.py +++ b/airgun/views/filter.py @@ -7,16 +7,16 @@ View, ) from widgetastic_patternfly import BreadCrumb -from widgetastic_patternfly4 import Pagination +from widgetastic_patternfly4 import Pagination as PF4Pagination from airgun.views.common import BaseLoggedInView, SatTab from airgun.widgets import ( ActionsDropdown, MultiSelect, Pagination, - PF4FilteredDropdown, - PF4MultiSelect, Search, + PF4FilteredDropdown, + PF4MultiSelect ) @@ -30,7 +30,7 @@ class FiltersView(BaseLoggedInView): 'Actions': ActionsDropdown("./div[contains(@class, 'btn-group')]"), }, ) - pagination = Pagination() + pagination = PF4Pagination() @property def is_displayed(self): diff --git a/airgun/views/host_new.py b/airgun/views/host_new.py index 22e75b4ee..cb3286064 100644 --- a/airgun/views/host_new.py +++ b/airgun/views/host_new.py @@ -2,7 +2,13 @@ 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, @@ -360,7 +366,7 @@ class packages(Tab): 5: Dropdown(locator='.//div[contains(@class, "pf-c-dropdown")]'), }, ) - pagination = Pagination() + pagination = PF4Pagination() @View.nested class errata(Tab): @@ -387,7 +393,7 @@ class errata(Tab): 8: Dropdown(locator='./div'), }, ) - pagination = Pagination() + pagination = PF4Pagination() @View.nested class module_streams(Tab): @@ -413,7 +419,7 @@ class module_streams(Tab): 5: DropdownWithDescripton(locator='.//div[contains(@class, "pf-c-dropdown")]'), }, ) - pagination = Pagination() + pagination = PF4Pagination() @View.nested class repository_sets(Tab): @@ -447,7 +453,7 @@ class repository_sets(Tab): 6: Dropdown(locator='.//div[contains(@class, "pf-c-dropdown")]'), }, ) - pagination = Pagination() + pagination = PF4Pagination() @View.nested class parameters(Tab): @@ -482,7 +488,7 @@ class parameters(Tab): 5: Dropdown(locator='.//div[contains(@class, "pf-c-dropdown")]'), }, ) - pagination = Pagination() + pagination = PF4Pagination() @View.nested class traces(Tab): @@ -505,7 +511,7 @@ class traces(Tab): 4: Button(locator='.//button[contains(@aria-label, "Actions")]'), }, ) - pagination = Pagination() + pagination = PF4Pagination() @View.nested class ansible(Tab): @@ -524,7 +530,7 @@ class roles(Tab): locator='.//table[contains(@class, "pf-c-table")]', column_widgets={'Name': Text('.//a')}, ) - pagination = Pagination() + pagination = PF4Pagination() @View.nested class variables(Tab): @@ -546,7 +552,7 @@ class variables(Tab): 7: Button(locator='.//button[@aria-label="Edit override button"]'), }, ) - pagination = Pagination() + pagination = PF4Pagination() @View.nested class inventory(Tab): @@ -590,7 +596,7 @@ class jobs(Tab): 4: Dropdown(locator='.//div[contains(@class, "pf-c-dropdown")]'), }, ) - pagination = Pagination() + pagination = PF4Pagination() @property def is_displayed(self): @@ -610,7 +616,7 @@ class previous(Tab): 'Schedule': Text('./span'), }, ) - pagination = Pagination() + pagination = PF4Pagination() @property def is_displayed(self): @@ -634,7 +640,7 @@ class puppet(Tab): 7: Button(locator='.//button[contains(@aria-label, "Actions")]'), }, ) - pagination = Pagination() + pagination = PF4Pagination() @View.nested class enc_preview(Tab): @@ -675,7 +681,7 @@ class reports(Tab): }, ) - pagination = Pagination() + pagination = PF4Pagination() @View.nested class insights(Tab): @@ -700,7 +706,7 @@ class insights(Tab): 4: Button(locator='.//button[contains(@aria-label, "Actions")]'), }, ) - pagination = Pagination() + pagination = PF4Pagination() class InstallPackagesView(View): @@ -719,7 +725,7 @@ class InstallPackagesView(View): 'Version': Text('./parent::td'), }, ) - pagination = Pagination() + pagination = PF4Pagination() install = Button(locator='.//button[(normalize-space(.)="Install")]') cancel = Button('Cancel') @@ -734,7 +740,7 @@ class AllAssignedRolesView(View): locator='.//table[contains(@class, "pf-c-table")]', column_widgets={'Name': Text('.//a'), 'Source': Text('.//a')}, ) - pagination = Pagination() + pagination = PF4Pagination() class EnableTracerView(View): @@ -773,7 +779,7 @@ class ManageHostCollectionModal(View): }, ) - pagination = Pagination() + pagination = PF4Pagination() add = OUIAButton('add-button') remove = OUIAButton('add-button') diff --git a/airgun/views/task.py b/airgun/views/task.py index 25bd7be15..e8a6c00cb 100644 --- a/airgun/views/task.py +++ b/airgun/views/task.py @@ -1,7 +1,7 @@ from wait_for import wait_for from widgetastic.widget import Table, Text, View from widgetastic_patternfly import BreadCrumb -from widgetastic_patternfly4 import Pagination +from widgetastic_patternfly4 import Pagination as PF4Pagination from airgun.views.common import BaseLoggedInView, SatTab, SearchableViewMixinPF4 from airgun.widgets import ( @@ -33,7 +33,7 @@ class TasksView(BaseLoggedInView, SearchableViewMixinPF4): 'Action': Text('./a'), }, ) - pagination = Pagination() + pagination = PF4Pagination() @property def is_displayed(self): diff --git a/airgun/widgets.py b/airgun/widgets.py index 93a7c16db..e797c2c01 100644 --- a/airgun/widgets.py +++ b/airgun/widgets.py @@ -26,6 +26,7 @@ Kebab, VerticalNavigation, ) +from widgetastic_patternfly4 import Pagination as PF4Pagination from widgetastic_patternfly4.ouia import BaseSelect, Button as PF4Button, Dropdown from widgetastic_patternfly4.progress import Progress as PF4Progress @@ -1745,12 +1746,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. @@ -1791,7 +1786,7 @@ class SatTable(Table): "contains(@data-block, 'no-search-results-message')]" ) tbody_row = Text('./tbody/tr') - pagination = SatTablePagination() + pagination = PF4Pagination() @property def has_rows(self): From 39239d429530de03410504d644f6a0bd344a3da8 Mon Sep 17 00:00:00 2001 From: Matyas Strelec Date: Tue, 7 Nov 2023 14:43:09 +0100 Subject: [PATCH 3/5] fix SatTable locator --- airgun/views/ansible_variable.py | 1 - airgun/views/task.py | 1 - airgun/widgets.py | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/airgun/views/ansible_variable.py b/airgun/views/ansible_variable.py index 9886a63d0..01e07fe57 100644 --- a/airgun/views/ansible_variable.py +++ b/airgun/views/ansible_variable.py @@ -18,7 +18,6 @@ class AnsibleVariablesView(BaseLoggedInView, SearchableViewMixinPF4): 'Actions': Text(".//a[@data-method='delete']"), }, ) - pagination = PF4Pagination() @property def is_displayed(self): diff --git a/airgun/views/task.py b/airgun/views/task.py index e8a6c00cb..bd744ee02 100644 --- a/airgun/views/task.py +++ b/airgun/views/task.py @@ -33,7 +33,6 @@ class TasksView(BaseLoggedInView, SearchableViewMixinPF4): 'Action': Text('./a'), }, ) - pagination = PF4Pagination() @property def is_displayed(self): diff --git a/airgun/widgets.py b/airgun/widgets.py index e797c2c01..3e945c897 100644 --- a/airgun/widgets.py +++ b/airgun/widgets.py @@ -1786,7 +1786,7 @@ class SatTable(Table): "contains(@data-block, 'no-search-results-message')]" ) tbody_row = Text('./tbody/tr') - pagination = PF4Pagination() + pagination = PF4Pagination(locator="//div[contains(@class, 'pf-c-pagination') and not(contains(@class, 'pf-m-compact'))]") @property def has_rows(self): From f1779c64d4aa104aa10ea1748a98489fc45780ea Mon Sep 17 00:00:00 2001 From: Matyas Strelec Date: Tue, 7 Nov 2023 15:20:52 +0100 Subject: [PATCH 4/5] add Pagination to location for testing --- airgun/views/location.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/airgun/views/location.py b/airgun/views/location.py index 0dc241bbd..794312fe8 100644 --- a/airgun/views/location.py +++ b/airgun/views/location.py @@ -1,6 +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 ( ActionsDropdown, @@ -20,6 +20,7 @@ class LocationsView(BaseLoggedInView, SearchableViewMixinPF4): 'Actions': ActionsDropdown("./div[contains(@class, 'btn-group')]"), }, ) + pagination = PF4Pagination() @property def is_displayed(self): From 9b2823846a59efe3981aef33365f52432b828675 Mon Sep 17 00:00:00 2001 From: Matyas Strelec Date: Tue, 7 Nov 2023 15:22:35 +0100 Subject: [PATCH 5/5] pre-commit --- airgun/views/ansible_variable.py | 1 - airgun/views/filter.py | 5 ++--- airgun/views/location.py | 1 + airgun/views/task.py | 1 - airgun/widgets.py | 4 +++- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/airgun/views/ansible_variable.py b/airgun/views/ansible_variable.py index 01e07fe57..7a24d8f3e 100644 --- a/airgun/views/ansible_variable.py +++ b/airgun/views/ansible_variable.py @@ -1,6 +1,5 @@ from widgetastic.widget import Checkbox, Select, Text, TextInput, View from widgetastic_patternfly import BreadCrumb -from widgetastic_patternfly4 import Pagination as PF4Pagination from airgun.views.common import BaseLoggedInView, SatTable, SearchableViewMixinPF4 from airgun.widgets import CustomParameter, FilteredDropdown, SatSelect diff --git a/airgun/views/filter.py b/airgun/views/filter.py index ede0a4a75..486e6c872 100644 --- a/airgun/views/filter.py +++ b/airgun/views/filter.py @@ -13,10 +13,9 @@ from airgun.widgets import ( ActionsDropdown, MultiSelect, - Pagination, - Search, PF4FilteredDropdown, - PF4MultiSelect + PF4MultiSelect, + Search, ) diff --git a/airgun/views/location.py b/airgun/views/location.py index 794312fe8..b862e2440 100644 --- a/airgun/views/location.py +++ b/airgun/views/location.py @@ -1,6 +1,7 @@ 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 ( ActionsDropdown, diff --git a/airgun/views/task.py b/airgun/views/task.py index bd744ee02..f7931b0cb 100644 --- a/airgun/views/task.py +++ b/airgun/views/task.py @@ -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 as PF4Pagination from airgun.views.common import BaseLoggedInView, SatTab, SearchableViewMixinPF4 from airgun.widgets import ( diff --git a/airgun/widgets.py b/airgun/widgets.py index 3e945c897..525c8cf30 100644 --- a/airgun/widgets.py +++ b/airgun/widgets.py @@ -1786,7 +1786,9 @@ class SatTable(Table): "contains(@data-block, 'no-search-results-message')]" ) tbody_row = Text('./tbody/tr') - pagination = PF4Pagination(locator="//div[contains(@class, 'pf-c-pagination') and not(contains(@class, 'pf-m-compact'))]") + pagination = PF4Pagination( + locator="//div[contains(@class, 'pf-c-pagination') and not(contains(@class, 'pf-m-compact'))]" + ) @property def has_rows(self):