<commit_before><!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="/tracing/model/event_set.html">
<link rel="import" href="/tracing/ui/analysis/analysis_link.html">
<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
<link rel="import" href="/tracing/ui/analysis/single_event_sub_view.html">

<!-- TODO(polymer): Migrate this element>
<!--
<polymer-element name="tr-ui-a-single-flow-event-sub-view"
    extends="tr-ui-a-single-event-sub-view">
</polymer-element>
<script>
'use strict';

Polymer({
  getEventRows_: function(event) {
    // TODO(nduca): Figure out if there is a cleaner way to do this.
    var rows = this.__proto__.__proto__.getEventRows_(event);

    // Put the ID up top.
    rows.splice(0, 0, {
      name: 'ID',
      value: event.id
    });

    function createLinkTo(slice) {
      var linkEl = document.createElement('tr-ui-a-analysis-link');
      linkEl.setSelectionAndContent(function() {
          return new tr.model.EventSet(slice);
      });
      Polymer.dom(linkEl).textContent = slice.userFriendlyName;
      return linkEl;
    }

    rows.push({
      name: 'From',
      value: createLinkTo(event.startSlice)
    });
    rows.push({
      name: 'To',
      value: createLinkTo(event.endSlice)
    });
    return rows;
  }
});
</script>--><commit_msg>[polymer] Polymer 1.0 rewrite for the single flow event sub view<commit_after><!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="/tracing/base/iteration_helpers.html">
<link rel="import" href="/tracing/model/event_set.html">
<link rel="import" href="/tracing/ui/analysis/analysis_link.html">
<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
<link rel="import" href="/tracing/ui/analysis/single_event_sub_view.html">

<dom-module id="tr-ui-a-single-flow-event-sub-view">
  <template>
    <style>
    :host {
      display: block;
    }
    </style>
    <tr-ui-a-single-event-sub-view id="singleEventSubView">
    </tr-ui-a-single-event-sub-view>
  </template>
</dom-module>
<script>
'use strict';

function createAnalysisLinkTo(event) {
  var linkEl = document.createElement('tr-ui-a-analysis-link');
  linkEl.setSelectionAndContent(
      new tr.model.EventSet(event), event.userFriendlyName);
  return linkEl;
}

Polymer({
  is: 'tr-ui-a-single-flow-event-sub-view',
  behaviors: [Catapult.tr_ui_a_sub_view_behavior],

  listeners: {
    'singleEventSubView.customize-rows': 'onCustomizeRows_'
  },

  set selection(selection) {
    this.currentSelection_ = selection;
    this.$.singleEventSubView.setSelectionWithoutErrorChecks(selection);
  },

  get selection() {
    return this.currentSelection_;
  },

  /**
   * Event handler for an event that's fired after the single event sub view has
   * finished row construction. This hook gives us the opportunity to customize
   * the rows present in the sub view.
   */
  onCustomizeRows_: function(e) {
    var event = tr.b.getOnlyElement(this.currentSelection_);
    var rows = e.rows;

    rows.unshift({
      name: 'ID',
      value: event.id
    });
    rows.push({
      name: 'From',
      value: createAnalysisLinkTo(event.startSlice)
    });
    rows.push({
      name: 'To',
      value: createAnalysisLinkTo(event.endSlice)
    });
  }
});
</script>
{'fraction_non_alphanumeric': 0.14470356841809498, 'fraction_numerical': 0.0033717336330429896, 'mean_word_length': 3.494949494949495, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6100161', 'n_tokens_mistral': 1188, 'n_tokens_neox': 1154, 'n_words': 262}