mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
update
This commit is contained in:
@@ -982,6 +982,18 @@ def replSetNode():
|
||||
nodes = c['nodes']
|
||||
add_node = args['node'].strip()
|
||||
|
||||
priority = -1
|
||||
if 'priority' in args:
|
||||
priority = args['priority'].strip()
|
||||
priority = int(priority)
|
||||
if priority<0 or priority>100:
|
||||
return mw.returnJson(False, 'priority应该在[0-100]之间!')
|
||||
|
||||
arbiterOnly = 0
|
||||
if 'arbiterOnly' in args:
|
||||
priority = args['arbiterOnly'].strip()
|
||||
arbiterOnly = int(arbiterOnly)
|
||||
|
||||
is_have = False
|
||||
for x in nodes:
|
||||
if x['host'] == add_node:
|
||||
@@ -992,6 +1004,9 @@ def replSetNode():
|
||||
|
||||
t = {}
|
||||
t['host'] = add_node
|
||||
t['priority'] = priority
|
||||
t['arbiterOnly'] = arbiterOnly
|
||||
|
||||
nodes.append(t)
|
||||
c['nodes'] = nodes
|
||||
setReplConfigData(c)
|
||||
|
||||
@@ -265,16 +265,34 @@ function mongoReplCfgNodes(){
|
||||
btn:["提交","关闭"],
|
||||
content: "<form class='bt-form pd20' id='mod_pwd'>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>节点服务</span>\
|
||||
<div class='info-r'>\
|
||||
<input class='bt-input-text mr5' type='text' name='node' style='width:330px' value='"+def_node+"'/>\
|
||||
<span class='tname'>节点服务:</span>\
|
||||
<div class='info-r'>\
|
||||
<input class='bt-input-text mr5' type='text' name='node' style='width:330px' value='"+def_node+"'/>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>priority:</span>\
|
||||
<div class='info-r'>\
|
||||
<input class='bt-input-text mr5' type='number' name='priority' style='width:220px' value='0'/>\
|
||||
<span class='c9'>值越大,优先权越高</span>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>仲裁员:</span>\
|
||||
<div class='info-r'>\
|
||||
<select class='bt-input-text mr5' name='arbiterOnly'>\
|
||||
<option value='0'>否</option>\
|
||||
<option value='1'>是</option>\
|
||||
</select>\
|
||||
</div>\
|
||||
</div>\
|
||||
</form>",
|
||||
yes:function(index){
|
||||
// var data = $("#mod_pwd").serialize();
|
||||
var data = {};
|
||||
data['node'] = $('input[name=node]').val();
|
||||
data['priority'] = $('input[name=priority]').val();
|
||||
data['arbiterOnly'] = $('select[name=arbiterOnly]').val();
|
||||
mgPost('repl_set_node', '',data, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
showMsg(rdata.msg,function(){
|
||||
|
||||
Reference in New Issue
Block a user