feat: support invoke as debug

This commit is contained in:
root 2021-06-16 18:49:45 +08:00
parent 1ead2613a9
commit 4532c905e6
2 changed files with 11 additions and 4 deletions

View File

@ -397,6 +397,11 @@ function changeAppInternal(requireRendering) {
+ " <select id=\"selectAction\" onchange=\"showDescription()\" class=\"custom-select\" style=\"-webkit-appearance: none;\"><option value=\"-1\">选择方法</option></select> \n"
+ " </div>\n"
+ " <input type=\"text\" class=\"form-control\" id=\"argInput\" placeholder=\"填写参数\" >\n"
+ " <div class=\"input-group-append input-group-text\">\n"
+ "<input type=\"checkbox\" id=\"executeContractAsDebug\" aria-label=\"Checkbox for isDebug\" data-toggle=\"tooltip\" title=\"模拟调用\"></input>"
+ " </div>\n"
+ " <div class=\"input-group-append\">\n"
+ " <button class=\"btn btn-outline-secondary\" type=\"button\" \n"
+ " onclick=\"triggerExecuteCurrentContract()\">\n"
@ -463,8 +468,9 @@ function triggerExecuteCurrentContract() {
}
console.log(funNode);
const argInput = $("#argInput");
executeCurrentContract(funNode.functionName, argInput[0].value,
fillResultInternal);
var contract = global.currentContract;
executeContract(contract.id, funNode.functionName, argInput[0].value,
fillResultInternal,executeContractAsDebug.checked);
const iHtml = "/SCIDE/SCManager?action=executeContract&contractID="
+ global.currentContract.name + "&operation="
+ funNode.functionName + "&arg=" + argInput[0].value

View File

@ -179,13 +179,14 @@ var onExecuteResultInternal = function (data) {
callback(global.executeResult, data);
}
};
window.executeContract = function (contractID, method, strarg, cb) {
window.executeContract = function (contractID, method, strarg, cb, asDebug) {
var sm2Key = global.sm2Key;
var request = {};
request.action = "executeContract";
request.requestID = new Date().getTime() + "_"
+ Math.floor(Math.random() * 10000);
if (asDebug)
request.isDebug = true;
global.cbs[request.requestID] = cb;
request.contractID = contractID;
request.operation = method;