@@ -10,9 +10,8 @@ app.controller('SQCntl', ['DataService', '$interval', '$location', SQCntl]);
1010function SQCntl ( dataService , $interval , $location ) {
1111 var self = this ;
1212 self . prs = { } ;
13- self . builds = { } ;
14- self . nonBlockingBuilds = { } ;
1513 self . health = { } ;
14+ self . testResults = { } ;
1615 self . lastMergeTime = Date ( ) ;
1716 self . prQuerySearch = prQuerySearch ;
1817 self . historyQuerySearch = historyQuerySearch ;
@@ -102,8 +101,8 @@ function SQCntl(dataService, $interval, $location) {
102101
103102 // This data is shown in a top banner (when the Queue is blocked),
104103 // so it's always loaded.
105- refreshGoogleInternalCI ( ) ;
106- $interval ( refreshGoogleInternalCI , 60000 ) ; // Refresh every minute
104+ refreshContinuousTests ( ) ;
105+ $interval ( refreshContinuousTests , 60000 ) ; // Refresh every minute
107106
108107 // Request Avatars that are only as large necessary (CSS limits them to 40px)
109108 function fixPRAvatars ( prs ) {
@@ -166,24 +165,22 @@ function SQCntl(dataService, $interval, $location) {
166165 var percentStable = self . health . NumStable * 100.0 / self . health . TotalLoops ;
167166 self . OverallHealth = Math . round ( percentStable ) + "%" ;
168167 }
169- updateBuildStability ( self . builds , self . nonBlockingBuilds , self . health ) ;
168+ updateBuildStability ( self . testResults . blockingBuilds , self . testResults . nonBlockingBuilds , self . health ) ;
170169 } ) ;
171170 }
172171
173- function refreshGoogleInternalCI ( ) {
172+ function refreshContinuousTests ( ) {
174173 dataService . getData ( 'google-internal-ci' ) . then ( function successCallback ( response ) {
175- var result = getE2E ( response . data ) ;
176- self . builds = result . builds ;
177- self . nonBlockingBuilds = result . nonBlockingBuilds ;
178- updateBuildStability ( self . builds , self . nonBlockingBuilds , self . health ) ;
179- self . failedBuild = result . failedBuild ;
174+ self . testResults = processTests ( response . data ) ;
175+ updateBuildStability ( self . testResults . blockingBuilds , self . testResults . nonBlockingBuilds , self . health ) ;
180176 } ) ;
181177 }
182178
183- function getE2E ( builds ) {
184- var result = [ ] ;
179+ function processTests ( builds ) {
180+ var blockingResult = [ ] ;
185181 var nonBlockingResult = [ ] ;
186- var failedBuild = false ;
182+ var redBuilds = false ;
183+ var yellowBuilds = false ;
187184 angular . forEach ( builds , function ( job , key ) {
188185 var obj = {
189186 'name' : key ,
@@ -199,19 +196,21 @@ function SQCntl(dataService, $interval, $location) {
199196 // red X mark
200197 obj . state = '\u2716' ;
201198 obj . color = 'red' ;
202- failedBuild = true ;
199+ redBuilds = true ;
203200 break ;
204201 case 'Ignorable flake' :
205202 // orange X mark
206203 obj . state = '\u2716' ;
207- obj . color = 'orange ' ;
204+ obj . color = '#FF8A65 ' ;
208205 obj . msg = 'Flake!' ;
206+ yellowBuilds = true ;
209207 break ;
210208 case 'Problem Resolved' :
211209 // orange X mark
212210 obj . state = '\u2716' ;
213- obj . color = 'orange ' ;
211+ obj . color = '#FF8A65 ' ;
214212 obj . msg = 'Manual override' ;
213+ yellowBuilds = true ;
215214 break ;
216215 case '[nonblocking] Stable' :
217216 // green check mark
@@ -222,41 +221,49 @@ function SQCntl(dataService, $interval, $location) {
222221 case '[nonblocking] Not Stable' :
223222 // orange X mark
224223 obj . state = '\u2716' ;
225- obj . color = 'orange ' ;
224+ obj . color = '#FF8A65 ' ;
226225 obj . msg = '[nonblocking]' ;
227226 break ;
228227 case '[nonblocking] Ignorable flake' :
229228 // orange X mark
230229 obj . state = '\u2716' ;
231- obj . color = 'orange ' ;
232- obj . msg = '[nonblocking]' ;
230+ obj . color = '#FF8A65 ' ;
231+ obj . msg = '[nonblocking] Flake! ' ;
233232 break ;
234233 default :
235234 obj . state = 'Error' ;
236235 obj . color = 'red' ;
237236 obj . msg = job . Status ;
238- failedBuild = true ;
237+ redBuilds = true ;
239238 }
240239 obj . stability = '' ;
241240 if ( ! obj . msg ) {
242- result . push ( obj ) ;
241+ blockingResult . push ( obj ) ;
243242 } else {
244243 if ( obj . msg . includes ( '[nonblocking]' ) ) {
245244 obj . msg = obj . msg . replace ( '[nonblocking]' , '' ) ;
246245 nonBlockingResult . push ( obj ) ;
247246 } else {
248- result . push ( obj ) ;
247+ blockingResult . push ( obj ) ;
249248 }
250249 }
251250 } ) ;
251+ if ( redBuilds ) {
252+ yellowBuilds = false ;
253+ }
252254 return {
253- builds : result ,
255+ blockingBuilds : blockingResult ,
254256 nonBlockingBuilds : nonBlockingResult ,
255- failedBuild : failedBuild ,
257+ yellowBuilds : yellowBuilds ,
258+ redBuilds : redBuilds ,
256259 } ;
257260 }
258261
259262 function updateBuildStabilityHelper ( builds , health ) {
263+ if ( builds === undefined || Object . keys ( builds ) . length === 0 ||
264+ health . TotalLoops === 0 || health . NumStablePerJob === undefined ) {
265+ return ;
266+ }
260267 angular . forEach ( builds , function ( build ) {
261268 var key = build . name ;
262269 if ( key in self . health . NumStablePerJob ) {
@@ -266,12 +273,8 @@ function SQCntl(dataService, $interval, $location) {
266273 } ) ;
267274 }
268275
269- function updateBuildStability ( builds , nonBlockingBuilds , health ) {
270- if ( Object . keys ( builds ) . length === 0 ||
271- health . TotalLoops === 0 || health . NumStablePerJob === undefined ) {
272- return ;
273- }
274- updateBuildStabilityHelper ( builds , health ) ;
276+ function updateBuildStability ( blockingBuilds , nonBlockingBuilds , health ) {
277+ updateBuildStabilityHelper ( blockingBuilds , health ) ;
275278 updateBuildStabilityHelper ( nonBlockingBuilds , health ) ;
276279 }
277280
0 commit comments