151 lines
4.8 KiB
JavaScript
151 lines
4.8 KiB
JavaScript
var listContractProcess = function() {
|
|
console.log("listContractProcess : ");
|
|
var request = {};
|
|
request.action = "listContractProcess";
|
|
global.wssocket.send(JSON.stringify(request));
|
|
|
|
};
|
|
|
|
var onListContractProcess = function(obj) {
|
|
var userManTab = $("#v-pills-contractInstance-tab")[0];
|
|
var isActive = (userManTab.getAttribute("aria-selected") == "true");
|
|
if (isActive) {
|
|
onListContractProcess1(obj);
|
|
} else {
|
|
onListContractProcess2(obj);
|
|
}
|
|
};
|
|
|
|
var changeContractProcess = function(obj) {
|
|
global.contractProcess = obj; // 代码管理菜单选中的合约
|
|
console.log("oooooooooooo" + global.contractProcess);
|
|
//showPermissionList(global.contractProcess);
|
|
};
|
|
|
|
var onListContractProcess2 = function(obj) {
|
|
var data = JSON.parse(obj.data);
|
|
|
|
global.contracts = data;
|
|
// $("#contractProcess").editableSelect('clear');
|
|
// $("#tabdiv").html("");
|
|
|
|
global.contractName2ID = {};
|
|
//global.permissionNameMap = {};
|
|
var name = "";
|
|
var htm = "<option selected>选择合约进程</option>";
|
|
for (var i = 0; i < data.length; i++) {
|
|
// htm += "<option value='" + 0 + "'>" + data[i].name + "</option>";
|
|
htm += "<option selected>" + data[i].name + "</option>";
|
|
global.contractName2ID[data[i].name] = data[i].id;
|
|
//global.permissionNameMap[data[i].name] = data[i].contractPermission;
|
|
console.log(htm);
|
|
name = data[i].name;
|
|
}
|
|
//showPermissionList(name);
|
|
console.log(htm);
|
|
$("#contractProcess").html(htm);
|
|
|
|
/*
|
|
* $("#contractProcess").editableSelect({ effects: 'slide',
|
|
* //可选参数default、fade filter: true //false 不过滤,否则选中后其它选项消失 });
|
|
*/
|
|
|
|
/*
|
|
* if(data.length > 0){ for (var i = 0; i < data.length; i++) {
|
|
* console.log(i); $("#contractProcess").editableSelect('add',
|
|
* data[i].name); global.contractName2ID[data[i].name] = data[i].id; //
|
|
* $("#tabdiv").append( // $("<option></option>").attr("value",
|
|
* data[i].id).text( // data[i].id)); } } if (data.length > 0)
|
|
* $("#contractProcess").editableSelect()[0].value = data[0].name;
|
|
*/
|
|
};
|
|
|
|
var addTcpNodeUnits = function(data) {
|
|
if (data.length > 0) {
|
|
for (var i = 0; i < data.length; i++) {
|
|
var unitID = data[i].key;
|
|
var nodes = JSON.parse(data[i].value);
|
|
var json = {};
|
|
json.type = "TCP";
|
|
json.key = unitID;
|
|
json.value = nodes;
|
|
addNodeUnit(json);
|
|
}
|
|
}
|
|
};
|
|
|
|
var listSelectUnits = function(data) {
|
|
console.log(data);
|
|
global.units = {};
|
|
var htm = "";
|
|
if (data.length > 0) {
|
|
// data的key是创建人公钥_时间戳,value是nodes的ID
|
|
for (var i = 0; i < data.length; i++) {
|
|
var unitID = data[i].key;
|
|
var nodes = JSON.parse(data[i].value);
|
|
var at_ = data[i].key.indexOf("_");
|
|
console.log(nodes);
|
|
htm += "<option>集群:" + unitID.substring(at_ + 1)
|
|
+ "</option>";
|
|
global.units[unitID.substring(at_ + 1)] = nodes;
|
|
}
|
|
}
|
|
htm += "<option selected>选择节点集群</option>";
|
|
htm += "<option>无</option>";
|
|
console.log(htm);
|
|
|
|
$("#selectUnits").html(htm);
|
|
}
|
|
var onCancelAuth = function(obj) {
|
|
myToast("取消权限", obj.data);
|
|
if (obj.data == "success") {
|
|
}
|
|
};
|
|
|
|
var setPermission = function(data) {
|
|
var request = {};
|
|
request.resetContractProcess = data.name;
|
|
console.log(request.resetContractName);
|
|
request.closePer = data.permission;
|
|
request.oldPer = data.oldPermission;
|
|
request.isOpen = data.isOpen;
|
|
request.action = "setPermission";
|
|
global.wssocket.send(JSON.stringify(request));
|
|
};
|
|
var onSetPermission = function(obj) {
|
|
console.log(obj);
|
|
|
|
var html = "<div class='input-group mb-2'>";
|
|
|
|
html += "<div class='input-group-prepend'>";
|
|
html += "<span class='input-group-text' id='inputGroup-sizing-default'>";
|
|
html += "状态保存策略:" + "</span></div>";
|
|
html += "<div class='input-group-append'>";
|
|
html += "<select id='selectDumpPeriod2' class='custom-select' style='appearance: none; -webkit-appearance: none;'>";
|
|
|
|
if(period == "43200000"){
|
|
html += "<option selected>/1day自动保存</option>";
|
|
html += "<option selected>/2days自动保存</option> ";
|
|
html += "<option selected>不保存</option>";
|
|
html += "<option selected>/12hours自动保存</option>";
|
|
}else if(period == "86400000"){
|
|
html += "<option selected>/2days自动保存</option> ";
|
|
html += "<option selected>不保存</option>";
|
|
html += "<option selected>/12hours自动保存</option>";
|
|
html += "<option selected>/1day自动保存</option>";
|
|
}else if(period == "172800000"){
|
|
html += "<option selected>不保存</option>";
|
|
html += "<option selected>/12hours自动保存</option>";
|
|
html += "<option selected>/1day自动保存</option>";
|
|
html += "<option selected>/2days自动保存</option> ";
|
|
}else{
|
|
html += "<option selected>/12hours自动保存</option>";
|
|
html += "<option selected>/1day自动保存</option>";
|
|
html += "<option selected>/2days自动保存</option> ";
|
|
html += "<option selected>不保存</option>";
|
|
}
|
|
};
|
|
|
|
var onListLeakContractProcess = function(obj){
|
|
drawCPTable(obj);
|
|
} |