New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add descriptions for services, methods, and fields #166
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,21 +4,67 @@ | |
} | ||
|
||
.grpc-desc { | ||
margin-bottom: 8px; | ||
margin-left: 16px; | ||
margin-bottom: 0; | ||
} | ||
|
||
.grpc-desc span.grpc-form-label { | ||
font-size: 125%; | ||
width: 130px; | ||
float: left; | ||
line-height: 30px; | ||
.grpc-desc td { | ||
vertical-align: top; | ||
} | ||
|
||
#grpc-desc-selects td { | ||
padding-top: 12px; | ||
} | ||
|
||
.grpc-desc select { | ||
height: 30px; | ||
} | ||
|
||
.grpc-desc pre { | ||
margin: 0 0 0 36px; | ||
padding-left: 20px; | ||
border-left: 1px solid #d8d8d8; | ||
color: #777; | ||
} | ||
|
||
.grpc-desc button#grpc-descriptions-toggle { | ||
position: absolute; | ||
z-index: 3; | ||
padding: 0; | ||
margin-top: 10px; | ||
margin-left: 10px; | ||
border: none; | ||
background: white; | ||
font-size: 150%; | ||
} | ||
|
||
.grpc-desc div.grpc-form-label { | ||
font-size: 110%; | ||
width: 128px; | ||
line-height: 30px; | ||
text-align: right; | ||
margin-right: 12px; | ||
} | ||
|
||
#grpc-descriptions { | ||
width: 100%; | ||
overflow: scroll; | ||
} | ||
|
||
#grpc-service-description { | ||
padding-top:14px; | ||
} | ||
|
||
#grpc-method-description { | ||
font-weight: bold; | ||
color: black; | ||
padding-top: 12px; | ||
padding-bottom: 12px; | ||
} | ||
|
||
#grpc-service-description-end { | ||
padding-bottom:14px; | ||
} | ||
|
||
#grpc-request-response { | ||
margin-top: 24px; | ||
border: none; | ||
|
@@ -34,8 +80,7 @@ | |
|
||
#grpc-request-response li.ui-tabs-tab { | ||
border: 1px solid #ccc; | ||
margin: 0; | ||
margin-right: -1px; | ||
margin: 0 -1px 0 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This and the one below were cleanup suggested by my IDE. |
||
padding: 4px 8px; | ||
border-top-right-radius: 6px; | ||
border-top-left-radius: 6px; | ||
|
@@ -118,8 +163,7 @@ textarea#grpc-request-raw-text { | |
} | ||
|
||
table#grpc-request-metadata-form { | ||
margin: 0; | ||
margin-left: 4px; | ||
margin: 0 0 0 4px; | ||
border-collapse: collapse; | ||
} | ||
|
||
|
@@ -174,7 +218,7 @@ table#grpc-request-metadata-form { | |
|
||
#grpc-request-form td { | ||
padding: 16px 0 0 16px; | ||
font-size: 13.2px; | ||
font-size: 13px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto, this and the change at the bottom were cleanup suggested by the IDE (due to not all browsers supporting fractional pixels). |
||
} | ||
|
||
#grpc-request-form td:first-of-type { | ||
|
@@ -254,6 +298,12 @@ table#grpc-request-metadata-form { | |
font-size: 120%; | ||
} | ||
|
||
.ui-tooltip.grpc-field-description { | ||
white-space: pre; | ||
font-family: "Courier New", Courier, monospace; | ||
max-width: none; | ||
} | ||
|
||
#grpc-request-form td.toggle_presence { | ||
width: 1px; | ||
} | ||
|
@@ -442,7 +492,7 @@ textarea.grpc-response-textarea { | |
|
||
#grpc-response-data td { | ||
padding: 12px 0 0 12px; | ||
font-size: 13.2px; | ||
font-size: 13px; | ||
font-family: "courier new", courier, monospace; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,42 @@ | ||
<div id="grpc-form"> | ||
<div class="grpc-desc" id="grpc-service-select"><span class="grpc-form-label">Service name:</span> | ||
<select name="grpc-service" id="grpc-service"> | ||
{{ range .Services }} | ||
<option value="{{.}}">{{.}}</option> | ||
{{ end }} | ||
</select> | ||
</div> | ||
|
||
<div class="grpc-desc" id="grpc-method-select"><span class="grpc-form-label">Method name:</span> | ||
<select name="grpc-method" id="grpc-method"> | ||
<!-- populated by JavaScript when grpc-service is selected --> | ||
</select> | ||
</div> | ||
<table class="grpc-desc"> | ||
<tr> | ||
<td> | ||
<table id="grpc-desc-selects"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I hate adding a nested table. But I played around with the layout quite a lot, and I could not figure out how to preserve the existing look without doing this. I tried floating divs and simpler tables with more divs inside and fewer table cells and no nesting. But I just couldn't figure out how to get the look and layout behavior I was aiming for without this. |
||
<!-- 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-request-response"> | ||
<ul> | ||
|
@@ -85,12 +110,22 @@ <h3>Response Trailers</h3> | |
], | ||
{{- 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, '{{ .InvokeURI }}', '{{ .MetadataURI }}', {{ .Debug }}, headers); | ||
initGRPCForm(services, svcDescs, mtdDescs, '{{ .InvokeURI }}', '{{ .MetadataURI }}', {{ .Debug }}, headers); | ||
})(); | ||
</script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This version includes a fix for printing methods: without it, comments on option statements were never included.