Compare commits
21 Commits
proj/nanni
...
b0f4c4225b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b0f4c4225b | ||
|
|
897f59c2eb | ||
|
|
a1a52ffc32 | ||
|
|
cdcdfbdfde | ||
|
|
d0f8af9851 | ||
|
|
965ee67409 | ||
|
|
0dfa8a555a | ||
|
|
37476bd506 | ||
|
|
89360bbf0c | ||
|
|
f6c898dc9e | ||
|
|
c73d1cfabf | ||
|
|
e96048de2a | ||
|
|
a117a53b0b | ||
|
|
2aa98c4f17 | ||
|
|
de634576fd | ||
|
|
e600c386da | ||
| fe1dcf7e79 | |||
|
|
5758a3ae78 | ||
|
|
e48679db44 | ||
|
|
1ff93a3e76 | ||
|
|
44d288f147 |
@@ -127,7 +127,7 @@
|
|||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body style="overflow-x: hidden;">
|
||||||
|
|
||||||
<header
|
<header
|
||||||
class="headerFooter navbar navbar-default navbar-fixed-top navColor ">
|
class="headerFooter navbar navbar-default navbar-fixed-top navColor ">
|
||||||
@@ -142,7 +142,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<div class="container-fluid" id="main">
|
<div class="container-fluid" id="main">
|
||||||
<div class="row h-100">
|
<div class="row h-100" style="overflow:hidden">
|
||||||
<div class="col-2 h-100" id="horiNav">
|
<div class="col-2 h-100" id="horiNav">
|
||||||
<div class="container-fluid d-flex flex-column h-100">
|
<div class="container-fluid d-flex flex-column h-100">
|
||||||
<div class="row" style="display: none;">
|
<div class="row" style="display: none;">
|
||||||
@@ -271,7 +271,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="box" style="overflow:auto; height:100%">
|
<div id="box" style="overflow:hidden; height:100%">
|
||||||
<div id="contractCode" class="flex-grow-1" style="height:100%">
|
<div id="contractCode" class="flex-grow-1" style="height:100%">
|
||||||
<div id="textareaDiv" class="col-sm-12" style="width: 100%; height: 100%; padding:0">
|
<div id="textareaDiv" class="col-sm-12" style="width: 100%; height: 100%; padding:0">
|
||||||
<textarea id="scriptEditor" style="width: 100%; height: 100%"
|
<textarea id="scriptEditor" style="width: 100%; height: 100%"
|
||||||
|
|||||||
115
NodePortal.html
115
NodePortal.html
@@ -60,7 +60,7 @@
|
|||||||
<script src="./js/bootstrap4-toggle.min.js"></script>
|
<script src="./js/bootstrap4-toggle.min.js"></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body style="overflow-x: hidden;">
|
||||||
|
|
||||||
<header
|
<header
|
||||||
class="headerFooter navbar navbar-default navbar-fixed-top navColor ">
|
class="headerFooter navbar navbar-default navbar-fixed-top navColor ">
|
||||||
@@ -230,15 +230,22 @@
|
|||||||
onchange="changeYpkName(this.value)">
|
onchange="changeYpkName(this.value)">
|
||||||
<option selected>请选择ypk文件</option>
|
<option selected>请选择ypk文件</option>
|
||||||
</select>
|
</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"
|
<select id="selectDumpPeriod" class="custom-select"
|
||||||
style="appearance: none">
|
style="appearance: none">
|
||||||
|
|
||||||
<option selected>不保存</option>
|
<option selected>不保存</option>
|
||||||
<option selected>/12hours自动保存</option>
|
<option>/12hours自动保存</option>
|
||||||
<option selected>/1day自动保存</option>
|
<option>/1day自动保存</option>
|
||||||
<option selected>/2days自动保存</option>
|
<option>/2days自动保存</option>
|
||||||
<option selected>选择状态保存模式</option>
|
<option>选择状态保存模式</option>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<button onclick="deleteYpk()"
|
<button onclick="deleteYpk()"
|
||||||
@@ -280,7 +287,9 @@
|
|||||||
<option value="3">RARF</option>
|
<option value="3">RARF</option>
|
||||||
<option value="4">RARH</option>
|
<option value="4">RARH</option>
|
||||||
<option value="5">RARA</option>
|
<option value="5">RARA</option>
|
||||||
<option value="6">Shading</option>
|
<option value="6">Sharding</option>
|
||||||
|
<option value="7">SASharding</option>
|
||||||
|
<option value="8">PBFT</option>
|
||||||
</select>
|
</select>
|
||||||
<div class="btn-group mr-3" role="group"
|
<div class="btn-group mr-3" role="group"
|
||||||
style="margin-left: 2%">
|
style="margin-left: 2%">
|
||||||
@@ -504,7 +513,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="text" class="form-control" placeholder="输入参数" id="arg">
|
<input type="text" class="form-control" placeholder="输入参数" id="arg">
|
||||||
<input type="text" class="form-control col-2" placeholder="输入gas" id="gasLimit">
|
<input type="text" class="form-control col-2" placeholder="输入gas"
|
||||||
|
id="gasLimit">
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<div class="input-group-text">
|
<div class="input-group-text">
|
||||||
<input type="checkbox" id="executeContractAsDebug"
|
<input type="checkbox" id="executeContractAsDebug"
|
||||||
@@ -544,6 +554,75 @@
|
|||||||
<textarea class="form-control" id="responseArea"></textarea>
|
<textarea class="form-control" id="responseArea"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row d-flex justify-content-flex-start">
|
||||||
|
<h6 class="card-title" style="margin-top: 2%">Mask配置</h6>
|
||||||
|
<div class="input-group mb-3">
|
||||||
|
|
||||||
|
<div class="input-group-append">
|
||||||
|
<span class="input-group-text">参数</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="text" class="form-control" placeholder="输入参数"
|
||||||
|
id="maskArg">
|
||||||
|
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button onclick="getMask()" type="button"
|
||||||
|
class="btn btn-outline-primary">get
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button onclick="setMask()"
|
||||||
|
type="button" class="btn btn-outline-primary">set
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row d-flex justify-content-flex-start">
|
||||||
|
<div class="input-group mb-3">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text" id="maskStatus">当前配置:</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<textarea class="form-control" id="maskResponseArea"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row d-flex justify-content-flex-start">
|
||||||
|
<h6 class="card-title" style="margin-top: 2%">Mock配置</h6>
|
||||||
|
<div class="input-group mb-3">
|
||||||
|
|
||||||
|
<div class="input-group-append">
|
||||||
|
<span class="input-group-text">参数</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="text" class="form-control" placeholder="输入参数"
|
||||||
|
id="mockArg">
|
||||||
|
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button onclick="getMock()" type="button"
|
||||||
|
class="btn btn-outline-primary">get
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="input-group-append">
|
||||||
|
<button onclick="setMock()"
|
||||||
|
type="button" class="btn btn-outline-primary">set
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row d-flex justify-content-flex-start">
|
||||||
|
<div class="input-group mb-3">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text" id="mockStatus">当前配置:</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<textarea class="form-control" id="mockResponseArea"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row d-flex justify-content-flex-start">
|
<div class="row d-flex justify-content-flex-start">
|
||||||
<h6 class="card-title" style="margin-top: 2%">权限管理</h6>
|
<h6 class="card-title" style="margin-top: 2%">权限管理</h6>
|
||||||
</div>
|
</div>
|
||||||
@@ -1012,6 +1091,22 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</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="d-flex justify-content-center">
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3">
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
@@ -1268,6 +1363,8 @@
|
|||||||
//initWSocket();
|
//initWSocket();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
1333
NodePortal_Gateway.html
Normal file
1333
NodePortal_Gateway.html
Normal file
File diff suppressed because it is too large
Load Diff
@@ -132,7 +132,7 @@
|
|||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body style="overflow-x: hidden;">
|
||||||
|
|
||||||
<header
|
<header
|
||||||
class="headerFooter navbar navbar-default navbar-fixed-top navColor ">
|
class="headerFooter navbar navbar-default navbar-fixed-top navColor ">
|
||||||
@@ -147,7 +147,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<div class="container-fluid" id="main">
|
<div class="container-fluid" id="main">
|
||||||
<div class="row h-100">
|
<div class="row h-100" style="overflow:hidden">
|
||||||
<div class="col-2 h-100" id="horiNav">
|
<div class="col-2 h-100" id="horiNav">
|
||||||
<div class="container-fluid d-flex flex-column h-100">
|
<div class="container-fluid d-flex flex-column h-100">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -278,7 +278,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="box" style="overflow:auto; height:100%">
|
<div id="box" style="overflow:hidden; height:100%">
|
||||||
<div id="contractCode" class="flex-grow-1" style="height:100%">
|
<div id="contractCode" class="flex-grow-1" style="height:100%">
|
||||||
<div id="textareaDiv" class="col-sm-12" style="width: 100%; height: 100%; padding:0">
|
<div id="textareaDiv" class="col-sm-12" style="width: 100%; height: 100%; padding:0">
|
||||||
<textarea id="scriptEditor" style="width: 100%; height: 100%"
|
<textarea id="scriptEditor" style="width: 100%; height: 100%"
|
||||||
|
|||||||
BIN
images/bdwarelog.png
Executable file
BIN
images/bdwarelog.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
1333
index_gate.html
Normal file
1333
index_gate.html
Normal file
File diff suppressed because it is too large
Load Diff
165
index_gateway.html
Normal file
165
index_gateway.html
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
<html>
|
||||||
|
<header>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<meta http-equiv="Cache-Control" content="no-cache"/>
|
||||||
|
<title>北大数瑞数联网网关</title>
|
||||||
|
<script src="./jqueryui1.12/jquery-2.1.4.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.halfDiv {
|
||||||
|
float: left;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.projectTreeDiv {
|
||||||
|
height: auto;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.halfDivRight {
|
||||||
|
float: left;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-tabs {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-accordion .ui-accordion-content {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tabs-1 {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-tabs .ui-tabs-panel {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.context-menu-root {
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
#projectDiv {
|
||||||
|
height: 83%;
|
||||||
|
width: 20%;
|
||||||
|
border: 0px solid grey;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror {
|
||||||
|
height: auto
|
||||||
|
}
|
||||||
|
|
||||||
|
.logoimg {
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
height: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sendTransInput {
|
||||||
|
background-color: #f0e4e4;
|
||||||
|
border-radius: 5px;
|
||||||
|
margin: 5px;
|
||||||
|
width: 15%;
|
||||||
|
margin-left: 4%;
|
||||||
|
border: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.normalDiv {
|
||||||
|
float: left;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 5px;
|
||||||
|
margin: 2%;
|
||||||
|
padding: 5px;
|
||||||
|
padding-top: 30px;
|
||||||
|
padding-bottom: 30px;
|
||||||
|
width: 45%;
|
||||||
|
cursor: hand;
|
||||||
|
background: #2E324C;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.iconimg {
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
max-width: 48px;
|
||||||
|
max-height: 48px;
|
||||||
|
vertical-align: middle;
|
||||||
|
filter: invert(100%);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</header>
|
||||||
|
<body style="background: #2E324C; color: white;">
|
||||||
|
<div
|
||||||
|
style="width: 90%; max-width: 1000px; min-width: 850px; margin: 0 auto; margin-top: 3%;">
|
||||||
|
<div style="width: 20%; float: right; margin-right: 0%">
|
||||||
|
<img src="./images/logo.png" class="logoimg"></img>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
style="width: fit-content; margin: 0; font-size: 200%; background-color: white; color: black; border-radius: 10px; float: left; padding: 10px;">
|
||||||
|
导航
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
style="width: 100%; margin-top: 2%; float: left; background-color: white; border-radius: 10px;">
|
||||||
|
|
||||||
|
<div class="normalDiv" onclick="jumpTo('./OnlineIDE.html')">
|
||||||
|
<img src="./images/index/web.png" class="iconimg"></img><br/>
|
||||||
|
<span style="vertical-align: middle">网关接入管理</span>
|
||||||
|
</div>
|
||||||
|
<div class="normalDiv" onclick="jumpTo('./NodePortal_Gateway.html')">
|
||||||
|
<img src="./images/index/analysis.png" class="iconimg"></img><br/>
|
||||||
|
<span style="vertical-align: middle">网关配置管理</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
jumpTo = function (addr) {
|
||||||
|
document.location.href = addr;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<div style="width: fit-content; margin-top: 2%; float: right; border-radius: 10px; font-size: 50%">
|
||||||
|
Icons made by
|
||||||
|
<a href="https://www.flaticon.com/authors/monkik"
|
||||||
|
title="monkik" style="color: white;">monkik</a>
|
||||||
|
from
|
||||||
|
<a href="https://www.flaticon.com/" title="Flaticon"
|
||||||
|
style="color: white;">www.flaticon.com</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<!--
|
||||||
|
============ NodeCenter的一些链接:其中39.106.6.6监听的是1817端口。 查看节点是否启动
|
||||||
|
http://39.106.6.6:18001/SCIDE/NodeCenter?action=ping 查看NodeCenter当前连接的节点
|
||||||
|
http://39.106.6.6:18001/SCIDE/NodeCenter?action=listCMInfo
|
||||||
|
|
||||||
|
刷新NodeCenter已连接节点的合约数据
|
||||||
|
http://39.106.6.6:18001/SCIDE/NodeCenter?action=updateContract
|
||||||
|
|
||||||
|
检查节点是否已连接,删除断开连接的节点
|
||||||
|
http://39.106.6.6:18001/SCIDE/NodeCenter?action=checkAlive
|
||||||
|
|
||||||
|
获取某个合约的日志数量
|
||||||
|
http://39.106.6.6:18001/SCIDE/NodeCenter?action=getLogSize&contractID=BDCoin
|
||||||
|
|
||||||
|
获取某个合约的日志,从第offset条,取count条
|
||||||
|
http://39.106.6.6:18001/SCIDE/NodeCenter?action=requestLog&contractID=BDCoin&offset=16&count=10
|
||||||
|
|
||||||
|
获取某个合约的日志,取最新的count条
|
||||||
|
http://39.106.6.6:18001/SCIDE/NodeCenter?action=requestLastLog&contractID=BDCoin&count=10
|
||||||
|
-->
|
||||||
Binary file not shown.
9214
jqueryui1.12/jquery-2.1.4.js
vendored
Executable file → Normal file
9214
jqueryui1.12/jquery-2.1.4.js
vendored
Executable file → Normal file
File diff suppressed because one or more lines are too long
@@ -10,11 +10,12 @@ function loadNodeConfig(event) {
|
|||||||
|
|
||||||
function onLoadNodeConfig(data) {
|
function onLoadNodeConfig(data) {
|
||||||
global.config = data.data;
|
global.config = data.data;
|
||||||
|
showNodeConfig(data);
|
||||||
if (!global.centerportalws) {
|
if (!global.centerportalws) {
|
||||||
let port = global.config.nodeCenter.replace(/.*:/g, "");
|
let url = global.config.nodeCenterWS;
|
||||||
const len = global.config.nodeCenter.length - port.length;
|
if (window.location.origin.startsWith("https")){
|
||||||
port = port - 1;
|
url = url.replace("ws://","wss://");
|
||||||
let url = global.config.nodeCenter.substring(0, len) + port + "/NodeCenterWS";
|
}
|
||||||
if (window.location.origin === "https://contract.internetapi.cn") {
|
if (window.location.origin === "https://contract.internetapi.cn") {
|
||||||
url = "wss://cluster.contract.internetapi.cn/NodeCenterWS";
|
url = "wss://cluster.contract.internetapi.cn/NodeCenterWS";
|
||||||
}
|
}
|
||||||
@@ -28,7 +29,7 @@ function onLoadNodeConfig(data) {
|
|||||||
}));
|
}));
|
||||||
}, centerportalWSHandler);
|
}, centerportalWSHandler);
|
||||||
}
|
}
|
||||||
showNodeConfig(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showNodeConfig(data) {
|
function showNodeConfig(data) {
|
||||||
@@ -44,6 +45,7 @@ function showNodeConfig(data) {
|
|||||||
$("#expireTime").html(global.config.expireTime);
|
$("#expireTime").html(global.config.expireTime);
|
||||||
$("#yjsInput")[0].value = global.config.yjsPath;
|
$("#yjsInput")[0].value = global.config.yjsPath;
|
||||||
nodeCenterInputEl[0].value = global.config.nodeCenter;
|
nodeCenterInputEl[0].value = global.config.nodeCenter;
|
||||||
|
$("#nodeCenterWSInput")[0].value = global.config.nodeCenterWS;
|
||||||
if (global.config.clusterConnected && global.config.clusterConnected === "true") {
|
if (global.config.clusterConnected && global.config.clusterConnected === "true") {
|
||||||
nodeCenterInputEl.css("color", "green");
|
nodeCenterInputEl.css("color", "green");
|
||||||
} else {
|
} 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) {
|
function onChangeNodeCenter(event) {
|
||||||
// console.log("onChangeNodeCenter", data);
|
// console.log("onChangeNodeCenter", data);
|
||||||
myToast("成功", "修改NodeCenter成功")
|
myToast("成功", "修改NodeCenter成功")
|
||||||
@@ -262,7 +272,7 @@ function showNodeTrustUnits(obj) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
let html = "<table class='table display row-border' id='trustNodesUnitTabDivTab'>" +
|
let html = "<table class='table display row-border' id='trustNodesUnitTabDivTab'>" +
|
||||||
"<thead><tr><th>序号</th><th>ID</th><th>类型</th><th>创建者</th><th>节点数目</th><th>节点公钥</th></tr></thead>" +
|
"<thead><tr><th>序号</th><th>ID</th><th>类型</th><th>创建者</th><th>节点数目</th><th>节点列表</th></tr></thead>" +
|
||||||
"<tbody>";
|
"<tbody>";
|
||||||
const tableTail = "</tbody></table>";
|
const tableTail = "</tbody></table>";
|
||||||
if (global.nodeUnits) {
|
if (global.nodeUnits) {
|
||||||
@@ -275,12 +285,12 @@ function showNodeTrustUnits(obj) {
|
|||||||
<td>TCP</td>
|
<td>TCP</td>
|
||||||
<td>${global.nodeUnits[i].key.substring(0, at_ - 1)}</td>
|
<td>${global.nodeUnits[i].key.substring(0, at_ - 1)}</td>
|
||||||
<td>${nodes.length}</td>
|
<td>${nodes.length}</td>
|
||||||
<td>${JSON.stringify(nodes)}</td>
|
<td>${nodes.map(x => x.nodeName).sort().join(',')}</td>
|
||||||
</tr>`
|
</tr>`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (global.p2pNodes) {
|
if (global.p2pNodes) {
|
||||||
html += "<tr><td>" + (i+1) + "</td> <td>P2PUnit</td><td>P2P</td> <td>bdledger</td> <td>" + global.p2pNodes.length + "</td> <td>" + JSON.stringify(global.p2pNodes) + "</td> </tr>";
|
html += "<tr><td>" + (i + 1) + "</td> <td>P2PUnit</td><td>P2P</td> <td>bdledger</td> <td>" + global.p2pNodes.length + "</td> <td>" + JSON.stringify(global.p2pNodes) + "</td> </tr>";
|
||||||
}
|
}
|
||||||
html += tableTail;
|
html += tableTail;
|
||||||
$("#trustNodesUnitTabDiv").html(html);
|
$("#trustNodesUnitTabDiv").html(html);
|
||||||
|
|||||||
@@ -102,8 +102,6 @@ function drawConInfoTable(table) {
|
|||||||
<th>状态</th>
|
<th>状态</th>
|
||||||
<th>端口</th>
|
<th>端口</th>
|
||||||
<th>类型</th>
|
<th>类型</th>
|
||||||
<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]['contractStatus']}</td>
|
||||||
<td>${table[i].port || '-'}</td>
|
<td>${table[i].port || '-'}</td>
|
||||||
<td>${table[i].type}</td>
|
<td>${table[i].type}</td>
|
||||||
<td>${table[i]['networkType'] ? "P2P" : "TCP"}</td>
|
<!--<td>${table[i]['networkType'] ? "P2P" : "TCP"}</td>-->
|
||||||
<td>${table[i]['consensusType'] ? CONSENSUS_TABLE[table[i]['consensusType']] : '无'}</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].responseType ? RESPONSE_TYPE_TABLE[table[i].responseType] : '-'}</td>-->
|
||||||
<td>${table[i].times}</td>
|
<td>${table[i].times}</td>
|
||||||
<td>${table[i]['traffic'] || '-'}</td>
|
<td>${table[i]['traffic'] || '-'}</td>
|
||||||
<td>${table[i].storage || '-'}</td>
|
<td>${table[i].storage || '-'}</td>
|
||||||
<td style='padding:2px 12px 2px 12px'>
|
<td style='padding:2px 12px 2px 12px'>
|
||||||
<button onclick="stopContractByID('${table[i].id}')" class="btn btn-secondary">停止</button>
|
<button onclick="stopContractByID('${table[i].id}')" class="btn btn-secondary">停止</button>
|
||||||
|
<button onclick="restartContractByID('${table[i].id}')" class="btn btn-secondary">重启</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>`
|
</tr>`
|
||||||
}
|
}
|
||||||
html += tableTail;
|
html += tableTail;
|
||||||
html = "<h5 class='card-title'>合约实例列表</h5>" + html;
|
html = "<h5 class='card-title'>DO实例列表</h5>" + "<button onclick='pruneKilledContract()' class='btn btn-secondary' style='float:right'>清除已停合约</button>"+html;
|
||||||
ciTabDiv.html(html);
|
ciTabDiv.html(html);
|
||||||
|
|
||||||
$("#ciTabDivTab").DataTable(
|
$("#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) {
|
function drawContractInstanceStatusPie(table) {
|
||||||
const ciStatusPieDiv = $("#ciStatusPieDiv")
|
const ciStatusPieDiv = $("#ciStatusPieDiv")
|
||||||
if (ciStatusPieDiv.css("height") === "0px") {
|
if (ciStatusPieDiv.css("height") === "0px") {
|
||||||
@@ -398,14 +420,14 @@ function executeContract() {
|
|||||||
request.pubkey = global.sm2Key.publicKey;
|
request.pubkey = global.sm2Key.publicKey;
|
||||||
request.isDebug = executeContractAsDebug.checked;
|
request.isDebug = executeContractAsDebug.checked;
|
||||||
console.log(request.arg);
|
console.log(request.arg);
|
||||||
const gasLimit = $('#gasLimit').val()/1;
|
const gasLimit = $('#gasLimit').val() / 1;
|
||||||
var toSign = request.contractID + "|"
|
var toSign = request.contractID + "|"
|
||||||
+ request.operation + "|" + arg ;
|
+ request.operation + "|" + request.arg;
|
||||||
if (gasLimit>0){
|
if (gasLimit > 0) {
|
||||||
request.gasLimit = gasLimit;
|
request.gasLimit = gasLimit;
|
||||||
toSign+= "|" + gasLimit;
|
toSign += "|" + gasLimit;
|
||||||
}
|
}
|
||||||
toSign+= "|" + global.sm2Key.publicKey;
|
toSign += "|" + global.sm2Key.publicKey;
|
||||||
request.signature = sm2.doSignature(
|
request.signature = sm2.doSignature(
|
||||||
toSign,
|
toSign,
|
||||||
global.sm2Key.privateKey,
|
global.sm2Key.privateKey,
|
||||||
@@ -431,9 +453,9 @@ function onExecuteResult(obj) {
|
|||||||
$("#responseArea")[0].value = result.result;
|
$("#responseArea")[0].value = result.result;
|
||||||
}
|
}
|
||||||
$("#responseID").html(`请求ID:${obj['responseID']}`);
|
$("#responseID").html(`请求ID:${obj['responseID']}`);
|
||||||
var gasInfo="";
|
var gasInfo = "";
|
||||||
if (obj.executionGas!=undefined && obj.executionGas>0)
|
if (obj.executionGas != undefined && obj.executionGas > 0)
|
||||||
gasInfo="<br>"+obj.executionGas+"gas";
|
gasInfo = "<br>" + obj.executionGas + "gas";
|
||||||
$("#responseTime").html(`响应时间:${obj['executeTime']}ms${gasInfo}${styleTail}`);
|
$("#responseTime").html(`响应时间:${obj['executeTime']}ms${gasInfo}${styleTail}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
$("#responseStatus").html("执行状态:Failed");
|
$("#responseStatus").html("执行状态:Failed");
|
||||||
@@ -443,6 +465,156 @@ function onExecuteResult(obj) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getMask() {
|
||||||
|
const argDiv = $('#maskArg')[0];
|
||||||
|
const request = {};
|
||||||
|
request.action = "getMask";
|
||||||
|
request.requestID = new Date().getTime() + "";
|
||||||
|
request.contractID = global.contractInstance;
|
||||||
|
const operation = $("#selectContractFunction")[0].value;
|
||||||
|
if (operation === " " && !operation) {
|
||||||
|
myToast("执行合约", "请选择合约方法!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//request.operation = operation;
|
||||||
|
request.arg = argDiv.value;
|
||||||
|
request.pubkey = global.sm2Key.publicKey;
|
||||||
|
//request.isDebug = executeContractAsDebug.checked;
|
||||||
|
console.log(request.arg);
|
||||||
|
//const gasLimit = $('#gasLimit').val()/1;
|
||||||
|
var toSign = request.contractID + "|"
|
||||||
|
+ request.operation + "|" + arg;
|
||||||
|
/*if (gasLimit>0){
|
||||||
|
request.gasLimit = gasLimit;
|
||||||
|
toSign+= "|" + gasLimit;
|
||||||
|
}*/
|
||||||
|
toSign += "|" + global.sm2Key.publicKey;
|
||||||
|
request.signature = sm2.doSignature(
|
||||||
|
toSign,
|
||||||
|
global.sm2Key.privateKey,
|
||||||
|
{hash: true, der: true});
|
||||||
|
localStorage.setItem("persisArg", JSON.stringify(request));
|
||||||
|
global.wssocket.send(JSON.stringify(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
function setMask() {
|
||||||
|
const argDiv = $('#maskArg')[0];
|
||||||
|
const request = {};
|
||||||
|
request.action = "setMask";
|
||||||
|
request.requestID = new Date().getTime() + "";
|
||||||
|
request.contractID = global.contractInstance;
|
||||||
|
const operation = $("#selectContractFunction")[0].value;
|
||||||
|
if (operation === " " && !operation) {
|
||||||
|
myToast("执行合约", "请选择合约方法!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//request.operation = operation;
|
||||||
|
request.arg = argDiv.value;
|
||||||
|
request.pubkey = global.sm2Key.publicKey;
|
||||||
|
//request.isDebug = executeContractAsDebug.checked;
|
||||||
|
console.log(request.arg);
|
||||||
|
//const gasLimit = $('#gasLimit').val()/1;
|
||||||
|
var toSign = request.contractID + "|"
|
||||||
|
+ request.operation + "|" + arg;
|
||||||
|
/*if (gasLimit>0){
|
||||||
|
request.gasLimit = gasLimit;
|
||||||
|
toSign+= "|" + gasLimit;
|
||||||
|
}*/
|
||||||
|
toSign += "|" + global.sm2Key.publicKey;
|
||||||
|
request.signature = sm2.doSignature(
|
||||||
|
toSign,
|
||||||
|
global.sm2Key.privateKey,
|
||||||
|
{hash: true, der: true});
|
||||||
|
localStorage.setItem("persisArg", JSON.stringify(request));
|
||||||
|
global.wssocket.send(JSON.stringify(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
function onGetMask(obj) {
|
||||||
|
console.log("onGetMask obj.data", obj.data);
|
||||||
|
try {
|
||||||
|
const result = obj;
|
||||||
|
$("#maskResponseArea")[0].value = JSON.stringify(obj.data);
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
$("#maskResponseArea")[0].value = JSON.stringify(obj.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getMock() {
|
||||||
|
const argDiv = $('#mockArg')[0];
|
||||||
|
const request = {};
|
||||||
|
request.action = "getMock";
|
||||||
|
request.requestID = new Date().getTime() + "";
|
||||||
|
request.contractID = global.contractInstance;
|
||||||
|
const operation = $("#selectContractFunction")[0].value;
|
||||||
|
if (operation === " " && !operation) {
|
||||||
|
myToast("执行合约", "请选择合约方法!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//request.operation = operation;
|
||||||
|
request.arg = argDiv.value;
|
||||||
|
request.pubkey = global.sm2Key.publicKey;
|
||||||
|
//request.isDebug = executeContractAsDebug.checked;
|
||||||
|
console.log(request.arg);
|
||||||
|
//const gasLimit = $('#gasLimit').val()/1;
|
||||||
|
var toSign = request.contractID + "|"
|
||||||
|
+ request.operation + "|" + arg;
|
||||||
|
/*if (gasLimit>0){
|
||||||
|
request.gasLimit = gasLimit;
|
||||||
|
toSign+= "|" + gasLimit;
|
||||||
|
}*/
|
||||||
|
toSign += "|" + global.sm2Key.publicKey;
|
||||||
|
request.signature = sm2.doSignature(
|
||||||
|
toSign,
|
||||||
|
global.sm2Key.privateKey,
|
||||||
|
{hash: true, der: true});
|
||||||
|
localStorage.setItem("persisArg", JSON.stringify(request));
|
||||||
|
global.wssocket.send(JSON.stringify(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
function setMock() {
|
||||||
|
const argDiv = $('#mockArg')[0];
|
||||||
|
const request = {};
|
||||||
|
request.action = "setMock";
|
||||||
|
request.requestID = new Date().getTime() + "";
|
||||||
|
request.contractID = global.contractInstance;
|
||||||
|
const operation = $("#selectContractFunction")[0].value;
|
||||||
|
if (operation === " " && !operation) {
|
||||||
|
myToast("执行合约", "请选择合约方法!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//request.operation = operation;
|
||||||
|
request.arg = argDiv.value;
|
||||||
|
request.pubkey = global.sm2Key.publicKey;
|
||||||
|
//request.isDebug = executeContractAsDebug.checked;
|
||||||
|
console.log(request.arg);
|
||||||
|
//const gasLimit = $('#gasLimit').val()/1;
|
||||||
|
var toSign = request.contractID + "|"
|
||||||
|
+ request.operation + "|" + arg;
|
||||||
|
/*if (gasLimit>0){
|
||||||
|
request.gasLimit = gasLimit;
|
||||||
|
toSign+= "|" + gasLimit;
|
||||||
|
}*/
|
||||||
|
toSign += "|" + global.sm2Key.publicKey;
|
||||||
|
request.signature = sm2.doSignature(
|
||||||
|
toSign,
|
||||||
|
global.sm2Key.privateKey,
|
||||||
|
{hash: true, der: true});
|
||||||
|
localStorage.setItem("persisArg", JSON.stringify(request));
|
||||||
|
global.wssocket.send(JSON.stringify(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
function onGetMock(obj) {
|
||||||
|
console.log("onGetMask obj.data", obj.data);
|
||||||
|
try {
|
||||||
|
const result = obj;
|
||||||
|
$("#mockResponseArea")[0].value = JSON.stringify(obj.data);
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
$("#mockResponseArea")[0].value = JSON.stringify(obj.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function onHashResult(obj) {
|
function onHashResult(obj) {
|
||||||
$("#hashResult").html("数链指纹:" + obj.data);
|
$("#hashResult").html("数链指纹:" + obj.data);
|
||||||
}
|
}
|
||||||
@@ -502,7 +674,7 @@ function drawCPTable(table) {
|
|||||||
<td>${i + 1}</td>
|
<td>${i + 1}</td>
|
||||||
<td>${table[i].pid}</td>
|
<td>${table[i].pid}</td>
|
||||||
<td>${table[i]['isLeak']}</td>
|
<td>${table[i]['isLeak']}</td>
|
||||||
<td>${new Date(table[i]['cpuStart']).toLocaleString()}/td>
|
<td>${new Date(table[i]['cpuStart']).toLocaleString()}</td>
|
||||||
<td>${table[i]['cpuTotal']}</td>
|
<td>${table[i]['cpuTotal']}</td>
|
||||||
<td>${table[i]['cpuSys']}</td>
|
<td>${table[i]['cpuSys']}</td>
|
||||||
<td>${(table[i]['resident'] / (1024 * 1024)).toFixed(2)}MB</td>
|
<td>${(table[i]['resident'] / (1024 * 1024)).toFixed(2)}MB</td>
|
||||||
|
|||||||
@@ -200,6 +200,12 @@ function WSHandler(event) {
|
|||||||
case 'onListLeakContractProcess':
|
case 'onListLeakContractProcess':
|
||||||
onListLeakContractProcess(obj);
|
onListLeakContractProcess(obj);
|
||||||
break;
|
break;
|
||||||
|
case 'onGetMask':
|
||||||
|
onGetMask(obj);
|
||||||
|
break;
|
||||||
|
case 'onGetMock':
|
||||||
|
onGetMock(obj);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
displayOutput(obj);
|
displayOutput(obj);
|
||||||
break;
|
break;
|
||||||
@@ -268,7 +274,7 @@ function getControlWsUrl(host) {
|
|||||||
}
|
}
|
||||||
path += "SCExecutor";
|
path += "SCExecutor";
|
||||||
if (isBaaS) {
|
if (isBaaS) {
|
||||||
path = path.replace("ide/", "")
|
path = "/SCIDE/SCExecutor"
|
||||||
}
|
}
|
||||||
return prefix + host + path;
|
return prefix + host + path;
|
||||||
}
|
}
|
||||||
@@ -276,6 +282,7 @@ function getControlWsUrl(host) {
|
|||||||
function initWSocket() {
|
function initWSocket() {
|
||||||
const host = document.location.host;
|
const host = document.location.host;
|
||||||
const url = getControlWsUrl(host);
|
const url = getControlWsUrl(host);
|
||||||
|
document.title = `数瑞智能合约节点管理中心(${host})`;
|
||||||
// console.log("connect ws:" + url);
|
// console.log("connect ws:" + url);
|
||||||
global.wssocket = createWssocket(url, function () {
|
global.wssocket = createWssocket(url, function () {
|
||||||
getSession();
|
getSession();
|
||||||
@@ -309,8 +316,8 @@ function onNodeLogin(data) {
|
|||||||
console.log("onNodeLogin");
|
console.log("onNodeLogin");
|
||||||
pubkeyDialogVue.myRole = data.data;
|
pubkeyDialogVue.myRole = data.data;
|
||||||
global.myRole = data.data;
|
global.myRole = data.data;
|
||||||
loadUserMan();
|
|
||||||
loadNodeConfig();
|
loadNodeConfig();
|
||||||
|
loadUserMan();
|
||||||
}
|
}
|
||||||
|
|
||||||
function apply() {
|
function apply() {
|
||||||
@@ -518,6 +525,3 @@ function addNodeUnit(obj) {
|
|||||||
option.value = obj.key;
|
option.value = obj.key;
|
||||||
x.add(option, null);
|
x.add(option, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -127,21 +127,14 @@ function getControlWsUrl(host) {
|
|||||||
if (document.location.href.startsWith("https")) {
|
if (document.location.href.startsWith("https")) {
|
||||||
prefix = "wss://";
|
prefix = "wss://";
|
||||||
}
|
}
|
||||||
let path = document.location.pathname.lastIndexOf("/");
|
path = "/SCIDE/SCExecutor";
|
||||||
path = document.location.pathname.substr(0, path + 1);
|
|
||||||
if (path.indexOf("SCIDE") < 0) {
|
|
||||||
path += "SCIDE/";
|
|
||||||
}
|
|
||||||
path += "SCExecutor";
|
|
||||||
if (isBaaS) {
|
|
||||||
path = path.replace("ide/", "")
|
|
||||||
}
|
|
||||||
return prefix + host + path;
|
return prefix + host + path;
|
||||||
}
|
}
|
||||||
|
|
||||||
function initWSocket() {
|
function initWSocket() {
|
||||||
console.log("[OnlineIDE.js] initWSocket : ");
|
console.log("[OnlineIDE.js] initWSocket : ");
|
||||||
let host = document.location.host;
|
let host = document.location.host;
|
||||||
|
document.title = `数瑞智能合约在线编辑器(${host})`
|
||||||
let url = getControlWsUrl(
|
let url = getControlWsUrl(
|
||||||
global.urlparam && global.urlparam['nodeAddr'] ? global.urlparam['nodeAddr'] : host);
|
global.urlparam && global.urlparam['nodeAddr'] ? global.urlparam['nodeAddr'] : host);
|
||||||
// console.log("connect ws:" + url);
|
// console.log("connect ws:" + url);
|
||||||
@@ -360,12 +353,12 @@ function initResponseAndOutputArea() {
|
|||||||
function onExecuteResult(obj) {
|
function onExecuteResult(obj) {
|
||||||
const executeResultTitleEl = $("#executeResultTitle");
|
const executeResultTitleEl = $("#executeResultTitle");
|
||||||
const data = obj;
|
const data = obj;
|
||||||
var sytleTail = "未知格式";
|
var styleTail = "未知格式";
|
||||||
if (data.result==undefined) {
|
if (data.result==undefined) {
|
||||||
styleTail = "Undefined";
|
styleTail = "Undefined";
|
||||||
data.result = "";
|
data.result = "";
|
||||||
} else if (data.result instanceof Object) {
|
} else if (data.result instanceof Object) {
|
||||||
sytleTail = "JSON格式";
|
styleTail = "JSON格式";
|
||||||
data.result =JSON.stringify(data.result);
|
data.result =JSON.stringify(data.result);
|
||||||
} else if (typeof data.result == 'string') {
|
} else if (typeof data.result == 'string') {
|
||||||
styleTail = "字符串格式";
|
styleTail = "字符串格式";
|
||||||
|
|||||||
4
js/cm.js
4
js/cm.js
@@ -75,9 +75,7 @@ var getControlWsUrl = function (host) {
|
|||||||
var prefix = "ws://";
|
var prefix = "ws://";
|
||||||
if (document.location.href.startsWith("https"))
|
if (document.location.href.startsWith("https"))
|
||||||
prefix = "wss://";
|
prefix = "wss://";
|
||||||
var path = document.location.pathname.lastIndexOf("/");
|
var path = "/SCIDE/SCExecutor";
|
||||||
path = document.location.pathname.substr(0, path + 1);
|
|
||||||
path += "SCExecutor";
|
|
||||||
return prefix + host + path;
|
return prefix + host + path;
|
||||||
};
|
};
|
||||||
var initWSocket = function () {
|
var initWSocket = function () {
|
||||||
|
|||||||
@@ -131,10 +131,23 @@ var startContractAtSlave = function() {
|
|||||||
}
|
}
|
||||||
var dumpPeriod = switchPeriod(period);
|
var dumpPeriod = switchPeriod(period);
|
||||||
var project = global.ypkName;
|
var project = global.ypkName;
|
||||||
|
|
||||||
$("#result")[0].innerHTML="正在启动,请稍候";
|
$("#result")[0].innerHTML="正在启动,请稍候";
|
||||||
var request = {};
|
var request = {};
|
||||||
request.action = "startContractByYPK";
|
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.dumpPeriod = dumpPeriod;
|
||||||
request.isPrivate = global.ypkIsPrivate;
|
request.isPrivate = global.ypkIsPrivate;
|
||||||
request.owner = global.sm2Key.publicKey;
|
request.owner = global.sm2Key.publicKey;
|
||||||
@@ -158,39 +171,44 @@ var onStartContract = function(obj) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 集群启动合约
|
// 集群启动合约
|
||||||
var startContractUnits = function(place) {
|
function startContractUnits(place) {
|
||||||
// ZYX
|
// ZYX
|
||||||
var unitsID = $("#selectUnits")[0].value.split("_")[1];
|
const unitsID = $("#selectUnits")[0].value.split("_")[1];
|
||||||
if(unitsID == undefined || unitsID == "选择节点集群"){
|
if (!unitsID || unitsID === "选择节点集群") {
|
||||||
myToast("提示","请选择节点集群!");
|
myToast("提示", "请选择节点集群!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var peersID = "";
|
let peersID = "";
|
||||||
for ( var i in global.units[unitsID]) {
|
for (let i in global.units[unitsID]) {
|
||||||
peersID += global.units[unitsID][i].pubKey + ",";
|
peersID += global.units[unitsID][i].pubKey + ",";
|
||||||
}
|
}
|
||||||
|
|
||||||
var request = {};
|
const request = {};
|
||||||
|
|
||||||
request.action = "startContractMultiPoint";
|
request.action = "startContractMultiPoint";
|
||||||
request.peersID = peersID;
|
request.peersID = peersID;
|
||||||
request.type = $("#sequence")[0].value;
|
request.type = $("#sequence")[0].value;
|
||||||
console.log(request.type);
|
console.log(request.type);
|
||||||
if (request.type==0){
|
if (request.type == 0) {
|
||||||
myToast("提示","请选择集群合约模式!");
|
myToast("提示", "请选择集群合约模式!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
request.selectUnitNum = Number($("#selectUnitNum")[0].value);
|
||||||
|
if (!request.selectUnitNum || isNaN(request.selectUnitNum)) {
|
||||||
|
myToast("提示", "请填写集群规模!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
request.projectName = global.ypkName;
|
request.projectName = global.ypkName;
|
||||||
if (request.projectName==undefined || request.projectName == "请选择ypk文件"){
|
if (!request.projectName || request.projectName == "请选择ypk文件") {
|
||||||
myToast("提示","请选择合约!");
|
myToast("提示", "请选择合约!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
request.isPrivate = global.ypkIsPrivate;
|
request.isPrivate = global.ypkIsPrivate;
|
||||||
request.sponsorPeerID = global.peerID; //peerID of the node
|
request.sponsorPeerID = global.peerID; //peerID of the node
|
||||||
console.log(request);
|
console.log(request);
|
||||||
global.wssocket.send(JSON.stringify(request));
|
global.wssocket.send(JSON.stringify(request));
|
||||||
};
|
}
|
||||||
|
|
||||||
var onStartTrustfulContract = function(obj) {
|
var onStartTrustfulContract = function(obj) {
|
||||||
console.log(obj);
|
console.log(obj);
|
||||||
|
|||||||
@@ -176,8 +176,6 @@ var getControlWsUrl = function(host) {
|
|||||||
var prefix = "ws://";
|
var prefix = "ws://";
|
||||||
if (document.location.href.startsWith("https"))
|
if (document.location.href.startsWith("https"))
|
||||||
prefix = "wss://";
|
prefix = "wss://";
|
||||||
var path = document.location.pathname.lastIndexOf("/");
|
var path = "/SCIDE/SCExecutor";
|
||||||
path = document.location.pathname.substr(0, path + 1);
|
|
||||||
path += "SCExecutor";
|
|
||||||
return prefix + host + path;
|
return prefix + host + path;
|
||||||
};
|
};
|
||||||
@@ -173,9 +173,13 @@ function importContractInstanceCodeByDOI() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function openInClient() {
|
function openInClient() {
|
||||||
|
let path = document.location.pathname.lastIndexOf("/ide");
|
||||||
|
if (path > 0)
|
||||||
|
path = document.location.pathname.substr(0, path + 1);
|
||||||
|
else path = "/";
|
||||||
window.open(isBaaS ?
|
window.open(isBaaS ?
|
||||||
`${location.origin}/client/BaaSClient.html${location.search}` :
|
`${location.origin}${path}client/BaaSClient.html${location.search}` :
|
||||||
`${location.origin}/client/bdwareclient.html?self=true&` +
|
`${location.origin}${path}client/bdwareclient.html?self=true&` +
|
||||||
`contract=${mainVue.contracts[selectedContract.value].id}`);
|
`contract=${mainVue.contracts[selectedContract.value].id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,15 +222,15 @@ function executeContract() {
|
|||||||
request.contractID = contract.id;
|
request.contractID = contract.id;
|
||||||
request.operation = contract.exportedFunctions[selectedFunction.value].functionName;
|
request.operation = contract.exportedFunctions[selectedFunction.value].functionName;
|
||||||
const arg = executeContractArgInput.value;
|
const arg = executeContractArgInput.value;
|
||||||
const gasLimit = $('#gasLimit').val()/1;
|
const gasLimit = $('#gasLimit').val() / 1;
|
||||||
request.pubkey = sm2Key.publicKey;
|
request.pubkey = sm2Key.publicKey;
|
||||||
var toSign = request.contractID + "|"
|
let toSign = request.contractID + "|"
|
||||||
+ request.operation + "|" + arg ;
|
+ request.operation + "|" + arg;
|
||||||
if (gasLimit>0){
|
if (gasLimit > 0) {
|
||||||
request.gasLimit = gasLimit;
|
request.gasLimit = gasLimit;
|
||||||
toSign+= "|" + gasLimit;
|
toSign += "|" + gasLimit;
|
||||||
}
|
}
|
||||||
toSign+= "|" + sm2Key.publicKey;
|
toSign += "|" + sm2Key.publicKey;
|
||||||
request.signature = sm2.doSignature(
|
request.signature = sm2.doSignature(
|
||||||
toSign,
|
toSign,
|
||||||
sm2Key.privateKey,
|
sm2Key.privateKey,
|
||||||
|
|||||||
Reference in New Issue
Block a user