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

Unified Diff: appengine/sheriff_o_matic/ui/ct-results-detail.html

Issue 1315693002: SoM: upgrade Polymer from 0.5 to 1.0 Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: get bower_components from polymer_1.0.4 Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: appengine/sheriff_o_matic/ui/ct-results-detail.html
diff --git a/appengine/sheriff_o_matic/ui/ct-results-detail.html b/appengine/sheriff_o_matic/ui/ct-results-detail.html
index f2555f326e8706fd141b9731c6839b3749ea0876..a6404e92c40e53ce9b14c5e5dbd6c5e54424d63d 100644
--- a/appengine/sheriff_o_matic/ui/ct-results-detail.html
+++ b/appengine/sheriff_o_matic/ui/ct-results-detail.html
@@ -2,62 +2,84 @@
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-results-comparison.html">
-
-<polymer-element name="ct-results-detail" attributes="failure builder">
- <template>
- <style>
+--><html><head><link rel="import" href="ct-results-comparison.html">
+
+ <!--
+ TODO(polyup): unable to infer path to components
+ directory. This import path is probably incomplete.
+ -->
+ <link rel="import" href="iron-flex-layout/iron-flex-layout.html">
+<dom-module id="ct-results-detail">
+ <style>
+ /* TODO(polyup): For speed, consider reworking these styles with .classes
+ and #ids rather than [attributes].
+ */
+ [layout] {
+ @apply(--layout);
+ }
+ [layout][vertical] {
+ @apply(--layout-vertical);
+ }
+ [layout][flex] {
+ @apply(--layout-flex);
+ }
+ </style>
+ <style>
:host {
display: block;
}
</style>
- <template if="{{!_urlGroups.length}}">
+ <template>
+ <template is="dom-if" if="{{!_urlGroups.length}}">
No results to display.
</template>
- <template repeat="{{urlGroup in _urlGroups}}">
- <template if="{{urlGroup.urls[_kUnknownKind]}}">
- <ct-test-output type="{{urlGroup.type}}" url="{{urlGroup.urls[_kUnknownKind]}}" flex layout vertical></ct-test-output>
+ <template is="dom-repeat" items="{{_urlGroups}}" as="urlGroup">
+ <template is="dom-if" if="{{computeUrl(_kUnknownKind, urlGroup)}}">
+ <ct-test-output type="{{urlGroup.type}}" url="{{computeUrl(_kUnknownKind, urlGroup)}}" flex="" layout="" vertical=""></ct-test-output>
</template>
- <template if="{{!urlGroup.urls[_kUnknownKind]}}">
- <ct-results-comparison type="{{urlGroup.type}}" expectedUrl="{{urlGroup.urls[_kExpectedKind]}}"
- actualUrl="{{urlGroup.urls[_kActualKind]}}" diffUrl="{{urlGroup.urls[_kDiffKind]}}" flex layout vertical></ct-results-comparison>
+ <template is="dom-if" if="{{computeIf(_kUnknownKind, urlGroup)}}">
+ <ct-results-comparison type="{{urlGroup.type}}" expectedurl="{{computeExpectedurl(_kExpectedKind, urlGroup)}}" actualurl="{{computeActualurl(_kActualKind, urlGroup)}}" diffurl="{{computeDiffurl(_kDiffKind, urlGroup)}}" flex="" layout="" vertical=""></ct-results-comparison>
</template>
</template>
</template>
<script>
Polymer({
- failure: null,
- // FIXME: Initializing builder gives a JS error. Presumably because
- // ct-results-by-builder sets builder="{{builders[selected]}}". But,
- // it seems wrong that the way the parent uses this element constrains
- // what the element can do. Polymer bug?
- // builder: '',
-
- _urlGroups: [],
+ is: 'ct-results-detail',
+ properties: {
+ // FIXME: Initializing builder gives a JS error. Presumably because
+ // ct-results-by-builder sets builder="{{builders[selected]}}". But,
+ // it seems wrong that the way the parent uses this element constrains
+ // what the element can do. Polymer bug?
+ // builder: '',
+ _urlGroups: {
+ type: Array,
+ value: function () {
+ return [];
+ }
+ },
+ builder: {
+ notify: true,
+ observer: '_update'
+ },
+ failure: {
+ value: null,
+ notify: true,
+ observer: '_update'
+ }
+ },
_kExpectedKind: results.kExpectedKind,
_kActualKind: results.kActualKind,
_kDiffKind: results.kDiffKind,
_kUnknownKind: results.kUnknownKind,
-
- observe: {
- failure: '_update',
- builder: '_update',
- },
-
- _isStdioStep: function(result, step) {
+ _isStdioStep: function (result, step) {
return result.actual == 'UNKNOWN' || step == 'compile';
},
-
- _update: function() {
+ _update: function () {
if (!this.failure || !this.builder)
return;
-
// FIXME: If the types of groups doesn't change, then it'd be better to do this
// update in place so that the user doesn't see a flicker.
this._urlGroups = [];
-
var result = this.failure.resultNodesByBuilder[this.builder];
// FIXME: There's probably a less hacky way to check this.
if (result.actual == 'FAIL' || this._isStdioStep(result, this.failure.step))
@@ -65,60 +87,62 @@ found in the LICENSE file.
else
this._updateWebkitTestUrls();
},
-
- _updateWebkitTestUrls: function() {
+ _updateWebkitTestUrls: function () {
var result = this.failure.resultNodesByBuilder[this.builder];
var failureInfo = results.failureInfo(this.failure.testName, this.builder, result.actual);
-
// FIXME: Move this logic to a proper model class so that the network requests this makes
// can be easily mocked out in tests.
- results.fetchResultsURLs(failureInfo).then(function(resultsUrls) {
+ results.fetchResultsURLs(failureInfo).then(function (resultsUrls) {
var resultsUrlsByTypeAndKind = {};
- resultsUrls.forEach(function(url) {
- var resultType = results.resultType(url);
- if (!resultsUrlsByTypeAndKind[resultType])
- resultsUrlsByTypeAndKind[resultType] = {};
- resultsUrlsByTypeAndKind[resultType][results.resultKind(url)] = url;
+ resultsUrls.forEach(function (url) {
+ var resultType = results.resultType(url);
+ if (!resultsUrlsByTypeAndKind[resultType])
+ resultsUrlsByTypeAndKind[resultType] = {};
+ resultsUrlsByTypeAndKind[resultType][results.resultKind(url)] = url;
});
-
- Object.keys(resultsUrlsByTypeAndKind, function(resultType, resultsUrlsByKind) {
+ Object.keys(resultsUrlsByTypeAndKind, function (resultType, resultsUrlsByKind) {
this._urlGroups.push({
type: resultType,
- urls: resultsUrlsByKind,
+ urls: resultsUrlsByKind
});
}.bind(this));
}.bind(this));
},
-
- _updateUrls: function() {
+ _updateUrls: function () {
// FIXME: Along with _updateWebkitTestUrls, move this logic to a proper model class
// so that the network requests this makes can be easily mocked out in tests.
-
var result = this.failure.resultNodesByBuilder[this.builder];
-
// FIXME: We only store build logs by the test name, not the testsuite.testname,
// which means that two failing tests from different test suites conflict!
var testPart = this._isStdioStep(result, this.failure.step) ? 'stdio' : this.failure.testName;
// Fix url for parameterized gtests, e.g.: /2 -> _2.
- testPart = testPart.replace(/\/(\d+)$/, "_$1");
- var url = result.masterUrl +
- '/builders/' + encodeURIComponent(this.builder);
-
+ testPart = testPart.replace(/\/(\d+)$/, '_$1');
+ var url = result.masterUrl + '/builders/' + encodeURIComponent(this.builder);
// FIXME: Make failure groups aware of their own url
if (this.failure.testName)
- url +=
- '/builds/' + result.lastFailingBuild +
- '/steps/' + this.failure.step +
- '/logs/' + testPart;
-
+ url += '/builds/' + result.lastFailingBuild + '/steps/' + this.failure.step + '/logs/' + testPart;
var resultsUrlsByKind = {};
resultsUrlsByKind[this._kUnknownKind] = url;
-
this._urlGroups.push({
type: results.kTextType,
- urls: resultsUrlsByKind,
+ urls: resultsUrlsByKind
});
},
+ computeUrl: function (_kUnknownKind, urlGroup) {
+ return urlGroup.urls[_kUnknownKind];
+ },
+ computeIf: function (_kUnknownKind, urlGroup) {
+ return !urlGroup.urls[_kUnknownKind];
+ },
+ computeExpectedurl: function (_kExpectedKind, urlGroup) {
+ return urlGroup.urls[_kExpectedKind];
+ },
+ computeActualurl: function (_kActualKind, urlGroup) {
+ return urlGroup.urls[_kActualKind];
+ },
+ computeDiffurl: function (_kDiffKind, urlGroup) {
+ return urlGroup.urls[_kDiffKind];
+ }
});
</script>
-</polymer-element>
+</dom-module>
« no previous file with comments | « appengine/sheriff_o_matic/ui/ct-results-comparison-zoomer.html ('k') | appengine/sheriff_o_matic/ui/ct-results-panel.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698