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

Unified Diff: golden/res/imp/commit-panel.html

Issue 1200343002: gold: ByBlame WIP (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: rebase Created 5 years, 6 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
« no previous file with comments | « golden/go/skiacorrectness/main2.go ('k') | golden/res/imp/testsummarydetails.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: golden/res/imp/commit-panel.html
diff --git a/golden/res/imp/commit-panel.html b/golden/res/imp/commit-panel.html
new file mode 100644
index 0000000000000000000000000000000000000000..5ad95a617e3ac7c5fdacf5a3a609859c0fb01c4f
--- /dev/null
+++ b/golden/res/imp/commit-panel.html
@@ -0,0 +1,77 @@
+<!-- The <commits-panel-sk> custom element declaration.
+
+ An element to display information on one or more commits.
+
+ Attributes:
+ mailbox - The sk.Mailbox name to listen for the data to populate
+ the element. The mailbox data needs to be a serialized slice
+ of []*types.Commit.
+
+ Events:
+ None.
+
+ Methods:
+ None.
+
+
+-->
+<polymer-element name="commits-panel-sk">
+ <template>
+ <table>
+ <template repeat="{{c in commitinfo}}">
+ <tr>
+ <td>{{c.author}}</td>
+ <td>{{c.commit_time | humanize}}</td>
+ <td><a href="https://skia.googlesource.com/skia/+/{{c.hash}}">{{c.hash | trunc}}</a></td>
+ <td>{{c.message}}</td>
+ </tr>
+ </template>
+ </table>
+ </template>
+ <script>
+ Polymer({
+ publish: {
+ mailbox: {
+ value: "",
+ reflect: true,
+ },
+ },
+
+ ready: function() {
+ sk.Mailbox.subscribe(this.mailbox, function(info) {
+ this.commitinfo = info;
+ this.populateCommitMessage();
+ }.bind(this));
+ },
+
+ populateCommitMessage: function() {
+ if (this.commitinfo && this.commitinfo.length && this.commitinfo[0].message == undefined) {
+ var lastHash = this.commitinfo[0].hash;
+ var url = "https://skia.googlesource.com/skia/+log/" + lastHash + "~" + this.commitinfo.length + ".." + lastHash + "?format=json";
+ sk.get(url).then(this.removeSecurityHeader).then(JSON.parse).then(function(json) {
+ var len = this.commitinfo.length;
+ for (var i=0; i<json.log.length; i++) {
+ this.commitinfo[i].message = json.log[i].message.slice(0, 60);
+ }
+ }.bind(this));
+ }
+ },
+
+ // removeSecurityHeader strips the first 4 chars from the input. Needed
+ // since googlesource.com prefixes all JSON responses with )]}' as an
+ // XSS defense.
+ removeSecurityHeader: function(s) {
+ return s.slice(4, s.length);
+ },
+
+ humanize: function(s) {
+ return sk.human.diffDate(s*1000);
+ },
+
+ trunc: function(s) {
+ return s.slice(0, 7);
+ }
+
+ });
+ </script>
+</polymer-element>
« no previous file with comments | « golden/go/skiacorrectness/main2.go ('k') | golden/res/imp/testsummarydetails.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698