1<!DOCTYPE html> 2<!-- 3Copyright (c) 2015 The Chromium Authors. All rights reserved. 4Use of this source code is governed by a BSD-style license that can be 5found in the LICENSE file. 6--> 7 8<link rel="import" href="/tracing/ui/base/dom_helpers.html"> 9<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html"> 10<link rel="import" href="/tracing/ui/analysis/single_event_sub_view.html"> 11 12<polymer-element name="tr-ui-a-single-alert-sub-view" 13 extends="tr-ui-a-sub-view"> 14 <script> 15 'use strict'; 16 17 Polymer({ 18 created: function() { 19 this.currentSelection_ = undefined; 20 }, 21 22 set selection(selection) { 23 this.currentSelection_ = selection; 24 25 this.textContent = ''; 26 var realView = document.createElement('tr-ui-a-single-event-sub-view'); 27 realView.addExtraRowsCallback = function(rows) { 28 // Alert description. 29 var alert = this.currentSelection_[0]; 30 31 var descriptionEl = tr.ui.b.createSpan({ 32 textContent: alert.info.description 33 }); 34 rows.push({ 35 name: 'Description', 36 value: descriptionEl 37 }); 38 39 // Associated events... 40 if (alert.associatedEvents.length) { 41 var eventSubRows = []; 42 alert.associatedEvents.forEach(function(event, i) { 43 var linkEl = document.createElement('tr-ui-a-analysis-link'); 44 linkEl.setSelectionAndContent(function() { 45 return event; 46 }, event.userFriendlyName); 47 eventSubRows.push({ 48 name: i, 49 value: linkEl 50 }); 51 }); 52 53 rows.push({ 54 name: 'Alerts', value: '', 55 isExpanded: true, subRows: eventSubRows 56 }); 57 } 58 }.bind(this); 59 60 this.appendChild(realView); 61 realView.setSelectionWithoutErrorChecks(selection); 62 } 63 }); 64 </script> 65</polymer-element> 66