feat: invoke fromDebug in NodePortal.html

This commit is contained in:
root 2021-06-16 12:11:09 +08:00
parent 0b16ec99cd
commit 900413f0e4
5 changed files with 44 additions and 19 deletions

View File

@ -269,7 +269,9 @@
<option selected>选择节点集群</option> <option selected>选择节点集群</option>
<option></option> <option></option>
</select> </select>
<input class="form-control" id="selectUnitNum" type="number" placeholder="选择节点数量" step="1" class="modal_input" min="1" max="10"/> <input class="form-control" id="selectUnitNum" type="number"
placeholder="选择节点数量" step="1" class="modal_input" min="1"
max="10"/>
<select class="custom-select" <select class="custom-select"
style="appearance: none"> style="appearance: none">
<option selected id="sequencing" value="0">选择集群合约模式</option> <option selected id="sequencing" value="0">选择集群合约模式</option>
@ -299,7 +301,8 @@
</div> </div>
</br> </br>
<div class="input-group mb3"> <div class="input-group mb3">
<select id="sequence" class="custom-select" style="appearance: none"> <select id="sequence" class="custom-select"
style="appearance: none">
<option selected value="0">选择共识算法</option> <option selected value="0">选择共识算法</option>
<option value="0">无需共识</option> <option value="0">无需共识</option>
<option value="1">PBFT</option> <option value="1">PBFT</option>
@ -311,7 +314,8 @@
<option value="0">TCP</option> <option value="0">TCP</option>
<option value="1">P2P</option> <option value="1">P2P</option>
</select> </select>
<select id="response" class="custom-select" style="appearance: none"> <select id="response" class="custom-select"
style="appearance: none">
<option selected value="0">选择结果返回模式</option> <option selected value="0">选择结果返回模式</option>
<option value="0">All</option> <option value="0">All</option>
<option value="1">Most</option> <option value="1">Most</option>
@ -432,8 +436,12 @@
<div class="row" style="margin-top: 30px"> <div class="row" style="margin-top: 30px">
<div class="col-sm-12"> <div class="col-sm-12">
<div class="card "> <div class="card ">
<div class="card-body">
<button onclick="killAllContract()" type="button"
class="btn btn-outline-primary">停止全部
</button>
</div>
<div class="card-body" id="cpTabDiv"> <div class="card-body" id="cpTabDiv">
<h5 class="card-title">合约进程列表</h5>
<div class="d-flex justify-content-center"> <div class="d-flex justify-content-center">
<div class="spinner-border text-primary" <div class="spinner-border text-primary"
style="width: 4rem; height: 4rem;" role="status"> style="width: 4rem; height: 4rem;" role="status">
@ -462,12 +470,8 @@
<div class="container"> <div class="container">
<div class="row d-flex justify-content-flex-start"> <div class="row d-flex justify-content-flex-start">
<div class="input-group mb-3"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<button onclick="killAllContract()" type="button"
class="btn btn-outline-primary">停止全部
</button>
</div>
<div class="input-group-append">
<label class="input-group-text">选择实例</label> <label class="input-group-text">选择实例</label>
</div> </div>
<select id="selectContractInstance" <select id="selectContractInstance"
@ -499,6 +503,14 @@
</div> </div>
<input type="text" class="form-control" id="arg"> <input type="text" class="form-control" id="arg">
<div class="input-group-append">
<div class="input-group-text">
<input type="checkbox" id="executeContractAsDebug"
aria-label="Checkbox for isDebug"
data-toggle="tooltip"
title="模拟调用"></input>
</div>
</div>
<div class="input-group-append"> <div class="input-group-append">
<button onclick="executeContract()" type="button" <button onclick="executeContract()" type="button"
class="btn btn-outline-primary">执行 class="btn btn-outline-primary">执行
@ -1253,6 +1265,8 @@
//initWSocket(); //initWSocket();
</script> </script>
</body> </body>

View File

