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

Unified Diff: tracing/tracing/value/ui/merged_revision_info_span.html

Issue 2999663002: Revert of Revision Info into GenericSet (Closed)
Patch Set: Created 3 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: tracing/tracing/value/ui/merged_revision_info_span.html
diff --git a/tracing/tracing/value/ui/merged_revision_info_span.html b/tracing/tracing/value/ui/merged_revision_info_span.html
new file mode 100644
index 0000000000000000000000000000000000000000..7a66bae63048aefbd1d31cdecf06f91b44064d0c
--- /dev/null
+++ b/tracing/tracing/value/ui/merged_revision_info_span.html
@@ -0,0 +1,95 @@
+<!DOCTYPE html>
+<!--
+Copyright 2017 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="/tracing/ui/base/table.html">
+
+<dom-module id="tr-v-ui-merged-revision-info-span">
+ <template>
+ <tr-ui-b-table id="table"></tr-ui-b-table>
+ </template>
+</dom-module>
+
+<script>
+'use strict';
+Polymer({
+ is: 'tr-v-ui-merged-revision-info-span',
+
+ ready() {
+ this.diagnostic_ = undefined;
+ this.$.table.showHeader = false;
+ this.$.table.tableColumns = [
+ {value: row => row[0]},
+ {value: row => row[1]},
+ ];
+ },
+
+ get diagnostic() {
+ return this.diagnostic_;
+ },
+
+ set diagnostic(d) {
+ this.diagnostic_ = d;
+ this.updateContents_();
+ },
+
+ buildRow_(rows, label, revisions, host) {
+ if (revisions.length === 0) return;
+
+ const valueSpan = document.createElement('span');
+ for (const revs of revisions) {
+ const anchor = document.createElement('a');
+ anchor.innerText = revs[0];
+
+ if (revs.length === 1) {
+ anchor.href = host + '+/' + revs[0];
+ } else {
+ anchor.innerText += '..' + revs[1];
+ anchor.href = host + '+log/' + revs[0] + '..' + revs[1];
+ }
+
+ // Prevent the table from calling preventDefault().
+ anchor.addEventListener('click', event => {
+ event.stopPropagation();
+ });
+ valueSpan.appendChild(anchor);
+ valueSpan.appendChild(document.createTextNode(' '));
+ }
+ rows.push([label, valueSpan]);
+ },
+
+ updateContents_() {
+ if (this.diagnostic === undefined) {
+ this.$.table.tableRows = [];
+ return;
+ }
+
+ const rows = [];
+ if (this.diagnostic.chromiumCommitPosition) {
+ const positions = Array.from(this.diagnostic.chromiumCommitPositions);
+ positions.sort((x, y) => x - y);
+ rows.push(['chromiumCommitPositions', positions.join(', ')]);
+ }
+ if (this.diagnostic.v8CommitPosition) {
+ const positions = Array.from(this.diagnostic.v8CommitPositions);
+ rows.push(['v8CommitPositions', positions.join(', ')]);
+ }
+ this.buildRow_(rows, 'chromium', this.diagnostic.chromium,
+ tr.v.ui.CHROMIUM_REVISION_HOST);
+ this.buildRow_(rows, 'v8', this.diagnostic.v8, tr.v.ui.V8_REVISION_HOST);
+ this.buildRow_(rows, 'catapult', this.diagnostic.catapult,
+ tr.v.ui.CATAPULT_REVISION_HOST);
+ this.buildRow_(rows, 'angle', this.diagnostic.angle,
+ tr.v.ui.ANGLE_REVISION_HOST);
+ this.buildRow_(rows, 'skia', this.diagnostic.skia,
+ tr.v.ui.SKIA_REVISION_HOST);
+ this.buildRow_(rows, 'webrtc', this.diagnostic.webrtc,
+ tr.v.ui.WEBRTC_REVISION_HOST);
+
+ this.$.table.tableRows = rows;
+ }
+});
+</script>
« no previous file with comments | « tracing/tracing/value/ui/diagnostic_span.html ('k') | tracing/tracing/value/ui/merged_revision_info_span_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698