Skip to content

Commit df17783

Browse files
jackfranklinDevtools-frontend LUCI CQ
authored andcommitted
AI: enable computed styles widget to use node link for title
R=kimanh@chromium.org Bug: 495422556 Change-Id: I4907a3d262bbd41c4365843b5b26d590a155677c Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7693626 Commit-Queue: Kim-Anh Tran <kimanh@chromium.org> Reviewed-by: Kim-Anh Tran <kimanh@chromium.org> Auto-Submit: Jack Franklin <jacktfranklin@chromium.org>
1 parent 0810b25 commit df17783

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

front_end/panels/ai_assistance/components/ChatMessage.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import type {
1818
import * as AiAssistanceModel from '../../../models/ai_assistance/ai_assistance.js';
1919
import * as ComputedStyle from '../../../models/computed_style/computed_style.js';
2020
import * as Trace from '../../../models/trace/trace.js';
21+
import * as PanelsCommon from '../../../panels/common/common.js';
2122
import * as Marked from '../../../third_party/marked/marked.js';
2223
import * as Buttons from '../../../ui/components/buttons/buttons.js';
2324
import * as Input from '../../../ui/components/input/input.js';
@@ -186,18 +187,10 @@ const UIStringsNotTranslate = {
186187
* @description Title used for revealing the performance trace.
187188
*/
188189
revealTrace: 'Reveal trace',
189-
/**
190-
* @description Title for the computed styles widget.
191-
*/
192-
computedStyles: 'Computed styles',
193190
/**
194191
* @description Title for the core web vitals widget.
195192
*/
196193
coreVitals: 'Core Web Vitals',
197-
/**
198-
* @description Title for the styles widget.
199-
*/
200-
styles: 'Styles',
201194
/**
202195
* @description Title for the LCP breakdown widget.
203196
*/
@@ -694,7 +687,7 @@ interface WidgetMakerResponse {
694687
revealable: unknown;
695688
customRevealTitle?: Platform.UIString.LocalizedString;
696689
// Can be null if the widget is only used to add the Reveal CTA.
697-
title: Platform.UIString.LocalizedString|null;
690+
title: Lit.LitTemplate|Platform.UIString.LocalizedString|null;
698691
}
699692

700693
const nodeCache = new Map<Protocol.DOM.BackendNodeId, SDK.DOMModel.DOMNode>();
@@ -741,7 +734,11 @@ async function makeComputedStyleWidget(widgetData: ComputedStyleAiWidget): Promi
741734
return {
742735
renderedWidget,
743736
revealable: new Elements.ElementsPanel.NodeComputedStyles(domNodeForId),
744-
title: lockedString(UIStringsNotTranslate.computedStyles),
737+
title: html`<devtools-widget
738+
${widget(PanelsCommon.DOMLinkifier.DOMNodeLink, {
739+
node: domNodeForId,
740+
})}
741+
></devtools-widget>`,
745742
};
746743
}
747744

@@ -778,7 +775,11 @@ async function makeStylePropertiesWidget(widgetData: StylePropertiesAiWidget): P
778775
return {
779776
renderedWidget,
780777
revealable: domNodeForId,
781-
title: lockedString(UIStringsNotTranslate.styles),
778+
title: html`<devtools-widget
779+
${widget(PanelsCommon.DOMLinkifier.DOMNodeLink, {
780+
node: domNodeForId,
781+
})}
782+
></devtools-widget>`,
782783
};
783784
}
784785

0 commit comments

Comments
 (0)