Commit 727be052 authored by Scott Chen's avatar Scott Chen Committed by Commit Bot

MD Extensions: fix error-console sub-page looking broken.

This CL is the first pass for error-console such that it no longer looks
completely broken, as well as fixing keyboard navigation. There will be 
follow-up CLs to bring it closer to the design spec as well as adding the
missing dev-tool buttons.

Bug: 768580
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I15d85e0ebe946b11a9a7aaf9f471ba22fe705a97
Reviewed-on: https://chromium-review.googlesource.com/685988
Commit-Queue: Scott Chen <scottchen@chromium.org>
Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#505257}
parent fd0041e9
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
color: var(--paper-grey-800); color: var(--paper-grey-800);
display: flex; display: flex;
font-family: monospace; font-family: monospace;
overflow: auto;
white-space: pre; white-space: pre;
} }
......
...@@ -14,22 +14,35 @@ ...@@ -14,22 +14,35 @@
<dom-module id="extensions-error-page"> <dom-module id="extensions-error-page">
<template> <template>
<style include="cr-icons cr-hidden-style"> <style include="cr-icons cr-hidden-style">
:host {
display: block;
height: 100%;
overflow: auto;
}
#main { #main {
background-color: white; background-color: white;
height: 800px; display: flex;
width: 90%; flex-direction: column;
margin: auto;
min-height: 100%;
width: 640px;
} }
#heading { #heading {
color: var(--paper-grey-600);
height: 40px; height: 40px;
margin-bottom: 30px; margin-bottom: 30px;
padding: 8px 12px 0; padding: 8px 12px 0;
@apply(--cr-title-text);
} }
#errors-list { #errors-list {
min-height: 100px; min-height: 100px;
padding: 0 10px; padding: 0 var(--cr-section-padding);
}
#content-view {
padding: 0 var(--cr-section-padding);
} }
.error-item { .error-item {
...@@ -39,6 +52,10 @@ ...@@ -39,6 +52,10 @@
margin: 5px 0; margin: 5px 0;
} }
.error-item button[is='paper-icon-button-light'] {
-webkit-margin-end: 0;
}
.error-item.selected { .error-item.selected {
background-color: #ccc; background-color: #ccc;
} }
...@@ -68,16 +85,18 @@ ...@@ -68,16 +85,18 @@
</button> </button>
<span>$i18n{errorsPageHeading}</span> <span>$i18n{errorsPageHeading}</span>
</div> </div>
<iron-list id="errors-list" items="[[calculateShownItems_(data.*)]]"> <iron-list id="errors-list" items="[[calculateShownItems_(data.*)]]"
preserve-focus>
<template> <template>
<div class$="[[computeErrorClass_(selectedError_, item)]]" <div class$="error-item [[computeErrorClass_(selectedError_, item)]]"
error="[[item]]" error="[[item]]"
tabindex$="[[tabIndex]]" tabindex$="[[tabIndex]]"
on-tap="onErrorItemTap_" on-keydown="onErrorItemKeydown_"> on-tap="onErrorItemAction_" on-keydown="onErrorItemAction_">
<img class$="[[computeErrorIconClass_(item)]]"> <img class$="[[computeErrorIconClass_(item)]]">
<div class="error-message">[[item.message]]</div> <div class="error-message">[[item.message]]</div>
<button is="paper-icon-button-light" class="icon-delete-gray" <button is="paper-icon-button-light" class="icon-delete-gray"
on-tap="onDeleteErrorTap_" tabindex$="[[tabIndex]]"></button> on-tap="onDeleteErrorAction_" tabindex$="[[tabIndex]]"
on-keydown="onDeleteErrorAction_"></button>
</div> </div>
</template> </template>
</iron-list> </iron-list>
......
...@@ -64,6 +64,8 @@ cr.define('extensions', function() { ...@@ -64,6 +64,8 @@ cr.define('extensions', function() {
* @private * @private
*/ */
calculateShownItems_: function() { calculateShownItems_: function() {
// Render iron-list correctly after data changes.
setTimeout(() => this.$['errors-list'].fire('iron-resize'));
return this.data.manifestErrors.concat(this.data.runtimeErrors); return this.data.manifestErrors.concat(this.data.runtimeErrors);
}, },
...@@ -98,14 +100,16 @@ cr.define('extensions', function() { ...@@ -98,14 +100,16 @@ cr.define('extensions', function() {
}, },
/** /**
* @param {!Event} event * @param {!Event} e
* @private * @private
*/ */
onDeleteErrorTap_: function(event) { onDeleteErrorAction_: function(e) {
// TODO(devlin): It would be cleaner if we could cast this to a if (e.type == 'keydown' && !((e.code == 'Space' || e.code == 'Enter')))
// PolymerDomRepeatEvent-type thing, but that doesn't exist yet. return;
const e = /** @type {!{model:Object}} */ (event);
this.delegate.deleteErrors(this.data.id, [e.model.item.id]); this.delegate.deleteErrors(
this.data.id, [(/** @type {!{model:Object}} */ (e)).model.item.id]);
e.stopPropagation();
}, },
/** /**
...@@ -146,7 +150,7 @@ cr.define('extensions', function() { ...@@ -146,7 +150,7 @@ cr.define('extensions', function() {
* @private * @private
*/ */
computeErrorClass_: function(selectedError, error) { computeErrorClass_: function(selectedError, error) {
return selectedError == error ? 'error-item selected' : 'error-item'; return selectedError == error ? 'selected' : '';
}, },
/** /**
...@@ -162,17 +166,11 @@ cr.define('extensions', function() { ...@@ -162,17 +166,11 @@ cr.define('extensions', function() {
* @param {!{model: !{item: (!RuntimeError|!ManifestError)}}} e * @param {!{model: !{item: (!RuntimeError|!ManifestError)}}} e
* @private * @private
*/ */
onErrorItemTap_: function(e) { onErrorItemAction_: function(e) {
this.selectError_(e.model.item); if (e.type == 'keydown' && !((e.code == 'Space' || e.code == 'Enter')))
}, return;
/** this.selectError_(e.model.item);
* @param {!{model: !{item: (!RuntimeError|!ManifestError)}}} e
* @private
*/
onErrorItemKeydown_: function(e) {
if (e.key == ' ' || e.key == 'Enter')
this.selectError_(e.model.item);
}, },
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment