Skip to content

Commit 97f50d8

Browse files
Kateryna ProkopenkoDevtools-frontend LUCI CQ
authored andcommitted
[GM3Restyling] Update Lighthouse timespan view dialog
Screenshot: https://imgur.com/a/4tTUpge Bug: 325442935 Change-Id: Ic072ea949998c6d6e7e80c6ef3eae6036ade33f6 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6298130 Auto-Submit: Kateryna Prokopenko <[email protected]> Reviewed-by: Kim-Anh Tran <[email protected]> Commit-Queue: Kim-Anh Tran <[email protected]>
1 parent 03afe5f commit 97f50d8

File tree

4 files changed

+33
-20
lines changed

4 files changed

+33
-20
lines changed

front_end/panels/lighthouse/LighthouseStatusView.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,14 @@ export class StatusView {
196196
jslogContext: 'lighthouse.cancel',
197197
});
198198
const fragment = UI.Fragment.Fragment.build`
199-
<span $="status-header">Auditing your web page…</span>
199+
<span $="status-header" class="header">Auditing your web page…</span>
200200
<div class="lighthouse-status vbox" $="status-view">
201201
<div class="lighthouse-progress-wrapper" $="progress-wrapper">
202202
<div class="lighthouse-progress-bar" $="progress-bar"></div>
203203
</div>
204204
<div class="lighthouse-status-text" $="status-text"></div>
205205
</div>
206-
<div class="lighthouse-button-container">
206+
<div class="lighthouse-action-buttons">
207207
${cancelButton}
208208
</div>
209209
`;

front_end/panels/lighthouse/LighthouseTimespanView.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ const UIStrings = {
1717
/**
1818
* @description Header indicating that a Lighthouse timespan has started. "Timespan" is a Lighthouse mode that analyzes user interactions over a period of time. "interact with the page" is a call to action for the user to interact with the web page.
1919
*/
20-
timespanStarted: 'Timespan started, interact with the page',
20+
timespanStarted: 'Timespan started',
21+
/**
22+
* @description Call to action for the user to interact with the web page.
23+
*/
24+
interactWithPage: 'Interact with the page.',
2125
/**
2226
* @description Label for a button that ends a Lighthouse timespan. "timespan" is a Lighthouse mode that analyzes user interactions over a period of time.
2327
*/
@@ -34,12 +38,14 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
3438
export class TimespanView extends UI.Dialog.Dialog {
3539
private panel: LighthousePanel;
3640
private statusHeader: Element|null;
41+
private contentContainer: Element|null;
3742
private endButton: Buttons.Button.Button|null;
3843

3944
constructor(panel: LighthousePanel) {
4045
super();
4146
this.panel = panel;
4247
this.statusHeader = null;
48+
this.contentContainer = null;
4349
this.endButton = null;
4450
this.setDimmed(true);
4551
this.setCloseOnEscape(false);
@@ -53,15 +59,17 @@ export class TimespanView extends UI.Dialog.Dialog {
5359
}
5460

5561
reset(): void {
56-
if (this.statusHeader && this.endButton) {
62+
if (this.statusHeader && this.contentContainer && this.endButton) {
5763
this.statusHeader.textContent = i18nString(UIStrings.timespanStarting);
64+
this.contentContainer.textContent = '';
5865
this.endButton.disabled = true;
5966
}
6067
}
6168

6269
ready(): void {
63-
if (this.statusHeader && this.endButton) {
70+
if (this.statusHeader && this.contentContainer && this.endButton) {
6471
this.statusHeader.textContent = i18nString(UIStrings.timespanStarted);
72+
this.contentContainer.textContent = i18nString(UIStrings.interactWithPage);
6573
this.endButton.disabled = false;
6674
this.endButton.focus();
6775
}
@@ -74,14 +82,16 @@ export class TimespanView extends UI.Dialog.Dialog {
7482
this.endButton = UI.UIUtils.createTextButton(
7583
i18nString(UIStrings.endTimespan),
7684
this.endTimespan.bind(this),
77-
{variant: Buttons.Button.Variant.PRIMARY, jslogContext: 'lighthouse.end-time-span'},
85+
{variant: Buttons.Button.Variant.PRIMARY, jslogContext: 'lighthouse.end-time-span', className: 'end-timespan'},
7886
);
7987
const cancelButton = UI.UIUtils.createTextButton(i18nString(UIStrings.cancel), this.cancel.bind(this), {
88+
className: 'cancel',
8089
jslogContext: 'lighthouse.cancel',
8190
});
8291
const fragment = UI.Fragment.Fragment.build`
8392
<div class="lighthouse-view vbox">
84-
<h2 $="status-header"></h2>
93+
<span $="status-header" class="header"></span>
94+
<span $="call-to-action" class="lighthouse-dialog-text"></span>
8595
<div class="lighthouse-action-buttons hbox">
8696
${cancelButton}
8797
${this.endButton}
@@ -90,6 +100,7 @@ export class TimespanView extends UI.Dialog.Dialog {
90100
`;
91101

92102
this.statusHeader = fragment.$('status-header');
103+
this.contentContainer = fragment.$('call-to-action');
93104
dialogRoot.appendChild(fragment.element());
94105

95106
this.setSizeBehavior(UI.GlassPane.SizeBehavior.SET_EXACT_WIDTH_MAX_HEIGHT);

front_end/panels/lighthouse/lighthouseDialog.css

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@
88
flex: auto;
99
align-items: start;
1010
width: 100%;
11-
max-width: 500px;
12-
}
11+
max-width: var(--sys-size-34);
12+
13+
.header {
14+
font: var(--sys-typescale-body2-medium);
15+
padding-top: var(--sys-size-3);
16+
margin: var(--sys-size-5) var(--sys-size-5) var(--sys-size-5) var(--sys-size-8);
17+
flex: none;
18+
}
1319

14-
.lighthouse-view span {
15-
font: var(--sys-typescale-body2-medium);
16-
padding-top: var(--sys-size-3);
17-
margin: var(--sys-size-5) var(--sys-size-5) var(--sys-size-5) var(--sys-size-8);
18-
flex: none;
20+
.lighthouse-dialog-text {
21+
margin: 0 var(--sys-size-8);
22+
}
1923
}
2024

2125
.lighthouse-view button {
@@ -48,10 +52,6 @@
4852
overflow: auto;
4953
}
5054

51-
.lighthouse-button-container {
52-
margin: var(--sys-size-6) var(--sys-size-8) var(--sys-size-8) var(--sys-size-8);
53-
}
54-
5555
.lighthouse-progress-wrapper {
5656
height: var(--sys-size-2);
5757
background-color: var(--sys-color-neutral-outline);
@@ -117,6 +117,8 @@
117117
}
118118

119119
.lighthouse-action-buttons {
120+
justify-content: space-between;
120121
align-self: end;
121-
column-gap: var(--sys-size-6);
122+
width: calc(100% - 2*var(--sys-size-8));
123+
margin: var(--sys-size-6) var(--sys-size-8) var(--sys-size-8) var(--sys-size-8);
122124
}

test/e2e/helpers/lighthouse-helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export async function waitForStorageUsage(p: (quota: number) => boolean) {
178178
}
179179

180180
export async function waitForTimespanStarted() {
181-
await waitForElementWithTextContent('Timespan started, interact with the page');
181+
await waitForElementWithTextContent('Timespan started');
182182
}
183183

184184
export async function endTimespan() {

0 commit comments

Comments
 (0)