OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <!-- |
| 3 Copyright 2017 The Chromium Authors. All rights reserved. |
| 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. |
| 6 --> |
| 7 |
| 8 <link type="text/css" rel="stylesheet" href="/dashboard/static/base.css"> |
| 9 |
| 10 <link rel="import" href="/components/app-route/app-route.html"> |
| 11 <link rel="import" href="/components/iron-form/iron-form.html"> |
| 12 <link rel="import" href="/components/paper-button/paper-button.html"> |
| 13 <link rel="import" href="/components/paper-checkbox/paper-checkbox.html"> |
| 14 <link rel="import" href="/components/paper-dialog/paper-dialog.html"> |
| 15 <link rel="import" href="/components/paper-input/paper-input.html"> |
| 16 <link rel="import" href="/components/paper-radio-button/paper-radio-button.html"
> |
| 17 <link rel="import" href="/components/paper-radio-group/paper-radio-group.html"> |
| 18 <link rel="import" href="/components/paper-spinner/paper-spinner.html"> |
| 19 <link rel="import" href="/components/polymer/polymer.html"> |
| 20 |
| 21 <link rel="import" href="/dashboard/static/simple_xhr.html"> |
| 22 |
| 23 <dom-module id="new-job-dialog"> |
| 24 <template> |
| 25 <style> |
| 26 form > paper-button { |
| 27 margin-top: 20px; |
| 28 } |
| 29 form > paper-button:not([disabled]) { |
| 30 background: var(--paper-green-700); |
| 31 color: white; |
| 32 } |
| 33 .error { |
| 34 color: #dd4b39; |
| 35 } |
| 36 </style> |
| 37 |
| 38 <paper-dialog id="container" autoCloseDisabled="true"> |
| 39 <form> |
| 40 <paper-input id="bug-id" label="Bug ID" value="{{bugId::input}}" require
d auto-validate></paper-input> |
| 41 <paper-input id="configuration" label="configuration" value="{{configura
tion::input}}" required auto-validate></paper-input> |
| 42 <paper-input id="test_suite" label="test_suite" value="{{test_suite::inp
ut}}" required auto-validate></paper-input> |
| 43 <paper-input id="test" label="test" value="{{test::input}}" required aut
o-validate></paper-input> |
| 44 <paper-input id="metric" label="metric" value="{{metric::input}}" requir
ed auto-validate></paper-input> |
| 45 <paper-input id="start_repository" label="start_repository" value="{{sta
rt_repository::input}}" required auto-validate></paper-input> |
| 46 <paper-input id="start_git_hash" label="start_git_hash" value="{{start_g
it_hash::input}}" allowed-pattern="[A-Fa-f0-9]" required auto-validate prevent-i
nvalid-input></paper-input> |
| 47 <paper-input id="end_repository" label="end_repository" value="{{end_rep
ository::input}}" required auto-validate></paper-input> |
| 48 <paper-input id="end_git_hash" label="end_git_hash" value="{{end_git_has
h::input}}" allowed-pattern="[A-Fa-f0-9]" required auto-validate prevent-invalid
-input></paper-input> |
| 49 <paper-radio-group id="bisect-mode" selected="performance"> |
| 50 <paper-radio-button id="performance" name="performance" on-change="onB
isectModeChanged">Performance</paper-radio-button> |
| 51 <paper-radio-button id="functional" name="functional" on-change="onBis
ectModeChanged">Functional</paper-radio-button> |
| 52 </paper-radio-group> |
| 53 <paper-checkbox id="auto_explore" checked>Automatically explore</paper-c
heckbox><br> |
| 54 <div> |
| 55 <paper-button raised disabled disabled$="{{create_disabled}}" on-click
="onCreateJob">Create</paper-button> |
| 56 <paper-button raised on-click="close">Close</paper-button> |
| 57 </div> |
| 58 <p class="error">{{error}}</p> |
| 59 </form> |
| 60 |
| 61 <template is="dom-if" if="{{loading}}"> |
| 62 <div id="loading"> |
| 63 <paper-spinner active></paper-spinner> |
| 64 </div> |
| 65 </template> |
| 66 </paper-dialog> |
| 67 </template> |
| 68 <script> |
| 69 'use strict'; |
| 70 Polymer({ |
| 71 is: 'new-job-dialog', |
| 72 |
| 73 properties: { |
| 74 bugId: { |
| 75 type: Number, |
| 76 }, |
| 77 configuration: { |
| 78 type: String, |
| 79 value: 'Mac Pro 10.11 Perf', |
| 80 }, |
| 81 test_suite: { |
| 82 type: String, |
| 83 value: 'speedometer', |
| 84 }, |
| 85 test: { |
| 86 type: String, |
| 87 value: '', |
| 88 }, |
| 89 metric: { |
| 90 type: String, |
| 91 value: '', |
| 92 }, |
| 93 start_repository: { |
| 94 type: String, |
| 95 value: 'chromium', |
| 96 }, |
| 97 start_git_hash: { |
| 98 type: String, |
| 99 value: '', |
| 100 }, |
| 101 end_repository: { |
| 102 type: String, |
| 103 value: 'chromium', |
| 104 }, |
| 105 end_git_hash: { |
| 106 type: String, |
| 107 value: '', |
| 108 }, |
| 109 create_disabled: { |
| 110 type: Boolean, |
| 111 value: false, |
| 112 notify: true |
| 113 }, |
| 114 error: { |
| 115 type: String, |
| 116 value: '', |
| 117 notify: true |
| 118 }, |
| 119 ENDPOINT: { |
| 120 type: String, |
| 121 value: '/start_pinpoint_job', |
| 122 notify: true |
| 123 } |
| 124 }, |
| 125 |
| 126 computeIsDisabled(e) { |
| 127 return !!e; |
| 128 }, |
| 129 |
| 130 onBisectModeChanged(e) { |
| 131 if (e.target.name == this.$.performance.name) { |
| 132 this.$.metric.hidden = false; |
| 133 } else { |
| 134 this.$.metric.hidden = true; |
| 135 } |
| 136 }, |
| 137 |
| 138 async onCreateJob(e) { |
| 139 const params = { |
| 140 configuration: this.configuration, |
| 141 test_suite: this.test_suite, |
| 142 test: this.test, |
| 143 metric: this.metric, |
| 144 auto_explore: this.auto_explore ? '1' : '0', |
| 145 start_repository: this.start_repository, |
| 146 start_git_hash: this.start_git_hash, |
| 147 end_repository: this.end_repository, |
| 148 end_git_hash: this.end_git_hash |
| 149 } |
| 150 |
| 151 try { |
| 152 this.create_disabled = true; |
| 153 const results = await simple_xhr.asPromise(this.ENDPOINT, params); |
| 154 this.fire('pinpoint-new-response', { |
| 155 'text': 'Job Started: ' + results['jobId'], |
| 156 }); |
| 157 this.close(); |
| 158 } catch(e) { |
| 159 this.error = e; |
| 160 } |
| 161 this.create_disabled = false; |
| 162 }, |
| 163 |
| 164 ready() { |
| 165 }, |
| 166 |
| 167 /** |
| 168 * Initializes and shows the bisect form. |
| 169 */ |
| 170 show() { |
| 171 this.create_disabled = false; |
| 172 this.error = ''; |
| 173 this.open(); |
| 174 }, |
| 175 |
| 176 open() { |
| 177 this.$.container.open(); |
| 178 }, |
| 179 |
| 180 close() { |
| 181 this.$.container.close(); |
| 182 } |
| 183 |
| 184 }); |
| 185 </script> |
| 186 </dom-module> |
OLD | NEW |