<commit_before><!DOCTYPE html>
<!--
Copyright 2016 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.
-->
<!--
The triage-dialog element is the dialog box that is shown when a user clicks
on an alert, or clicks on a "triage" button on the alerts page. It allows the
-->

<link rel="import" href="/components/paper-button/paper-button.html">
<link rel="import" href="/components/paper-card/paper-card.html">

<link rel="import" href="/dashboard/static/simple_xhr.html">

<dom-module id="triage-dialog">
  <template>
    <style>
      #container {
        position: relative;
        margin: 10px;
        max-height: 400px;
        width: 360px;
      }

      #container .card-content {
        overflow-y: auto;
      }
    </style>

    <paper-card id="container" alwaysOnTop elevation=4>
      <style>
        #loading {
          background-color: white;
          height: 100%;
          width: 100%;
          position: absolute;
          left: 0;
          top: 0;
          display: flex;
          align-items: center;
          justify-content: center;
          opacity: 0;
          transition: opacity 0.2s;
        }

        paper-button[dialog-confirm] {
          background: #4285f4;
          color: #fff;
        }

        fieldset {
          border: 1px solid #ebebeb;
        }

        .submit-button {
          background-color: #4285f4;
          color: white;
        }

        form {
          margin-bottom: 0;
        }

        #invalidAlert {
          float: right;
          text-align: center;
          width: 50px;
        }

        #nudgeSelect {
          height: 145px;
          overflow: hidden;
        }
      </style>

      <div class="card-content">
        <form>
          <fieldset name="Triage">
            <legend>Triage</legend>
            <paper-button class="submit-button" raised dialog-confirm
                          on-click="fileNewBug">New bug</paper-button>
            <paper-button class="submit-button" raised dialog-confirm
                          on-click="associateWithBug">Existing bug</paper-button>
            <paper-button class="submit-button" raised dialog-confirm
                          on-click="markIgnored">Ignore</paper-button>
          </fieldset>
          <fieldset name="Fix-up alert">
            <legend>Fix-up</legend>
            <select class="kennedy-button" id="nudgeSelect" size="2"
                    hidden$="{{computeIsEmpty(nudgeList)}}" 
                    on-change="nudgeAlert">
              <template is="dom-repeat" items="{{nudgeList}}">
                <option value$="{{item.endRevision}}" selected$="{{item.selected}}">
                  Nudge {{item.amount}} {{item.displayEndRevision}} ({{item.value}})
                </option>
              </template>
            </select>
            <paper-button id="invalidAlert" raised on-click="markInvalid">
              Report Invalid Alert
            </paper-button>
          </fieldset>
        </form>
      </div>

      <div class="card-actions">
        <paper-button raised dismissive on-click="close">Close</paper-button>

        <template is="dom-if" if="{{loading}}">
          <div id="loading">
            <paper-spinner active></paper-spinner>
          </div>
        </template>
      </div>
    </paper-card>

    <div id="toasts" hidden>
      <div id="jobsubmitted">
        Bug <a href="http://crbug.com/{{lastSubmittedProjectId}}/{{lastSubmittedBugId}}"
               target="_blank">
               {{lastSubmittedProjectId}}:{{lastSubmittedBugId}}
            </a> created/updated.
        <template is="dom-if" if="{{!!lastSubmittedTryJobId}}">
          Bisect job <a href="{{lastSubmittedTryJobUrl}}"
                        target="_blank">{{lastSubmittedTryJobId}}</a> started.
        </template>
        <template is="dom-if" if="{{lastSubmittedTryJobError}}">
          <span class="error">No bisect automatically started.
                              {{lastSubmittedTryJobError}}</span>
        </template>
      </div>
    </div>

  </template>
