From 728677c7028adc44462f76196104877802f310fa Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sun, 5 May 2024 19:46:45 +0800 Subject: [PATCH] update --- plugins/mongodb/index.py | 15 +++++++++++++++ plugins/mongodb/js/mongodb.js | 24 +++++++++++++++++++++--- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/plugins/mongodb/index.py b/plugins/mongodb/index.py index 71f28c186..1aecaabda 100755 --- a/plugins/mongodb/index.py +++ b/plugins/mongodb/index.py @@ -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) diff --git a/plugins/mongodb/js/mongodb.js b/plugins/mongodb/js/mongodb.js index 63294f682..b5c3c227d 100644 --- a/plugins/mongodb/js/mongodb.js +++ b/plugins/mongodb/js/mongodb.js @@ -265,16 +265,34 @@ function mongoReplCfgNodes(){ btn:["提交","关闭"], content: "
\
\ - 节点服务\ -
\ - \ + 节点服务:\ +
\ + \ +
\
\ +
\ + priority:\ +
\ + \ + 值越大,优先权越高\ +
\ +
\ +
\ + 仲裁员:\ +
\ + \ +
\
\ ", 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(){