Chromium Code Reviews| 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-icon/iron-icon.html"> | |
| 9 <link rel="import" href="../logdog-styles/app-theme.html"> | |
| 10 <link rel="import" href="../rpc/rpc-client.html"> | |
| 11 <link rel="import" href="./logdog-query-panel.html"> | |
| 12 <link rel="import" href="../logdog-stream/logdog-stream.html"> | |
| 13 | |
| 14 <!-- | |
| 15 An element for fetching complete LogDog log streams. | |
| 16 --> | |
| 17 <dom-module id="logdog-query-view"> | |
| 18 | |
| 19 <style> | |
| 20 #list { | |
| 21 text-decoration: none; | |
| 22 width: 90%; | |
| 23 margin: 10px 10px 10px 10px; | |
| 24 } | |
| 25 #list a { | |
| 26 color: var(--primary-text-color); | |
| 27 text-decoration: none; | |
| 28 } | |
| 29 #list ul { | |
| 30 padding: 0; | |
| 31 margin: 0; | |
| 32 list-style-type: none; | |
| 33 border-width: 1px; | |
| 34 border-color: darkgray; | |
| 35 border-style: solid; | |
| 36 } | |
| 37 #list li { | |
| 38 padding: 2px 2px 2px 2px; | |
| 39 margin: 5px 10px 5px 10px; | |
| 40 font-size: 1.1em; | |
| 41 } | |
| 42 #list li a { | |
| 43 display: block; | |
| 44 } | |
| 45 #list li:nth-of-type(odd) { | |
| 46 background-color: white; | |
| 47 } | |
| 48 #list li:nth-of-type(even) { | |
| 49 background-color: #f2f2f2; | |
| 50 } | |
| 51 #list .stream-component { | |
| 52 font-weight: bold; | |
| 53 } | |
| 54 </style> | |
| 55 | |
| 56 <template> | |
| 57 <!-- Load server description --> | |
| 58 <rpc-client | |
| 59 id="client" | |
| 60 auto-token | |
| 61 host="[[host]]"> | |
| 62 </rpc-client> | |
| 63 | |
| 64 <!-- The current list view. --> | |
| 65 <logdog-query-panel id="queryPanel"> | |
| 66 </logdog-query-panel> | |
| 67 | |
| 68 <!-- The current list view. --> | |
| 69 <template is="dom-if" if="[[sharedPrefix]]"> | |
| 70 <div id="sharedPrefix"> | |
| 71 Shared Prefix: [[sharedPrefix]] | |
| 72 </div> | |
| 73 </template> | |
| 74 <div id="list" flex> | |
| 75 <ul> | |
| 76 <template is="dom-repeat" items="{{queryResults}}"> | |
| 77 <li class="stream-component"> | |
| 78 <a href="[[streamLinkBase]]?s=[[item.fullPath]]"> | |
| 79 [[item.title]] | |
| 80 </a> | |
| 81 </li> | |
| 82 </template> | |
| 83 </ul> | |
| 84 </div> | |
| 85 </template> | |
| 86 </dom-module> | |
| 87 | |
| 88 <script> | |
| 89 Polymer({ | |
| 90 is: "logdog-query-view", | |
| 91 properties: { | |
| 92 | |
| 93 hostAttributes: { | |
| 94 hidden: true, | |
| 95 }, | |
| 96 | |
| 97 /** The name ([host][:port]) of the pRPC host. */ | |
| 98 host: { | |
| 99 type: String, | |
| 100 notify: true, | |
| 101 }, | |
| 102 | |
| 103 /** | |
| 104 * Generated stream links will use this parameter, referencing the | |
| 105 * selected streams with "s" query parameters. | |
| 106 */ | |
| 107 streamLinkBase: { | |
| 108 type: String, | |
| 109 notify: true, | |
| 110 }, | |
| 111 | |
| 112 sharedPrefix: { | |
|
Ryan Tseng
2017/08/02 23:34:09
Whats this? (document)
dnj
2017/08/03 00:07:37
Done.
| |
| 113 type: String, | |
| 114 value: null, | |
| 115 readOnly: true, | |
| 116 }, | |
| 117 | |
| 118 queryResults: { | |
|
Ryan Tseng
2017/08/02 23:34:09
What do results look like? Array of strings? (docu
dnj
2017/08/03 00:07:37
Done.
| |
| 119 type: Array, | |
| 120 value: [], | |
| 121 readOnly: true, | |
| 122 }, | |
| 123 }, | |
| 124 | |
| 125 created: function() { | |
| 126 this._view = new LogDog.QueryView(this); | |
| 127 }, | |
| 128 | |
| 129 attached: function() { | |
| 130 this._view.reset(); | |
| 131 }, | |
| 132 | |
| 133 detached: function() { | |
| 134 this._view.reset(); | |
| 135 }, | |
| 136 | |
| 137 ready: function() { | |
| 138 this._currentQuery = null; | |
| 139 | |
| 140 this.$.queryPanel.addEventListener('query-selected', function(e) { | |
| 141 this._view.doQuery(this.$.queryPanel); | |
| 142 }.bind(this)); | |
| 143 }, | |
| 144 }); | |
| 145 </script> | |
| OLD | NEW |