OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <!-- |
| 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 |
| 5 found in the LICENSE file. |
| 6 --> |
| 7 |
| 8 <link rel="import" href="/components/iron-selector/iron-selector.html"> |
| 9 |
| 10 <link rel="import" href="/dashboard/pinpoint/elements/base-style.html"> |
| 11 |
| 12 <dom-module id="execution-status"> |
| 13 <template> |
| 14 <style include="base-style"> |
| 15 #exception { |
| 16 font-size: 0.5em; |
| 17 white-space: pre-wrap; |
| 18 } |
| 19 |
| 20 #status-boxes { |
| 21 display: flex; |
| 22 height: 1em; |
| 23 margin: 0.5em -1px; |
| 24 } |
| 25 |
| 26 .status-box { |
| 27 flex: 1; |
| 28 margin: 0 1px; |
| 29 } |
| 30 |
| 31 .completed { |
| 32 background-color: var(--paper-green-500); |
| 33 } |
| 34 |
| 35 .completed:hover, |
| 36 .completed.iron-selected { |
| 37 background-color: var(--paper-green-700); |
| 38 } |
| 39 |
| 40 .failed { |
| 41 background-color: var(--paper-red-500); |
| 42 } |
| 43 |
| 44 .failed:hover, |
| 45 .failed.iron-selected { |
| 46 background-color: var(--paper-red-700); |
| 47 } |
| 48 |
| 49 .running { |
| 50 background-color: var(--paper-grey-500); |
| 51 } |
| 52 |
| 53 .running:hover, |
| 54 .running.iron-selected { |
| 55 background-color: var(--paper-grey-700); |
| 56 } |
| 57 |
| 58 th { |
| 59 text-align: right; |
| 60 width: 8em; |
| 61 } |
| 62 </style> |
| 63 |
| 64 <iron-selector id="status-boxes" selected="{{attemptIndex}}"> |
| 65 <template is="dom-repeat" items="[[attempts]]"> |
| 66 <div id="status-box-[[index]]-[[questIndex]]" |
| 67 class$="status-box [[status(item, questIndex)]]"> |
| 68 </div> |
| 69 </template> |
| 70 </iron-selector> |
| 71 <template is="dom-if" if="[[exception(attemptIndex, questIndex)]]"> |
| 72 <p id="exception">[[exception(attemptIndex, questIndex)]]</p> |
| 73 </template> |
| 74 <table> |
| 75 <template is="dom-repeat" items="[[executionDetails(attemptIndex, questInd
ex)]]"> |
| 76 <tr> |
| 77 <th>[[item.key]] |
| 78 <td> |
| 79 <template is="dom-if" if="[[item.url]]"> |
| 80 <a href="[[item.url]]" target="_blank">[[item.value]]</a> |
| 81 </template> |
| 82 <template is="dom-if" if="[[!item.url]]"> |
| 83 [[item.value]] |
| 84 </template> |
| 85 </tr> |
| 86 </template> |
| 87 </table> |
| 88 </template> |
| 89 |
| 90 <script> |
| 91 'use strict'; |
| 92 Polymer({ |
| 93 is: 'execution-status', |
| 94 |
| 95 properties: { |
| 96 attempts: { |
| 97 type: Object, |
| 98 }, |
| 99 |
| 100 attemptIndex: { |
| 101 type: Number, |
| 102 notify: true, |
| 103 }, |
| 104 |
| 105 questIndex: { |
| 106 type: Number, |
| 107 }, |
| 108 }, |
| 109 |
| 110 status(attempt, questIndex) { |
| 111 const execution = attempt.executions[questIndex]; |
| 112 if (execution.exception) { |
| 113 return 'failed'; |
| 114 } |
| 115 if (execution.completed) { |
| 116 return 'completed'; |
| 117 } |
| 118 return 'running'; |
| 119 }, |
| 120 |
| 121 exception(attemptIndex, questIndex) { |
| 122 return this.attempts[attemptIndex].executions[questIndex].exception; |
| 123 }, |
| 124 |
| 125 executionDetails(attemptIndex, questIndex) { |
| 126 const execution = this.attempts[attemptIndex].executions[questIndex]; |
| 127 const details = |
| 128 Object.assign(execution.details, execution.result_arguments); |
| 129 |
| 130 const executionDetails = []; |
| 131 for (const key in details) { |
| 132 const value = details[key]; |
| 133 if (!value) { |
| 134 continue; |
| 135 } |
| 136 |
| 137 let url = ''; |
| 138 if (key == 'bot_id') { |
| 139 url = 'https://chromium-swarm.appspot.com/bot?id=' + value; |
| 140 } else if (key == 'build') { |
| 141 // TODO: Buildbucket doesn't have a UI. Provide some kind of link. |
| 142 } else if (key == 'isolate_hash') { |
| 143 url = 'https://isolateserver.appspot.com/browse?digest=' + value; |
| 144 } else if (key == 'task_id') { |
| 145 url = 'https://chromium-swarm.appspot.com/task?id=' + value; |
| 146 } |
| 147 |
| 148 executionDetails.push({key, value, url}); |
| 149 } |
| 150 return executionDetails; |
| 151 }, |
| 152 }); |
| 153 </script> |
| 154 </dom-module> |
OLD | NEW |