blob: f306f43766473f99caeb3f1f4a973301d48ba4b8 [file] [log] [blame]
<!DOCTYPE html>
<!--
Copyright (c) 2015 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="/perf_insights/mappers/slice_cost.html">
<link rel="import" href="/perf_insights/mre/mre_result.html">
<link rel="import" href="/perf_insights/ui/caching_column.html">
<link rel="import" href="/perf_insights/ui/generic_results_view.html">
<link rel="import" href="/perf_insights/ui/reports/pi_report.html">
<link rel="import" href="/perf_insights/ui/trace_link_list.html">
<link rel="import" href="/tracing/base/iteration_helpers.html">
<link rel="import" href="/tracing/model/source_info/source_info.html">
<link rel="import" href="/tracing/ui/base/dom_helpers.html">
<link rel="import" href="/tracing/ui/base/grouping_table.html">
<link rel="import" href="/tracing/ui/base/info_bar_group.html">
<link rel="import" href="/tracing/ui/base/overlay.html">
<link rel="import" href="/tracing/ui/base/table.html">
<link rel="import" href="/tracing/value/ui/generic_table_view.html">
<link rel="import" href="/tracing/value/ui/histogram_span.html">
<link rel="import" href="/tracing/value/ui/scalar_span.html">
<link rel="import" href="/tracing/value/unit.html">
<polymer-element name="pi-ui-r-test-report"
extends="pi-ui-r-pi-report"
map-function-href="/perf_insights/mappers/test_mapper.html"
map-function-name="testMapFunction"
reduce-function-href="/perf_insights/reducers/test_reducer.html"
reduce-function-name="testReduceFunction">
<template>
<style>
:host {
display: flex;
flex-direction: column;
}
#histogram {
flex: 1 1 auto;
max-width: 400px;
}
#links {
min-height: 200px;
}
h2 {
font-size: 12pt;
}
</style>
<tr-ui-b-table id="table"></tr-ui-b-table>
</template>
<script>
'use strict';
Polymer({
created: function() {
this.mapResults_ = undefined;
},
get mapResults() {
return this.mapResults_;
},
set mapResults(mapResults) {
this.mapResults_ = mapResults;
this.updateContents_();
},
updateContents_: function() {
var results = this.mapResults_;
var table = this.$.table;
var columns = this.createColumns_();
table.tableColumns = columns;
table.sortColumnIndex = 1;
table.sortDescending = true;
var categoryRows = [];
results.forEach(function(result) {
categoryRows.push({
title: 'Foo',
total: result.pairs['simon'].value
});
});
table.tableRows = categoryRows;
table.rebuild();
},
createColumns_: function() {
var columns = [
{
title: 'Title',
value: function(row) {
return row.title;
},
textAlign: 'left',
width: '400px'
},
{
title: 'Total',
value: function(row) {
return row.total;
},
cmp: function(a, b) {
return tr.b.compareNumericWithNaNs(a.total, b.total);
},
textAlign: 'left',
width: '100px'
}
];
return columns;
}
});
</script>
</polymer-element>