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></option>
</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"
style="appearance: none">
<option selected id="sequencing" value="0">选择集群合约模式</option>
@ -299,7 +301,8 @@
</div>
</br>
<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 value="0">无需共识</option>
<option value="1">PBFT</option>
@ -311,7 +314,8 @@
<option value="0">TCP</option>
<option value="1">P2P</option>
</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 value="0">All</option>
<option value="1">Most</option>
@ -432,8 +436,12 @@
<div class="row" style="margin-top: 30px">
<div class="col-sm-12">
<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">
<h5 class="card-title">合约进程列表</h5>
<div class="d-flex justify-content-center">
<div class="spinner-border text-primary"
style="width: 4rem; height: 4rem;" role="status">
@ -462,12 +470,8 @@
<div class="container">
<div class="row d-flex justify-content-flex-start">
<div class="input-group mb-3">
<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>
</div>
<select id="selectContractInstance"
@ -499,6 +503,14 @@
</div>
<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">
<button onclick="executeContract()" type="button"
class="btn btn-outline-primary">执行
@ -1253,6 +1265,8 @@
//initWSocket();
</script>
</body>

View File

@ -125,6 +125,7 @@
}
</style>
</head>
<body>
@ -424,11 +425,11 @@
<div class="input-group mb-1">
<div class="btn-group btn-block" role="group">
<!-- <button type="button" class="btn btn-outline-primary"-->
<!-- title="数据预览" data-toggle="tooltip" onclick="genData()">-->
<!-- <img alt="Brand" src="./images/onlineide/data.png"-->
<!-- class="buttonimg">-->
<!-- </button>-->
<!-- <button type="button" class="btn btn-outline-primary"-->
<!-- title="数据预览" data-toggle="tooltip" onclick="genData()">-->
<!-- <img alt="Brand" src="./images/onlineide/data.png"-->
<!-- class="buttonimg">-->
<!-- </button>-->
</div>
</div>
@ -509,10 +510,11 @@
<div class="input-group mb-3">
<input type="text" class="form-control"
id="executeContractArgInput" placeholder="填写参数"></input>
<div class="input-group-append">
<button class="btn btn-outline-primary"
onclick="executeContract()" type="button" data-toggle="tooltip"
title="调用" id="button-addon2">
title="调用" id="button-addon1">
<img src="./images/onlineide/execute.png" class="buttonimg"/>
</button>
</div>
@ -532,14 +534,14 @@
<div class="input-group-append">
<button class="btn btn-outline-primary"
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"/>
</button>
</div>
<div class="input-group-append">
<button class="btn btn-outline-primary"
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"/>
</button>
</div>
@ -729,6 +731,7 @@
//initWSocket();
</script>
</body>
</html>

View File

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

View File

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

View File

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