| OLD | NEW |
| (Empty) | |
| 1 <!-- |
| 2 Copyright 2016 The LUCI Authors. All rights reserved. |
| 3 Use of this source code is governed under the Apache License, Version 2.0 |
| 4 that can be found in the LICENSE file. |
| 5 --> |
| 6 |
| 7 <link rel="import" href="../bower_components/polymer/polymer.html"> |
| 8 <link rel="import" href="../bower_components/iron-form/iron-form.html"> |
| 9 <link rel="import" href="../bower_components/paper-input/paper-input.html"> |
| 10 <link rel="import" href="../bower_components/paper-button/paper-button.html"> |
| 11 <link rel="import" href="../bower_components/paper-dropdown-menu/paper-dropdown-
menu.html"> |
| 12 <link rel="import" href="../bower_components/paper-listbox/paper-listbox.html"> |
| 13 <link rel="import" href="../bower_components/paper-item/paper-item.html"> |
| 14 <link rel="import" href="../logdog-styles/app-theme.html"> |
| 15 |
| 16 |
| 17 <!-- |
| 18 An element for fetching complete LogDog log streams. |
| 19 --> |
| 20 <dom-module id="logdog-query-panel"> |
| 21 |
| 22 <style> |
| 23 paper-button.indigo { |
| 24 background-color: var(--paper-indigo-500); |
| 25 color: white; |
| 26 --paper-button-raised-keyboard-focus: { |
| 27 background-color: var(--paper-pink-a200) !important; |
| 28 color: white !important; |
| 29 }; |
| 30 } |
| 31 </style> |
| 32 |
| 33 <template> |
| 34 |
| 35 <iron-form id="form"> |
| 36 <paper-input |
| 37 label="Project" |
| 38 value="{{project}}" |
| 39 on-keydown="_maybeSubmit" |
| 40 required |
| 41 auto-validate |
| 42 error-message="A project is required."> |
| 43 </paper-input> |
| 44 |
| 45 <paper-input |
| 46 label="Path Query" |
| 47 value="{{path}}" |
| 48 on-keydown="_maybeSubmit"> |
| 49 </paper-input> |
| 50 |
| 51 <paper-dropdown-menu label="Stream Type" value="{{streamType}}"> |
| 52 <paper-listbox class="dropdown-content" selected="0"> |
| 53 <paper-item>Text</paper-item> |
| 54 <paper-item>Binary</paper-item> |
| 55 <paper-item>Datagram</paper-item> |
| 56 <paper-item>Any</paper-item> |
| 57 </paper-listbox> |
| 58 </paper-dropdown-menu> |
| 59 |
| 60 <paper-button |
| 61 id="query" |
| 62 class="indigo" |
| 63 disabled$="[[_isQueryDisabled(project)]]" |
| 64 on-tap="_handleQueryTap" |
| 65 raised> |
| 66 Query |
| 67 </paper-button> |
| 68 </iron-form> |
| 69 |
| 70 </template> |
| 71 |
| 72 </dom-module> |
| 73 |
| 74 <script> |
| 75 Polymer({ |
| 76 is: "logdog-query-panel", |
| 77 properties: { |
| 78 |
| 79 /** The log stream path to query. */ |
| 80 project: { |
| 81 type: String, |
| 82 notify: true, |
| 83 }, |
| 84 |
| 85 /** The log stream path to query. */ |
| 86 path: { |
| 87 type: String, |
| 88 notify: true, |
| 89 }, |
| 90 |
| 91 /** The stream type. */ |
| 92 streamType: { |
| 93 type: String, |
| 94 notify: true, |
| 95 }, |
| 96 }, |
| 97 |
| 98 _isQueryDisabled(project) { |
| 99 return (!project); |
| 100 }, |
| 101 |
| 102 _handleQueryTap: function() { |
| 103 this.dispatchEvent(new CustomEvent('query-selected')); |
| 104 }, |
| 105 |
| 106 _maybeSubmit: function(e) { |
| 107 if (e.key === 'Enter' && !this._isQueryDisabled(this.project)) { |
| 108 this._handleQueryTap(); |
| 109 } |
| 110 }, |
| 111 }); |
| 112 </script> |
| OLD | NEW |