Skip to content

Commit 1d5f223

Browse files
authored
Increase list page size to 50 (#2798)
increase default page size to 50
1 parent 73e36cb commit 1d5f223

File tree

5 files changed

+24
-26
lines changed

5 files changed

+24
-26
lines changed

app/api/hooks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export const getApiQueryOptions =
119119

120120
// Managed here instead of at the display layer so it can be built into the
121121
// query options and shared between loader prefetch and QueryTable
122-
export const PAGE_SIZE = 25
122+
export const PAGE_SIZE = 50
123123

124124
/**
125125
* This primarily exists so we can have an object that encapsulates everything

app/api/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ export * from './__generated__/Api'
1919

2020
export type { ApiTypes }
2121

22-
export { ensurePrefetched, PAGE_SIZE, type PaginatedQuery, type ResultsPage } from './hooks'
22+
export { ensurePrefetched, type PaginatedQuery, type ResultsPage } from './hooks'
2323
export type { ApiError } from './errors'
2424
export { navToLogin } from './nav-to-login'

mock-api/snapshot.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { disks } from './disk'
1616
import type { Json } from './json-type'
1717
import { project } from './project'
1818

19-
const generatedSnapshots: Json<Snapshot>[] = Array.from({ length: 80 }, (_, i) =>
19+
const generatedSnapshots: Json<Snapshot>[] = Array.from({ length: 160 }, (_, i) =>
2020
generateSnapshot(i)
2121
)
2222

test/e2e/pagination.e2e.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
*/
88
import { expect, test, type Page } from '@playwright/test'
99

10+
import { PAGE_SIZE } from '~/api/hooks'
11+
1012
import { expectScrollTop, scrollTo } from './utils'
1113

1214
// expectRowVisible is too have for all this
@@ -26,8 +28,8 @@ test('pagination', async ({ page }) => {
2628
await expect(prevButton).toBeDisabled() // we're on the first page
2729

2830
await expectCell(page, 'snapshot-1')
29-
await expectCell(page, 'disk-1-snapshot-25')
30-
await expect(rows).toHaveCount(25)
31+
await expectCell(page, `disk-1-snapshot-${PAGE_SIZE}`)
32+
await expect(rows).toHaveCount(PAGE_SIZE)
3133

3234
await scrollTo(page, 100)
3335

@@ -40,28 +42,28 @@ test('pagination', async ({ page }) => {
4042
await expect(spinner).toBeHidden()
4143
await expectScrollTop(page, 0) // scroll resets to top on page change
4244

43-
await expectCell(page, 'disk-1-snapshot-26')
44-
await expectCell(page, 'disk-1-snapshot-50')
45-
await expect(rows).toHaveCount(25)
45+
await expectCell(page, `disk-1-snapshot-${PAGE_SIZE + 1}`)
46+
await expectCell(page, `disk-1-snapshot-${2 * PAGE_SIZE}`)
47+
await expect(rows).toHaveCount(PAGE_SIZE)
4648

4749
await nextButton.click()
48-
await expectCell(page, 'disk-1-snapshot-51')
49-
await expectCell(page, 'disk-1-snapshot-75')
50-
await expect(rows).toHaveCount(25)
50+
await expectCell(page, `disk-1-snapshot-${2 * PAGE_SIZE + 1}`)
51+
await expectCell(page, `disk-1-snapshot-${3 * PAGE_SIZE}`)
52+
await expect(rows).toHaveCount(PAGE_SIZE)
5153

5254
await nextButton.click()
53-
await expectCell(page, 'disk-1-snapshot-76')
54-
await expectCell(page, 'disk-1-snapshot-86')
55-
await expect(rows).toHaveCount(12)
55+
await expectCell(page, `disk-1-snapshot-${3 * PAGE_SIZE + 1}`)
56+
await expectCell(page, 'disk-1-snapshot-167')
57+
await expect(rows).toHaveCount(17)
5658
await expect(nextButton).toBeDisabled() // no more pages
5759

5860
await scrollTo(page, 250)
5961

6062
await prevButton.click()
6163
await expect(spinner).toBeHidden({ timeout: 10 }) // no spinner, cached page
62-
await expect(rows).toHaveCount(25)
63-
await expectCell(page, 'disk-1-snapshot-51')
64-
await expectCell(page, 'disk-1-snapshot-75')
64+
await expect(rows).toHaveCount(PAGE_SIZE)
65+
await expectCell(page, `disk-1-snapshot-${2 * PAGE_SIZE + 1}`)
66+
await expectCell(page, `disk-1-snapshot-${3 * PAGE_SIZE}`)
6567
await expectScrollTop(page, 0) // scroll resets to top on prev too
6668

6769
await nextButton.click()

test/e2e/snapshots.e2e.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Copyright Oxide Computer Company
77
*/
8-
import { expect, expectRowVisible, expectVisible, test } from './utils'
8+
import { clickRowAction, expect, expectRowVisible, expectVisible, test } from './utils'
99

1010
test('Click through snapshots', async ({ page }) => {
1111
await page.goto('/projects/mock-project')
@@ -85,13 +85,11 @@ test('Error on delete snapshot', async ({ page }) => {
8585
test('Create image from snapshot', async ({ page }) => {
8686
await page.goto('/projects/mock-project/snapshots')
8787

88-
const row = page.getByRole('row', { name: 'snapshot-4' })
89-
await row.getByRole('button', { name: 'Row actions' }).click()
90-
await page.getByRole('menuitem', { name: 'Create image' }).click()
88+
await clickRowAction(page, 'disk-1-snapshot-8', 'Create image')
9189

9290
await expectVisible(page, ['role=dialog[name="Create image from snapshot"]'])
9391

94-
await page.fill('role=textbox[name="Name"]', 'image-from-snapshot-4')
92+
await page.fill('role=textbox[name="Name"]', 'image-from-snapshot-8')
9593
await page.fill('role=textbox[name="Description"]', 'image description')
9694
await page.fill('role=textbox[name="OS"]', 'Ubuntu')
9795
await page.fill('role=textbox[name="Version"]', '20.02')
@@ -102,17 +100,15 @@ test('Create image from snapshot', async ({ page }) => {
102100

103101
await page.click('role=link[name*="Images"]')
104102
await expectRowVisible(page.getByRole('table'), {
105-
name: 'image-from-snapshot-4',
103+
name: 'image-from-snapshot-8',
106104
description: 'image description',
107105
})
108106
})
109107

110108
test('Create image from snapshot, name taken', async ({ page }) => {
111109
await page.goto('/projects/mock-project/snapshots')
112110

113-
const row = page.getByRole('row', { name: 'snapshot-4' })
114-
await row.getByRole('button', { name: 'Row actions' }).click()
115-
await page.getByRole('menuitem', { name: 'Create image' }).click()
111+
await clickRowAction(page, 'disk-1-snapshot-8', 'Create image')
116112

117113
await expectVisible(page, ['role=dialog[name="Create image from snapshot"]'])
118114

0 commit comments

Comments
 (0)