-
Notifications
You must be signed in to change notification settings - Fork 375
/
webform-template.html
138 lines (131 loc) · 4.8 KB
/
webform-template.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<div id="grpc-form">
<table class="grpc-desc">
<tr>
<td>
<table id="grpc-desc-selects">
<!-- service -->
<tr>
<td>
<div class="grpc-form-label">Service name:</div>
</td>
<td id="grpc-service-select">
<select name="grpc-service" id="grpc-service">
{{ range .Services }}
<option value="{{.}}">{{.}}</option>
{{ end }}
</select>
</td>
</tr>
<!-- method -->
<tr>
<td>
<div class="grpc-form-label">Method name:</div>
</td>
<td id="grpc-method-select">
<select name="grpc-method" id="grpc-method">
<!-- populated by JavaScript when grpc-service is selected -->
</select>
</td>
</tr>
</table>
</td>
<td id="grpc-descriptions">
<button id="grpc-descriptions-toggle">»</button>
<pre id="grpc-service-description"></pre>
<pre id="grpc-method-description"></pre>
<pre id="grpc-service-description-end"></pre>
</td>
</tr>
</table>
<div id="grpc-container">
<div id="grpc-request-examples-container" style="display: none">
<h3>Examples</h3>
<ol id="grpc-request-examples"/>
</div>
<div id="grpc-request-response">
<ul>
<li id="#grpc-request-tab-button"><a href="#grpc-request-tab">Request Form</a></li>
<li id="#grpc-request-raw-tab-button"><a href="#grpc-request-raw-tab">Raw Request (JSON)</a></li>
<li id="#grpc-response-tab-button"><a href="#grpc-response-tab">Response</a></li>
<li id="#grpc-history-tab-button"><a href="#grpc-history-tab">History</a></li>
</ul>
<div class="grpc-tabcontent" id="grpc-request-tab">
<h3>Request Metadata</h3>
<div id="grpc-request-metadata">
<table class="grpc-request-table" id="grpc-request-metadata-form">
<tr><th></th><th class="name">Name</th><th class="value">Value</th></tr>
<tr><td><button id="grpc-request-metadata-add-row" class="add">+</button></td><td colspan="2"><span class="add-row-label">Add item</span></td></tr>
</table>
</div>
<h3>Request Data</h3>
<div id="grpc-request-form"></div>
<h3>Request Timeout</h3>
<div id="grpc-request-timeout">
<input/> seconds
</div>
<button class="grpc-invoke" disabled>Invoke</button>
</div>
<div class="grpc-tabcontent" id="grpc-request-raw-tab">
<textarea id="grpc-request-raw-text"></textarea><br/>
<button class="grpc-invoke" disabled>Invoke</button>
</div>
<div class="grpc-tabcontent" id="grpc-response-tab">
<h3>Response Headers</h3>
<table class="grpc-metadata-table" id="grpc-response-headers"></table>
<h3>Response Data</h3>
<div id="grpc-response-req-stats"></div>
<div class="grpc-response-messages" id="grpc-response-data"></div>
<div id="grpc-response-error">
<div id="grpc-response-error-summary">
<span id="grpc-response-error-desc"></span> <span id="grpc-response-error-num"></span>
</div>
<div id = "response-error-extra">
<span id="grpc-response-error-msg"></span>
<div id="grpc-response-error-details-container">
<h4>Error Details:</h4>
<div class="grpc-response-messages" id="grpc-response-error-details"></div>
</div>
</div>
</div>
<h3>Response Trailers</h3>
<table class="grpc-metadata-table" id="grpc-response-trailers"></table>
</div>
<div class="grpc-tabcontent" id="grpc-history-tab">
<button class="grpc-history-clear" id="grpc-history-clear">Clear History</button>
<button class="grpc-history-save" id="grpc-history-save">Save History</button>
<div class="grpc-history-list" id="grpc-history-list">
</div>
</div>
</div>
</div>
</div>
<datalist id="grpc-message-types"></datalist>
<script type="application/javascript">
(function() {
var services = {
{{- range .Services}}
"{{.}}": [
{{- range $i, $elt := index $.Methods .}}
"{{$elt}}",
{{- end}}
],
{{- end}}
};
var svcDescs = {
{{- range $name, $desc := .SvcDescs}}
"{{$name}}": "{{$desc}}",
{{- end}}
};
var mtdDescs = {
{{- range $name, $desc := .MtdDescs}}
"{{$name}}": "{{$desc}}",
{{- end}}
};
var headers = [
{{- range .DefaultMetadata}}
{"name": "{{.Name}}", "value": "{{.Value}}"},
{{- end}}
];
initGRPCForm(services, svcDescs, mtdDescs, '{{ .InvokeURI }}', '{{ .MetadataURI }}', {{ .Debug }}, headers);
})();
</script>