blob: b05b4fcf74b7e3f974f5b16b94c0e1e325bca1f7 [file] [log] [blame]
Chris Craikb122baf2015-03-05 13:58:42 -08001<!DOCTYPE html>
2<!--
3Copyright (c) 2013 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="/core/analysis/analysis_sub_view.html">
Chris Craik24385db2015-06-11 11:16:26 -07009<link rel="import" href="/base/ui/table.html">
Chris Craikbeca7ae2015-04-07 13:29:55 -070010<link rel="import" href="/core/analysis/stack_frame.html">
Chris Craik24385db2015-06-11 11:16:26 -070011<link rel="import" href="/base/units/time_stamp_span.html">
Chris Craikb122baf2015-03-05 13:58:42 -080012
Chris Craik24385db2015-06-11 11:16:26 -070013<polymer-element name="tr-c-a-single-sample-sub-view"
14 extends="tr-c-a-sub-view">
Chris Craikbeca7ae2015-04-07 13:29:55 -070015 <template>
16 <style>
17 :host {
18 display: flex;
19 }
20 </style>
Chris Craik24385db2015-06-11 11:16:26 -070021 <tr-b-ui-table id="content"></tr-b-ui-table>
Chris Craikbeca7ae2015-04-07 13:29:55 -070022 </template>
Chris Craikb122baf2015-03-05 13:58:42 -080023 <script>
24 'use strict';
25
26 Polymer({
27 created: function() {
28 this.currentSelection_ = undefined;
29 },
30
Chris Craikbeca7ae2015-04-07 13:29:55 -070031 ready: function() {
32 this.$.content.tableColumns = [
33 {
34 title: 'FirstColumn',
35 value: function(row) { return row.title; },
36 width: '250px'
37 },
38 {
39 title: 'SecondColumn',
40 value: function(row) { return row.value; },
41 width: '100%'
42 }
43 ];
44 this.$.content.showHeader = false;
Chris Craikb122baf2015-03-05 13:58:42 -080045 },
46
47 get selection() {
48 return this.currentSelection_;
49 },
50
Chris Craikbeca7ae2015-04-07 13:29:55 -070051 set selection(selection) {
52 this.currentSelection_ = selection;
Chris Craikb122baf2015-03-05 13:58:42 -080053
Chris Craikbeca7ae2015-04-07 13:29:55 -070054 if (this.currentSelection_ === undefined) {
55 this.$.content.tableRows = [];
56 return;
57 }
58
59 var sample = this.currentSelection_[0];
60 var table = this.$.content;
61
62 var rows = [];
63
64 rows.push({
65 title: 'Title',
66 value: sample.title
67 });
68
69 rows.push({
70 title: 'Sample time',
Chris Craik24385db2015-06-11 11:16:26 -070071 value: tr.b.units.createTimeStampSpan(sample.start)
Chris Craikbeca7ae2015-04-07 13:29:55 -070072 });
73
Chris Craik24385db2015-06-11 11:16:26 -070074 var sfEl = document.createElement('tr-c-a-stack-frame');
Chris Craikbeca7ae2015-04-07 13:29:55 -070075 sfEl.stackFrame = sample.leafStackFrame;
76 rows.push({
77 title: 'Stack trace',
78 value: sfEl
79 });
80 table.tableRows = rows;
81 table.rebuild();
Chris Craikb122baf2015-03-05 13:58:42 -080082 }
83 });
84 </script>
Chris Craik24385db2015-06-11 11:16:26 -070085</polymer-element>