Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When starting a new search, set start=0. #4394

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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