From 25c62d981b9c9faecfd49b3ffb363387199a8e4f Mon Sep 17 00:00:00 2001 From: Kyle Ju Date: Wed, 18 Sep 2024 14:30:08 -0700 Subject: [PATCH] Add name_only for data fetch in /newfeatures (#4374) * Add name_only for newfeatures page * Make name_only a backend param only --- client-src/elements/chromedash-all-features-page.ts | 8 ++++++++ client-src/elements/chromedash-app.ts | 1 + client-src/elements/chromedash-feature-table.ts | 5 ++++- client-src/js-src/cs-client.js | 12 +++++++++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/client-src/elements/chromedash-all-features-page.ts b/client-src/elements/chromedash-all-features-page.ts index 15c9321d..4c4d4941 100644 --- a/client-src/elements/chromedash-all-features-page.ts +++ b/client-src/elements/chromedash-all-features-page.ts @@ -44,6 +44,10 @@ export class ChromedashAllFeaturesPage extends LitElement { num = 100; @state() starredFeatures: Set = new Set(); + @state() + isNewfeaturesPage = false; + @state() + nameOnly = false; @queryAll('chromedash-feature-table') chromedashFeatureTables; @@ -83,6 +87,9 @@ export class ChromedashAllFeaturesPage extends LitElement { ) { this.num = parseInt(this.rawQuery['num']); } + if (this.isNewfeaturesPage) { + this.nameOnly = true; + } } fetchData() { @@ -131,6 +138,7 @@ export class ChromedashAllFeaturesPage extends LitElement { .sortSpec=${this.sortSpec} .start=${this.start} .num=${this.num} + .nameOnly=${this.nameOnly} ?showQuery=${this.showQuery} ?signedIn=${Boolean(this.user)} ?canEdit=${this.user && this.user.can_edit_all} diff --git a/client-src/elements/chromedash-app.ts b/client-src/elements/chromedash-app.ts index 9347a236..53bd9a94 100644 --- a/client-src/elements/chromedash-app.ts +++ b/client-src/elements/chromedash-app.ts @@ -362,6 +362,7 @@ export class ChromedashApp extends LitElement { if (!this.setupNewPage(ctx, 'chromedash-all-features-page', true)) return; this.pageComponent.user = this.user; this.pageComponent.rawQuery = parseRawQuery(ctx.querystring); + this.pageComponent.isNewfeaturesPage = true; this.pageComponent.addEventListener( 'search', this.handleSearchQuery.bind(this) diff --git a/client-src/elements/chromedash-feature-table.ts b/client-src/elements/chromedash-feature-table.ts index a27385f7..5a5052af 100644 --- a/client-src/elements/chromedash-feature-table.ts +++ b/client-src/elements/chromedash-feature-table.ts @@ -46,6 +46,8 @@ export class ChromedashFeatureTable extends LitElement { columns!: 'normal' | 'approvals'; @property({type: Boolean}) signedIn!: boolean; + @property({type: Boolean}) + nameOnly = false; connectedCallback() { super.connectedCallback(); @@ -61,7 +63,8 @@ export class ChromedashFeatureTable extends LitElement { this.showEnterprise, this.sortSpec, this.start, - this.num + this.num, + this.nameOnly ) .then(resp => { this.features = resp.features; diff --git a/client-src/js-src/cs-client.js b/client-src/js-src/cs-client.js index 74cf5373..31b6a3c7 100644 --- a/client-src/js-src/cs-client.js +++ b/client-src/js-src/cs-client.js @@ -576,7 +576,14 @@ export class ChromeStatusClient { return this.doGet(`/features?releaseNotesMilestone=${milestone}`); } - async searchFeatures(userQuery, showEnterprise, sortSpec, start, num) { + async searchFeatures( + userQuery, + showEnterprise, + sortSpec, + start, + num, + nameOnly + ) { const query = new URLSearchParams(); query.set('q', userQuery); if (showEnterprise) { @@ -591,6 +598,9 @@ export class ChromeStatusClient { if (num) { query.set('num', num); } + if (nameOnly) { + query.set('name_only', nameOnly); + } return this.doGet(`/features?${query.toString()}`); }