Skip to content

Commit

Permalink
DevTools: ui polish for the audits2 panel.
Browse files Browse the repository at this point in the history
BUG=723371,723413

Review-Url: https://codereview.chromium.org/2890613004
Cr-Commit-Position: refs/heads/master@{#472969}
  • Loading branch information
pavelfeldman authored and Commit bot committed May 18, 2017
1 parent 03024fa commit 4ef9da3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Audits2.Audits2Panel = class extends UI.PanelWithSidebar {
this.contentElement, [UI.DropTarget.Types.Files], Common.UIString('Drop audit file here'),
this._handleDrop.bind(this));

for (var preset of Audits2.Audits2Panel.Presets)
preset.setting.addChangeListener(this._updateStartButtonEnabled.bind(this));
this._showLandingPage();
}

Expand Down Expand Up @@ -103,6 +105,7 @@ Audits2.Audits2Panel = class extends UI.PanelWithSidebar {
var buttonsRow = uiElement.createChild('div', 'audits2-dialog-buttons hbox');
this._startButton =
UI.createTextButton(Common.UIString('Run audit'), this._start.bind(this), 'material-button default');
this._updateStartButtonEnabled();
buttonsRow.appendChild(this._startButton);
this._cancelButton = UI.createTextButton(Common.UIString('Cancel'), this._cancel.bind(this), 'material-button');
buttonsRow.appendChild(this._cancelButton);
Expand All @@ -114,6 +117,18 @@ Audits2.Audits2Panel = class extends UI.PanelWithSidebar {
auditsViewElement.focus();
}

_updateStartButtonEnabled() {
if (!this._startButton)
return;
for (var preset of Audits2.Audits2Panel.Presets) {
if (preset.setting.get()) {
this._startButton.disabled = false;
return;
}
}
this._startButton.disabled = true;
}

/**
* @param {!Element} launcherUIElement
* @return {!Element}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
display: flex;
align-items: center;
justify-content: center;
overflow: auto;
}


Expand All @@ -33,6 +34,10 @@
margin: 50px;
}

.audits2-landing-center > * {
flex-shrink: 0;
}

.audits2-landing-text {
color: #666;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,11 @@ button.material-button.default {
background-color: #4285f4 !important;
}

button.material-button.default:disabled {
background-color: #ffffff !important;
color: gray;
}

button.material-button.default:not(:disabled):hover {
background-color: hsla(217, 89%, 58%, 1) !important;
color: white !important;
Expand Down

0 comments on commit 4ef9da3

Please sign in to comment.