blob: 6bba8644c7d48dd8810c0178e56906a6511ece52 [file] [log] [blame]
<!DOCTYPE html>
<!--
Copyright (c) 2013 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="/base/ui/dom_helpers.html">
<link rel="import" href="/base/ui/table.html">
<link rel="import" href="/base/units/time_stamp_span.html">
<link rel="import" href="/core/analysis/analysis_link.html">
<link rel="import" href="/core/analysis/analysis_sub_view.html">
<link rel="import" href="/base/units/util.html">
<polymer-element name="tr-c-a-multi-object-sub-view"
extends="tr-c-a-sub-view">
<template>
<style>
:host {
display: flex;
}
</style>
<tr-b-ui-table id="content"></tr-b-ui-table>
</template>
<script>
'use strict';
Polymer({
created: function() {
this.currentSelection_ = undefined;
},
ready: function() {
this.$.content.showHeader = false;
},
get selection() {
return this.currentSelection_;
},
set selection(selection) {
this.currentSelection_ = selection;
var objectEvents = tr.b.asArray(selection).sort(
tr.b.Range.compareByMinTimes);
var table = this.$.content;
table.tableColumns = [
{
title: 'First',
value: function(event) {
if (event instanceof tr.model.ObjectSnapshot)
return tr.b.units.createTimeStampSpan(event.ts);
var spanEl = document.createElement('span');
spanEl.appendChild(tr.b.units.createTimeStampSpan(
event.creationTs));
spanEl.appendChild(tr.b.ui.createSpan({
textContent: '-',
marginLeft: '4px',
marginRight: '4px'
}));
if (event.deletionTs != Number.MAX_VALUE) {
spanEl.appendChild(
tr.b.units.createTimeStampSpan(event.deletionTs));
}
return spanEl;
},
width: '200px'
},
{
title: 'Second',
value: function(event) {
var linkEl = document.createElement('tr-c-a-analysis-link');
linkEl.setSelectionAndContent(function() {
return new tr.c.Selection(event);
}, event.userFriendlyName);
return linkEl;
},
width: '100%'
}
];
table.tableRows = objectEvents;
table.rebuild();
}
});
</script>
</polymer-element>