From ddeb84d86823ca617d57f487d10fb92bb670a036 Mon Sep 17 00:00:00 2001 From: Doug Davis Date: Wed, 28 Oct 2026 19:07:42 +0000 Subject: [PATCH] disable pagination first/last buttons when needed Signed-off-by: Doug Davis --- misc/largetest | 1 + registry/http/ui/app.js | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/misc/largetest b/misc/largetest index 7ec2501..ee9994c 100755 --- a/misc/largetest +++ b/misc/largetest @@ -29,6 +29,7 @@ # 1e95cb88cbb2 2m13s 2m40s 34s Pagination part 2/UI support # 035a8ce55604 2m12s 2m38s 34s Remove defaultWriter # af1e4527e1ab 2m20s 2m36s 33s Remove shared* files +# 4ef52aea3e73 2m6s 2m33s 34s Remove lowerxid index/col set -e diff --git a/registry/http/ui/app.js b/registry/http/ui/app.js index df3f843..b3a991c 100644 --- a/registry/http/ui/app.js +++ b/registry/http/ui/app.js @@ -7300,24 +7300,28 @@ function paginationBarHtml(itemCount) { } var countText = parts.join(' \u00b7 '); - function btn(rel, pairShown, icon, title) { + function btn(rel, pairShown, icon, title, atEnd) { if (!pairShown) return ''; - var has = !!_lastPageLinks[rel]; + var has = !!_lastPageLinks[rel] && !atEnd; return ''; } + // First/Last are disabled on the first/last page (no prev/next), even if + // the server returned those links, since they'd be no-ops there. var showFirstLast = !!(_lastPageLinks.first || _lastPageLinks.last); + var onFirstPage = !_lastPageLinks.prev; + var onLastPage = !_lastPageLinks.next; var showPrevNext = !!(_lastPageLinks.prev || _lastPageLinks.next); return '' + '' + esc(countText) + '' + '' - + btn('first', showFirstLast, _pageFirstIconSVG, 'First') + + btn('first', showFirstLast, _pageFirstIconSVG, 'First', onFirstPage) + btn('prev', showPrevNext, _pagePrevIconSVG, 'Prev') + btn('next', showPrevNext, _pageNextIconSVG, 'Next') - + btn('last', showFirstLast, _pageLastIconSVG, 'Last') + + btn('last', showFirstLast, _pageLastIconSVG, 'Last', onLastPage) + '' + ''; }