Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: Tools/GardeningServer/scripts/ui/notifications.js

Issue 359283003: Remove usages of jquery and add sugar.js from garden-o-matic. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove jquery script from ct-sheriff-o-matic Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 requestAnimationFrame(function() {
54 this.animate([
55 {opacity: '0'},
56 {opacity: '1'},
57 ], 200);
58 }.bind(this));
abarth-chromium 2014/06/30 04:26:03 What's the point of using requestAnimationFrame?
ojan 2014/06/30 04:49:59 It didn't work to do it synchronously. I didn't fe
54 }, 59 },
55 dismiss: function() 60 dismiss: function()
56 { 61 {
57 // FIXME: These fade in/out effects are lame. 62 this.animate([
58 $(this).fadeOut(function() 63 {opacity: '1'},
59 { 64 {opacity: '0'},
60 this.parentNode && this.parentNode.removeChild(this); 65 ], 200).onfinish = this.remove.bind(this);
61 });
62 }, 66 },
63 }); 67 });
64 68
65 ui.notifications.Info = base.extends(ui.notifications.Notification, { 69 ui.notifications.Info = base.extends(ui.notifications.Notification, {
66 init: function(message) 70 init: function(message)
67 { 71 {
68 this.update(message); 72 this.update(message);
69 }, 73 },
70 update: function(message) 74 update: function(message)
71 { 75 {
72 this._what.textContent = message; 76 this._what.textContent = message;
73 }, 77 },
74 updateWithNode: function(node) 78 updateWithNode: function(node)
75 { 79 {
76 $(this._what).empty(); 80 this._what.innerHTML = '';
77 this._what.appendChild(node); 81 this._what.appendChild(node);
78 } 82 }
79 }); 83 });
80 84
81 ui.notifications.FailingTestGroup = base.extends('li', { 85 ui.notifications.FailingTestGroup = base.extends('li', {
82 init: function(groupName, testNameList) 86 init: function(groupName, testNameList)
83 { 87 {
84 this.appendChild(ui.createLinkNode(ui.urlForFlakinessDashboard(testNameL ist), groupName)); 88 this.appendChild(ui.createLinkNode(ui.urlForFlakinessDashboard(testNameL ist), groupName));
85 } 89 }
86 }); 90 });
(...skipping 29 matching lines...) Expand all
116 _addDetail: function(part, commitData, linkFunction) 120 _addDetail: function(part, commitData, linkFunction)
117 { 121 {
118 var content = commitData[part]; 122 var content = commitData[part];
119 if (!content) 123 if (!content)
120 return; 124 return;
121 125
122 var span = this._details.appendChild(document.createElement('span')); 126 var span = this._details.appendChild(document.createElement('span'));
123 span.className = part; 127 span.className = part;
124 128
125 if (linkFunction) { 129 if (linkFunction) {
126 var parts = $.isArray(content) ? content : [content]; 130 var parts = Array.isArray(content) ? content : [content];
127 parts.forEach(function(item, index) { 131 parts.forEach(function(item, index) {
128 if (index > 0) 132 if (index > 0)
129 span.appendChild(document.createTextNode(', ')); 133 span.appendChild(document.createTextNode(', '));
130 var link = ui.createLinkNode(linkFunction(item), item); 134 var link = ui.createLinkNode(linkFunction(item), item);
131 link.className = part + '-item'; 135 link.className = part + '-item';
132 span.appendChild(link); 136 span.appendChild(link);
133 }); 137 });
134 } else { 138 } else {
135 span.textContent = content; 139 span.textContent = content;
136 } 140 }
(...skipping 26 matching lines...) Expand all
163 }, 167 },
164 containsFailureAnalysis: function(failureAnalysis) 168 containsFailureAnalysis: function(failureAnalysis)
165 { 169 {
166 return this._testNameList.indexOf(failureAnalysis.testName) != -1; 170 return this._testNameList.indexOf(failureAnalysis.testName) != -1;
167 }, 171 },
168 addFailureAnalysis: function(failureAnalysis) 172 addFailureAnalysis: function(failureAnalysis)
169 { 173 {
170 if (this.containsFailureAnalysis(failureAnalysis)) 174 if (this.containsFailureAnalysis(failureAnalysis))
171 return false; 175 return false;
172 this._testNameList.push(failureAnalysis.testName); 176 this._testNameList.push(failureAnalysis.testName);
173 $(this._effects).empty(); 177 this._effects.innerHTML = '';
174 this._forEachTestGroup(function(groupName, testNameList) { 178 this._forEachTestGroup(function(groupName, testNameList) {
175 this._effects.appendChild(new ui.notifications.FailingTestGroup(grou pName, testNameList)) 179 this._effects.appendChild(new ui.notifications.FailingTestGroup(grou pName, testNameList))
176 }.bind(this)); 180 }.bind(this));
177 return true; 181 return true;
178 }, 182 },
179 _forEachTestGroup: function(callback) 183 _forEachTestGroup: function(callback)
180 { 184 {
181 var individualTests = []; 185 var individualTests = [];
182 base.forEachDirectory(this._testNameList, function(groupLabel, testsInDi rectory) { 186 base.forEachDirectory(this._testNameList, function(groupLabel, testsInDi rectory) {
183 if (testsInDirectory.length <= kMaxTestsPerGroup) { 187 if (testsInDirectory.length <= kMaxTestsPerGroup) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 }); 220 });
217 221
218 ui.notifications.BuildersFailing = base.extends(ui.notifications.Failure, { 222 ui.notifications.BuildersFailing = base.extends(ui.notifications.Failure, {
219 init: function(message) 223 init: function(message)
220 { 224 {
221 if (message) 225 if (message)
222 this._problem.insertBefore(document.createTextNode(message + ':'), t his._problem.firstChild); 226 this._problem.insertBefore(document.createTextNode(message + ':'), t his._problem.firstChild);
223 }, 227 },
224 setFailingBuilders: function(failuresList) 228 setFailingBuilders: function(failuresList)
225 { 229 {
226 $(this._effects).empty().append(Object.keys(failuresList).map(function(b uilderName) { 230 this._effects.innerHTML = '';
231 Object.keys(failuresList).map(function(builderName) {
227 var effect = document.createElement('li'); 232 var effect = document.createElement('li');
228 effect.className = 'builder'; 233 effect.className = 'builder';
229 effect.appendChild(new ui.failures.Builder(builderName, failuresList [builderName])); 234 effect.appendChild(new ui.failures.Builder(builderName, failuresList [builderName]));
230 return effect; 235 this._effects.appendChild(effect);
231 })); 236 }.bind(this));
232 } 237 }
233 }); 238 });
234 239
235 })(); 240 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698