| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright 2017 The Chromium Authors. All rights reserved. | 3 Copyright 2017 The Chromium Authors. All rights reserved. |
| 4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. | 5 found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 | 7 |
| 8 <link rel="import" href="/dashboard/pinpoint/elements/base-style.html"> | 8 <link rel="import" href="/dashboard/pinpoint/elements/base-style.html"> |
| 9 <link rel="import" href="/dashboard/pinpoint/elements/loading-wrapper.html"> | 9 <link rel="import" href="/dashboard/pinpoint/elements/loading-wrapper.html"> |
| 10 | 10 |
| 11 <dom-module id="dep-info"> | 11 <dom-module id="change-info"> |
| 12 <template> | 12 <template> |
| 13 <style include="base-style"> | 13 <style include="base-style"> |
| 14 h3 { | 14 h3 { |
| 15 font-weight: normal; | 15 font-weight: normal; |
| 16 margin-bottom: 0.2em; | 16 margin-bottom: 0.2em; |
| 17 } | 17 } |
| 18 </style> | 18 </style> |
| 19 | 19 |
| 20 <div> | 20 <div> |
| 21 <loading-wrapper id="loader"> | 21 <loading-wrapper id="loader"> |
| 22 <h3> | 22 <h3> |
| 23 <a href="[[dep.url]]" target="_blank">[[subject]]</a> | 23 <a href="[[url(change)]]" target="_blank">[[subject]]</a> |
| 24 </h3> | 24 </h3> |
| 25 <p class="byline"> | 25 <p class="byline"> |
| 26 By [[author]]<span class="middle-dot"></span>[[time]] | 26 By [[author]]<span class="middle-dot"></span>[[time]] |
| 27 </p> | 27 </p> |
| 28 </loading-wrapper> | 28 </loading-wrapper> |
| 29 </div> | 29 </div> |
| 30 </template> | 30 </template> |
| 31 | 31 |
| 32 <script> | 32 <script> |
| 33 'use strict'; | 33 'use strict'; |
| 34 Polymer({ | 34 Polymer({ |
| 35 is: 'dep-info', | 35 is: 'change-info', |
| 36 | 36 |
| 37 properties: { | 37 properties: { |
| 38 dep: { | 38 change: { |
| 39 type: Object, | 39 type: Object, |
| 40 observer: '_depChanged' | 40 observer: '_changeChanged' |
| 41 }, | 41 } |
| 42 }, | 42 }, |
| 43 | 43 |
| 44 async _depChanged() { | 44 lastCommit(change) { |
| 45 return change.commits[change.commits.length - 1]; |
| 46 }, |
| 47 |
| 48 url(change) { |
| 49 return this.lastCommit(change).url; |
| 50 }, |
| 51 |
| 52 async _changeChanged() { |
| 53 const commit = this.lastCommit(this.change); |
| 45 const params = { | 54 const params = { |
| 46 repository: this.dep.repository, | 55 repository: commit.repository, |
| 47 git_hash_1: this.dep.git_hash | 56 git_hash_1: commit.git_hash |
| 48 }; | 57 }; |
| 49 const response = await this.$.loader.load('/api/gitiles', params); | 58 const response = await this.$.loader.load('/api/gitiles', params); |
| 50 if (response) { | 59 if (response) { |
| 51 this.subject = response.message.split('\n')[0]; | 60 this.subject = response.message.split('\n')[0]; |
| 52 this.author = response.author.email; | 61 this.author = response.author.email; |
| 53 this.time = new Date(response.committer.time + 'Z').toLocaleString(); | 62 this.time = new Date(response.committer.time + 'Z').toLocaleString(); |
| 54 } | 63 } |
| 55 } | 64 }, |
| 56 }); | 65 }); |
| 57 </script> | 66 </script> |
| 58 </dom-module> | 67 </dom-module> |
| 59 | |
| 60 <dom-module id="change-info"> | |
| 61 <template> | |
| 62 <dep-info dep="[[change.base_commit]]"></dep-info> | |
| 63 <template is="dom-repeat" items="[[change.deps]]"> | |
| 64 <dep-info dep="[[item]]"></dep-info> | |
| 65 </template> | |
| 66 </template> | |
| 67 | |
| 68 <script> | |
| 69 'use strict'; | |
| 70 Polymer({ | |
| 71 is: 'change-info', | |
| 72 | |
| 73 properties: { | |
| 74 change: { | |
| 75 type: Object, | |
| 76 } | |
| 77 } | |
| 78 }); | |
| 79 </script> | |
| 80 </dom-module> | |
| OLD | NEW |