Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: server/static/rpcexplorer/rpc-explorer.html

Issue 1695893004: RPC Explorer (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@rpcepxlorer-deps
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
8 <link rel="import" href="/static/common/third_party/app-router/app-router.html">
9 <link rel="import" href="/static/common/third_party/polymer/polymer.html">
10
11 <link rel="import" href="rpc-descriptor-util.html">
12 <link rel="import" href="rpc-method.html">
13 <link rel="import" href="rpc-service-list.html">
14 <link rel="import" href="rpc-service.html">
15
16
17 <!-- The `rpc-explorer` is the top-level element of RPC Explorer -->
18 <dom-module id="rpc-explorer">
19 <template>
20 <style>
21 li[hidden] {
22 display: none;
23 }
24 </style>
25
26 <!-- Load server description -->
27 <rpc-call auto service="discovery.Discovery" method="Describe"
28 last-response="{{serverDescription}}">
29 </rpc-call>
30
31 <div class="navbar navbar-default" role="navigation">
32 <div class="navbar-header">
33 <button type="button" class="navbar-toggle collapsed" data-toggle="colla pse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
34 <span class="sr-only">Toggle navigation</span>
35 <span class="icon-bar"></span>
36 <span class="icon-bar"></span>
37 <span class="icon-bar"></span>
38 </button>
39 <span class="navbar-brand">
40 <span id="progress-spinner" class="not-spinning">
41 <a href="#">RPC Explorer</a>
42 </span>
43 </span>
44 </div>
45 </div>
46
47 <ol class="breadcrumb">
48 <li>
49 <a href="#">Home</a>
50 </li>
51 <li hidden="{{!service}}">
52 <a href="#/services/[[service]]">[[service]]</a>
53 </li>
54 <li hidden="{{!method}}">
55 <a href="#/services/[[service]]/[[method]">[[method]]</a>
56 </li>
57 </ol>
58
59 <app-router id="router" trailing-slash="ignore"
60 on-activate-route-end="_onRouted"
61 on-before-data-binding="_onRouteBinding">
62 <app-route path="/services" element="rpc-service-list"></app-route>
63 <app-route path="/services/:service" element="rpc-service"></app-route>
64 <app-route path="/services/:service/:method" element="rpc-method"></app-ro ute>
65 <app-route path="*" redirect="/services"></app-route>
66 </app-router>
67 </template>
68
69 <script>
70 'use strict';
71
72 Polymer({
73 is: 'rpc-explorer',
74 properties: {
75 service: String,
76 method: String,
77 serverDescription: {
78 type: Object, // DescribeResponse message
79 observer: '_onServerDescriptionChanged'
80 }
81 },
82
83 _onRouteBinding: function(e) {
84 if (this.serverDescription) {
85 e.detail.model.description = this.serverDescription.description;
86 e.detail.model.serviceNames = this.serverDescription.services;
87 }
88 },
89
90 _onServerDescriptionChanged: function(e) {
91 if (this.serverDescription) {
92 rpcExplorer.descUtil.annotateSet(this.serverDescription.description);
93 // Recreate route model.
94 this.$.router.go(document.location.hash.substring(1));
95 }
96 },
97
98 _onRouted: function(e) {
99 var model = e.detail.model || {};
100 this.service = model.service || '';
101 this.method = model.method || '';
102 }
103 });
104 </script>
105 </dom-module>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698