Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/coverage/CoverageView.js

Issue 2875793004: Coverage: misc UI polish (Closed)
Patch Set: review comments, dropped some stray lines Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 Coverage.CoverageView = class extends UI.VBox { 5 Coverage.CoverageView = class extends UI.VBox {
6 constructor() { 6 constructor() {
7 super(true); 7 super(true);
8 8
9 /** @type {?Coverage.CoverageModel} */ 9 /** @type {?Coverage.CoverageModel} */
10 this._model = null; 10 this._model = null;
(...skipping 15 matching lines...) Expand all
26 var startWithReloadAction = 26 var startWithReloadAction =
27 /** @type {!UI.Action }*/ (UI.actionRegistry.action('coverage.start-with -reload')); 27 /** @type {!UI.Action }*/ (UI.actionRegistry.action('coverage.start-with -reload'));
28 this._startWithReloadButton = UI.Toolbar.createActionButton(startWithReloadA ction); 28 this._startWithReloadButton = UI.Toolbar.createActionButton(startWithReloadA ction);
29 topToolbar.appendToolbarItem(this._startWithReloadButton); 29 topToolbar.appendToolbarItem(this._startWithReloadButton);
30 30
31 this._clearButton = new UI.ToolbarButton(Common.UIString('Clear all'), 'larg eicon-clear'); 31 this._clearButton = new UI.ToolbarButton(Common.UIString('Clear all'), 'larg eicon-clear');
32 this._clearButton.addEventListener(UI.ToolbarButton.Events.Click, this._rese t.bind(this)); 32 this._clearButton.addEventListener(UI.ToolbarButton.Events.Click, this._rese t.bind(this));
33 topToolbar.appendToolbarItem(this._clearButton); 33 topToolbar.appendToolbarItem(this._clearButton);
34 34
35 this._coverageResultsElement = this.contentElement.createChild('div', 'cover age-results'); 35 this._coverageResultsElement = this.contentElement.createChild('div', 'cover age-results');
36 this._progressElement = this._coverageResultsElement.createChild('div', 'pro gress-view'); 36 this._landingPage = this._buildLandingPage();
37
37 this._listView = new Coverage.CoverageListView(); 38 this._listView = new Coverage.CoverageListView();
38 39
39 this._statusToolbarElement = this.contentElement.createChild('div', 'coverag e-toolbar-summary'); 40 this._statusToolbarElement = this.contentElement.createChild('div', 'coverag e-toolbar-summary');
40 this._statusMessageElement = this._statusToolbarElement.createChild('div', ' coverage-message'); 41 this._statusMessageElement = this._statusToolbarElement.createChild('div', ' coverage-message');
41 this._showHelpScreen(); 42 this._landingPage.show(this._coverageResultsElement);
42 } 43 }
43 44
44 _reset() { 45 _reset() {
45 if (this._decorationManager) { 46 if (this._decorationManager) {
46 this._decorationManager.dispose(); 47 this._decorationManager.dispose();
47 this._decorationManager = null; 48 this._decorationManager = null;
48 } 49 }
49 this._listView.reset(); 50 this._listView.reset();
50 this._listView.detach(); 51 this._listView.detach();
51 this._coverageResultsElement.removeChildren(); 52 this._landingPage.show(this._coverageResultsElement);
52 this._showHelpScreen();
53
54 this._statusMessageElement.textContent = ''; 53 this._statusMessageElement.textContent = '';
55 } 54 }
56 55
57 _showHelpScreen() { 56 /**
58 this._coverageResultsElement.appendChild(this._progressElement); 57 * @return {!UI.VBox}
59 this._progressElement.removeChildren(); 58 */
60 59 _buildLandingPage() {
61 var recordButton = UI.Toolbar.createActionButton(this._toggleRecordAction).e lement; 60 var recordButton = UI.createInlineButton(UI.Toolbar.createActionButton(this. _toggleRecordAction));
62 var reloadButton = UI.Toolbar.createActionButtonForId('coverage.start-with-r eload').element; 61 var reloadButton = UI.createInlineButton(UI.Toolbar.createActionButtonForId( 'coverage.start-with-reload'));
63 62 var widget = new UI.VBox();
64 this._progressElement.createChild('p', 'landing-page') 63 var message = UI.formatLocalized(
65 .appendChild(UI.formatLocalized( 64 'Click the record button %s to start capturing coverage.\n' +
66 'Click the record button %s to start capturing coverage.\n' + 65 'Click the reload button %s to reload and start capturing coverage.' ,
67 'Click the reload button %s to reload and start capturing covera ge.', 66 [recordButton, reloadButton]);
68 [recordButton, reloadButton])); 67 message.classList.add('message');
68 widget.contentElement.appendChild(message);
69 widget.element.classList.add('landing-page');
70 return widget;
69 } 71 }
70 72
71 _toggleRecording() { 73 _toggleRecording() {
72 var enable = !this._toggleRecordAction.toggled(); 74 var enable = !this._toggleRecordAction.toggled();
73 75
74 if (enable) 76 if (enable)
75 this._startRecording(); 77 this._startRecording();
76 else 78 else
77 this._stopRecording(); 79 this._stopRecording();
78 } 80 }
(...skipping 16 matching lines...) Expand all
95 return; 97 return;
96 console.assert(!this._model, 'Attempting to start coverage twice'); 98 console.assert(!this._model, 'Attempting to start coverage twice');
97 var model = new Coverage.CoverageModel(mainTarget); 99 var model = new Coverage.CoverageModel(mainTarget);
98 if (!model.start()) 100 if (!model.start())
99 return; 101 return;
100 this._model = model; 102 this._model = model;
101 this._decorationManager = new Coverage.CoverageDecorationManager(model); 103 this._decorationManager = new Coverage.CoverageDecorationManager(model);
102 this._toggleRecordAction.setToggled(true); 104 this._toggleRecordAction.setToggled(true);
103 this._clearButton.setEnabled(false); 105 this._clearButton.setEnabled(false);
104 this._startWithReloadButton.setEnabled(false); 106 this._startWithReloadButton.setEnabled(false);
105 this._coverageResultsElement.removeChildren(); 107 if (this._landingPage.isShowing())
108 this._landingPage.detach();
106 this._listView.show(this._coverageResultsElement); 109 this._listView.show(this._coverageResultsElement);
107 this._poll(); 110 this._poll();
108 } 111 }
109 112
110 async _poll() { 113 async _poll() {
111 delete this._pollTimer; 114 delete this._pollTimer;
112 var updates = await this._model.poll(); 115 var updates = await this._model.poll();
113 this._updateViews(updates); 116 this._updateViews(updates);
114 this._pollTimer = setTimeout(() => this._poll(), 700); 117 this._pollTimer = setTimeout(() => this._poll(), 700);
115 } 118 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 coverageView._toggleRecording(); 187 coverageView._toggleRecording();
185 break; 188 break;
186 case 'coverage.start-with-reload': 189 case 'coverage.start-with-reload':
187 coverageView._startWithReload(); 190 coverageView._startWithReload();
188 break; 191 break;
189 default: 192 default:
190 console.assert(false, `Unknown action: ${actionId}`); 193 console.assert(false, `Unknown action: ${actionId}`);
191 } 194 }
192 } 195 }
193 }; 196 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698