Chromium Code Reviews| 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/app-router/app-router.html"> | |
| 8 <link rel="import" href="../bower_components/polymer/polymer.html"> | |
| 9 | |
| 10 <link rel="import" href="/static/common/rpc/rpc-client.html"> | |
| 11 | |
| 12 <link rel="import" href="rpc-descriptor-util.html"> | |
| 13 <link rel="import" href="rpc-method.html"> | |
| 14 <link rel="import" href="rpc-service-list.html"> | |
| 15 <link rel="import" href="rpc-service.html"> | |
| 16 | |
| 17 | |
| 18 <!-- The `rpc-explorer` is the top-level element of RPC Explorer --> | |
| 19 <dom-module id="rpc-explorer"> | |
| 20 <template> | |
| 21 <style> | |
| 22 li[hidden] { | |
|
Bons
2016/02/23 15:52:29
[hidden] is already a user-agent defined selector.
nodir
2016/02/23 18:32:25
yeah, it is not displayed indeed, but bootstrap br
Bons
2016/02/24 06:10:56
Acknowledged.
| |
| 23 display: none; | |
| 24 } | |
| 25 </style> | |
| 26 | |
| 27 <!-- Load server description --> | |
| 28 <rpc-client | |
| 29 auto | |
| 30 service="discovery.Discovery" | |
| 31 method="Describe" | |
| 32 last-response="{{serverDescription}}"> | |
| 33 </rpc-client> | |
| 34 | |
| 35 <div class="navbar navbar-default" role="navigation"> | |
| 36 <div class="navbar-header"> | |
| 37 <button | |
| 38 type="button" | |
|
Bons
2016/02/23 15:52:29
i don't think you need type="button" for a button
nodir
2016/02/23 18:32:26
Done.
| |
| 39 class="navbar-toggle collapsed" | |
| 40 data-toggle="collapse" | |
| 41 data-target="#bs-example-navbar-collapse-1" | |
| 42 aria-expanded="false"> | |
| 43 <span class="sr-only">Toggle navigation</span> | |
| 44 <span class="icon-bar"></span> | |
| 45 <span class="icon-bar"></span> | |
| 46 <span class="icon-bar"></span> | |
| 47 </button> | |
| 48 <span class="navbar-brand"> | |
| 49 <span id="progress-spinner" class="not-spinning"> | |
| 50 <a href="#">RPC Explorer</a> | |
| 51 </span> | |
| 52 </span> | |
| 53 </div> | |
| 54 </div> | |
| 55 | |
| 56 <ol class="breadcrumb"> | |
| 57 <li> | |
| 58 <a href="#">Home</a> | |
| 59 </li> | |
| 60 <li hidden="{{!service}}"> | |
| 61 <a href="#/services/[[service]]">[[service]]</a> | |
| 62 </li> | |
| 63 <li hidden="{{!method}}"> | |
| 64 <a href="#/services/[[service]]/[[method]">[[method]]</a> | |
| 65 </li> | |
| 66 </ol> | |
| 67 | |
| 68 <app-router | |
|
Bons
2016/02/23 15:52:29
can you put in a TODO to use the HTML5 history api
nodir
2016/02/23 18:32:25
Used HTML5 history API.
Better not to change it in
| |
| 69 id="router" | |
| 70 trailing-slash="ignore" | |
| 71 on-activate-route-end="_onRouted" | |
| 72 on-before-data-binding="_onRouteBinding"> | |
| 73 <app-route path="/services" element="rpc-service-list"></app-route> | |
| 74 <app-route path="/services/:service" element="rpc-service"></app-route> | |
| 75 <app-route path="/services/:service/:method" element="rpc-method"></app-ro ute> | |
| 76 <app-route path="*" redirect="/services"></app-route> | |
| 77 </app-router> | |
| 78 </template> | |
| 79 | |
| 80 <script> | |
| 81 'use strict'; | |
| 82 | |
| 83 Polymer({ | |
| 84 is: 'rpc-explorer', | |
| 85 | |
| 86 properties: { | |
| 87 | |
| 88 service: String, | |
| 89 | |
| 90 method: String, | |
| 91 | |
| 92 /** @type {DescribeResponse} */ | |
| 93 serverDescription: { | |
| 94 type: Object, | |
| 95 observer: '_onServerDescriptionChanged' | |
| 96 } | |
| 97 }, | |
| 98 | |
| 99 _onRouteBinding: function(e) { | |
| 100 if (this.serverDescription) { | |
| 101 e.detail.model.description = this.serverDescription.description; | |
| 102 e.detail.model.serviceNames = this.serverDescription.services; | |
| 103 } | |
| 104 }, | |
| 105 | |
| 106 _onServerDescriptionChanged: function(e) { | |
| 107 if (this.serverDescription) { | |
| 108 rpcExplorer.descUtil.annotateSet(this.serverDescription.description); | |
| 109 // Recreate route model. | |
| 110 this.$.router.go(document.location.hash.substring(1)); | |
| 111 } | |
| 112 }, | |
| 113 | |
| 114 _onRouted: function(e) { | |
| 115 var model = e.detail.model || {}; | |
| 116 this.service = model.service || ''; | |
| 117 this.method = model.method || ''; | |
| 118 } | |
| 119 }); | |
| 120 </script> | |
| 121 </dom-module> | |
| OLD | NEW |