| Index: appengine/sheriff_o_matic/ui/ct-commit-list.html
|
| diff --git a/appengine/sheriff_o_matic/ui/ct-commit-list.html b/appengine/sheriff_o_matic/ui/ct-commit-list.html
|
| index 286d109c12e1deff0573d31b57a2289194f6c9d0..f3dd61f71edd254163073a9908b7d90f396a162a 100644
|
| --- a/appengine/sheriff_o_matic/ui/ct-commit-list.html
|
| +++ b/appengine/sheriff_o_matic/ui/ct-commit-list.html
|
| @@ -2,16 +2,13 @@
|
| 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="ct-commit.html">
|
| +--><html><head><link rel="import" href="ct-commit.html">
|
| <link rel="import" href="ct-detailed-commit.html">
|
| <link rel="import" href="../bower_components/paper-button/paper-button.html">
|
| <link rel="import" href="ct-user-prefs.html">
|
|
|
| -<polymer-element name="ct-commit-list" attributes="flex commitList detailed suspectedCLsByRepo">
|
| - <template>
|
| - <style>
|
| +<dom-module id="ct-commit-list">
|
| + <style>
|
| :host {
|
| display: block;
|
| }
|
| @@ -36,32 +33,32 @@ found in the LICENSE file.
|
| margin-top: 3px;
|
| }
|
| </style>
|
| + <template>
|
| <ct-user-prefs id="userPrefs"></ct-user-prefs>
|
| - <template if="{{ totalSuspectedCommits_ > 0 }}">
|
| - <a target="{{ $.userPrefs.values.linkTarget }}" href="https://findit-for-me.appspot.com/build-failure?url={{ representiveBuildUrl_ }}">Findit found {{ totalSuspectedCommits_ }} suspected CL(s).</a>
|
| + <template is="dom-if" if="{{computeIf(totalSuspectedCommits_)}}">
|
| + <a target="{{ $.userPrefs.values.linkTarget }}" href$="{{computeHref(representiveBuildUrl_)}}">Findit found <span>{{ totalSuspectedCommits_ }}</span> suspected CL(s).</a>
|
| </template>
|
| - <template repeat="{{ repository in commitList.repositories }}">
|
| + <template is="dom-repeat" items="{{commitList.repositories}}" as="repository">
|
| <div class="repository-info">
|
| <span style="font-weight: bold">{{ repository.name }}</span>
|
| - <template if="{{ repository.name == 'chromium' }}">
|
| - <a target="{{ $.userPrefs.values.linkTarget }}" href="http://test-results.appspot.com/revision_range?start={{ repository.firstRevision }}&end={{ repository.lastRevision }}">{{ repository.range }}</a>
|
| + <template is="dom-if" if="{{computeIf2(repository)}}">
|
| + <a target="{{ $.userPrefs.values.linkTarget }}" href$="{{computeHref2(repository)}}">{{ repository.range }}</a>
|
| </template>
|
| - <template if="{{ repository.name == 'blink' }}">
|
| - <a target="{{ $.userPrefs.values.linkTarget }}" href="http://build.chromium.org/f/chromium/perf/dashboard/ui/changelog_blink.html?url=/trunk&range={{ repository.firstRevision }}:{{ repository.lastRevision }}&mode=html">{{ repository.range }}</a>
|
| + <template is="dom-if" if="{{computeIf3(repository)}}">
|
| + <a target="{{ $.userPrefs.values.linkTarget }}" href$="{{computeHref3(repository)}}">{{ repository.range }}</a>
|
| </template>
|
| - <template if="{{ repository.name != 'blink' && repository.name != 'chromium'}}">{{ repository.range }}</template>
|
| - <paper-icon-button icon="unfold-more"
|
| - on-click="{{ _toggle }}" repository="{{ repository.name }}"></paper-icon-button>
|
| - <template if="{{ suspectedCommitsByRepo_[repository.name] && _numberOfSuspectedCL(repository.name) > 0 }}">
|
| - <span style="color: red">{{ _numberOfSuspectedCL(repository.name) }} suspected CL(s)</span>
|
| + <template is="dom-if" if="{{computeIf4(repository)}}">{{ repository.range }}</template>
|
| + <paper-icon-button icon="unfold-more" on-click=" _toggle " repository="{{ repository.name }}"></paper-icon-button>
|
| + <template is="dom-if" if="{{computeIf5(repository, suspectedCommitsByRepo_)}}">
|
| + <span style="color: red"><span>{{ _numberOfSuspectedCL(repository.name) }}</span> suspected CL(s)</span>
|
| </template>
|
| - <template if="{{ repository.expanded }}">
|
| - <template repeat="{{ commit, commit_index in repository.commits }}">
|
| - <template if="{{ !detailed }}">
|
| - <ct-commit class="{{ commit_index == 0 ? 'first' : 'notfirst' }}" data="{{ commit }}" suspected="{{ commit.revision | _isSuspected(repository.name) }}"></ct-commit>
|
| + <template is="dom-if" if="{{ repository.expanded }}">
|
| + <template is="dom-repeat" items="{{repository.commits }}" as="commit" index-as="commit_index">
|
| + <template is="dom-if" if="{{ !detailed }}">
|
| + <ct-commit data="{{ commit }}" suspected="{{computeClass(commit_index)}}" class$="{{computeClass(commit_index)}}"></ct-commit>
|
| </template>
|
| - <template if="{{ detailed }}">
|
| - <ct-detailed-commit class="{{ commit_index == 0 ? 'first' : 'notfirst' }}" data="{{ commit }}" suspected="{{ commit.revision | _isSuspected(repository.name) }}"></ct-detailed-commit>
|
| + <template is="dom-if" if="{{ detailed }}">
|
| + <ct-detailed-commit data="{{ commit }}" suspected="{{_isSuspected(commit.revision, repository.name)}}" class$="{{computeClass(commit_index)}}"></ct-detailed-commit>
|
| </template>
|
| </template>
|
| </template>
|
| @@ -69,97 +66,129 @@ found in the LICENSE file.
|
| </template>
|
| </template>
|
| <script>
|
| - Polymer({
|
| - detailed: false,
|
| - suspectedCommitsByRepo_: {},
|
| - totalSuspectedCommits_: 0,
|
| - representiveBuildUrl_: null,
|
| -
|
| - observe: {
|
| - commitList: '_updateSuspectedCommitInfo',
|
| - suspectedCLsByRepo: '_updateSuspectedCommitInfo',
|
| - },
|
| -
|
| - _toggle: function(event, detail, sender, target) {
|
| - var repo = sender.getAttribute('repository');
|
| - var r = this.commitList.repositories.find(function(item) {
|
| - return item.name === repo;
|
| - });
|
| - r.expanded = !r.expanded;
|
| -
|
| - var anyExpanded = this.commitList.repositories.some(function(item) {
|
| - return item.expanded;
|
| - });
|
| -
|
| - if (anyExpanded) {
|
| - this.setAttribute('flex', r.expanded);
|
| - } else {
|
| - this.removeAttribute('flex');
|
| - }
|
| - },
|
| -
|
| - _updateSuspectedCommitInfo: function() {
|
| - this.suspectedCommitsByRepo_ = {};
|
| - this.totalSuspectedCommits_ = 0;
|
| - this.representiveBuildUrl_ = null;
|
| -
|
| - if (Object.isEmpty(this.suspectedCLsByRepo))
|
| - return;
|
| -
|
| - var builds = {};
|
| -
|
| - this.commitList.repositories.forEach(function(repository) {
|
| - if (!this.suspectedCLsByRepo[repository.name])
|
| + Polymer({
|
| + is: 'ct-commit-list',
|
| + properties: {
|
| + commitList: {
|
| + notify: true,
|
| + observer: '_updateSuspectedCommitInfo'
|
| + },
|
| + detailed: {
|
| + type: Boolean,
|
| + value: false,
|
| + notify: true
|
| + },
|
| + flex: { notify: true },
|
| + representiveBuildUrl_: { value: null },
|
| + suspectedCLsByRepo: {
|
| + notify: true,
|
| + observer: '_updateSuspectedCommitInfo'
|
| + },
|
| + suspectedCommitsByRepo_: {
|
| + type: Object,
|
| + value: function () {
|
| + return {};
|
| + }
|
| + },
|
| + totalSuspectedCommits_: {
|
| + type: Number,
|
| + value: 0
|
| + }
|
| + },
|
| + _toggle: function (event, detail, sender, target) {
|
| + var repo = sender.getAttribute('repository');
|
| + var r = this.commitList.repositories.find(function (item) {
|
| + return item.name === repo;
|
| + });
|
| + r.expanded = !r.expanded;
|
| + var anyExpanded = this.commitList.repositories.some(function (item) {
|
| + return item.expanded;
|
| + });
|
| + if (anyExpanded) {
|
| + this.setAttribute('flex', r.expanded);
|
| + } else {
|
| + this.removeAttribute('flex');
|
| + }
|
| + },
|
| + _updateSuspectedCommitInfo: function () {
|
| + this.suspectedCommitsByRepo_ = {};
|
| + this.totalSuspectedCommits_ = 0;
|
| + this.representiveBuildUrl_ = null;
|
| + if (Object.isEmpty(this.suspectedCLsByRepo))
|
| return;
|
| -
|
| - if (!this.suspectedCommitsByRepo_[repository.name])
|
| - this.suspectedCommitsByRepo_[repository.name] = {};
|
| -
|
| - repository.commits.forEach(function(commit) {
|
| - var suspectedCL = null;
|
| -
|
| - // If a suspected CL is not in the regression range, don't show it on UI.
|
| - this.suspectedCLsByRepo[repository.name].some(function(cl) {
|
| - // In builder_alerts and sheriff-o-matic, git commit position is referred as revision.
|
| - if (cl.commitPosition == commit.revision) {
|
| - suspectedCL = cl;
|
| - return true;
|
| - }
|
| - return false;
|
| - });
|
| -
|
| - if (suspectedCL) {
|
| - this.suspectedCommitsByRepo_[repository.name][commit.revision] = suspectedCL;
|
| - suspectedCL.builds.forEach(function(buildUrl) {
|
| - if (!builds[buildUrl])
|
| - builds[buildUrl] = 0;
|
| - builds[buildUrl] += 1;
|
| + var builds = {};
|
| + this.commitList.repositories.forEach(function (repository) {
|
| + if (!this.suspectedCLsByRepo[repository.name])
|
| + return;
|
| + if (!this.suspectedCommitsByRepo_[repository.name])
|
| + this.suspectedCommitsByRepo_[repository.name] = {};
|
| + repository.commits.forEach(function (commit) {
|
| + var suspectedCL = null;
|
| + // If a suspected CL is not in the regression range, don't show it on UI.
|
| + this.suspectedCLsByRepo[repository.name].some(function (cl) {
|
| + // In builder_alerts and sheriff-o-matic, git commit position is referred as revision.
|
| + if (cl.commitPosition == commit.revision) {
|
| + suspectedCL = cl;
|
| + return true;
|
| + }
|
| + return false;
|
| });
|
| - this.totalSuspectedCommits_ += 1;
|
| - }
|
| - }.bind(this));
|
| - }.bind(this));
|
| -
|
| - // Use a build out of the same step failure group as a representative one to link back to Findit.
|
| - // It could be the one that has the most failures tagged with some suspected CLs.
|
| - if (!Object.isEmpty(builds)) {
|
| - var maxCount = 0;
|
| - Object.keys(builds, function(buildUrl, count) {
|
| - if (count > maxCount) {
|
| - this.representiveBuildUrl_ = buildUrl;
|
| - maxCount = count;
|
| - }
|
| + if (suspectedCL) {
|
| + this.suspectedCommitsByRepo_[repository.name][commit.revision] = suspectedCL;
|
| + suspectedCL.builds.forEach(function (buildUrl) {
|
| + if (!builds[buildUrl])
|
| + builds[buildUrl] = 0;
|
| + builds[buildUrl] += 1;
|
| + });
|
| + this.totalSuspectedCommits_ += 1;
|
| + }
|
| + }.bind(this));
|
| }.bind(this));
|
| + // Use a build out of the same step failure group as a representative one to link back to Findit.
|
| + // It could be the one that has the most failures tagged with some suspected CLs.
|
| + if (!Object.isEmpty(builds)) {
|
| + var maxCount = 0;
|
| + Object.keys(builds, function (buildUrl, count) {
|
| + if (count > maxCount) {
|
| + this.representiveBuildUrl_ = buildUrl;
|
| + maxCount = count;
|
| + }
|
| + }.bind(this));
|
| + }
|
| + },
|
| + _isSuspected: function (revision, repoName) {
|
| + return this.suspectedCommitsByRepo_[repoName] && this.suspectedCommitsByRepo_[repoName][revision] !== undefined;
|
| + },
|
| + _numberOfSuspectedCL: function (repoName) {
|
| + return Object.size(this.suspectedCommitsByRepo_[repoName]);
|
| + },
|
| + computeIf: function (totalSuspectedCommits_) {
|
| + return totalSuspectedCommits_ > 0;
|
| + },
|
| + computeHref: function (representiveBuildUrl_) {
|
| + return 'https://findit-for-me.appspot.com/build-failure?url=' + representiveBuildUrl_;
|
| + },
|
| + computeIf2: function (repository) {
|
| + return repository.name == 'chromium';
|
| + },
|
| + computeIf3: function (repository) {
|
| + return repository.name == 'blink';
|
| + },
|
| + computeIf4: function (repository) {
|
| + return repository.name != 'blink' && repository.name != 'chromium';
|
| + },
|
| + computeIf5: function (repository, suspectedCommitsByRepo_) {
|
| + return suspectedCommitsByRepo_[repository.name] && this._numberOfSuspectedCL(repository.name) > 0;
|
| + },
|
| + computeHref2: function (repository) {
|
| + return 'http://test-results.appspot.com/revision_range?start=' + repository.firstRevision + '&end=' + repository.lastRevision;
|
| + },
|
| + computeHref3: function (repository) {
|
| + return 'http://build.chromium.org/f/chromium/perf/dashboard/ui/changelog_blink.html?url=/trunk&range=' + repository.firstRevision + ':' + repository.lastRevision + '&mode=html';
|
| + },
|
| + computeClass: function (commit_index) {
|
| + return commit_index == 0 ? 'first' : 'notfirst';
|
| }
|
| - },
|
| -
|
| - _isSuspected: function(revision, repoName) {
|
| - return this.suspectedCommitsByRepo_[repoName] && this.suspectedCommitsByRepo_[repoName][revision] !== undefined;
|
| - },
|
| -
|
| - _numberOfSuspectedCL: function(repoName) {
|
| - return Object.size(this.suspectedCommitsByRepo_[repoName]);
|
| - },
|
| - });
|
| + });
|
| </script>
|
| -</polymer-element>
|
| +</dom-module>
|
|
|