</dom-module>
<script>
'use strict';
Polymer({

  is: 'triage-dialog',
  properties: {
    // A string describing the magnitude of change from zero to non-zero.
    FREAKIN_HUGE: {
      type: String,
      value: 'zero-to-nonzero',
    },
    alerts: {
      notify: true,
      observer: 'alertsChanged'
    },
    lastSubmittedBugId: {
      type: Number,
      value: 0
    },<commit_msg>Reland "Fix pop up statement when triaging with an existing bug."<commit_after><!DOCTYPE html>
<!--
Copyright 2016 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.
-->
<!--
The triage-dialog element is the dialog box that is shown when a user clicks
on an alert, or clicks on a "triage" button on the alerts page. It allows the
-->

<link rel="import" href="/components/paper-button/paper-button.html">
<link rel="import" href="/components/paper-card/paper-card.html">

<link rel="import" href="/dashboard/static/simple_xhr.html">

<dom-module id="triage-dialog">
  <template>
    <style>
      #container {
        position: relative;
        margin: 10px;
        max-height: 400px;
        width: 360px;
      }

      #container .card-content {
        overflow-y: auto;
      }
    </style>

    <paper-card id="container" alwaysOnTop elevation=4>
      <style>
        #loading {
          background-color: white;
          height: 100%;
          width: 100%;
          position: absolute;
          left: 0;
          top: 0;
          display: flex;
          align-items: center;
          justify-content: center;
          opacity: 0;
          transition: opacity 0.2s;
        }

        paper-button[dialog-confirm] {
          background: #4285f4;
          color: #fff;
        }

        fieldset {
          border: 1px solid #ebebeb;
        }

        .submit-button {
          background-color: #4285f4;
          color: white;
        }

        form {
          margin-bottom: 0;
        }

        #invalidAlert {
          float: right;
          text-align: center;
          width: 50px;
        }

        #nudgeSelect {
          height: 145px;
          overflow: hidden;
        }
      </style>

      <div class="card-content">
        <form>
          <fieldset name="Triage">
            <legend>Triage</legend>
            <paper-button class="submit-button" raised dialog-confirm
                          on-click="fileNewBug">New bug</paper-button>
            <paper-button class="submit-button" raised dialog-confirm
                          on-click="associateWithBug">Existing bug</paper-button>
            <paper-button class="submit-button" raised dialog-confirm
                          on-click="markIgnored">Ignore</paper-button>
          </fieldset>
          <fieldset name="Fix-up alert">
            <legend>Fix-up</legend>
            <select class="kennedy-button" id="nudgeSelect" size="2"
                    hidden$="{{computeIsEmpty(nudgeList)}}" 
                    on-change="nudgeAlert">
              <template is="dom-repeat" items="{{nudgeList}}">
                <option value$="{{item.endRevision}}" selected$="{{item.selected}}">
                  Nudge {{item.amount}} {{item.displayEndRevision}} ({{item.value}})
                </option>
              </template>
            </select>
            <paper-button id="invalidAlert" raised on-click="markInvalid">
              Report Invalid Alert
            </paper-button>
          </fieldset>
        </form>
      </div>

      <div class="card-actions">
        <paper-button raised dismissive on-click="close">Close</paper-button>

        <template is="dom-if" if="{{loading}}">
          <div id="loading">
            <paper-spinner active></paper-spinner>
          </div>
        </template>
      </div>
    </paper-card>

    <div id="toasts" hidden>
      <div id="jobsubmitted">
        Bug <a href="http://crbug.com/{{lastSubmittedProjectId}}/{{lastSubmittedBugId}}"
               target="_blank">
               {{lastSubmittedProjectId}}:{{lastSubmittedBugId}}
            </a> created/updated.
        <template is="dom-if" if="{{lastSubmittedTryJobId.toString()}}">
          Bisect job <a href="{{lastSubmittedTryJobUrl}}"
                        target="_blank">{{lastSubmittedTryJobId}}</a> started.
        </template>
        <template is="dom-if" if="{{lastSubmittedTryJobError}}">
          <span class="error">No bisect automatically started.
                              {{lastSubmittedTryJobError}}</span>
        </template>
      </div>
    </div>

  </template>
</dom-module>
<script>
'use strict';
Polymer({

  is: 'triage-dialog',
  properties: {
    // A string describing the magnitude of change from zero to non-zero.
    FREAKIN_HUGE: {
      type: String,
      value: 'zero-to-nonzero',
    },
    alerts: {
      notify: true,
      observer: 'alertsChanged'
    },
    lastSubmittedBugId: {
      type: Number,
      value: 0
    },
{'fraction_non_alphanumeric': 0.13423847585678308, 'fraction_numerical': 0.009416402058469288, 'mean_word_length': 1.8481446835048332, 'pattern_counts': {'":': 0, '<': 137, '<?xml version=': 0, '>': 137, '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': '5620867', 'n_tokens_mistral': 2711, 'n_tokens_neox': 2540, 'n_words': 590}