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 function(bugID) { |
122 return 'http://crbug.com/' + bugID; | |
apavlov
2014/02/28 13:15:25
Any suggestions on this? Should the base URL resid
| |
123 }, | |
124 function(value) { | |
125 return value.split(/\s*,\s*/); | |
126 } | |
127 ); | |
122 }, | 128 }, |
123 hasRevision: function(revision) | 129 hasRevision: function(revision) |
124 { | 130 { |
125 return this._revision == revision; | 131 return this._revision == revision; |
126 }, | 132 }, |
127 _addDetail: function(part, commitData, linkFunction) | 133 _addDetail: function(part, commitData, linkFunction) |
128 { | 134 { |
129 var content = commitData[part]; | 135 var content = commitData[part]; |
130 if (!content) | 136 if (!content) |
131 return; | 137 return; |
132 | 138 |
133 var span = this._details.appendChild(document.createElement('span')); | 139 var span = this._details.appendChild(document.createElement('span')); |
134 span.className = part; | 140 span.className = part; |
135 | 141 |
136 if (linkFunction) { | 142 if (linkFunction) { |
137 var link = base.createLinkNode(linkFunction(content), content); | 143 var parts = $.isArray(content) ? content : [content]; |
138 span.appendChild(link); | 144 parts.forEach(function(item, index) { |
139 } else | 145 if (index > 0) |
146 span.appendChild(document.createTextNode(', ')); | |
147 var link = base.createLinkNode(linkFunction(item), item); | |
148 link.className = part + '-item'; | |
149 span.appendChild(link); | |
150 }); | |
151 } else { | |
140 span.textContent = content; | 152 span.textContent = content; |
153 } | |
141 } | 154 } |
142 }); | 155 }); |
143 | 156 |
144 ui.notifications.Failure = base.extends(ui.notifications.Notification, { | 157 ui.notifications.Failure = base.extends(ui.notifications.Notification, { |
145 init: function() | 158 init: function() |
146 { | 159 { |
147 this._time = this._how.appendChild(new ui.RelativeTime()); | 160 this._time = this._how.appendChild(new ui.RelativeTime()); |
148 this._problem = this._what.appendChild(document.createElement('div')); | 161 this._problem = this._what.appendChild(document.createElement('div')); |
149 this._problem.className = 'problem'; | 162 this._problem.className = 'problem'; |
150 this._effects = this._problem.appendChild(document.createElement('ul')); | 163 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) { | 268 $(this._effects).empty().append(Object.keys(failuresList).map(function(b uilderName) { |
256 var effect = document.createElement('li'); | 269 var effect = document.createElement('li'); |
257 effect.className = 'builder'; | 270 effect.className = 'builder'; |
258 effect.appendChild(new ui.failures.Builder(builderName, failuresList [builderName])); | 271 effect.appendChild(new ui.failures.Builder(builderName, failuresList [builderName])); |
259 return effect; | 272 return effect; |
260 })); | 273 })); |
261 } | 274 } |
262 }); | 275 }); |
263 | 276 |
264 })(); | 277 })(); |
OLD | NEW |