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

Side by Side Diff: go/src/infra/appengine/sheriff-o-matic/elements/som-app.html

Issue 2200943002: SoM: Alerts error handling. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Added some tests for error handling. Created 4 years, 4 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
« no previous file with comments | « no previous file | go/src/infra/appengine/sheriff-o-matic/test/som-app-test.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <link rel="import" href="/bower_components/polymer/polymer.html"> 1 <link rel="import" href="/bower_components/polymer/polymer.html">
2 <link rel="import" href="/bower_components/iron-ajax/iron-ajax.html"> 2 <link rel="import" href="/bower_components/iron-ajax/iron-ajax.html">
3 <link rel="import" href="/bower_components/iron-flex-layout/classes/iron-flex-la yout.html"> 3 <link rel="import" href="/bower_components/iron-flex-layout/classes/iron-flex-la yout.html">
4 <link rel="import" href="/bower_components/iron-icons/hardware-icons.html"> 4 <link rel="import" href="/bower_components/iron-icons/hardware-icons.html">
5 <link rel="import" href="/bower_components/iron-icon/iron-icon.html"> 5 <link rel="import" href="/bower_components/iron-icon/iron-icon.html">
6 <link rel="import" href="/bower_components/iron-icons/iron-icons.html"> 6 <link rel="import" href="/bower_components/iron-icons/iron-icons.html">
7 <link rel="import" href="/bower_components/iron-location/iron-location.html"> 7 <link rel="import" href="/bower_components/iron-location/iron-location.html">
8 <link rel="import" href="/bower_components/iron-pages/iron-pages.html"> 8 <link rel="import" href="/bower_components/iron-pages/iron-pages.html">
9 <link rel="import" href="/bower_components/neon-animation/animations/scale-up-an imation.html"> 9 <link rel="import" href="/bower_components/neon-animation/animations/scale-up-an imation.html">
10 <link rel="import" href="/bower_components/neon-animation/animations/fade-out-an imation.html"> 10 <link rel="import" href="/bower_components/neon-animation/animations/fade-out-an imation.html">
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 margin: 1em 0.5em; 50 margin: 1em 0.5em;
51 background-color: #eee; 51 background-color: #eee;
52 border-bottom: 1px solid #ddd; 52 border-bottom: 1px solid #ddd;
53 } 53 }
54 #alertsListInner h2 { 54 #alertsListInner h2 {
55 font-size: 22px; 55 font-size: 22px;
56 } 56 }
57 #bugDialog, #snoozeDialog { 57 #bugDialog, #snoozeDialog {
58 width: 300px; 58 width: 300px;
59 } 59 }
60 #fetchAlertsError {
61 color: #f00;
62 margin: 1em;
63 }
60 #noAlerts { 64 #noAlerts {
61 text-align: center; 65 text-align: center;
62 font-size: 2.5em; 66 font-size: 2.5em;
63 line-height: 150%; 67 line-height: 150%;
64 } 68 }
65 #refresh { 69 #refresh {
66 width: 25px; 70 width: 25px;
67 height: 25px; 71 height: 25px;
68 padding: 0; 72 padding: 0;
69 } 73 }
70 .error { 74 .error {
71 color: #cc0000; 75 color: #c00;
72 margin-top: 0; 76 margin-top: 0;
73 } 77 }
74 .last-updated, .user-name { 78 .last-updated, .user-name {
75 text-align: right; 79 text-align: right;
76 padding-right: 1em; 80 padding-right: 1em;
77 } 81 }
78 .list-item { 82 .list-item {
79 @apply(--layout-flex); 83 @apply(--layout-flex);
80 @apply(--layout-vertical); 84 @apply(--layout-vertical);
81 margin: 1em; 85 margin: 1em;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 <iron-pages attr-for-selected='id' selected="[[_selectedPage]]" class="f lex layout vertical"> 154 <iron-pages attr-for-selected='id' selected="[[_selectedPage]]" class="f lex layout vertical">
151 <div id="alertsList" class="page-body"> 155 <div id="alertsList" class="page-body">
152 <div class="list-item" hidden$="[[_hideWebkitNotice]]"> 156 <div class="list-item" hidden$="[[_hideWebkitNotice]]">
153 <div class="notification"> 157 <div class="notification">
154 Chromium sheriffs: you now need to handle WebKit bot failures to o. <a href="http://www.chromium.org/blink/sheriffing" target="_blank">More infor mation</a>. 158 Chromium sheriffs: you now need to handle WebKit bot failures to o. <a href="http://www.chromium.org/blink/sheriffing" target="_blank">More infor mation</a>.
155 </div> 159 </div>
156 </div> 160 </div>
157 <som-bug-queue id="bugQueue" bug-queue-label="[[_bugQueueLabel]]"></ som-bug-queue> 161 <som-bug-queue id="bugQueue" bug-queue-label="[[_bugQueueLabel]]"></ som-bug-queue>
158 <div id="alertsListInner"> 162 <div id="alertsListInner">
159 <h2>Failure Alerts (<a href="/help-som">Help?</a>)</h2> 163 <h2>Failure Alerts (<a href="/help-som">Help?</a>)</h2>
164 <div id="fetchAlertsError" hidden=[[!_fetchAlertsError]]>[[_fetchA lertsError]]</div>
160 <template is="dom-if" if="[[!_hideJulie]]"> 165 <template is="dom-if" if="[[!_hideJulie]]">
161 <div id="noAlerts"> 166 <div id="noAlerts">
162 No alerts! 167 No alerts!
163 <br> 168 <br>
164 <img src="/images/jparent-jump.gif" alt="Julie Jumping" title= "Julie Jumping"> 169 <img src="/images/jparent-jump.gif" alt="Julie Jumping" title= "Julie Jumping">
165 </div> 170 </div>
166 </template> 171 </template>
167 <template is="dom-repeat" items="[[_computeSeverities(_alerts)]]" as="sev"> 172 <template is="dom-repeat" items="[[_computeSeverities(_alerts)]]" as="sev">
168 <h3 class="severity-title">[[_getSeverityTitle(sev)]]:</h3> 173 <h3 class="severity-title">[[_getSeverityTitle(sev)]]:</h3>
169 <template is="dom-repeat" items="[[_alertsWithSeverity(_alerts, sev)]]" as="alert"> 174 <template is="dom-repeat" items="[[_alertsWithSeverity(_alerts, sev)]]" as="alert">
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 _bugErrorMessage: String, 289 _bugErrorMessage: String,
285 _bugModel: Object, 290 _bugModel: Object,
286 _bugQueueLabel: { 291 _bugQueueLabel: {
287 type: Array, 292 type: Array,
288 computed: '_computeBugQueueLabel(_tree, _trees)', 293 computed: '_computeBugQueueLabel(_tree, _trees)',
289 }, 294 },
290 _filedBug: { 295 _filedBug: {
291 type: Boolean, 296 type: Boolean,
292 value: false, 297 value: false,
293 }, 298 },
299 _fetchAlertsError: String,
294 _fetchingAlerts: { 300 _fetchingAlerts: {
295 type: Boolean, 301 type: Boolean,
296 computed: '_computeFetchingAlerts(_activeRequests)', 302 computed: '_computeFetchingAlerts(_activeRequests)',
297 }, 303 },
298 _fetchedAlerts: { 304 _fetchedAlerts: {
299 type: Boolean, 305 type: Boolean,
300 value: function() { return false; }, 306 value: function() { return false; },
301 }, 307 },
302 _hideJulie: { 308 _hideJulie: {
303 type: Boolean, 309 type: Boolean,
304 computed: '_computeHideJulie(_alerts, _fetchedAlerts, _fetchingAlerts, _tree)', 310 computed: '_computeHideJulie(_alerts, _fetchedAlerts, _fetchingAlerts, _fetchAlertsError, _tree)',
305 value: function() { return true; }, 311 value: function() { return true; },
306 }, 312 },
307 _hideWebkitNotice: { 313 _hideWebkitNotice: {
308 type: Boolean, 314 type: Boolean,
309 computed: '_computeHideWebkitNotice(_tree)', 315 computed: '_computeHideWebkitNotice(_tree)',
310 }, 316 },
311 logoutUrl: String, 317 logoutUrl: String,
312 _path: { 318 _path: {
313 type: String, 319 type: String,
314 }, 320 },
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 }, 427 },
422 428
423 _computeSelectedPage: function(path) { 429 _computeSelectedPage: function(path) {
424 let pathParts = path.split('/'); 430 let pathParts = path.split('/');
425 if (pathParts.length < 2) { 431 if (pathParts.length < 2) {
426 console.error('error: pathParts < 2', pathParts); 432 console.error('error: pathParts < 2', pathParts);
427 } 433 }
428 if (pathParts.length == 2) { 434 if (pathParts.length == 2) {
429 if (pathParts[1] in this._staticPages) { 435 if (pathParts[1] in this._staticPages) {
430 if (pathParts[1] === 'calendar') { 436 if (pathParts[1] === 'calendar') {
431 // Hide rotation calendar until visited because it's really big. 437 // Hide rotation calendar until visited because it's really big.
432 this._showRotationCalendar = true; 438 this._showRotationCalendar = true;
433 } 439 }
434 return this._staticPages[pathParts[1]].pageId; 440 return this._staticPages[pathParts[1]].pageId;
435 } else { 441 } else {
436 // On the page for a tree 442 // On the page for a tree
437 return 'alertsList'; 443 return 'alertsList';
438 } 444 }
439 } 445 }
440 if (pathParts[2] == 'examine') { 446 if (pathParts[2] == 'examine') {
441 return 'examineAlert'; 447 return 'examineAlert';
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 }); 490 });
485 491
486 // Assume it takes less than 1 millisecond to calculate that. 492 // Assume it takes less than 1 millisecond to calculate that.
487 if (Date.now() - oldestDate > 1) { 493 if (Date.now() - oldestDate > 1) {
488 return new Date(oldestDate * 1000).toLocaleString(); 494 return new Date(oldestDate * 1000).toLocaleString();
489 } 495 }
490 return 'Unknown'; 496 return 'Unknown';
491 }, 497 },
492 498
493 _alertsGroupsChanged: function(alertsGroups) { 499 _alertsGroupsChanged: function(alertsGroups) {
500 this._fetchAlertsError = '';
494 if (alertsGroups.length > 0) { 501 if (alertsGroups.length > 0) {
495 this._fetchedAlerts = false; 502 this._fetchedAlerts = false;
496 this._activeRequests += alertsGroups.length; 503 this._activeRequests += alertsGroups.length;
497 504
498 // TODO: handle webpage offline throwing an exception
499 alertsGroups.forEach((group) => { 505 alertsGroups.forEach((group) => {
500 let foo = fetch('/api/v1/alerts/' + group, {credentials: 'include'}) .then((response) => { 506 let foo = fetch('/api/v1/alerts/' + group, {credentials: 'include'}) .then((response) => {
501 // TODO: handle alerts not found
502 this._activeRequests -= 1; 507 this._activeRequests -= 1;
508 if (response.status == 404) {
509 this._fetchAlertsError = 'Server responded with 404: ' + group + ' not found. ';
seanmccullough1 2016/08/04 16:11:50 80 col here and below (silly requirement, I know)
510 return false;
511 }
503 return response.json(); 512 return response.json();
513 }, (error) => {
514 this._activeRequests -= 1;
515 this._fetchAlertsError = 'Could not connect to the server. ' + err or;
504 }).then((json) => { 516 }).then((json) => {
505 this.set(['_alertsData', this._alertGroupVarName(group)], json.ale rts); 517 if (json) {
506 this.set(['_alertsTimes', this._alertGroupVarName(group)], json.ti mestamp); 518 this.set(['_alertsData', this._alertGroupVarName(group)], json.a lerts);
519 this.set(['_alertsTimes', this._alertGroupVarName(group)], json. timestamp);
520 }
507 }); 521 });
508 }); 522 });
509 } 523 }
510 }, 524 },
511 525
512 _alertGroupVarName(group) { 526 _alertGroupVarName(group) {
513 return group.replace('.', '_'); 527 return group.replace('.', '_');
514 }, 528 },
515 529
516 _computeFetchingAlerts: function(activeRequests) { 530 _computeFetchingAlerts: function(activeRequests) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 }); 567 });
554 568
555 // Wait for alerts to be loaded 569 // Wait for alerts to be loaded
556 setTimeout(() => { 570 setTimeout(() => {
557 this._fetchedAlerts = true; 571 this._fetchedAlerts = true;
558 }, 200); 572 }, 200);
559 return allAlerts; 573 return allAlerts;
560 }, 574 },
561 575
562 576
563 _computeHideJulie: function(alerts, fetchedAlerts, fetchingAlerts, tree) { 577 _computeHideJulie: function(alerts, fetchedAlerts, fetchingAlerts, fetchAl ertsError, tree) {
564 if (fetchingAlerts || !fetchedAlerts || !alerts || tree === '') { 578 if (fetchingAlerts || !fetchedAlerts || !alerts || fetchAlertsError !== '' || tree === '') {
565 return true; 579 return true;
566 } 580 }
567 return alerts.length > 0; 581 return alerts.length > 0;
568 }, 582 },
569 583
570 _computeHideWebkitNotice: function(tree) { 584 _computeHideWebkitNotice: function(tree) {
571 return tree != 'chromium'; 585 return tree != 'chromium';
572 }, 586 },
573 587
574 ////////////////////// Severity /////////////////////////// 588 ////////////////////// Severity ///////////////////////////
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 this.$.snoozeDialog.close(); 746 this.$.snoozeDialog.close();
733 }, (error) => { 747 }, (error) => {
734 this._snoozeErrorMessage = error; 748 this._snoozeErrorMessage = error;
735 }); 749 });
736 }, 750 },
737 751
738 }); 752 });
739 })(); 753 })();
740 </script> 754 </script>
741 </dom-module> 755 </dom-module>
OLDNEW
« no previous file with comments | « no previous file | go/src/infra/appengine/sheriff-o-matic/test/som-app-test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698