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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js

Issue 2890613004: DevTools: ui polish for the audits2 panel. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/audits2/audits2Panel.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 /** 5 /**
6 * @unrestricted 6 * @unrestricted
7 */ 7 */
8 Audits2.Audits2Panel = class extends UI.PanelWithSidebar { 8 Audits2.Audits2Panel = class extends UI.PanelWithSidebar {
9 constructor() { 9 constructor() {
10 super('audits2'); 10 super('audits2');
(...skipping 22 matching lines...) Expand all
33 33
34 this._treeOutline = new UI.TreeOutlineInShadow(); 34 this._treeOutline = new UI.TreeOutlineInShadow();
35 this._treeOutline.registerRequiredCSS('audits2/lighthouse/report-styles.css' ); 35 this._treeOutline.registerRequiredCSS('audits2/lighthouse/report-styles.css' );
36 this._treeOutline.registerRequiredCSS('audits2/audits2Tree.css'); 36 this._treeOutline.registerRequiredCSS('audits2/audits2Tree.css');
37 this.panelSidebarElement().appendChild(this._treeOutline.element); 37 this.panelSidebarElement().appendChild(this._treeOutline.element);
38 38
39 this._dropTarget = new UI.DropTarget( 39 this._dropTarget = new UI.DropTarget(
40 this.contentElement, [UI.DropTarget.Types.Files], Common.UIString('Drop audit file here'), 40 this.contentElement, [UI.DropTarget.Types.Files], Common.UIString('Drop audit file here'),
41 this._handleDrop.bind(this)); 41 this._handleDrop.bind(this));
42 42
43 for (var preset of Audits2.Audits2Panel.Presets)
44 preset.setting.addChangeListener(this._updateStartButtonEnabled.bind(this) );
43 this._showLandingPage(); 45 this._showLandingPage();
44 } 46 }
45 47
46 _clearAll() { 48 _clearAll() {
47 this._treeOutline.removeChildren(); 49 this._treeOutline.removeChildren();
48 this._showLandingPage(); 50 this._showLandingPage();
49 } 51 }
50 52
51 _deleteSelected() { 53 _deleteSelected() {
52 var selection = this._treeOutline.selectedTreeElement; 54 var selection = this._treeOutline.selectedTreeElement;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 var row = this._auditSelectorForm.createChild('div', 'vbox audits2-launche r-row'); 98 var row = this._auditSelectorForm.createChild('div', 'vbox audits2-launche r-row');
97 row.appendChild(checkbox.element); 99 row.appendChild(checkbox.element);
98 row.createChild('span', 'audits2-launcher-description dimmed').textContent = preset.description; 100 row.createChild('span', 'audits2-launcher-description dimmed').textContent = preset.description;
99 } 101 }
100 102
101 this._statusView = this._createStatusView(uiElement); 103 this._statusView = this._createStatusView(uiElement);
102 104
103 var buttonsRow = uiElement.createChild('div', 'audits2-dialog-buttons hbox') ; 105 var buttonsRow = uiElement.createChild('div', 'audits2-dialog-buttons hbox') ;
104 this._startButton = 106 this._startButton =
105 UI.createTextButton(Common.UIString('Run audit'), this._start.bind(this) , 'material-button default'); 107 UI.createTextButton(Common.UIString('Run audit'), this._start.bind(this) , 'material-button default');
108 this._updateStartButtonEnabled();
106 buttonsRow.appendChild(this._startButton); 109 buttonsRow.appendChild(this._startButton);
107 this._cancelButton = UI.createTextButton(Common.UIString('Cancel'), this._ca ncel.bind(this), 'material-button'); 110 this._cancelButton = UI.createTextButton(Common.UIString('Cancel'), this._ca ncel.bind(this), 'material-button');
108 buttonsRow.appendChild(this._cancelButton); 111 buttonsRow.appendChild(this._cancelButton);
109 112
110 this._dialog.setSizeBehavior(UI.GlassPane.SizeBehavior.SetExactWidthMaxHeigh t); 113 this._dialog.setSizeBehavior(UI.GlassPane.SizeBehavior.SetExactWidthMaxHeigh t);
111 this._dialog.setMaxContentSize(new UI.Size(500, 400)); 114 this._dialog.setMaxContentSize(new UI.Size(500, 400));
112 this._dialog.show(this.mainElement()); 115 this._dialog.show(this.mainElement());
113 auditsViewElement.tabIndex = 0; 116 auditsViewElement.tabIndex = 0;
114 auditsViewElement.focus(); 117 auditsViewElement.focus();
115 } 118 }
116 119
120 _updateStartButtonEnabled() {
121 if (!this._startButton)
122 return;
123 for (var preset of Audits2.Audits2Panel.Presets) {
124 if (preset.setting.get()) {
125 this._startButton.disabled = false;
126 return;
127 }
128 }
129 this._startButton.disabled = true;
130 }
131
117 /** 132 /**
118 * @param {!Element} launcherUIElement 133 * @param {!Element} launcherUIElement
119 * @return {!Element} 134 * @return {!Element}
120 */ 135 */
121 _createStatusView(launcherUIElement) { 136 _createStatusView(launcherUIElement) {
122 var statusView = launcherUIElement.createChild('div', 'audits2-status vbox h idden'); 137 var statusView = launcherUIElement.createChild('div', 'audits2-status vbox h idden');
123 this._statusIcon = statusView.createChild('div', 'icon'); 138 this._statusIcon = statusView.createChild('div', 'icon');
124 this._statusElement = statusView.createChild('div'); 139 this._statusElement = statusView.createChild('div');
125 this._updateStatus(Common.UIString('Loading...')); 140 this._updateStatus(Common.UIString('Loading...'));
126 return statusView; 141 return statusView;
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 return; 719 return;
705 720
706 var element = Components.DOMPresentationUtils.linkifyNodeReference(node, undefined, detailsItem.snippet); 721 var element = Components.DOMPresentationUtils.linkifyNodeReference(node, undefined, detailsItem.snippet);
707 origElement.title = ''; 722 origElement.title = '';
708 origElement.textContent = ''; 723 origElement.textContent = '';
709 origElement.appendChild(element); 724 origElement.appendChild(element);
710 }); 725 });
711 }); 726 });
712 } 727 }
713 }; 728 };
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/audits2/audits2Panel.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698