| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 ui.notifications.SuspiciousCommit = base.extends(Cause, { | 111 ui.notifications.SuspiciousCommit = base.extends(Cause, { |
| 112 init: function(commitData) | 112 init: function(commitData) |
| 113 { | 113 { |
| 114 this._revision = commitData.revision; | 114 this._revision = commitData.revision; |
| 115 this._description.appendChild(base.createLinkNode(trac.changesetURL(comm
itData.revision), commitData.revision)); | 115 this._description.appendChild(base.createLinkNode(trac.changesetURL(comm
itData.revision), commitData.revision)); |
| 116 this._details = this._description.appendChild(document.createElement('sp
an')); | 116 this._details = this._description.appendChild(document.createElement('sp
an')); |
| 117 this._addDetail('title', commitData); | 117 this._addDetail('title', commitData); |
| 118 this._addDetail('author', commitData); | 118 this._addDetail('author', commitData); |
| 119 this._addDetail('reviewer', commitData); | 119 this._addDetail('reviewer', commitData); |
| 120 // FIXME: Add bugID detail. | 120 this._addDetail('bugID', commitData, |
| 121 // this._addDetail('bugID', commitData, bugzilla.bugURL); | 121 ui.urlForCrbug, |
| 122 function(value) { |
| 123 return value.split(/\s*,\s*/); |
| 124 } |
| 125 ); |
| 122 }, | 126 }, |
| 123 hasRevision: function(revision) | 127 hasRevision: function(revision) |
| 124 { | 128 { |
| 125 return this._revision == revision; | 129 return this._revision == revision; |
| 126 }, | 130 }, |
| 127 _addDetail: function(part, commitData, linkFunction) | 131 _addDetail: function(part, commitData, linkFunction) |
| 128 { | 132 { |
| 129 var content = commitData[part]; | 133 var content = commitData[part]; |
| 130 if (!content) | 134 if (!content) |
| 131 return; | 135 return; |
| 132 | 136 |
| 133 var span = this._details.appendChild(document.createElement('span')); | 137 var span = this._details.appendChild(document.createElement('span')); |
| 134 span.className = part; | 138 span.className = part; |
| 135 | 139 |
| 136 if (linkFunction) { | 140 if (linkFunction) { |
| 137 var link = base.createLinkNode(linkFunction(content), content); | 141 var parts = $.isArray(content) ? content : [content]; |
| 138 span.appendChild(link); | 142 parts.forEach(function(item, index) { |
| 139 } else | 143 if (index > 0) |
| 144 span.appendChild(document.createTextNode(', ')); |
| 145 var link = base.createLinkNode(linkFunction(item), item); |
| 146 link.className = part + '-item'; |
| 147 span.appendChild(link); |
| 148 }); |
| 149 } else { |
| 140 span.textContent = content; | 150 span.textContent = content; |
| 151 } |
| 141 } | 152 } |
| 142 }); | 153 }); |
| 143 | 154 |
| 144 ui.notifications.Failure = base.extends(ui.notifications.Notification, { | 155 ui.notifications.Failure = base.extends(ui.notifications.Notification, { |
| 145 init: function() | 156 init: function() |
| 146 { | 157 { |
| 147 this._time = this._how.appendChild(new ui.RelativeTime()); | 158 this._time = this._how.appendChild(new ui.RelativeTime()); |
| 148 this._problem = this._what.appendChild(document.createElement('div')); | 159 this._problem = this._what.appendChild(document.createElement('div')); |
| 149 this._problem.className = 'problem'; | 160 this._problem.className = 'problem'; |
| 150 this._effects = this._problem.appendChild(document.createElement('ul')); | 161 this._effects = this._problem.appendChild(document.createElement('ul')); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 $(this._effects).empty().append(Object.keys(failuresList).map(function(b
uilderName) { | 266 $(this._effects).empty().append(Object.keys(failuresList).map(function(b
uilderName) { |
| 256 var effect = document.createElement('li'); | 267 var effect = document.createElement('li'); |
| 257 effect.className = 'builder'; | 268 effect.className = 'builder'; |
| 258 effect.appendChild(new ui.failures.Builder(builderName, failuresList
[builderName])); | 269 effect.appendChild(new ui.failures.Builder(builderName, failuresList
[builderName])); |
| 259 return effect; | 270 return effect; |
| 260 })); | 271 })); |
| 261 } | 272 } |
| 262 }); | 273 }); |
| 263 | 274 |
| 264 })(); | 275 })(); |
| OLD | NEW |