59d54cb2b5
refactor style
153 lines
5.2 KiB
JavaScript
153 lines
5.2 KiB
JavaScript
function listContractProcess() {
|
|
console.log("listContractProcess : ");
|
|
global.wssocket.send(JSON.stringify({
|
|
action: 'listContractProcess',
|
|
filters: 2
|
|
}));
|
|
}
|
|
|
|
function onListContractProcess(obj) {
|
|
const userManTab = $("#v-pills-contractInstance-tab")[0];
|
|
const isActive = (userManTab.getAttribute("aria-selected") === "true");
|
|
if (isActive) {
|
|
onListContractProcess1(obj);
|
|
} else {
|
|
onListContractProcess2(obj);
|
|
}
|
|
}
|
|
|
|
function changeContractProcess(obj) {
|
|
global.contractProcess = obj; // 代码管理菜单选中的合约
|
|
console.log("oooooooooooo" + global.contractProcess);
|
|
//showPermissionList(global.contractProcess);
|
|
}
|
|
|
|
function onListContractProcess2(obj) {
|
|
const data = JSON.parse(obj.data);
|
|
|
|
global.contracts = data;
|
|
// $("#contractProcess").editableSelect('clear');
|
|
// $("#tabdiv").html("");
|
|
|
|
global.contractName2ID = {};
|
|
//global.permissionNameMap = {};
|
|
let name = "";
|
|
let htm = "<option selected>选择合约进程</option>";
|
|
for (let 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;
|
|
*/
|
|
}
|
|
|
|
function addTcpNodeUnits(data) {
|
|
if (data.length > 0) {
|
|
for (let i = 0; i < data.length; i++) {
|
|
const unitID = data[i].key;
|
|
const nodes = JSON.parse(data[i].value);
|
|
addNodeUnit({
|
|
type: 'TCP',
|
|
key: unitID,
|
|
value: nodes
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
function listSelectUnits(data) {
|
|
console.log(data);
|
|
global.units = {};
|
|
let htm = "";
|
|
if (data.length > 0) {
|
|
// data的key是创建人公钥_时间戳,value是nodes的ID
|
|
for (let i = 0; i < data.length; i++) {
|
|
const unitID = data[i].key;
|
|
const nodes = JSON.parse(data[i].value);
|
|
const 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);
|
|
}
|
|
|
|
function onCancelAuth(obj) {
|
|
myToast("取消权限", obj.data);
|
|
if (obj.data === "success") {
|
|
}
|
|
}
|
|
|
|
function setPermission(data) {
|
|
// console.log(request.resetContractName);
|
|
global.wssocket.send(JSON.stringify({
|
|
resetContractProcess: data.name,
|
|
closePer: data.permission,
|
|
oldPer: data['oldPermission'],
|
|
isOpen: data.isOpen,
|
|
action: 'setPermission'
|
|
}));
|
|
}
|
|
|
|
function onSetPermission(obj) {
|
|
console.log(obj);
|
|
|
|
let 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>";
|
|
}
|
|
}
|
|
|
|
function onListLeakContractProcess(obj) {
|
|
drawCPTable(obj);
|
|
} |