Skip to content

Commit

Permalink
When starting a new search, set start=0. (#4394)
Browse files Browse the repository at this point in the history
* When starting a new search, set start=0.

* Message for empty paganation page.
  • Loading branch information
jrobbins committed Sep 26, 2024
1 parent 386252c commit 74cb10c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions client-src/elements/chromedash-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -550,6 +551,7 @@ export class ChromedashApp extends LitElement {

handleSearchQuery(e) {
updateURLParams('q', e.detail.query);
clearURLParams('start');
}

showSidebar() {
Expand Down
17 changes: 15 additions & 2 deletions client-src/elements/chromedash-feature-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down Expand Up @@ -122,6 +124,7 @@ export class ChromedashFeatureTable extends LitElement {
handleSearch(event) {
this.loading = true;
this.query = event.detail.query;
this.start = 0;
this.fetchFeatures();
}

Expand Down Expand Up @@ -154,6 +157,9 @@ export class ChromedashFeatureTable extends LitElement {
sl-skeleton {
height: 24px;
}
.message {
padding: var(--content-padding);
}
`,
];
}
Expand Down Expand Up @@ -183,10 +189,17 @@ export class ChromedashFeatureTable extends LitElement {
</tr>
`;
}
if (this.features.length == 0) {
if (this.totalCount == 0) {
return html`
<tr>
<td class="message">${this.noResultsMessage}</td>
</tr>
`;
}
if (this.features.length == 0 && this.start > 0) {
return html`
<tr>
<td>${this.noResultsMessage}</td>
<td class="message">${this.noPaginatedResultsMessage}</td>
</tr>
`;
}
Expand Down

0 comments on commit 74cb10c

Please sign in to comment.