10 Commits

Author SHA1 Message Date
root
8fefeb8b08 fix: security bugs for zhizhen 2021-08-19 17:29:10 +08:00
root
7482d0a1ae style update 2021-08-09 23:24:09 +08:00
zhanghongwei
2aa98c4f17 Merge branch 'master' of https://phabricator.internetapi.cn/source/bdcontract-web-ide 2021-08-09 21:58:18 +08:00
Frank.R.Wu
de634576fd feat: change title
change title with node addr
2021-08-09 21:19:43 +08:00
Frank.R.Wu
e600c386da feat: change title
change title with node addr
2021-08-09 21:08:57 +08:00
fe1dcf7e79 NodePortal 2021-08-09 09:48:56 +08:00
root
5758a3ae78 fix: /td> in NodePortal.html/合约实例管理 2021-08-04 10:49:44 +08:00
root
e48679db44 feat: decouple mockjs 2021-08-03 14:24:27 +08:00
root
1ff93a3e76 fix: BaasOnlineIDE.html hidden overflowed part 2021-07-26 16:57:28 +08:00
root
44d288f147 fix: BaasOnlineIDE.html hidden overflowed part 2021-07-26 16:12:23 +08:00
15 changed files with 260 additions and 54 deletions

View File

@@ -2,7 +2,7 @@
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Cache-Control" content="no-cache"/> <meta http-equiv="Cache-Control" content="no-cache"/>
<title>数瑞智能合约在线编辑器</title> <title>智能合约在线编辑器</title>
<script src="./jqueryui1.12/jquery-2.1.4.js"></script> <script src="./jqueryui1.12/jquery-2.1.4.js"></script>
<link href="./jqueryui1.12/jquery-ui.css" rel="stylesheet"> <link href="./jqueryui1.12/jquery-ui.css" rel="stylesheet">
<script src="./jqueryui1.12/jquery-ui.js"></script> <script src="./jqueryui1.12/jquery-ui.js"></script>
@@ -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 ">

View File

@@ -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 ">
@@ -544,6 +544,73 @@
<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>

View File

@@ -35,11 +35,7 @@
<!--script src="./js/echartsTheme.js"></script --> <!--script src="./js/echartsTheme.js"></script -->
<!-- script src="./js/echarts-gl.min.js"></script --> <!-- script src="./js/echarts-gl.min.js"></script -->
<script src="./js/sm2.js"></script> <script src="./js/sm2.js"></script>
<script src="./js/sm3.js"></script>
<script src="./js/sm4.js"></script>
<script src="./js/sm/index.js"></script>
<script src="./js/d3.v5.min.js"></script> <script src="./js/d3.v5.min.js"></script>
<!-- script src="./js/dagre-d3.min.js"></script --> <!-- script src="./js/dagre-d3.min.js"></script -->
<script src="./js/tipsy/jquery.tipsy.min.js"></script> <script src="./js/tipsy/jquery.tipsy.min.js"></script>
@@ -68,7 +64,7 @@
} }
.projectButton.ui-state-active { .projectButton.ui-state-active {
background: #2E324C; background: #304156;
color: white; color: white;
} }
@@ -82,8 +78,8 @@
.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link { .nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link {
color: white; color: white;
background-color: #2E324C; background-color: #304156;
border-color: #2E324C; border-color: #304156;
} }
.ui-tabs { .ui-tabs {
@@ -99,14 +95,14 @@
} }
.ui-menu-item.ui-state-active:hover { .ui-menu-item.ui-state-active:hover {
background: #2E324C; background: #304156;
color: white; color: white;
border: 1px solid #999; border: 1px solid #999;
} }
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active, .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active,
a.ui-button:active, .ui-button:active, .ui-button.ui-state-active:hover { a.ui-button:active, .ui-button:active, .ui-button.ui-state-active:hover {
background: #2E324C; background: #304156;
color: white; color: white;
border: 1px solid #999; border: 1px solid #999;
} }
@@ -120,7 +116,7 @@
} }
.fileLine:hover { .fileLine:hover {
background: #2E324C; background: #304156;
color: white; color: white;
cursor: pointer; cursor: pointer;
} }
@@ -132,7 +128,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 ">
@@ -278,7 +274,7 @@
</div> </div>
</div> </div>
<div id="box" style="overflow:hide; 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%"
@@ -559,14 +555,14 @@
<div class="row"> <div class="row">
<div class="col-sm-12" id="responseAreaDiv"> <div class="col-sm-12" id="responseAreaDiv">
<textarea id="responseArea" class="form-control" <textarea id="responseArea" class="form-control"
style="width: 100%; height: 150px;"></textarea> style="width: 100%; height: 200px;"></textarea>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm-12 mt-3" id="outputStreamAreaDiv"> <div class="col-sm-12 mt-3" id="outputStreamAreaDiv">
控制台输出: 控制台输出:
<textarea id="outputStreamArea" class="form-control" <textarea id="outputStreamArea" class="form-control"
style="width: 100%; height: 150px;"></textarea> style="width: 100%; height: 200px;"></textarea>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -58,7 +58,7 @@
} }
.projectButton.ui-state-active { .projectButton.ui-state-active {
background: #2E324C; background: #304156;
color: white; color: white;
} }
@@ -72,8 +72,8 @@
.nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link { .nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link {
color: white; color: white;
background-color: #2E324C; background-color: #304156;
border-color: #2E324C; border-color: #304156;
} }
.ui-tabs { .ui-tabs {
@@ -89,14 +89,14 @@
} }
.ui-menu-item.ui-state-active:hover { .ui-menu-item.ui-state-active:hover {
background: #2E324C; background: #304156;
color: white; color: white;
border: 1px solid #999; border: 1px solid #999;
} }
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active, .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active,
a.ui-button:active, .ui-button:active, .ui-button.ui-state-active:hover { a.ui-button:active, .ui-button:active, .ui-button.ui-state-active:hover {
background: #2E324C; background: #304156;
color: white; color: white;
border: 1px solid #999; border: 1px solid #999;
} }
@@ -110,7 +110,7 @@
} }
.fileLine:hover { .fileLine:hover {
background: #2E324C; background: #304156;
color: white; color: white;
cursor: pointer; cursor: pointer;
} }

