| 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 /** |
| 113 * Populates the "shared prefix" field in the template. |
| 114 * |
| 115 * If this is null, the shared prefix field will not exist. If it is not |
| 116 * null, it is a string to display as a shared prefix. This is set when |
| 117 * all of the items in "queryResults" share the same prefix, in which |
| 118 * case their text is abbreviated. This is a common situation in many |
| 119 * queries. |
| 120 */ |
| 121 sharedPrefix: { |
| 122 type: String, |
| 123 value: null, |
| 124 readOnly: true, |
| 125 }, |
| 126 |
| 127 /** |
| 128 * The query results, set when a query returns. |
| 129 * |
| 130 * Each item in this array is a LogDog.QueryEntry object (see "view.ts"). |
| 131 */ |
| 132 queryResults: { |
| 133 type: Array, |
| 134 value: [], |
| 135 readOnly: true, |
| 136 }, |
| 137 }, |
| 138 |
| 139 created: function() { |
| 140 this._view = new LogDog.QueryView(this); |
| 141 }, |
| 142 |
| 143 attached: function() { |
| 144 this._view.reset(); |
| 145 }, |
| 146 |
| 147 detached: function() { |
| 148 this._view.reset(); |
| 149 }, |
| 150 |
| 151 ready: function() { |
| 152 this._currentQuery = null; |
| 153 |
| 154 this.$.queryPanel.addEventListener('query-selected', function(e) { |
| 155 this._view.doQuery(this.$.queryPanel); |
| 156 }.bind(this)); |
| 157 }, |
| 158 }); |
| 159 </script> |
| OLD | NEW |