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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 }); | 43 }); |
44 | 44 |
45 ui.notifications.Notification = base.extends('li', { | 45 ui.notifications.Notification = base.extends('li', { |
46 init: function() | 46 init: function() |
47 { | 47 { |
48 this._how = this.appendChild(document.createElement('div')); | 48 this._how = this.appendChild(document.createElement('div')); |
49 this._how.className = 'how'; | 49 this._how.className = 'how'; |
50 this._what = this.appendChild(document.createElement('div')); | 50 this._what = this.appendChild(document.createElement('div')); |
51 this._what.className = 'what'; | 51 this._what.className = 'what'; |
52 this._index = 0; | 52 this._index = 0; |
53 $(this).hide().fadeIn('fast'); | 53 // FIXME: Why is this requestAnimationFrame needed to make the |
| 54 // animation happen? |
| 55 requestAnimationFrame(function() { |
| 56 this.animate([ |
| 57 {opacity: '0'}, |
| 58 {opacity: '1'}, |
| 59 ], 200); |
| 60 }.bind(this)); |
54 }, | 61 }, |
55 dismiss: function() | 62 dismiss: function() |
56 { | 63 { |
57 // FIXME: These fade in/out effects are lame. | 64 this.animate([ |
58 $(this).fadeOut(function() | 65 {opacity: '1'}, |
59 { | 66 {opacity: '0'}, |
60 this.parentNode && this.parentNode.removeChild(this); | 67 ], 200).onfinish = this.remove.bind(this); |
61 }); | |
62 }, | 68 }, |
63 }); | 69 }); |
64 | 70 |
65 ui.notifications.Info = base.extends(ui.notifications.Notification, { | 71 ui.notifications.Info = base.extends(ui.notifications.Notification, { |
66 init: function(message) | 72 init: function(message) |
67 { | 73 { |
68 this.update(message); | 74 this.update(message); |
69 }, | 75 }, |
70 update: function(message) | 76 update: function(message) |
71 { | 77 { |
72 this._what.textContent = message; | 78 this._what.textContent = message; |
73 }, | 79 }, |
74 updateWithNode: function(node) | 80 updateWithNode: function(node) |
75 { | 81 { |
76 $(this._what).empty(); | 82 this._what.innerHTML = ''; |
77 this._what.appendChild(node); | 83 this._what.appendChild(node); |
78 } | 84 } |
79 }); | 85 }); |
80 | 86 |
81 ui.notifications.FailingTestGroup = base.extends('li', { | 87 ui.notifications.FailingTestGroup = base.extends('li', { |
82 init: function(groupName, testNameList) | 88 init: function(groupName, testNameList) |
83 { | 89 { |
84 this.appendChild(ui.createLinkNode(ui.urlForFlakinessDashboard(testNameL
ist), groupName)); | 90 this.appendChild(ui.createLinkNode(ui.urlForFlakinessDashboard(testNameL
ist), groupName)); |
85 } | 91 } |
86 }); | 92 }); |
(...skipping 29 matching lines...) Expand all Loading... |
116 _addDetail: function(part, commitData, linkFunction) | 122 _addDetail: function(part, commitData, linkFunction) |
117 { | 123 { |
118 var content = commitData[part]; | 124 var content = commitData[part]; |
119 if (!content) | 125 if (!content) |
120 return; | 126 return; |
121 | 127 |
122 var span = this._details.appendChild(document.createElement('span')); | 128 var span = this._details.appendChild(document.createElement('span')); |
123 span.className = part; | 129 span.className = part; |
124 | 130 |
125 if (linkFunction) { | 131 if (linkFunction) { |
126 var parts = $.isArray(content) ? content : [content]; | 132 var parts = Array.isArray(content) ? content : [content]; |
127 parts.forEach(function(item, index) { | 133 parts.forEach(function(item, index) { |
128 if (index > 0) | 134 if (index > 0) |
129 span.appendChild(document.createTextNode(', ')); | 135 span.appendChild(document.createTextNode(', ')); |
130 var link = ui.createLinkNode(linkFunction(item), item); | 136 var link = ui.createLinkNode(linkFunction(item), item); |
131 link.className = part + '-item'; | 137 link.className = part + '-item'; |
132 span.appendChild(link); | 138 span.appendChild(link); |
133 }); | 139 }); |
134 } else { | 140 } else { |
135 span.textContent = content; | 141 span.textContent = content; |
136 } | 142 } |
(...skipping 26 matching lines...) Expand all Loading... |
163 }, | 169 }, |
164 containsFailureAnalysis: function(failureAnalysis) | 170 containsFailureAnalysis: function(failureAnalysis) |
165 { | 171 { |
166 return this._testNameList.indexOf(failureAnalysis.testName) != -1; | 172 return this._testNameList.indexOf(failureAnalysis.testName) != -1; |
167 }, | 173 }, |
168 addFailureAnalysis: function(failureAnalysis) | 174 addFailureAnalysis: function(failureAnalysis) |
169 { | 175 { |
170 if (this.containsFailureAnalysis(failureAnalysis)) | 176 if (this.containsFailureAnalysis(failureAnalysis)) |
171 return false; | 177 return false; |
172 this._testNameList.push(failureAnalysis.testName); | 178 this._testNameList.push(failureAnalysis.testName); |
173 $(this._effects).empty(); | 179 this._effects.innerHTML = ''; |
174 this._forEachTestGroup(function(groupName, testNameList) { | 180 this._forEachTestGroup(function(groupName, testNameList) { |
175 this._effects.appendChild(new ui.notifications.FailingTestGroup(grou
pName, testNameList)) | 181 this._effects.appendChild(new ui.notifications.FailingTestGroup(grou
pName, testNameList)) |
176 }.bind(this)); | 182 }.bind(this)); |
177 return true; | 183 return true; |
178 }, | 184 }, |
179 _forEachTestGroup: function(callback) | 185 _forEachTestGroup: function(callback) |
180 { | 186 { |
181 var individualTests = []; | 187 var individualTests = []; |
182 base.forEachDirectory(this._testNameList, function(groupLabel, testsInDi
rectory) { | 188 base.forEachDirectory(this._testNameList, function(groupLabel, testsInDi
rectory) { |
183 if (testsInDirectory.length <= kMaxTestsPerGroup) { | 189 if (testsInDirectory.length <= kMaxTestsPerGroup) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 }); | 222 }); |
217 | 223 |
218 ui.notifications.BuildersFailing = base.extends(ui.notifications.Failure, { | 224 ui.notifications.BuildersFailing = base.extends(ui.notifications.Failure, { |
219 init: function(message) | 225 init: function(message) |
220 { | 226 { |
221 if (message) | 227 if (message) |
222 this._problem.insertBefore(document.createTextNode(message + ':'), t
his._problem.firstChild); | 228 this._problem.insertBefore(document.createTextNode(message + ':'), t
his._problem.firstChild); |
223 }, | 229 }, |
224 setFailingBuilders: function(failuresList) | 230 setFailingBuilders: function(failuresList) |
225 { | 231 { |
226 $(this._effects).empty().append(Object.keys(failuresList).map(function(b
uilderName) { | 232 this._effects.innerHTML = ''; |
| 233 Object.keys(failuresList).map(function(builderName) { |
227 var effect = document.createElement('li'); | 234 var effect = document.createElement('li'); |
228 effect.className = 'builder'; | 235 effect.className = 'builder'; |
229 effect.appendChild(new ui.failures.Builder(builderName, failuresList
[builderName])); | 236 effect.appendChild(new ui.failures.Builder(builderName, failuresList
[builderName])); |
230 return effect; | 237 this._effects.appendChild(effect); |
231 })); | 238 }.bind(this)); |
232 } | 239 } |
233 }); | 240 }); |
234 | 241 |
235 })(); | 242 })(); |
OLD | NEW |