OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 Copyright 2016 The Chromium Authors. All rights reserved. |
| 3 Use of this source code is governed by a BSD-style license that can be |
| 4 found in the LICENSE file. |
| 5 --> |
| 6 |
| 7 <link rel="import" href="../bower_components/polymer/polymer.html"> |
| 8 <link rel="import" |
| 9 href="../bower_components/html5-history-anchor/html5-history-anchor.html"> |
| 10 |
| 11 <link rel="import" href="rpc-descriptor-util.html"> |
| 12 |
| 13 <!-- The `rpc-service-list` is a service list page --> |
| 14 <dom-module id="rpc-service-list"> |
| 15 <template> |
| 16 <p>Services:</p> |
| 17 <ul> |
| 18 <template is="dom-repeat" items="[[services]]" as="service"> |
| 19 <li> |
| 20 <a is="html5-history-anchor" pushstate popstate |
| 21 href="[[service.name]]/">[[service.name]]</a> |
| 22 <span class="text-muted comment">[[service.comments]]</span> |
| 23 </li> |
| 24 </template> |
| 25 </ul> |
| 26 </template> |
| 27 <script> |
| 28 'use strict'; |
| 29 |
| 30 Polymer({ |
| 31 is: 'rpc-service-list', |
| 32 |
| 33 properties: { |
| 34 /** @type {FileDescriptorSet} |
| 35 description: Object, |
| 36 |
| 37 /** @type {Array.<string>} */ |
| 38 serviceNames: Array, |
| 39 |
| 40 /** @type {Array.<{name: string, comment: string}>} */ |
| 41 services: { |
| 42 type: Array, |
| 43 computed: '_resolveServices(description, serviceNames)' |
| 44 } |
| 45 }, |
| 46 |
| 47 _resolveServices: function(desc, names) { |
| 48 var result = []; |
| 49 for (var i = 0; i < names.length; i++) { |
| 50 var svc = rpcExplorer.descUtil.resolve(desc, names[i]); |
| 51 if (svc && svc.type === 'service') { |
| 52 var info = svc.desc.source_code_info; |
| 53 result.push({ |
| 54 name: names[i], |
| 55 comments: info && info.leading_comments |
| 56 }); |
| 57 } |
| 58 } |
| 59 return result; |
| 60 } |
| 61 }); |
| 62 </script> |
| 63 </dom-module> |
OLD | NEW |