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

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

Issue 316033002: [GOM] Warn when the roll is running behind (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Even better change! Created 6 years, 6 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
« no previous file with comments | « no previous file | Tools/GardeningServer/scripts/ui_unittests.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 updateUI: function() { 354 // We only support 2 levels of visual escalation levels: warning and critica l.
355 warnRollRevisionSpanThreshold: 45,
356 criticalRollRevisionSpanThreshold: 80,
357 classNameForUrgencyLevel: function(rollRevisionSpan) {
358 if (rollRevisionSpan < this.criticalRollRevisionSpanThreshold)
359 return "warning";
360 return "critical";
361 },
362 updateUI: function(totRevision) {
355 this.appendChild(document.createElement("br")); 363 this.appendChild(document.createElement("br"));
356 this.appendChild(document.createTextNode('Last roll is to ')); 364 this.appendChild(document.createTextNode('Last roll is to '));
357 this.appendChild(ui.createLinkNode(trac.changesetURL(this.lastRolledRevi sion), this.lastRolledRevision)); 365 this.appendChild(ui.createLinkNode(trac.changesetURL(this.lastRolledRevi sion), this.lastRolledRevision));
366 var rollRevisionSpan = totRevision - this.lastRolledRevision;
367 // Don't clutter the UI if we haven't run behind.
368 if (rollRevisionSpan > this.warnRollRevisionSpanThreshold) {
369 var wrapper = document.createElement("span");
370 wrapper.className = this.classNameForUrgencyLevel(rollRevisionSpan);
371 wrapper.appendChild(document.createTextNode("(" + rollRevisionSpan + " revisions behind)"));
372 this.appendChild(wrapper);
373 }
358 this.appendChild(document.createTextNode(', current autoroll ')); 374 this.appendChild(document.createTextNode(', current autoroll '));
359 if (this.roll) { 375 if (this.roll) {
360 var linkText = "" + this.roll.fromRevision + ":" + this.roll.toRevis ion; 376 var linkText = "" + this.roll.fromRevision + ":" + this.roll.toRevis ion;
361 this.appendChild(ui.createLinkNode(this.roll.url, linkText)); 377 this.appendChild(ui.createLinkNode(this.roll.url, linkText));
362 if (this.roll.isStopped) 378 if (this.roll.isStopped)
363 this.appendChild(document.createTextNode(' (STOPPED) ')); 379 this.appendChild(document.createTextNode(' (STOPPED) '));
364 } else { 380 } else {
365 this.appendChild(document.createTextNode(' None')); 381 this.appendChild(document.createTextNode(' None'));
366 } 382 }
367 }, 383 },
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 } 433 }
418 }); 434 });
419 435
420 var totRevision = model.latestRevision(); 436 var totRevision = model.latestRevision();
421 theSpan.appendChild(document.createTextNode(', trunk is at ')); 437 theSpan.appendChild(document.createTextNode(', trunk is at '));
422 theSpan.appendChild(ui.createLinkNode(trac.changesetURL(totRevision), to tRevision)); 438 theSpan.appendChild(ui.createLinkNode(trac.changesetURL(totRevision), to tRevision));
423 439
424 Promise.all([checkout.lastBlinkRollRevision(), rollbot.fetchCurrentRoll( )]).then(function(results) { 440 Promise.all([checkout.lastBlinkRollRevision(), rollbot.fetchCurrentRoll( )]).then(function(results) {
425 theSpan.lastRolledRevision = results[0]; 441 theSpan.lastRolledRevision = results[0];
426 theSpan.roll = results[1]; 442 theSpan.roll = results[1];
427 theSpan.updateUI(); 443 theSpan.updateUI(totRevision);
428 }); 444 });
429 } 445 }
430 }); 446 });
431 447
432 })(); 448 })();
OLDNEW
« no previous file with comments | « no previous file | Tools/GardeningServer/scripts/ui_unittests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698