<commit_before><!--
Copyright 2014 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="ct-builder-grid.html">
<link rel="import" href="ct-commit-list.html">
<link rel="import" href="ct-test-list.html">

<polymer-element name="ct-failure-card" attributes="group commits tree">
  <template>
    <style>
      :host {
        display: flex;
      }

      /* FIXME: All this paper-button styling should go in a cr-button component so that
         we can use buttons in different places and have them all look the same. */
      paper-button {
        -webkit-user-select: none;
        background: #f5f5f5;
        border-radius: 2px;
        border: 1px solid #dcdcdc;
        color: #444;
        padding: 0 16px;
        margin-bottom: 5px;
        text-align: center;
      }

      paper-button:focus {
        border: 1px solid #4d90fe;
        outline: none;
      }

      paper-button:active {
        box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
      }

      paper-button:active, paper-button:hover {
        background: #f8f8f8;
        border-color: #c6c6c6;
        box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.1);
        color: #222;
      }

      ct-builder-grid {
        margin-right: 10px;
        width: 250px;
      }

      #failure {
        flex: 1;
      }

      #buttons {
        display: flex;
        flex-direction: column;
      }

      .snoozed {
        opacity: 0.5;
      }
    </style>
    <ct-builder-grid failures="{{ group.failures }}"></ct-builder-grid>
    <div id="failure" class="{{ { snoozed: group.isSnoozed } | tokenList }}">
      <ct-test-list tests="{{ group.failures }}" tree="{{ tree }}"></ct-test-list>
      <ct-commit-list first="{{ group.failures[0].lastPassingRevisions }}"
          last="{{ group.failures[0].firstFailingRevisions }}"
          commits="{{ commits }}"></ct-commit-list>
    </div>
    <div id="buttons">
      <paper-button id="examine" on-tap="{{ examine }}">Examine</paper-button>
      <template if="{{ !group.isSnoozed }}">
        <paper-button id="snooze" on-tap="{{ snooze }}">Snooze</paper-button>
      </template>
      <template if="{{ group.isSnoozed }}">
        <paper-button id="snooze" on-tap="{{ unsnooze }}">Unsnooze</paper-button>
      </template>
    </div>
  </template>
  <script>
    Polymer({
      group: null,
      commits: {},
      tree: '',

      examine: function() {
        this.fire('ct-examine-failures', this.group);
      },

      snooze: function() {
        this.group.snoozeUntil(Date.now() + 60 * 60 * 1000);
      },

      unsnooze: function() {
        this.group.unsnooze();
      },
    });<commit_msg>Use the non-deprecated way to set the button labels<commit_after><!--
Copyright 2014 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="ct-builder-grid.html">
<link rel="import" href="ct-commit-list.html">
<link rel="import" href="ct-test-list.html">

<polymer-element name="ct-failure-card" attributes="group commits tree">
  <template>
    <style>
      :host {
        display: flex;
      }

      /* FIXME: All this paper-button styling should go in a cr-button component so that
         we can use buttons in different places and have them all look the same. */
      paper-button {
        -webkit-user-select: none;
        background: #f5f5f5;
        border-radius: 2px;
        border: 1px solid #dcdcdc;
        color: #444;
        padding: 0 16px;
        margin-bottom: 5px;
        text-align: center;
      }

      paper-button:focus {
        border: 1px solid #4d90fe;
        outline: none;
      }

      paper-button:active {
        box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
      }

      paper-button:active, paper-button:hover {
        background: #f8f8f8;
        border-color: #c6c6c6;
        box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.1);
        color: #222;
      }

      ct-builder-grid {
        margin-right: 10px;
        width: 250px;
      }

      #failure {
        flex: 1;
      }

      #buttons {
        display: flex;
        flex-direction: column;
      }

      .snoozed {
        opacity: 0.5;
      }
    </style>
    <ct-builder-grid failures="{{ group.failures }}"></ct-builder-grid>
    <div id="failure" class="{{ { snoozed: group.isSnoozed } | tokenList }}">
      <ct-test-list tests="{{ group.failures }}" tree="{{ tree }}"></ct-test-list>
      <ct-commit-list first="{{ group.failures[0].lastPassingRevisions }}"
          last="{{ group.failures[0].firstFailingRevisions }}"
          commits="{{ commits }}"></ct-commit-list>
    </div>
    <div id="buttons">
      <paper-button id="examine" on-tap="{{ examine }}" label="Examine"></paper-button>
      <template if="{{ !group.isSnoozed }}">
        <paper-button id="snooze" on-tap="{{ snooze }}" label="Snooze"></paper-button>
      </template>
      <template if="{{ group.isSnoozed }}">
        <paper-button id="snooze" on-tap="{{ unsnooze }}" label="Unsnooze"></paper-button>
      </template>
    </div>
  </template>
  <script>
    Polymer({
      group: null,
      commits: {},
      tree: '',

      examine: function() {
        this.fire('ct-examine-failures', this.group);
      },

      snooze: function() {
        this.group.snoozeUntil(Date.now() + 60 * 60 * 1000);
      },

      unsnooze: function() {
        this.group.unsnooze();
      },
    });
{'fraction_non_alphanumeric': 0.157998920280727, 'fraction_numerical': 0.02267410473276948, 'mean_word_length': 2.192418150488225, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 63, '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': '4431607', 'n_tokens_mistral': 1955, 'n_tokens_neox': 1821, 'n_words': 438}