@ -125,6 +125,7 @@
} }
</style> </style>
</head> </head>
<body> <body>
@ -509,10 +510,11 @@
<div class="input-group mb-3"> <div class="input-group mb-3">
<input type="text" class="form-control" <input type="text" class="form-control"
id="executeContractArgInput" placeholder="填写参数"></input> id="executeContractArgInput" placeholder="填写参数"></input>
<div class="input-group-append"> <div class="input-group-append">
<button class="btn btn-outline-primary" <button class="btn btn-outline-primary"
onclick="executeContract()" type="button" data-toggle="tooltip" onclick="executeContract()" type="button" data-toggle="tooltip"
title="调用" id="button-addon2"> title="调用" id="button-addon1">
<img src="./images/onlineide/execute.png" class="buttonimg"/> <img src="./images/onlineide/execute.png" class="buttonimg"/>
</button> </button>
</div> </div>
@ -532,14 +534,14 @@
<div class="input-group-append"> <div class="input-group-append">
<button class="btn btn-outline-primary" <button class="btn btn-outline-primary"
onclick="executeContractWithDynamicResult()" type="button" onclick="executeContractWithDynamicResult()" type="button"
data-toggle="tooltip" title="动态分析" id="button-addon2"> data-toggle="tooltip" title="动态分析" id="button-addon3">
<img src="./images/onlineide/analysis.png" class="buttonimg"/> <img src="./images/onlineide/analysis.png" class="buttonimg"/>
</button> </button>
</div> </div>
<div class="input-group-append"> <div class="input-group-append">
<button class="btn btn-outline-primary" <button class="btn btn-outline-primary"
onclick="testEvaluates()" type="button" onclick="testEvaluates()" type="button"
data-toggle="tooltip" title="gas预估" id="button-addon2"> data-toggle="tooltip" title="gas预估" id="button-addon4">
<img src="./images/onlineide/budget.png" class="buttonimg"/> <img src="./images/onlineide/budget.png" class="buttonimg"/>
</button> </button>
</div> </div>
@ -729,6 +731,7 @@
//initWSocket(); //initWSocket();
</script> </script>
</body> </body>
</html> </html>

View File

@ -35,6 +35,9 @@ var onListContractProcess1 = function(obj) {
global.permissionNameMap = {}; global.permissionNameMap = {};
for (var i = 0; i < table.length; i++) { for (var i = 0; i < table.length; i++) {
if (table[i].contractStatus=="KILLED") {
continue;
}
var option = document.createElement("option"); var option = document.createElement("option");
option.text = table[i].name; option.text = table[i].name;
console.log(table[i].name); console.log(table[i].name);
@ -370,6 +373,7 @@ var executeContractWithDynamicResult = function() {
request.contractName = global.contractInstance; request.contractName = global.contractInstance;
request.sequencing = global.instanceSequencing; request.sequencing = global.instanceSequencing;
request.useP2P = global.useP2P; request.useP2P = global.useP2P;
request.isDebug = executeContractAsDebug.checked;
var operation = $("#selectContractFunction")[0].value; var operation = $("#selectContractFunction")[0].value;
if (operation == " " && operation == undefined) { if (operation == " " && operation == undefined) {
myToast("执行合约", "请选择合约方法!"); myToast("执行合约", "请选择合约方法!");
@ -399,6 +403,7 @@ var executeContract = function() {
request.operation = operation; request.operation = operation;
request.arg = $("#arg")[0].value ; request.arg = $("#arg")[0].value ;
request.pubkey = global.sm2Key.publicKey; request.pubkey = global.sm2Key.publicKey;
request.isDebug = executeContractAsDebug.checked;
console.log(request.arg); console.log(request.arg);
request.signature = sm2.doSignature(request.contractID + "|" + operation request.signature = sm2.doSignature(request.contractID + "|" + operation
+ "|" + $("#arg")[0].value + "|" + global.sm2Key.publicKey, + "|" + $("#arg")[0].value + "|" + global.sm2Key.publicKey,

View File

@ -207,9 +207,11 @@ function initGlobal(urlParams) {
global.isBaaS = true global.isBaaS = true
primaryColor = "#08263a" primaryColor = "#08263a"
} }
if (urlParams){
global.urlparam = urlParams;
}
if (urlParams && urlParams.keys) { if (urlParams && urlParams.keys) {
global.urlparam = urlParams global.sm2Key = urlParams.keys;
global.sm2Key = urlParams.keys
} else { } else {
global.sm2Key = localStorage.getItem("PrivKey"); global.sm2Key = localStorage.getItem("PrivKey");
if (!global.sm2Key || global.sm2Key.length < 100) { if (!global.sm2Key || global.sm2Key.length < 100) {

View File

@ -235,6 +235,7 @@ var executeContract = function () {
} }
// console.log("[arg.gasLimit]"+arg.gasLimit); // console.log("[arg.gasLimit]"+arg.gasLimit);
request.pubkey = sm2Key.publicKey; request.pubkey = sm2Key.publicKey;
// request.isDebug = executeContractAsDebug.checked;
request.signature = sm2.doSignature(request.contractID + "|" + arg.action request.signature = sm2.doSignature(request.contractID + "|" + arg.action
+ "|" + arg.arg + "|" + sm2Key.publicKey, sm2Key.privateKey, {hash: true, der: true}); + "|" + arg.arg + "|" + sm2Key.publicKey, sm2Key.privateKey, {hash: true, der: true});
request.arg = JSON.stringify(arg); request.arg = JSON.stringify(arg);