Skip to content

Commit 1d53d0c

Browse files
committed
fix(ui): align batch toolbar with primary actions and bump version to 1.3.15
1 parent 339cdb4 commit 1d53d0c

6 files changed

Lines changed: 285 additions & 217 deletions

File tree

frontend/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "sb-proxy-frontend",
33
"private": true,
4-
"version": "1.3.14",
4+
"version": "1.3.15",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

frontend/scripts/filter-selection-regression.mjs

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,17 @@ const assert = (condition, message) => {
313313
if (!condition) throw new Error(message)
314314
}
315315

316+
const getRect = async (page, selector) =>
317+
page.$eval(selector, (element) => {
318+
const rect = element.getBoundingClientRect()
319+
return {
320+
left: rect.left,
321+
top: rect.top,
322+
width: rect.width,
323+
height: rect.height,
324+
}
325+
})
326+
316327
const getVisibleRowKeys = async (page) =>
317328
page.$$eval('tbody.ant-table-tbody tr[data-row-key]', (rows) =>
318329
rows.map((row) => row.getAttribute('data-row-key') || '')
@@ -395,6 +406,7 @@ const run = async () => {
395406
})
396407

397408
const page = await browser.newPage()
409+
await page.setViewport({ width: 1440, height: 960 })
398410
const consoleErrors = []
399411
page.on('console', (msg) => {
400412
if (msg.type() === 'error') {
@@ -476,9 +488,40 @@ const run = async () => {
476488
// Select-all should only affect filtered rows, and batch delete should only delete within scope.
477489
await page.click('[data-testid="nodes-select-all"]')
478490
await page.waitForSelector('[data-testid="nodes-batch-delete"]', { timeout: 10000 })
491+
await page.waitForSelector('[data-testid="dashboard-toolbar-selection"]', { timeout: 10000 })
492+
await sleep(300)
493+
494+
const primaryToolbarRect = await getRect(page, '[data-testid="dashboard-toolbar-primary"]')
495+
const selectionToolbarRect = await getRect(page, '[data-testid="dashboard-toolbar-selection"]')
496+
assert(
497+
selectionToolbarRect.top > primaryToolbarRect.top + 4,
498+
`Expected batch toolbar to render below primary toolbar, got primary=${JSON.stringify(primaryToolbarRect)} selection=${JSON.stringify(selectionToolbarRect)}`
499+
)
500+
assert(
501+
Math.abs(selectionToolbarRect.left - primaryToolbarRect.left) <= 1.5,
502+
`Expected batch toolbar to align left with primary toolbar, got primary=${JSON.stringify(primaryToolbarRect)} selection=${JSON.stringify(selectionToolbarRect)}`
503+
)
504+
479505
await page.click('[data-testid="nodes-batch-delete"]')
480506
await page.waitForSelector('.ant-popconfirm', { timeout: 10000 })
481-
await page.click('.ant-popconfirm-buttons button.ant-btn-primary')
507+
await page.waitForSelector('.ant-popconfirm-buttons button.ant-btn-primary:not([disabled])', {
508+
timeout: 10000,
509+
})
510+
await page.evaluate(() => {
511+
const confirmButtons = Array.from(
512+
document.querySelectorAll('.ant-popconfirm-buttons button.ant-btn-primary:not([disabled])')
513+
).filter((button) => {
514+
if (!(button instanceof HTMLElement)) {
515+
return false
516+
}
517+
return button.offsetParent !== null
518+
})
519+
const target = confirmButtons[confirmButtons.length - 1]
520+
if (!target) {
521+
throw new Error('popconfirm primary button not found')
522+
}
523+
target.click()
524+
})
482525
await sleep(1200)
483526

484527
const stateAfterBatchDelete = mockApi.getState()

0 commit comments

Comments
 (0)