Skip to content

Commit 9c5dfce

Browse files
Adam RaineDevtools-frontend LUCI CQ
authored andcommitted
[RPP] Add home button for landing page
https://screenshot.googleplex.com/76b6LUofz9bjZsq Bug: 373526311 Change-Id: Iea6d904b5a8023c2f67bd7bc35ab64cdf4fd48ef Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5941205 Reviewed-by: Jack Franklin <[email protected]> Commit-Queue: Adam Raine <[email protected]>
1 parent f2f375a commit 9c5dfce

File tree

6 files changed

+26
-0
lines changed

6 files changed

+26
-0
lines changed

config/gni/devtools_grd_files.gni

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ grd_files_release_sources = [
150150
"front_end/Images/heap-snapshot.svg",
151151
"front_end/Images/heap-snapshots.svg",
152152
"front_end/Images/help.svg",
153+
"front_end/Images/home.svg",
153154
"front_end/Images/hover.svg",
154155
"front_end/Images/iframe-crossed.svg",
155156
"front_end/Images/iframe.svg",

config/gni/devtools_image_files.gni

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ devtools_svg_sources = [
153153
"heap-snapshot.svg",
154154
"heap-snapshots.svg",
155155
"help.svg",
156+
"home.svg",
156157
"hover.svg",
157158
"iframe-crossed.svg",
158159
"iframe.svg",

front_end/Images/src/home.svg

Lines changed: 1 addition & 0 deletions
Loading

front_end/panels/timeline/TimelineHistoryManager.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,10 @@ export class TimelineHistoryManager {
322322
return this.recordings[newIndex];
323323
}
324324

325+
navigateToLandingPage(): void {
326+
this.#setActiveTrace({type: 'LANDING_PAGE'});
327+
}
328+
325329
#setActiveTrace(item: RecordingData): void {
326330
if (item.type === 'TRACE_INDEX') {
327331
const data = TimelineHistoryManager.dataForTraceIndex(item.parsedTraceIndex);

front_end/panels/timeline/TimelinePanel.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,10 @@ const UIStrings = {
307307
*@description Text of a hyperlink to documentation.
308308
*/
309309
learnMore: 'Learn more',
310+
/**
311+
* @description Tooltip text for a button that takes the user back to the default view which shows performance metrics that are live.
312+
*/
313+
backToLiveMetrics: 'Go back to the live metrics page',
310314
};
311315
const str_ = i18n.i18n.registerUIStrings('panels/timeline/TimelinePanel.ts', UIStrings);
312316
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -383,6 +387,7 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
383387
private brickBreakerToolbarButtonAdded = false;
384388
private loadButton!: UI.Toolbar.ToolbarButton;
385389
private saveButton!: UI.Toolbar.ToolbarButton|UI.Toolbar.ToolbarMenuButton;
390+
private homeButton?: UI.Toolbar.ToolbarButton;
386391
private statusPane!: StatusPane|null;
387392
private landingPage!: UI.Widget.Widget;
388393
private loader?: TimelineLoader;
@@ -1012,6 +1017,18 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
10121017

10131018
// History
10141019
this.panelToolbar.appendSeparator();
1020+
1021+
if (Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.TIMELINE_OBSERVATIONS)) {
1022+
this.homeButton = new UI.Toolbar.ToolbarButton(
1023+
i18nString(UIStrings.backToLiveMetrics), 'home', undefined, 'timeline.back-to-live-metrics');
1024+
this.homeButton.addEventListener(UI.Toolbar.ToolbarButton.Events.CLICK, () => {
1025+
this.#changeView({mode: 'LANDING_PAGE'});
1026+
this.#historyManager.navigateToLandingPage();
1027+
});
1028+
this.panelToolbar.appendToolbarItem(this.homeButton);
1029+
this.panelToolbar.appendSeparator();
1030+
}
1031+
10151032
this.panelToolbar.appendToolbarItem(this.#historyManager.button());
10161033
this.panelToolbar.registerCSSFiles([historyToolbarButtonStyles]);
10171034
this.panelToolbar.appendSeparator();
@@ -1595,6 +1612,7 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
15951612
this.dropTarget.setEnabled(this.state === State.IDLE);
15961613
this.loadButton.setEnabled(this.state === State.IDLE);
15971614
this.saveButton.setEnabled(this.state === State.IDLE && this.#hasActiveTrace());
1615+
this.homeButton?.setEnabled(this.state === State.IDLE && this.#hasActiveTrace());
15981616
if (this.#viewMode.mode === 'VIEWING_TRACE') {
15991617
this.#addSidebarIconToToolbar();
16001618
}

front_end/ui/visual_logging/KnownContextValues.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3068,6 +3068,7 @@ export const knownContextValues = new Set([
30683068
'timeline.annotations.entry-annotation-create',
30693069
'timeline.annotations.entry-label-input',
30703070
'timeline.annotations.time-range-label-input',
3071+
'timeline.back-to-live-metrics',
30713072
'timeline.breadcrumb-select',
30723073
'timeline.clear',
30733074
'timeline.configure',

0 commit comments

Comments
 (0)