Chromium Code Reviews| Index: dashboard/dashboard/elements/pinpoint-perf-job-dialog.html |
| diff --git a/dashboard/dashboard/elements/pinpoint-perf-job-dialog.html b/dashboard/dashboard/elements/pinpoint-perf-job-dialog.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..fe2eaa19c838ab1ce4c7fd0c98084c447cd8a8dd |
| --- /dev/null |
| +++ b/dashboard/dashboard/elements/pinpoint-perf-job-dialog.html |
| @@ -0,0 +1,199 @@ |
| +<!DOCTYPE html> |
| +<!-- |
| +Copyright 2017 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="/components/paper-button/paper-button.html"> |
| +<link rel="import" href="/components/paper-checkbox/paper-checkbox.html"> |
| +<link rel="import" href="/components/paper-dialog/paper-dialog.html"> |
| +<link rel="import" href="/components/paper-input/paper-input.html"> |
| +<link rel="import" href="/components/paper-spinner/paper-spinner.html"> |
| + |
| +<link rel="import" href="/dashboard/static/simple_xhr.html"> |
| + |
| +<dom-module is="pinpoint-perf-job-dialog"> |
| + <template> |
| + |
| + <paper-dialog id="container" autoCloseDisabled="true"> |
| + <!-- Styling for paper-dialog's children. --> |
| + <style> |
| + paper-button[dialog-confirm] { |
| + background: #4285f4; |
| + color: #fff; |
| + margin-bottom: 5px; |
| + } |
| + |
| + paper-input { |
| + width: 400px; |
| + } |
| + </style> |
| + |
| + <form on-submit="onSendToTrybot"> |
| + <table> |
| + <tr> |
| + <td>Record a before/after trace profile.</td> |
| + </tr> |
| + <tr> |
| + <td>Perf try bot:</td> |
| + <td> |
| + <paper-input type="text" value="[[getBot(test_path)]]" disabled></paper-input> |
|
sullivan
2017/09/27 19:30:33
Eventually there needs to be some way to see the l
shatch
2017/09/27 20:41:25
Sure, I'll follow up and add the prefill. The exis
|
| + </td> |
| + </tr> |
| + <tr> |
| + <td><paper-checkbox checked="{{use_trace::input}}"></paper-checkbox>Chrome trace <a href="https://cs.chromium.org/chromium/src/base/trace_event/trace_config.h?rcl=c8db6c6371ca047c24d41f3972d5819bc83d83ae&l=125" target="_blank">filter string</a>:</td> |
| + <td> |
| + <paper-input value="{{trace_categories::input}}"></paper-input> |
| + </td> |
| + </tr> |
| + <template is="dom-if" if="{{computeIsAndroidBot(bot)}}"> |
| + <tr> |
| + <td><paper-checkbox checked="{{use_atrace::input}}"></paper-checkbox>Additional atrace categories (comma-separated):</td> |
| + <td> |
| + <paper-input value="{{atrace_categories::input}}"></paper-input> |
| + </td> |
| + </tr> |
| + </template> |
| + <tr> |
| + <td>Start Commit:</td> |
| + <td><paper-input id="start_commit" type="text" value="{{start_commit::input}}"></paper-input></td> |
| + </tr> |
| + <tr> |
| + <td>End Commit:</td> |
| + <td><paper-input id="end_commit" type="text" value="{{end_commit::input}}"></paper-input></td> |
| + </tr> |
| + </table> |
| + </form> |
| + |
| + <p class="error">{{error}}</p> |
| + |
| + <paper-button dialog-confirm raised autofocus disabled$="{{computeHasError(error)}}" |
| + on-click="onSendToTrybot">Send to Pinpoint</paper-button> |
| + <paper-button dialog-dismiss raised>Close</paper-button> |
| + |
| + <div id="toasts" hidden> |
| + <div id="jobsubmitted"> |
| + <b>Pinpoint Job submitted!</b> |
| + <a href="[[lastSubmittedJobUrl]]" |
| + target="_blank">View job [[lastSubmittedJobId]].</a> |
| + </div> |
| + </div> |
| + </paper-dialog> |
| + |
| + </template> |
| + <script> |
| + 'use strict'; |
| + (function() { |
| + Polymer({ |
| + is: 'pinpoint-perf-job-dialog', |
| + properties: { |
|
sullivan
2017/09/27 19:30:33
Properties in JS should be camelCase (startCommit,
|
| + error: { |
| + type: String, |
| + value: '', |
| + }, |
| + start_commit: { |
| + type: String, |
| + value: '', |
| + }, |
| + end_commit: { |
| + type: String, |
| + value: '', |
| + }, |
| + start_repository: { |
| + type: String, |
| + value: '', |
| + }, |
| + end_repository: { |
| + type: String, |
| + value: '', |
| + }, |
| + use_trace: { |
| + type: Boolean, |
| + }, |
| + use_atrace: { |
| + type: Boolean, |
| + }, |
| + atrace_categories: { |
| + type: String, |
| + }, |
| + trace_categories: { |
| + type: String, |
| + }, |
| + test_path: { |
| + type: String, |
| + value: '', |
| + }, |
| + xsrfToken: { |
| + } |
| + }, |
| + |
| + computeHasError: errorMessage => !!errorMessage, |
| + computeIsAndroidBot(bot) { return bot.indexOf('android') != -1; }, |
| + |
| + getBot(testPath) { |
| + return testPath.split('/')[1]; |
|
sullivan
2017/09/27 19:30:33
I'm not seeing a bot here, I think it's because th
shatch
2017/09/27 20:41:25
Ooops last second js lint name changes.
|
| + }, |
| + |
| + /** |
| + * Initializes and shows the trace form. |
| + */ |
| + show() { |
| + this.open(); |
| + |
| + this.atrace_categories = |
| + 'sched,freq,gfx,view,dalvik,webview,input,disk,am,' + |
| + 'wm,rs,binder_driver'; |
| + this.use_atrace = false; |
| + this.trace_categories = |
| + 'toplevel,disabled-by-default-toplevel.flow'; |
| + this.use_trace = true; |
| + }, |
| + |
| + /** |
| + * Makes a request to Pinpoint to perform a perf try job. |
| + */ |
| + async onSendToTrybot(event) { |
| + const args = []; |
| + if (this.use_trace) { |
| + args.push(['--extra-chrome-categories', this.trace_categories]); |
| + } |
| + if (this.use_atrace) { |
| + args.push(['--extra-atrace-categories', this.atrace_categories]); |
| + } |
| + |
| + const params = { |
| + test_path: this.test_path, |
| + start_commit: this.start_commit, |
| + end_commit: this.end_commit, |
| + start_repository: this.start_repository, |
| + end_repository: this.end_repository, |
| + extra_telemetry_args: args |
| + }; |
| + |
| + try { |
| + this.error = ''; |
| + this.create_disabled = true; |
| + const results = await simple_xhr.asPromise( |
| + '/pinpoint/new/perf_try', params); |
| + this.lastSubmittedJobId = results.jobId; |
| + this.lastSubmittedJobUrl = results.jobUrl; |
| + this.fire('display-toast', {'content': this.$.jobsubmitted}); |
| + this.close(); |
| + } catch (e) { |
| + this.error = e; |
| + } |
| + this.create_disabled = false; |
| + }, |
| + |
| + open() { |
| + this.$.container.open(); |
| + }, |
| + |
| + close() { |
| + this.$.container.close(); |
| + } |
| + }); |
| + })(); |
| + </script> |
| +</dom-module> |