Skip to content
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 new raw header #292

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions internal/resources/webform/webform-sample.css
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ textarea#grpc-request-raw-text {
height: 200px;
}

textarea#grpc-request-raw-header {
height: 200px;
}

#grpc-request-timeout {
margin-bottom: 20px;
}
Expand Down Expand Up @@ -273,7 +277,7 @@ table#grpc-request-metadata-form {
padding-left: 0;
}

#grpc-request-form tr:first-of-type > td {
#grpc-request-form tr:first-of-type>td {
padding-top: 0;
}

Expand All @@ -288,7 +292,7 @@ table#grpc-request-metadata-form {
padding-left: 0;
}

#grpc-request-form tr:first-of-type > th {
#grpc-request-form tr:first-of-type>th {
padding-top: 0;
}

Expand Down Expand Up @@ -471,7 +475,7 @@ table#grpc-request-metadata-form {
display: inline-block;
}

#grpc-request-form div.grpc-timestamp > input {
#grpc-request-form div.grpc-timestamp>input {
margin: 4px;
}

Expand Down Expand Up @@ -524,7 +528,8 @@ table#grpc-request-metadata-form {
margin: 2px;
}

.grpc-metadata-table td, .grpc-metadata-table th {
.grpc-metadata-table td,
.grpc-metadata-table th {
padding: 8px;
border: 1px solid #eee;
font-family: "courier new", courier, monospace;
Expand Down Expand Up @@ -577,7 +582,7 @@ textarea.grpc-response-textarea {
font-weight: bold;
}

#grpc-response-data tr:first-of-type > td {
#grpc-response-data tr:first-of-type>td {
padding-top: 0;
}

Expand Down Expand Up @@ -632,7 +637,8 @@ textarea.grpc-response-textarea {
color: #c00;
}

button#grpc-history-clear, button#grpc-history-save {
button#grpc-history-clear,
button#grpc-history-save {
margin-bottom: 16px;
font-size: 96%;
padding: 8px 15px;
Expand Down Expand Up @@ -669,7 +675,7 @@ button#grpc-history-clear, button#grpc-history-save {
color: #000;
}

#grpc-history-list > .ui-accordion:first-child {
#grpc-history-list>.ui-accordion:first-child {
border-top: 1px solid #eee;
}

Expand Down Expand Up @@ -762,4 +768,4 @@ button#grpc-history-clear, button#grpc-history-save {
border: 1px solid #dddddd;
padding: 1em;
margin-bottom: 1em;
}
}
5 changes: 5 additions & 0 deletions internal/resources/webform/webform-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ <h3>Request Timeout</h3>
<button class="grpc-invoke" disabled>Invoke</button>
</div>
<div class="grpc-tabcontent" id="grpc-request-raw-tab">
<div class="grpc-request-raw-container">
<h3>Request Header</h3>
<textarea id="grpc-request-raw-header"></textarea><br/>
<button class="button-header">Add Headaer</button>
</div>
<div class="grpc-request-raw-container">
<h3>Request payload</h3>
<textarea id="grpc-request-raw-text"></textarea><br/>
Expand Down
9 changes: 9 additions & 0 deletions internal/resources/webform/webform.js
Original file line number Diff line number Diff line change
Expand Up @@ -2855,6 +2855,15 @@ window.initGRPCForm = function(services, svcDescs, mtdDescs, invokeURI, metadata
invoke();
}
});
$(".button-header").click(function(e) {
if (onlyIfValid(e)) {
$('.metadataRow').closest("tr").remove();
$.each($('#grpc-request-raw-header').val().split(/\n/), function(i, line) {
let pair = line.split(':');
addMetadataRow(pair[0], pair[1]);
});
}
});

if (localStorage.getItem(expandDescStorageKey) === "true") {
descriptionsShown = true;
Expand Down