1
0
mirror of https://github.com/gusaul/grpcox.git synced 2024-12-26 02:40:10 +00:00

feat(client): store metadata on save or save as

This commit is contained in:
ananrafs 2023-08-15 12:59:25 +07:00
parent 6feae4127c
commit f899a5fc05

View File

@ -43,7 +43,9 @@ function getReqResData() {
const selectFunction = document.getElementById("select-function").value;
const responseHTML = document.getElementById("json-response").innerHTML;
const schemaProtoHTML = document.getElementById("schema-proto").innerHTML;
const metadata = document.getElementById("ctx-metadata-switch").checked ? document.querySelector('div#ctx-metadata-table > table > tbody').innerHTML : "";
editor = ace.edit("editor");
return {
server_target: serverTarget,
selected_service: selectService,
@ -51,6 +53,7 @@ function getReqResData() {
raw_request: editor.getValue(),
response_html: responseHTML,
schema_proto_html: schemaProtoHTML,
raw_metadata: metadata,
}
}
@ -66,6 +69,10 @@ function setReqResData(data) {
$('#schema-proto').html(data.schema_proto_html);
$('#json-response').html(data.response_html);
$('#response').show();
if (!!data.raw_metadata) {
$('#ctx-metadata-switch').trigger("click");
$('#ctx-metadata-table > table > tbody').html(data.raw_metadata);
}
}
function resetReqResData() {
@ -74,6 +81,8 @@ function resetReqResData() {
$('#choose-function').hide();
$('#body-request').hide();
$('#response').hide();
$('#ctx-metadata-switch').prop('checked', false);
$('#ctx-metadata-input').hide();
}
async function renderRequestList() {