From b0f4c4225b5152b11f5641ac766928a7a7f64b2a Mon Sep 17 00:00:00 2001 From: CaiHQ Date: Thu, 21 Apr 2022 10:14:00 +0800 Subject: [PATCH] feat: support createParam --- NodePortal.html | 23 ++++++++++++++++------- js/NodeContractInstances.js | 32 +++++++++++++++++++++++++++----- js/OnlineIDE.js | 4 ++-- js/codeManage/operManage.js | 15 ++++++++++++++- 4 files changed, 59 insertions(+), 15 deletions(-) diff --git a/NodePortal.html b/NodePortal.html index bfda802..e6f3fc8 100644 --- a/NodePortal.html +++ b/NodePortal.html @@ -230,15 +230,22 @@ onchange="changeYpkName(this.value)"> + +
+ +
@@ -1356,6 +1364,7 @@ + diff --git a/js/NodeContractInstances.js b/js/NodeContractInstances.js index ed612c2..62749ed 100644 --- a/js/NodeContractInstances.js +++ b/js/NodeContractInstances.js @@ -102,8 +102,6 @@ function drawConInfoTable(table) { 状态 端口 类型 -通讯 -共识 次数 流量 @@ -125,19 +123,20 @@ ${table[i].name} ${table[i]['contractStatus']} ${table[i].port || '-'} ${table[i].type} -${table[i]['networkType'] ? "P2P" : "TCP"} -${table[i]['consensusType'] ? CONSENSUS_TABLE[table[i]['consensusType']] : '无'} + + ${table[i].times} ${table[i]['traffic'] || '-'} ${table[i].storage || '-'} + ` } html += tableTail; - html = "
DO实例列表
" + html; + html = "
DO实例列表
" + ""+html; ciTabDiv.html(html); $("#ciTabDivTab").DataTable( @@ -184,6 +183,29 @@ function stopContractByID(contractID) { }); } +function pruneKilledContract() { + $("#dialogBodyDiv").html("是否清除已停合约" ); + showDialog("请确认", function () { + global.wssocket.send(JSON.stringify({ + action: 'pruneKilledContract', + requestID: new Date().getTime().toString() + })); + setTimeout(listContractProcess,1000); + }); +} + + +function restartContractByID(contractID) { + $("#dialogBodyDiv").html("是否重启合约,ContractID:" + contractID); + showDialog("请确认", function () { + global.wssocket.send(JSON.stringify({ + action: 'restartContractProcess', + requestID: new Date().getTime().toString(), + id: contractID + })); + }); +} + function drawContractInstanceStatusPie(table) { const ciStatusPieDiv = $("#ciStatusPieDiv") if (ciStatusPieDiv.css("height") === "0px") { diff --git a/js/OnlineIDE.js b/js/OnlineIDE.js index a8486d0..e623f98 100644 --- a/js/OnlineIDE.js +++ b/js/OnlineIDE.js @@ -353,12 +353,12 @@ function initResponseAndOutputArea() { function onExecuteResult(obj) { const executeResultTitleEl = $("#executeResultTitle"); const data = obj; - var sytleTail = "未知格式"; + var styleTail = "未知格式"; if (data.result==undefined) { styleTail = "Undefined"; data.result = ""; } else if (data.result instanceof Object) { - sytleTail = "JSON格式"; + styleTail = "JSON格式"; data.result =JSON.stringify(data.result); } else if (typeof data.result == 'string') { styleTail = "字符串格式"; diff --git a/js/codeManage/operManage.js b/js/codeManage/operManage.js index a5a943e..9aae93a 100644 --- a/js/codeManage/operManage.js +++ b/js/codeManage/operManage.js @@ -131,10 +131,23 @@ var startContractAtSlave = function() { } var dumpPeriod = switchPeriod(period); var project = global.ypkName; - $("#result")[0].innerHTML="正在启动,请稍候"; var request = {}; request.action = "startContractByYPK"; + if (createParam !='') { + request.createParam = createParam.value; + $("#createParam").css("color",""); + if (autoConvertStr.value=='on') { + try{ + request.createParam = JSON.parse(request.createParam); + $("#createParam").css("color",""); + }catch(e){ + console.log(e); + $("#createParam").css("color","red"); + } + }else{ + } + } request.dumpPeriod = dumpPeriod; request.isPrivate = global.ypkIsPrivate; request.owner = global.sm2Key.publicKey;