/*
* 调用管理
*/
// 终止本地合约
var stopContractAtSlave = function() {
var temp = global.contractInstance;
if (temp == undefined || temp == "选择...") {
myToast("提示","请选择合约进程!");
return;
}
var request = {};
request.action = "killContractProcess";
request.requestID = new Date().getTime() + "";
request.id = temp;
global.wssocket.send(JSON.stringify(request));
};
var onStopContract = function(obj) {
if(obj.data == "success"){
myToast("提示","停止该合约成功,用时" + obj.executeTime + "ms!")
}else{
myToast("提示","停止该合约失败,用时" + obj.executeTime + "ms!")
}
listContractProcess();
};
// 终止本地全部合约
var killAllContractLocal = function() {
var request = {};
request.action = "killAllContract";
global.wssocket.send(JSON.stringify(request));
};
var onKillAllContract = function(obj) {
customAlert(obj.data);
listContractProcess();
};
var stopContractP2PTrustfully = function() {
var request = {};
request.action = "killContractProcess";
request.requestID = new Date().getTime() + "";
request.name = $("#contractProcess")[0].value;
global.wssocket.send(JSON.stringify(request));
};
/*
* 权限管理
*/
var showPermissionList = function(data) {
var liHtml = "";
var result = {};
result.name = data;
var x = global.permissionNameMap[data];
if (x == undefined) {
console.log("undefined x" + undefined);
liHtml = "
没有智能合约进程,请先选择合约进程
";
$("#ulPermission").html(liHtml);
$('[data-toggle="toggle"]').bootstrapToggle();
} else {
x = JSON.parse(x);
var xlen = 0;
for ( var key in x) {
xlen++;
liHtml += "
";
var permission = key;
liHtml += permission;
if (x[key] == "open") {
liHtml += "