Skip to content

Commit 8afdce9

Browse files
ktranDevtools-frontend LUCI CQ
authored andcommitted
[GM3Restyling] Update issues panel empty states
Screenshots: https://imgur.com/a/g5CIjFF Bug: 325443331 Change-Id: I2a34b32b20ef45a63c31a122b8368397e53dec81 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6276164 Commit-Queue: Kim-Anh Tran <[email protected]> Reviewed-by: Kateryna Prokopenko <[email protected]>
1 parent 3cace8f commit 8afdce9

File tree

4 files changed

+52
-21
lines changed

4 files changed

+52
-21
lines changed

front_end/panels/issues/BUILD.gn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ devtools_module("issues") {
4444
deps = [
4545
"../../core/common:bundle",
4646
"../../core/i18n:bundle",
47+
"../../core/platform:bundle",
4748
"../../core/sdk:bundle",
4849
"../../models/issues_manager:bundle",
4950
"../../models/logs:bundle",
@@ -97,6 +98,7 @@ ts_library("unittests") {
9798
sources = [
9899
"IssueAggregator.test.ts",
99100
"IssueView.test.ts",
101+
"IssuesPane.test.ts",
100102
]
101103

102104
deps = [
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright 2025 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import * as IssuesManager from '../../models/issues_manager/issues_manager.js';
6+
import {describeWithEnvironment} from '../../testing/EnvironmentHelpers.js';
7+
8+
import * as Issues from './issues.js';
9+
10+
describeWithEnvironment('IssuesPane', () => {
11+
it('shows placeholder if only non-relevant issues have appeared', () => {
12+
const issuesManager = IssuesManager.IssuesManager.IssuesManager.instance();
13+
sinon.stub(issuesManager, 'numberOfAllStoredIssues').returns(10);
14+
const issuesPane = new Issues.IssuesPane.IssuesPane();
15+
assert.exists(issuesPane.contentElement.querySelector('.empty-state'));
16+
assert.deepEqual(
17+
issuesPane.contentElement.querySelector('.empty-state-header')?.textContent,
18+
'Only third-party cookie issues detected');
19+
assert.deepEqual(
20+
issuesPane.contentElement.querySelector('.empty-state-description > span')?.textContent,
21+
'On this page you can find warnings from the browser.');
22+
});
23+
24+
it('shows placeholder', () => {
25+
const issuesPane = new Issues.IssuesPane.IssuesPane();
26+
assert.exists(issuesPane.contentElement.querySelector('.empty-state'));
27+
assert.deepEqual(issuesPane.contentElement.querySelector('.empty-state-header')?.textContent, 'No issues detected');
28+
assert.deepEqual(
29+
issuesPane.contentElement.querySelector('.empty-state-description > span')?.textContent,
30+
'On this page you can find warnings from the browser.');
31+
});
32+
});

front_end/panels/issues/IssuesPane.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import '../../ui/legacy/legacy.js';
66

77
import * as Common from '../../core/common/common.js';
88
import * as i18n from '../../core/i18n/i18n.js';
9+
import type * as Platform from '../../core/platform/platform.js';
910
import * as IssuesManager from '../../models/issues_manager/issues_manager.js';
1011
import * as IssueCounter from '../../ui/components/issue_counter/issue_counter.js';
1112
import * as UI from '../../ui/legacy/legacy.js';
@@ -86,11 +87,15 @@ const UIStrings = {
8687
/**
8788
* @description Label on the issues tab
8889
*/
89-
onlyThirdpartyCookieIssues: 'Only third-party cookie issues detected so far',
90+
onlyThirdpartyCookieIssues: 'Only third-party cookie issues detected',
9091
/**
9192
* @description Label in the issues panel
9293
*/
93-
noIssuesDetectedSoFar: 'No issues detected so far',
94+
noIssues: 'No issues detected',
95+
/**
96+
* @description Text that explains the issues panel that is shown if no issues are shown.
97+
*/
98+
issuesPanelDescription: 'On this page you can find warnings from the browser.',
9499
/**
95100
* @description Category title for the different 'Attribution Reporting API' issues. The
96101
* Attribution Reporting API is a newly proposed web API (see https://github.com/WICG/conversion-measurement-api).
@@ -110,6 +115,9 @@ const UIStrings = {
110115
const str_ = i18n.i18n.registerUIStrings('panels/issues/IssuesPane.ts', UIStrings);
111116
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
112117

118+
const ISSUES_PANEL_EXPLANATION_URL =
119+
'https://developer.chrome.com/docs/devtools/issues' as Platform.DevToolsPath.UrlString;
120+
113121
class IssueCategoryView extends UI.TreeOutline.TreeElement {
114122
#category: IssuesManager.Issue.IssueCategory;
115123

@@ -177,7 +185,7 @@ export class IssuesPane extends UI.Widget.VBox {
177185
#showThirdPartyCheckbox: UI.Toolbar.ToolbarSettingCheckbox|null;
178186
#issuesTree: UI.TreeOutline.TreeOutlineInShadow;
179187
#hiddenIssuesRow: HiddenIssuesRow;
180-
#noIssuesMessageDiv: HTMLDivElement;
188+
#noIssuesMessageDiv: UI.EmptyWidget.EmptyWidget;
181189
#issuesManager: IssuesManager.IssuesManager.IssuesManager;
182190
#aggregator: IssueAggregator;
183191
#issueViewUpdatePromise: Promise<void> = Promise.resolve();
@@ -207,9 +215,9 @@ export class IssuesPane extends UI.Widget.VBox {
207215
this.#hiddenIssuesRow = new HiddenIssuesRow();
208216
this.#issuesTree.appendChild(this.#hiddenIssuesRow);
209217

210-
this.#noIssuesMessageDiv = document.createElement('div');
211-
this.#noIssuesMessageDiv.classList.add('issues-pane-no-issues');
212-
this.contentElement.appendChild(this.#noIssuesMessageDiv);
218+
this.#noIssuesMessageDiv = new UI.EmptyWidget.EmptyWidget('', i18nString(UIStrings.issuesPanelDescription));
219+
this.#noIssuesMessageDiv.appendLink(ISSUES_PANEL_EXPLANATION_URL);
220+
this.#noIssuesMessageDiv.show(this.contentElement);
213221

214222
this.#issuesManager = IssuesManager.IssuesManager.IssuesManager.instance();
215223
this.#aggregator = new IssueAggregator(this.#issuesManager);
@@ -435,7 +443,7 @@ export class IssuesPane extends UI.Widget.VBox {
435443
this.#hiddenIssuesRow.hidden = hiddenIssueCount === 0;
436444
this.#hiddenIssuesRow.update(hiddenIssueCount);
437445
this.#issuesTree.element.hidden = false;
438-
this.#noIssuesMessageDiv.style.display = 'none';
446+
this.#noIssuesMessageDiv.hideWidget();
439447
const firstChild = this.#issuesTree.firstChild();
440448
if (firstChild) {
441449
firstChild.select(/* omitFocus= */ true);
@@ -448,10 +456,9 @@ export class IssuesPane extends UI.Widget.VBox {
448456
}
449457
// We alreay know that issesCount is zero here.
450458
const hasOnlyThirdPartyIssues = this.#issuesManager.numberOfAllStoredIssues() > 0;
451-
this.#noIssuesMessageDiv.textContent = hasOnlyThirdPartyIssues ?
452-
i18nString(UIStrings.onlyThirdpartyCookieIssues) :
453-
i18nString(UIStrings.noIssuesDetectedSoFar);
454-
this.#noIssuesMessageDiv.style.display = 'flex';
459+
this.#noIssuesMessageDiv.header =
460+
hasOnlyThirdPartyIssues ? i18nString(UIStrings.onlyThirdpartyCookieIssues) : i18nString(UIStrings.noIssues);
461+
this.#noIssuesMessageDiv.showWidget();
455462
}
456463
}
457464

front_end/panels/issues/issuesPane.css

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@
88
overflow: hidden;
99
}
1010

11-
.issues-pane-no-issues {
12-
align-items: center;
13-
background-color: var(--sys-color-cdt-base-container);
14-
display: flex;
15-
flex: 1 1 auto;
16-
font-size: 14px;
17-
justify-content: center;
18-
padding: 30px;
19-
}
20-
2111
.issues-toolbar-container {
2212
display: flex;
2313
flex: none;

0 commit comments

Comments
 (0)