From 74cb10c4d3ca94e3866bcb0672bd0fced4dd0078 Mon Sep 17 00:00:00 2001 From: Jason Robbins Date: Thu, 26 Sep 2024 18:54:01 +0000 Subject: [PATCH] When starting a new search, set start=0. (#4394) * When starting a new search, set start=0. * Message for empty paganation page. --- client-src/elements/chromedash-app.ts | 2 ++ client-src/elements/chromedash-feature-table.ts | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/client-src/elements/chromedash-app.ts b/client-src/elements/chromedash-app.ts index 53ce02cd4762..85cfb47988b0 100644 --- a/client-src/elements/chromedash-app.ts +++ b/client-src/elements/chromedash-app.ts @@ -8,6 +8,7 @@ import {User} from '../js-src/cs-client.js'; import {ChromedashDrawer, DRAWER_WIDTH_PX} from './chromedash-drawer.js'; import {ChromedashGateColumn} from './chromedash-gate-column.js'; import { + clearURLParams, IS_MOBILE, isoDateString, parseRawQuery, @@ -550,6 +551,7 @@ export class ChromedashApp extends LitElement { handleSearchQuery(e) { updateURLParams('q', e.detail.query); + clearURLParams('start'); } showSidebar() { diff --git a/client-src/elements/chromedash-feature-table.ts b/client-src/elements/chromedash-feature-table.ts index 564501a6825c..92e33fe5dd9a 100644 --- a/client-src/elements/chromedash-feature-table.ts +++ b/client-src/elements/chromedash-feature-table.ts @@ -37,6 +37,8 @@ export class ChromedashFeatureTable extends LitElement { alwaysOfferPagination = false; @property({type: String}) noResultsMessage = 'No results'; + @property({type: String}) + noPaginatedResultsMessage = 'No results on this pagination page'; @property({type: Boolean}) canEdit = false; @property({type: Object}) @@ -122,6 +124,7 @@ export class ChromedashFeatureTable extends LitElement { handleSearch(event) { this.loading = true; this.query = event.detail.query; + this.start = 0; this.fetchFeatures(); } @@ -154,6 +157,9 @@ export class ChromedashFeatureTable extends LitElement { sl-skeleton { height: 24px; } + .message { + padding: var(--content-padding); + } `, ]; } @@ -183,10 +189,17 @@ export class ChromedashFeatureTable extends LitElement { `; } - if (this.features.length == 0) { + if (this.totalCount == 0) { + return html` + + ${this.noResultsMessage} + + `; + } + if (this.features.length == 0 && this.start > 0) { return html` - ${this.noResultsMessage} + ${this.noPaginatedResultsMessage} `; }