File diff suppressed because one or more lines are too long

View File

@@ -9,7 +9,7 @@
border: 1px solid rgba(0, 0, 0, .125); border: 1px solid rgba(0, 0, 0, .125);
border-radius: 5px; border-radius: 5px;
background: white; background: white;
color: #2E324C; color: #304156;
} }
.userName:hover { .userName:hover {
@@ -22,17 +22,17 @@
#horiNav { #horiNav {
padding-top: 10px; padding-top: 10px;
border: 1px solid rgba(0, 0, 0, .05); border: 1px solid rgba(0, 0, 0, .05);
background: #f8f9fa; background: #e9f6ff;
} }
#outputNav { #outputNav {
padding-top: 10px; padding-top: 10px;
border: 1px solid rgba(0, 0, 0, .05); border: 1px solid rgba(0, 0, 0, .05);
background: #f8f9fa; background: #e9f6ff;
} }
div .card { div .card {
background: #f8f9fa; background: #e9f6ff;
} }
#main { #main {
@@ -85,16 +85,16 @@ div .card {
.projectLine.collapsed { .projectLine.collapsed {
background: #D5D6DB; background: #D5D6DB;
color: #2E324C; color: #304156;
} }
.projectLine { .projectLine {
background: #2E324C; background: #304156;
color: white; color: white;
} }
.projectLine.collapsed:hover { .projectLine.collapsed:hover {
background: #2E324C; background: #304156;
color: white; color: white;
} }
@@ -111,7 +111,7 @@ div .card {
} }
.headerFooter { .headerFooter {
background: #2E324C; background: #304156;
color: white; color: white;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 37 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

BIN
images/logo.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 118 KiB

View File

@@ -2,7 +2,7 @@
<header> <header>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Cache-Control" content="no-cache"/> <meta http-equiv="Cache-Control" content="no-cache"/>
<title>智能合约</title> <title>数瑞智能合约</title>
<script src="./jqueryui1.12/jquery-2.1.4.js"></script> <script src="./jqueryui1.12/jquery-2.1.4.js"></script>
@@ -85,7 +85,7 @@
padding-bottom: 30px; padding-bottom: 30px;
width: 28%; width: 28%;
cursor: hand; cursor: hand;
background: #2E324C; background: #304156;
color: white; color: white;
} }
@@ -100,11 +100,11 @@
</style> </style>
</header> </header>
<body style="background: #2E324C; color: white;"> <body style="background: #304156; color: white;">
<div <div
style="width: 90%; max-width: 1000px; min-width: 850px; margin: 0 auto; margin-top: 3%;"> style="width: 90%; max-width: 1000px; min-width: 850px; margin: 0 auto; margin-top: 3%;">
<div style="width: 20%; float: right; margin-right: 0%"> <div style="width: 20%; float: right; margin-right: 0%">
<img src="./images/logo-1.png" class="logoimg"></img> <img src="./images/logo.png" class="logoimg"></img>
</div> </div>
<div <div
style="width: fit-content; margin: 0; font-size: 200%; background-color: white; color: black; border-radius: 10px; float: left; padding: 10px;"> style="width: fit-content; margin: 0; font-size: 200%; background-color: white; color: black; border-radius: 10px; float: left; padding: 10px;">

View File

@@ -443,6 +443,155 @@ 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 +651,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>

View File

@@ -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;
@@ -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();
@@ -518,6 +525,3 @@ function addNodeUnit(obj) {
option.value = obj.key; option.value = obj.key;
x.add(option, null); x.add(option, null);
} }

View File

@@ -142,6 +142,7 @@ function getControlWsUrl(host) {
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);

View File

@@ -3,7 +3,7 @@ function getDateDaysBefore(daysAgo) {
return new Date(dateStr).getTime() - daysAgo * 24 * 3600 * 1000; return new Date(dateStr).getTime() - daysAgo * 24 * 3600 * 1000;
} }
let primaryColor = "#2E324C"; let primaryColor = "#304156";
// ======Vue start // ======Vue start
let headerVue = ""; let headerVue = "";