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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
344 $(this).removeClass('processing'); | 344 $(this).removeClass('processing'); |
345 }, | 345 }, |
346 newId: function() { | 346 newId: function() { |
347 var id = 'status-content-' + ++this._currentId; | 347 var id = 'status-content-' + ++this._currentId; |
348 this._unfinishedIds[id] = 1; | 348 this._unfinishedIds[id] = 1; |
349 return id; | 349 return id; |
350 } | 350 } |
351 }); | 351 }); |
352 | 352 |
353 ui.revisionDetails = base.extends('span', { | 353 ui.revisionDetails = base.extends('span', { |
354 updateUIIfDone: function() { | 354 // We only support 2 levels of visual escalation levels: warning and critica l. |
355 warnRollRevisionSpanThreshold: 45, | |
356 criticalRollRevisionSpanThreshold: 70, | |
357 styleForUrgencyLevel: function(rollRevisionSpan) { | |
358 if (rollRevisionSpan < this.criticalRollRevisionSpanThreshold) | |
359 return { backgroundColor: "orange", fontSize: "2em" }; | |
360 return { backgroundColor: "red", fontSize: "3em" }; | |
ojan
2014/06/04 19:58:40
Nit: can we use the buildbot colors for consistenc
Julien - ping for review
2014/06/05 23:20:53
Good idea!
| |
361 }, | |
362 updateUIIfDone: function(totRevision) { | |
355 if (this.roll === undefined || this.lastRolledRevision === undefined) | 363 if (this.roll === undefined || this.lastRolledRevision === undefined) |
356 return; | 364 return; |
357 | 365 |
358 this.appendChild(document.createElement("br")); | 366 this.appendChild(document.createElement("br")); |
359 this.appendChild(document.createTextNode('Last roll is to ')); | 367 this.appendChild(document.createTextNode('Last roll is to ')); |
360 this.appendChild(ui.createLinkNode(trac.changesetURL(this.lastRolledRevi sion), this.lastRolledRevision)); | 368 this.appendChild(ui.createLinkNode(trac.changesetURL(this.lastRolledRevi sion), this.lastRolledRevision)); |
369 var rollRevisionSpan = totRevision - this.lastRolledRevision; | |
370 // Don't clutter the UI if we haven't run behind. | |
371 if (rollRevisionSpan > this.warnRollRevisionSpanThreshold) { | |
372 var wrapper = document.createElement("b"); | |
373 wrapper.style.color = "white"; | |
374 var wrapperStyle = this.styleForUrgencyLevel(rollRevisionSpan); | |
375 wrapper.style.backgroundColor = wrapperStyle.backgroundColor; | |
376 wrapper.style.fontSize = wrapperStyle.fontSize; | |
ojan
2014/06/04 19:58:40
Ditto on the using stylesheets thing.
Julien - ping for review
2014/06/05 23:20:53
Done.
| |
377 wrapper.appendChild(document.createTextNode("(" + rollRevisionSpan + " revisions behind)")); | |
378 this.appendChild(wrapper); | |
379 } | |
361 this.appendChild(document.createTextNode(', current autoroll ')); | 380 this.appendChild(document.createTextNode(', current autoroll ')); |
362 if (this.roll) { | 381 if (this.roll) { |
363 var linkText = "" + this.roll.fromRevision + ":" + this.roll.toRevis ion; | 382 var linkText = "" + this.roll.fromRevision + ":" + this.roll.toRevis ion; |
364 this.appendChild(ui.createLinkNode(this.roll.url, linkText)); | 383 this.appendChild(ui.createLinkNode(this.roll.url, linkText)); |
365 if (this.roll.isStopped) | 384 if (this.roll.isStopped) |
366 this.appendChild(document.createTextNode(' (STOPPED) ')); | 385 this.appendChild(document.createTextNode(' (STOPPED) ')); |
367 } else { | 386 } else { |
368 this.appendChild(document.createTextNode(' None')); | 387 this.appendChild(document.createTextNode(' None')); |
369 } | 388 } |
370 }, | 389 }, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
419 $(revisionsPopUp).removeClass("active"); | 438 $(revisionsPopUp).removeClass("active"); |
420 } | 439 } |
421 }); | 440 }); |
422 | 441 |
423 var totRevision = model.latestRevision(); | 442 var totRevision = model.latestRevision(); |
424 theSpan.appendChild(document.createTextNode(', trunk is at ')); | 443 theSpan.appendChild(document.createTextNode(', trunk is at ')); |
425 theSpan.appendChild(ui.createLinkNode(trac.changesetURL(totRevision), to tRevision)); | 444 theSpan.appendChild(ui.createLinkNode(trac.changesetURL(totRevision), to tRevision)); |
426 | 445 |
427 checkout.lastBlinkRollRevision().then(function(revision) { | 446 checkout.lastBlinkRollRevision().then(function(revision) { |
428 theSpan.lastRolledRevision = revision; | 447 theSpan.lastRolledRevision = revision; |
429 theSpan.updateUIIfDone(); | 448 theSpan.updateUIIfDone(totRevision); |
430 }, function() {}); | 449 }, function() {}); |
431 | 450 |
432 rollbot.fetchCurrentRoll().then(function(roll) { | 451 rollbot.fetchCurrentRoll().then(function(roll) { |
433 theSpan.roll = roll; | 452 theSpan.roll = roll; |
434 theSpan.updateUIIfDone(); | 453 theSpan.updateUIIfDone(totRevision); |
435 }); | 454 }); |
436 } | 455 } |
437 }); | 456 }); |
438 | 457 |
439 })(); | 458 })(); |
OLD | NEW |