diff --git a/front_end/issues/IssuesPane.js b/front_end/issues/IssuesPane.js index ab68fa46e4..ad38227b96 100644 --- a/front_end/issues/IssuesPane.js +++ b/front_end/issues/IssuesPane.js @@ -86,6 +86,17 @@ export class IssuesPaneImpl extends UI.Widget.VBox { this._issueViews = new Map(); this._selectedIssue = null; + const issuesToolbarContainer = this.contentElement.createChild('div', 'issues-toolbar-container'); + new UI.Toolbar.Toolbar('issues-toolbar-left', issuesToolbarContainer); + const rightToolbar = new UI.Toolbar.Toolbar('issues-toolbar-right', issuesToolbarContainer); + rightToolbar.appendSeparator(); + const toolbarWarnings = new UI.Toolbar.ToolbarItem(createElement('div')); + const breakingChangeIcon = UI.Icon.Icon.create('largeicon-breaking-change'); + toolbarWarnings.element.appendChild(breakingChangeIcon); + this._toolbarIssuesCount = toolbarWarnings.element.createChild('span', 'warnings-count-label'); + this._updateIssuesCount(); + rightToolbar.appendToolbarItem(toolbarWarnings); + for (const issue of this._model.issues()) { this._addIssueView(issue); } @@ -97,13 +108,14 @@ export class IssuesPaneImpl extends UI.Widget.VBox { _addIssueView(issue) { if (!(issue.code in issueDetails)) { - console.warn('Received issue with unknow code:', issue.code); + console.warn('Received issue with unknown code:', issue.code); return; } const view = new IssueView(this, issue); view.show(this.contentElement); this._issueViews.set(issue.code, view); + this._updateIssuesCount(); } _issuesCleared() { @@ -112,6 +124,11 @@ export class IssuesPaneImpl extends UI.Widget.VBox { } this._issueViews.clear(); this._selectedIssue = null; + this._updateIssuesCount(); + } + + _updateIssuesCount() { + this._toolbarIssuesCount.textContent = this._model.size(); } handleSelect(issue) { diff --git a/front_end/issues/issuesPane.css b/front_end/issues/issuesPane.css index 6d2fc0c1a1..a4a12cbf02 100644 --- a/front_end/issues/issuesPane.css +++ b/front_end/issues/issuesPane.css @@ -101,3 +101,21 @@ .issue.collapsed .body-wrapper { max-height: 0; } + +.issues-toolbar-container { + display: flex; + flex: none; +} + +.issues-toolbar-container > .toolbar { + background-color: var(--toolbar-bg-color); + border-bottom: var(--divider-border); +} + +.issues-toolbar-left { + flex: 1 1 auto; +} + +.issues-toolbar-right { + padding-right: 6px; +} diff --git a/front_end/sdk/IssuesModel.js b/front_end/sdk/IssuesModel.js index 21befcbb46..294baf1171 100644 --- a/front_end/sdk/IssuesModel.js +++ b/front_end/sdk/IssuesModel.js @@ -86,6 +86,13 @@ export class IssuesModel extends SDKModel { return this._browserIssuesByCode.values(); } + /** + * @return {number} + */ + size() { + return this._browserIssuesByCode.size; + } + /** * @param {!*} obj * @param {!Issue} issue