mirror of
https://gitee.com/BDWare/router-frontend
synced 2025-04-27 14:32:22 +00:00
feat: update contractlist.js
show master info in contract list for SelfAdaptiveSharding contracts
This commit is contained in:
parent
7754d3d1c4
commit
a93e03c48e
@ -3,7 +3,7 @@ var loadContractList = function (e) {
|
||||
param.action = "listNodes";
|
||||
param.pubKey = global.sm2Key.publicKey;
|
||||
global.wssocket.send(JSON.stringify(param));
|
||||
if (global.nodeInfo == undefined) {
|
||||
if (global.nodeInfo) {
|
||||
setTimeout(loadContractList, 300);
|
||||
return;
|
||||
}
|
||||
@ -11,7 +11,7 @@ var loadContractList = function (e) {
|
||||
var list = [];
|
||||
for (var i = 0; i < global.nodeInfo.online.length; i++) {
|
||||
var node = global.nodeInfo.online[i];
|
||||
if (node.contracts != undefined)
|
||||
if (node.contracts)
|
||||
for (var j = 0; j < node.contracts.length; j++) {
|
||||
list.push(node.contracts[j]);
|
||||
}
|
||||
@ -143,24 +143,32 @@ var drawContractListTable = function (list) {
|
||||
"sSortDescending": ": 以降序排列此列"
|
||||
}
|
||||
};
|
||||
var tableHead = "<table id='contractListTabDivTab' class='table display row-border'><thead><tr><th>序号</th><th>合约ID</th><th>合约名称</th><th>运行模式</th><th>合约类型</th><th>方法数量</th></tr></thead><tbody>";
|
||||
const tableHead = "<table id='contractListTabDivTab' class='table display row-border'>" +
|
||||
"<thead><tr>" +
|
||||
"<th>序号</th>" +
|
||||
"<th>合约ID</th>" +
|
||||
"<th>合约名称</th>" +
|
||||
"<th>运行模式</th>" +
|
||||
"<th>合约类型</th>" +
|
||||
"<th>方法数量</th>" +
|
||||
"</tr></thead><tbody>";
|
||||
var tableTail = "</tbody></table>";
|
||||
var html = tableHead;
|
||||
var count = 0;
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
var node = list[i];
|
||||
if (node.contracts != undefined)
|
||||
if (node.contracts)
|
||||
for (var j = 0; j < node.contracts.length; j++) {
|
||||
var c = node.contracts[j];
|
||||
if (c.type != undefined && c.type.startsWith("RequestAll") && !c.isMaster)
|
||||
if (c.type && c.type.startsWith("RequestAll") && !c.isMaster)
|
||||
continue;
|
||||
html += "<tr><td>";
|
||||
html += (++count);
|
||||
html += "</td><td>";
|
||||
html += c.contractID;
|
||||
html += "</td><td>";
|
||||
html += "<a onclick='jumpToContractClient(\"" + node.masterAddress + "\",\"" + c.contractID + "\")' style='cursor: pointer'>"
|
||||
html += c.contractName;
|
||||
html += `<a onclick='jumpToContractClient("${node.masterAddress}","${c.contractID}")' style='cursor: pointer'>`
|
||||
html += c.contractName + (c.type && c.type.startsWith("SelfAdaptive") && c.isMaster ? "(M)" : "");
|
||||
html += "</a>"
|
||||
html += "</td><td>";
|
||||
html += c.type;
|
||||
@ -170,9 +178,11 @@ var drawContractListTable = function (list) {
|
||||
// html+=c.events.length
|
||||
// else html+=0;
|
||||
html += "</td><td>";
|
||||
if (c.exportedFunctions != undefined)
|
||||
if (c.exportedFunctions) {
|
||||
html += c.exportedFunctions.length;
|
||||
else html += "-1";
|
||||
} else {
|
||||
html += "-1";
|
||||
}
|
||||
html += "</td></tr>";
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user