3 Commits

Author SHA1 Message Date
CaiHQ
b0f4c4225b feat: support createParam 2022-04-21 10:14:00 +08:00
CaiHQ
897f59c2eb add nodecenterws config 2022-03-30 11:17:08 +08:00
CaiHQ
a1a52ffc32 fix: MultiPointCooperationExecutor 2022-02-18 11:14:10 +08:00
6 changed files with 88 additions and 19 deletions

View File

@@ -230,15 +230,22 @@
onchange="changeYpkName(this.value)">
<option selected>请选择ypk文件</option>
</select>
<input class="form-control" id="createParam"
placeholder="填写启动参数" class="modal_input"/>
<div class="input-group-text">
<input type="checkbox" id="autoConvertStr"
aria-label="Checkbox for convertParam"
data-toggle="tooltip"
checked
title="" data-original-title="自动将参数转为JSON对象"/>
</div>
<select id="selectDumpPeriod" class="custom-select"
style="appearance: none">
<option selected>不保存</option>
<option selected>/12hours自动保存</option>
<option selected>/1day自动保存</option>
<option selected>/2days自动保存</option>
<option selected>选择状态保存模式</option>
<option>/12hours自动保存</option>
<option>/1day自动保存</option>
<option>/2days自动保存</option>
<option>选择状态保存模式</option>
</select>
<div class="input-group-append">
<button onclick="deleteYpk()"
@@ -1084,6 +1091,22 @@
</div>
</div>
</div>
<div class="d-flex justify-content-center">
<div class='input-group mb-3'>
<div class="input-group-prepend">
<span class="input-group-text"
id="inputGroup-sizing-default">加入网络WS</span>
</div>
<input type='text' class='form-control'
id='nodeCenterWSInput'>
<div class='input-group-append'>
<button class='btn btn-outline-secondary' type='button'
id='changeNodeCenterWS' onclick='changeNodeCenterWS()'>
修改
</button>
</div>
</div>
</div>
<div class="d-flex justify-content-center">
<div class="input-group mb-3">
<div class="input-group-prepend">
@@ -1341,6 +1364,7 @@
</script>
</body>

BIN
images/bdwarelog.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -10,11 +10,12 @@ function loadNodeConfig(event) {
function onLoadNodeConfig(data) {
global.config = data.data;
showNodeConfig(data);
if (!global.centerportalws) {
let port = global.config.nodeCenter.replace(/.*:/g, "");
const len = global.config.nodeCenter.length - port.length;
port = port - 1;
let url = global.config.nodeCenter.substring(0, len) + port + "/NodeCenterWS";
let url = global.config.nodeCenterWS;
if (window.location.origin.startsWith("https")){
url = url.replace("ws://","wss://");
}
if (window.location.origin === "https://contract.internetapi.cn") {
url = "wss://cluster.contract.internetapi.cn/NodeCenterWS";
}
@@ -28,7 +29,7 @@ function onLoadNodeConfig(data) {
}));
}, centerportalWSHandler);
}
showNodeConfig(data);
}
function showNodeConfig(data) {
@@ -44,6 +45,7 @@ function showNodeConfig(data) {
$("#expireTime").html(global.config.expireTime);
$("#yjsInput")[0].value = global.config.yjsPath;
nodeCenterInputEl[0].value = global.config.nodeCenter;
$("#nodeCenterWSInput")[0].value = global.config.nodeCenterWS;
if (global.config.clusterConnected && global.config.clusterConnected === "true") {
nodeCenterInputEl.css("color", "green");
} else {
@@ -167,6 +169,14 @@ function changeNodeCenter(event) {
}));
}
function changeNodeCenterWS(event) {
console.log("changeNodeCenterWS");
global.wssocket.send(JSON.stringify({
action: 'changeNodeCenterWS',
data: $("#nodeCenterWSInput")[0].value
}));
}
function onChangeNodeCenter(event) {
// console.log("onChangeNodeCenter", data);
myToast("成功", "修改NodeCenter成功")

View File

@@ -102,8 +102,6 @@ function drawConInfoTable(table) {
<th>状态</th>
<th>端口</th>
<th>类型</th>
<th>通讯</th>
<th>共识</th>
<!--<th>返回方式</th>-->
<th>次数</th>
<th>流量</th>
@@ -125,19 +123,20 @@ ${table[i].name}
<td>${table[i]['contractStatus']}</td>
<td>${table[i].port || '-'}</td>
<td>${table[i].type}</td>
<td>${table[i]['networkType'] ? "P2P" : "TCP"}</td>
<td>${table[i]['consensusType'] ? CONSENSUS_TABLE[table[i]['consensusType']] : '无'}</td>
<!--<td>${table[i]['networkType'] ? "P2P" : "TCP"}</td>-->
<!--<td>${table[i]['consensusType'] ? CONSENSUS_TABLE[table[i]['consensusType']] : '无'}</td>-->
<!--<td>${table[i].responseType ? RESPONSE_TYPE_TABLE[table[i].responseType] : '-'}</td>-->
<td>${table[i].times}</td>
<td>${table[i]['traffic'] || '-'}</td>
<td>${table[i].storage || '-'}</td>
<td style='padding:2px 12px 2px 12px'>
<button onclick="stopContractByID('${table[i].id}')" class="btn btn-secondary">停止</button>
<button onclick="restartContractByID('${table[i].id}')" class="btn btn-secondary">重启</button>
</td>
</tr>`
}
html += tableTail;
html = "<h5 class='card-title'>DO实例列表</h5>" + html;
html = "<h5 class='card-title'>DO实例列表</h5>" + "<button onclick='pruneKilledContract()' class='btn btn-secondary' style='float:right'>清除已停合约</button>"+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") {

View File

@@ -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 = "字符串格式";

View File

@@ -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;