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

Unified 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: 80 chars 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « server/static/rpcexplorer/rpc-editor.html ('k') | server/static/rpcexplorer/rpc-method.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: server/static/rpcexplorer/rpc-explorer.html
diff --git a/server/static/rpcexplorer/rpc-explorer.html b/server/static/rpcexplorer/rpc-explorer.html
new file mode 100644
index 0000000000000000000000000000000000000000..42025b8ea001b0e6f24ab9e9f25243af99d39f52
--- /dev/null
+++ b/server/static/rpcexplorer/rpc-explorer.html
@@ -0,0 +1,149 @@
+<!--
+ Copyright 2016 The Chromium Authors. All rights reserved.
+ Use of this source code is governed by a BSD-style license that can be
+ found in the LICENSE file.
+ -->
+
+<link rel="import" href="../bower_components/app-router/app-router.html">
+<link rel="import" href="../bower_components/polymer/polymer.html">
+<link rel="import"
+ href="../bower_components/html5-history-anchor/html5-history-anchor.html">
+
+<link rel="import" href="/static/common/rpc/rpc-client.html">
+
+<link rel="import" href="rpc-descriptor-util.html">
+<link rel="import" href="rpc-method.html">
+<link rel="import" href="rpc-service-list.html">
+<link rel="import" href="rpc-service.html">
+
+<!-- The `rpc-explorer` is the top-level element of RPC Explorer -->
+<dom-module id="rpc-explorer">
+ <template>
+ <style>
+ li[hidden] {
+ display: none;
+ }
+ </style>
+
+ <!-- Load server description -->
+ <rpc-client
+ auto
+ service="discovery.Discovery"
+ method="Describe"
+ last-response="{{serverDescription}}">
+ </rpc-client>
+
+ <div class="navbar navbar-default" role="navigation">
+ <div class="navbar-header">
+ <button
+ class="navbar-toggle collapsed"
+ data-toggle="collapse"
+ aria-expanded="false">
+ <span class="sr-only">Toggle navigation</span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+ <span class="navbar-brand">
+ <span id="progress-spinner" class="not-spinning">
+ <a is="html5-history-anchor" pushstate popstate
+ href="[[rootPath]]">RPC Explorer</a>
+ </span>
+ </span>
+ </div>
+ </div>
+
+ <ol class="breadcrumb">
+ <li>
+ <a is="html5-history-anchor" pushstate popstate
+ href="[[rootPath]]/services/">Home</a>
+ </li>
+ <li hidden="[[!service]]">
+ <a is="html5-history-anchor" pushstate popstate
+ href="[[rootPath]]/services/[[service]]/">[[service]]</a>
+ </li>
+ <li hidden="[[!method]]">
+ <a is="html5-history-anchor" pushstate popstate
+ href="[[rootPath]]/services/[[service]]/[[method]">
+ [[method]]
+ </a>
+ </li>
+ </ol>
+
+ <app-router
+ id="router"
+ mode="pushstate"
+ on-activate-route-end="_onRouted"
+ on-before-data-binding="_onRouteBinding">
+ <!--
+ "path" attributes in <app-route> elements are set dynamically, but
+ unless we set them to a string, app-router prints errors to the console.
+ -->
+ <app-route id="servicesRoute" path="" element="rpc-service-list">
+ </app-route>
+ <app-route id="serviceRoute" path="" element="rpc-service"></app-route>
+ <app-route id="methodRoute" path="" element="rpc-method"></app-route>
+ <app-route id="catchAllRoute" path="*"></app-route>
+ </app-router>
+ </template>
+
+ <script>
+ 'use strict';
+
+ Polymer({
+ is: 'rpc-explorer',
+
+ properties: {
+ rootPath: {
+ type: String,
+ value: '',
+ observer: '_onRootPathChanged'
+ },
+
+ service: String,
+
+ method: String,
+
+ /** @type {DescribeResponse} */
+ serverDescription: {
+ type: Object,
+ observer: '_onServerDescriptionChanged'
+ }
+ },
+
+ _onRootPathChanged: function (newVal) {
+ // The app-router element does not like data-binding in its attributes
+ // so we update their values manually.
+ var rootPath = newVal || '',
+ servicesPath = rootPath + '/services/',
+ servicePath = servicesPath + ':service/',
+ methodPath = servicePath + ':method';
+ this.$.servicesRoute.setAttribute('path', servicesPath);
+ this.$.serviceRoute.setAttribute('path', servicePath);
+ this.$.methodRoute.setAttribute('path', methodPath);
+ this.$.catchAllRoute.setAttribute('redirect', servicesPath);
+ },
+
+ _onRouteBinding: function(e) {
+ if (this.serverDescription) {
+ e.detail.model.description = this.serverDescription.description;
+ e.detail.model.serviceNames = this.serverDescription.services;
+ }
+ },
+
+ _onServerDescriptionChanged: function(e) {
+ if (this.serverDescription) {
+ rpcExplorer.descUtil.annotateSet(this.serverDescription.description);
+ // Recreate route model.
+ this.$.router.go(document.location.toString());
+ }
+ },
+
+ _onRouted: function(e) {
+ var model = e.detail.model || {};
+ this.service = model.service || '';
+ this.method = model.method || '';
+ }
+ });
+ </script>
+</dom-module>
« no previous file with comments | « server/static/rpcexplorer/rpc-editor.html ('k') | server/static/rpcexplorer/rpc-method.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698