| Index: appengine/sheriff_o_matic/ui/ct-test-list.html
|
| diff --git a/appengine/sheriff_o_matic/ui/ct-test-list.html b/appengine/sheriff_o_matic/ui/ct-test-list.html
|
| index 26dca55d6cad79a566927e758aa7fe1545c18344..afea91bffb361b3039e505634361dabb9dac4fd5 100644
|
| --- a/appengine/sheriff_o_matic/ui/ct-test-list.html
|
| +++ b/appengine/sheriff_o_matic/ui/ct-test-list.html
|
| @@ -2,14 +2,11 @@
|
| Copyright 2014 The Chromium Authors. All rights reserved.
|
| Use of this source code is governed by a BSD-style license that can be
|
| found in the LICENSE file.
|
| --->
|
| -
|
| -<link rel="import" href="../bower_components/paper-icon-button/paper-icon-button.html">
|
| +--><html><head><link rel="import" href="../bower_components/paper-icon-button/paper-icon-button.html">
|
| <link rel="import" href="ct-user-prefs.html">
|
|
|
| -<polymer-element name="ct-test-list" attributes="tests">
|
| - <template>
|
| - <style>
|
| +<dom-module id="ct-test-list">
|
| + <style>
|
| :host {
|
| display: block;
|
| }
|
| @@ -32,44 +29,55 @@ found in the LICENSE file.
|
| margin: 0;
|
| }
|
| </style>
|
| + <template>
|
| <ct-user-prefs id="userPrefs"></ct-user-prefs>
|
| - <template repeat="{{ groups in testGroups_ }}">
|
| - <template if="{{ groups.tests.length }}">
|
| - <div><span style="font-weight: bold">Step:</span> {{ groups.step }}</div>
|
| + <template is="dom-repeat" items="{{testGroups_}}" as="groups">
|
| + <template is="dom-if" if="{{ groups.tests.length }}">
|
| + <div><span style="font-weight: bold">Step:</span> <span>{{ groups.step }}</span></div>
|
| </template>
|
|
|
| - <template repeat="{{ group in groups.tests | maybeTruncate(groups.expanded) }}">
|
| + <template is="dom-repeat" items="{{maybeTruncate(groups.tests, groups.expanded)}}" as="group">
|
| <!-- Case 1: single test failure -->
|
| - <template if="{{ group.name && (group.tests.length == 1 || group.expanded) }}">
|
| - <template repeat="{{ test in group.tests }}">
|
| + <template is="dom-if" if="{{computeIf(group)}}">
|
| + <template is="dom-repeat" items="{{group.tests}}" as="test">
|
| <div class="test-failures">
|
| - <a target="{{ $.userPrefs.values.linkTarget }}" href="{{ test | flakinessDashboardURL }}">{{ test.testName }}</a>
|
| + <a target="{{ $.userPrefs.values.linkTarget }}" href$="{{flakinessDashboardURL ( test)}}">{{ test.testName }}</a>
|
| </div>
|
| </template>
|
| </template>
|
| <!-- Case 2: group of tests failed -->
|
| - <template if="{{ group.name && group.tests.length > 1 && !group.expanded }}">
|
| + <template is="dom-if" if="{{computeIf2(group)}}">
|
| <div class="test-failures">
|
| - {{ group.name }} ({{ group.tests.length }} Tests)
|
| - <paper-icon-button id="expand" icon="unfold-more" step="{{ groups.step }}" group="{{ group.name }}" on-click="{{ _innerExpand }}"></paper-icon-button>
|
| + <span>{{ group.name }}</span> (<span>{{ group.tests.length }}</span> Tests)
|
| + <paper-icon-button id="expand" icon="unfold-more" step="{{ groups.step }}" group="{{ group.name }}" on-click=" _innerExpand "></paper-icon-button>
|
| </div>
|
| </template>
|
| </template>
|
| - <template if="{{ !groups.expanded }}">
|
| + <template is="dom-if" if="{{ !groups.expanded }}">
|
| <div class="test-failures">
|
| - {{ groups.tests.length - kMaxTestsPerStep }} more
|
| - <paper-icon-button id="outerExpand" icon="unfold-more" step="{{ groups.step }}" on-click="{{ _outerExpand }}"></paper-icon-button>
|
| + <span>{{computeExpression5(groups, kMaxTestsPerStep)}}</span> more
|
| + <paper-icon-button id="outerExpand" icon="unfold-more" step="{{ groups.step }}" on-click=" _outerExpand "></paper-icon-button>
|
| </div>
|
| </template>
|
| </template>
|
| </template>
|
| <script>
|
| - Polymer('ct-test-list', {
|
| - kMaxTestsPerStep: 10,
|
| - testsChanged: function() {
|
| + Polymer({
|
| + is: 'ct-test-list',
|
| + properties: {
|
| + kMaxTestsPerStep: {
|
| + type: Number,
|
| + value: 10
|
| + },
|
| + tests: {
|
| + notify: true,
|
| + observer: 'testsChanged'
|
| + }
|
| + },
|
| + testsChanged: function () {
|
| var groups = {};
|
| if (this.tests) {
|
| - this.tests.forEach(function(test) {
|
| + this.tests.forEach(function (test) {
|
| if (!groups[test.step])
|
| groups[test.step] = {};
|
| var testName = test.reasonGroupName();
|
| @@ -79,26 +87,33 @@ found in the LICENSE file.
|
| }.bind(this));
|
| }
|
| this.testGroups_ = [];
|
| - Object.keys(groups, function(step, testsByName) {
|
| + Object.keys(groups, function (step, testsByName) {
|
| var tests = [];
|
| - Object.keys(testsByName, function(name, testList) {
|
| + Object.keys(testsByName, function (name, testList) {
|
| if (name == 'undefined')
|
| name = undefined;
|
| - tests.push({'name': name, 'tests': testList, 'expanded': false});
|
| + tests.push({
|
| + 'name': name,
|
| + 'tests': testList,
|
| + 'expanded': false
|
| + });
|
| }.bind(this));
|
| tests.sortBy('name');
|
| // The + 1 is to make sure at least 2 tests are hidden by the message.
|
| - this.testGroups_.push({'step': step, 'tests': tests, 'expanded': tests.length <= (this.kMaxTestsPerStep + 1)});
|
| + this.testGroups_.push({
|
| + 'step': step,
|
| + 'tests': tests,
|
| + 'expanded': tests.length <= this.kMaxTestsPerStep + 1
|
| + });
|
| }.bind(this));
|
| this.testGroups_.sortBy('step');
|
| },
|
| -
|
| - _innerExpand: function(evt) {
|
| + _innerExpand: function (evt) {
|
| step = evt.target.attributes['step'].value;
|
| name = evt.target.attributes['group'].value;
|
| - this.testGroups_.forEach(function(testGroup) {
|
| + this.testGroups_.forEach(function (testGroup) {
|
| if (testGroup.step == step) {
|
| - testGroup.tests.forEach(function(test) {
|
| + testGroup.tests.forEach(function (test) {
|
| // FIXME: This attribute should be persisted over reloads.
|
| if (test.name == name)
|
| test.expanded = true;
|
| @@ -106,27 +121,33 @@ found in the LICENSE file.
|
| }
|
| });
|
| },
|
| -
|
| - _outerExpand: function(evt) {
|
| + _outerExpand: function (evt) {
|
| var step = evt.target.attributes['step'].value;
|
| - this.testGroups_.forEach(function(testGroup) {
|
| + this.testGroups_.forEach(function (testGroup) {
|
| if (testGroup.step == step) {
|
| testGroup.expanded = true;
|
| }
|
| });
|
| },
|
| -
|
| - flakinessDashboardURL: function(test) {
|
| + flakinessDashboardURL: function (test) {
|
| return test.flakinessDashboardURL();
|
| },
|
| -
|
| // FIXME: Remove maybeTruncate. Persist the expanded list as described in
|
| // http://crbug.com/417159.
|
| - maybeTruncate: function(input, expanded) {
|
| + maybeTruncate: function (input, expanded) {
|
| if (expanded)
|
| return input;
|
| return input.slice(0, this.kMaxTestsPerStep);
|
| },
|
| + computeIf: function (group) {
|
| + return group.name && (group.tests.length == 1 || group.expanded);
|
| + },
|
| + computeIf2: function (group) {
|
| + return group.name && group.tests.length > 1 && !group.expanded;
|
| + },
|
| + computeExpression5: function (groups, kMaxTestsPerStep) {
|
| + return groups.tests.length - kMaxTestsPerStep;
|
| + }
|
| });
|
| </script>
|
| -</polymer-element>
|
| +</dom-module>
|
|
|