diff --git a/app/assets/javascripts/packages_and_registries/container_registry/explorer/components/list_page/image_list.vue b/app/assets/javascripts/packages_and_registries/container_registry/explorer/components/list_page/image_list.vue index 6f1f67e251fe386a945e471c7e19d77cef43dfdb..9ecb037c257a6cd6b1f94460c60f44a11b45f9d2 100644 --- a/app/assets/javascripts/packages_and_registries/container_registry/explorer/components/list_page/image_list.vue +++ b/app/assets/javascripts/packages_and_registries/container_registry/explorer/components/list_page/image_list.vue @@ -28,11 +28,6 @@ export default { required: false, }, }, - computed: { - showPagination() { - return this.pageInfo.hasPreviousPage || this.pageInfo.hasNextPage; - }, - }, }; </script> @@ -48,9 +43,7 @@ export default { /> <div class="gl-display-flex gl-justify-content-center"> <gl-keyset-pagination - v-if="showPagination" - :has-next-page="pageInfo.hasNextPage" - :has-previous-page="pageInfo.hasPreviousPage" + v-bind="pageInfo" class="gl-mt-3" @prev="$emit('prev-page')" @next="$emit('next-page')" diff --git a/app/assets/javascripts/packages_and_registries/dependency_proxy/components/manifests_list.vue b/app/assets/javascripts/packages_and_registries/dependency_proxy/components/manifests_list.vue index 94c958308dd25ce69e26cdd33efb1c4dd034fce2..462de03d19fb29adfdc4841df413364fd42494ef 100644 --- a/app/assets/javascripts/packages_and_registries/dependency_proxy/components/manifests_list.vue +++ b/app/assets/javascripts/packages_and_registries/dependency_proxy/components/manifests_list.vue @@ -37,11 +37,6 @@ export default { i18n: { listTitle: s__('DependencyProxy|Image list'), }, - computed: { - showPagination() { - return this.pagination.hasNextPage || this.pagination.hasPreviousPage; - }, - }, }; </script> @@ -68,7 +63,6 @@ export default { </div> <div class="gl-display-flex gl-justify-content-center"> <gl-keyset-pagination - v-if="showPagination" v-bind="pagination" class="gl-mt-3" @prev="$emit('prev-page')" diff --git a/app/assets/javascripts/packages_and_registries/package_registry/components/details/package_files.vue b/app/assets/javascripts/packages_and_registries/package_registry/components/details/package_files.vue index 96d097eff380e107935c8d9f92d670ebfa5d38f9..c8924e6548bdce81ec48eb558117b3c5ef07c6fc 100644 --- a/app/assets/javascripts/packages_and_registries/package_registry/components/details/package_files.vue +++ b/app/assets/javascripts/packages_and_registries/package_registry/components/details/package_files.vue @@ -178,10 +178,6 @@ export default { first: GRAPHQL_PACKAGE_FILES_PAGE_SIZE, }; }, - showPagination() { - const { hasPreviousPage, hasNextPage } = this.pageInfo; - return hasPreviousPage || hasNextPage; - }, tracking() { return { category: packageTypeToTrackCategory(this.packageType), @@ -490,7 +486,6 @@ export default { </gl-table> <div class="gl-display-flex gl-justify-content-center"> <gl-keyset-pagination - v-if="showPagination" :disabled="isLoading" v-bind="pageInfo" :prev-text="$options.i18n.prev" diff --git a/app/assets/javascripts/packages_and_registries/shared/components/registry_list.vue b/app/assets/javascripts/packages_and_registries/shared/components/registry_list.vue index 1c8f80972df4213350a248e6fbc8ae632ee25c8f..f67bee77eb6a498762e7a1a0d3f536b1fa114202 100644 --- a/app/assets/javascripts/packages_and_registries/shared/components/registry_list.vue +++ b/app/assets/javascripts/packages_and_registries/shared/components/registry_list.vue @@ -47,9 +47,6 @@ export default { }; }, computed: { - showPagination() { - return this.pagination.hasPreviousPage || this.pagination.hasNextPage; - }, disableDeleteButton() { return this.isLoading || this.selectedItems.length === 0; }, @@ -131,7 +128,6 @@ export default { <div class="gl-display-flex gl-justify-content-center"> <gl-keyset-pagination - v-if="showPagination" v-bind="pagination" class="gl-mt-3" @prev="$emit('prev-page')" diff --git a/spec/frontend/packages_and_registries/container_registry/explorer/components/list_page/image_list_spec.js b/spec/frontend/packages_and_registries/container_registry/explorer/components/list_page/image_list_spec.js index 6c771887b88b36196cfb789d7d4b718049261ad3..714f8d978390d7e1c5e7989543609ccbfd72aa4a 100644 --- a/spec/frontend/packages_and_registries/container_registry/explorer/components/list_page/image_list_spec.js +++ b/spec/frontend/packages_and_registries/container_registry/explorer/components/list_page/image_list_spec.js @@ -3,7 +3,7 @@ import { shallowMount } from '@vue/test-utils'; import Component from '~/packages_and_registries/container_registry/explorer/components/list_page/image_list.vue'; import ImageListRow from '~/packages_and_registries/container_registry/explorer/components/list_page/image_list_row.vue'; -import { imagesListResponse, pageInfo as defaultPageInfo } from '../../mock_data'; +import { imagesListResponse, pageInfo } from '../../mock_data'; describe('Image List', () => { let wrapper; @@ -11,6 +11,8 @@ describe('Image List', () => { const findRow = () => wrapper.findAllComponents(ImageListRow); const findPagination = () => wrapper.findComponent(GlKeysetPagination); + const { __typename, ...defaultPageInfo } = pageInfo; + const mountComponent = (props) => { wrapper = shallowMount(Component, { propsData: { @@ -45,25 +47,9 @@ describe('Image List', () => { it('exists', () => { mountComponent(); - expect(findPagination().exists()).toBe(true); + expect(findPagination().props()).toMatchObject({ ...defaultPageInfo }); }); - it.each` - hasNextPage | hasPreviousPage | isVisible - ${true} | ${true} | ${true} - ${true} | ${false} | ${true} - ${false} | ${true} | ${true} - `( - 'when hasNextPage is $hasNextPage and hasPreviousPage is $hasPreviousPage: is $isVisible that the component is visible', - ({ hasNextPage, hasPreviousPage, isVisible }) => { - mountComponent({ pageInfo: { ...defaultPageInfo, hasNextPage, hasPreviousPage } }); - - expect(findPagination().exists()).toBe(isVisible); - expect(findPagination().props('hasPreviousPage')).toBe(hasPreviousPage); - expect(findPagination().props('hasNextPage')).toBe(hasNextPage); - }, - ); - it('emits "prev-page" when the user clicks the back page button', () => { mountComponent(); diff --git a/spec/frontend/packages_and_registries/container_registry/explorer/mock_data.js b/spec/frontend/packages_and_registries/container_registry/explorer/mock_data.js index 8ca74f5077e6e42e99f6c33eb17671a677389d1b..5ee1b4315ff4da906d96f5d35ef8c8ea8f494997 100644 --- a/spec/frontend/packages_and_registries/container_registry/explorer/mock_data.js +++ b/spec/frontend/packages_and_registries/container_registry/explorer/mock_data.js @@ -40,7 +40,7 @@ export const pageInfo = { hasPreviousPage: true, startCursor: 'eyJpZCI6IjI2In0', endCursor: 'eyJpZCI6IjgifQ', - __typename: 'ContainerRepositoryConnection', + __typename: 'PageInfo', }; export const graphQLImageListMock = { diff --git a/spec/frontend/packages_and_registries/dependency_proxy/components/manifest_list_spec.js b/spec/frontend/packages_and_registries/dependency_proxy/components/manifest_list_spec.js index 8f445843aa8142c2cd5e10e0cbceffc7aad47722..521a38bee701d1f1a3045b43474b0a2df427c0b8 100644 --- a/spec/frontend/packages_and_registries/dependency_proxy/components/manifest_list_spec.js +++ b/spec/frontend/packages_and_registries/dependency_proxy/components/manifest_list_spec.js @@ -91,12 +91,6 @@ describe('Manifests List', () => { }); describe('pagination', () => { - it('is hidden when there is no next or prev pages', () => { - createComponent({ ...defaultProps, pagination: {} }); - - expect(findPagination().exists()).toBe(false); - }); - it('has the correct props', () => { createComponent(); diff --git a/spec/frontend/packages_and_registries/package_registry/components/details/package_files_spec.js b/spec/frontend/packages_and_registries/package_registry/components/details/package_files_spec.js index 2c712feac86ece85ee12bb22ad06325b9664c1be..5ba4b1f687e671f20b600ad4aa7ac6e4f0f6be04 100644 --- a/spec/frontend/packages_and_registries/package_registry/components/details/package_files_spec.js +++ b/spec/frontend/packages_and_registries/package_registry/components/details/package_files_spec.js @@ -176,22 +176,6 @@ describe('Package Files', () => { disabled: false, }); }); - - it('hides pagination when only one page', async () => { - createComponent({ - resolver: jest.fn().mockResolvedValue( - packageFilesQuery({ - extendPagination: { - hasNextPage: false, - hasPreviousPage: false, - }, - }), - ), - }); - await waitForPromises(); - - expect(findPagination().exists()).toBe(false); - }); }); describe('link', () => { diff --git a/spec/frontend/packages_and_registries/shared/components/registry_list_spec.js b/spec/frontend/packages_and_registries/shared/components/registry_list_spec.js index 66fca2ce12e01f7c2fe7e6d7727656976292bb71..43dca2e6bf259c7759fd97f7b5cd49c031b393b5 100644 --- a/spec/frontend/packages_and_registries/shared/components/registry_list_spec.js +++ b/spec/frontend/packages_and_registries/shared/components/registry_list_spec.js @@ -185,7 +185,7 @@ describe('Registry List', () => { pagination = { hasPreviousPage: false, hasNextPage: true }; }); - it('has a pagination', () => { + it('has pagination', () => { mountComponent({ propsData: { ...defaultPropsData, pagination }, }); @@ -193,24 +193,6 @@ describe('Registry List', () => { expect(findPagination().props()).toMatchObject(pagination); }); - it.each` - hasPreviousPage | hasNextPage | visible - ${true} | ${true} | ${true} - ${true} | ${false} | ${true} - ${false} | ${true} | ${true} - ${false} | ${false} | ${false} - `( - 'when hasPreviousPage is $hasPreviousPage and hasNextPage is $hasNextPage is $visible that the pagination is shown', - ({ hasPreviousPage, hasNextPage, visible }) => { - pagination = { hasPreviousPage, hasNextPage }; - mountComponent({ - propsData: { ...defaultPropsData, pagination }, - }); - - expect(findPagination().exists()).toBe(visible); - }, - ); - it('pagination emits the correct events', () => { mountComponent({ propsData: { ...defaultPropsData, pagination },