Skip to content

Commit ae8f37a

Browse files
Kateryna ProkopenkoDevtools-frontend LUCI CQ
authored andcommitted
Swap out promoteFeature flag to featurePromotionId
Bug: 434870886 Change-Id: I314f5fb223d9fdb28eb495c2e066ae6bbbceca44 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6811474 Auto-Submit: Kateryna Prokopenko <[email protected]> Commit-Queue: Benedikt Meurer <[email protected]> Reviewed-by: Benedikt Meurer <[email protected]> Commit-Queue: Kateryna Prokopenko <[email protected]>
1 parent 4ee7cec commit ae8f37a

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

front_end/panels/ai_assistance/ai_assistance-meta.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ UI.ViewManager.registerViewExtension({
115115
title: i18nLazyString(UIStrings.aiAssistance),
116116
order: 10,
117117
isPreviewFeature: true,
118-
promoteFeature: true,
118+
featurePromotionId: 'ai-assistance',
119119
persistence: UI.ViewManager.ViewPersistence.CLOSEABLE,
120120
hasToolbar: false,
121121
condition: config => isAnyFeatureAvailable(config) && !isPolicyRestricted(config),

front_end/ui/legacy/ViewManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ export class PreRegisteredView implements View {
7575
return Boolean(this.viewRegistration.isPreviewFeature);
7676
}
7777

78-
promoteFeature(): boolean {
79-
return Boolean(this.viewRegistration.promoteFeature);
78+
featurePromotionId(): string|undefined {
79+
return this.viewRegistration.featurePromotionId;
8080
}
8181

8282
iconName(): string|undefined {

front_end/ui/legacy/ViewRegistration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export interface ViewRegistration {
157157
/**
158158
* Whether a view needs to be promoted. A new badge is shown next to the menu items then.
159159
*/
160-
promoteFeature?: boolean;
160+
featurePromotionId?: string;
161161
}
162162

163163
const viewIdSet = new Set<string>();

front_end/ui/legacy/components/quick_open/CommandMenu.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class CommandMenu {
7373
userActionCode,
7474
deprecationWarning,
7575
isPanelOrDrawer,
76-
promoteFeature,
76+
featurePromotionId,
7777
} = options;
7878

7979
let handler = executeHandler;
@@ -86,7 +86,7 @@ export class CommandMenu {
8686
}
8787
return new Command(
8888
category, title, keys, shortcut, jslogContext, handler, availableHandler, deprecationWarning, isPanelOrDrawer,
89-
promoteFeature);
89+
featurePromotionId);
9090
}
9191

9292
static createSettingCommand<V>(setting: Common.Settings.Setting<V>, title: Common.UIString.LocalizedString, value: V):
@@ -158,7 +158,7 @@ export class CommandMenu {
158158
}
159159

160160
static createRevealViewCommand(options: RevealViewCommandOptions): Command {
161-
const {title, tags, category, userActionCode, id, promoteFeature} = options;
161+
const {title, tags, category, userActionCode, id, featurePromotionId} = options;
162162
if (!category) {
163163
throw new Error(`Creating '${title}' reveal view command failed. Reveal view has no category.`);
164164
}
@@ -186,7 +186,7 @@ export class CommandMenu {
186186
userActionCode,
187187
availableHandler: undefined,
188188
isPanelOrDrawer: panelOrDrawer,
189-
promoteFeature,
189+
featurePromotionId,
190190
});
191191
}
192192

@@ -210,7 +210,7 @@ export class CommandMenu {
210210
tags: view.tags() || '',
211211
category,
212212
id: view.viewId(),
213-
promoteFeature: view.promoteFeature(),
213+
featurePromotionId: view.featurePromotionId(),
214214
};
215215
this.commandsInternal.push(CommandMenu.createRevealViewCommand(options));
216216
}
@@ -243,7 +243,7 @@ export interface RevealViewCommandOptions {
243243
tags: string;
244244
category: UI.ViewManager.ViewLocationCategory;
245245
userActionCode?: number;
246-
promoteFeature?: boolean;
246+
featurePromotionId?: string;
247247
}
248248

249249
export interface CreateCommandOptions {
@@ -257,7 +257,7 @@ export interface CreateCommandOptions {
257257
userActionCode?: number;
258258
deprecationWarning?: Platform.UIString.LocalizedString;
259259
isPanelOrDrawer?: PanelOrDrawer;
260-
promoteFeature?: boolean;
260+
featurePromotionId?: string;
261261
}
262262

263263
export const enum PanelOrDrawer {
@@ -320,7 +320,7 @@ export class CommandMenuProvider extends Provider {
320320
const command = this.commands[itemIndex];
321321
let score = Diff.Diff.DiffWrapper.characterScore(query.toLowerCase(), command.title.toLowerCase());
322322
// Increase score of promoted items so that these appear on top of the list
323-
if (command.promoteFeature) {
323+
if (command.featurePromotionId) {
324324
score = Number.MAX_VALUE;
325325
return score;
326326
}
@@ -344,7 +344,7 @@ export class CommandMenuProvider extends Provider {
344344
UI.UIUtils.createTextChild(titleElement, command.title);
345345
FilteredListWidget.highlightRanges(titleElement, query, true);
346346

347-
if (command.promoteFeature) {
347+
if (command.featurePromotionId) {
348348
const badge = UI.UIUtils.maybeCreateNewBadge('ai-asisstance');
349349
if (badge) {
350350
titleElement.parentElement?.insertBefore(badge, subtitleElement);
@@ -416,7 +416,7 @@ export class Command {
416416
readonly jslogContext: string;
417417
readonly deprecationWarning?: Platform.UIString.LocalizedString;
418418
readonly isPanelOrDrawer?: PanelOrDrawer;
419-
readonly promoteFeature?: boolean;
419+
readonly featurePromotionId?: string;
420420

421421
readonly #executeHandler: () => unknown;
422422
readonly #availableHandler?: () => boolean;
@@ -425,7 +425,7 @@ export class Command {
425425
category: Common.UIString.LocalizedString, title: Common.UIString.LocalizedString, key: string, shortcut: string,
426426
jslogContext: string, executeHandler: () => unknown, availableHandler?: () => boolean,
427427
deprecationWarning?: Platform.UIString.LocalizedString, isPanelOrDrawer?: PanelOrDrawer,
428-
promoteFeature?: boolean) {
428+
featurePromotionId?: string) {
429429
this.category = category;
430430
this.title = title;
431431
this.key = category + '\0' + title + '\0' + key;
@@ -435,7 +435,7 @@ export class Command {
435435
this.#availableHandler = availableHandler;
436436
this.deprecationWarning = deprecationWarning;
437437
this.isPanelOrDrawer = isPanelOrDrawer;
438-
this.promoteFeature = promoteFeature;
438+
this.featurePromotionId = featurePromotionId;
439439
}
440440

441441
available(): boolean {

0 commit comments

Comments
 (0)