WS Tool: adjust labels on permalink, disable curl syntax for ws-only command

This commit is contained in:
mDuo13
2019-06-13 16:29:03 -07:00
parent b8f7d2566a
commit 652a65a531
2 changed files with 24 additions and 2 deletions

View File

@@ -162,8 +162,8 @@ Request('ledger_entry', {
Request("Transaction Methods")
// TODO: maybe special case sign/sign_for so you can use those if you're
// connected to a local server?
// Future feature: special case sign/sign_for so you can use those if you're
// connected to a local server (with big warning)
Request('submit', {
description: "Submits a transaction to the network to be confirmed and included in future ledgers.",
@@ -278,6 +278,7 @@ Request('deposit_authorized', {
Request('path_find', {
description: "Searches for a path along which a payment can possibly be made, and periodically sends updates when the path changes over time.",
link: "path_find.html",
ws_only: true,
body: {
"id": 8,
"command": "path_find",

View File

@@ -106,6 +106,11 @@ function select_request(request) {
} else {
$(".api-method-description-wrapper .api-readmore").hide()
}
if (command.ws_only) {
$(".curl").hide()
} else {
$(".curl").show()
}
$(".selected_command").attr('href', command.link).text(command.name)
@@ -288,13 +293,29 @@ function load_from_permalink(params) {
}
let req_body = params.get("req")
let cmd_name = ""
if (req_body) {
try {
req_body_json = JSON.parse(req_body)
req_body = JSON.stringify(req_body_json, null, 2)
cmd_name = req_body_json.command
} catch(e) {
console.warn("Loaded request body is invalid JSON:", e)
}
$(".selected_command").text(cmd_name)
if (requests.hasOwnProperty(slugify(cmd_name))) {
const req = requests[slugify(cmd_name)]
$(".selected_command").attr('href', req.link)
$(".api-method-description-wrapper .blurb").html(req.description)
$(".api-method-description-wrapper .api-readmore").attr("href", req.link)
$(".api-method-description-wrapper .api-readmore").show()
} else {
console.debug("Unknown command:", cmd_name)
$(".selected_command").attr('href', "")
$(".api-method-description-wrapper .blurb").empty()
$(".api-method-description-wrapper .api-readmore").hide()
}
cm_request.setValue(req_body)
}
}