From 5d81406fdfc19df4b2df33dc7bf2f7de20f4f822 Mon Sep 17 00:00:00 2001 From: midoks Date: Fri, 30 Dec 2022 15:21:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96mysql=E4=B8=BB=E4=BB=8E?= =?UTF-8?q?=E5=90=8C=E6=AD=A5UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/mysql/index.py | 6 ++++-- plugins/mysql/js/mysql.js | 22 +++++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/plugins/mysql/index.py b/plugins/mysql/index.py index 732e0d5b2..9a48ff301 100755 --- a/plugins/mysql/index.py +++ b/plugins/mysql/index.py @@ -2303,6 +2303,7 @@ def getSlaveList(version=''): tmp['Master_Log_File'] = dlist[x]["Master_Log_File"] tmp['Slave_IO_Running'] = dlist[x]["Slave_IO_Running"] tmp['Slave_SQL_Running'] = dlist[x]["Slave_SQL_Running"] + tmp['Last_Error'] = dlist[x]["Last_Error"] ret.append(tmp) data = {} data['data'] = ret @@ -2579,8 +2580,9 @@ def doFullSyncUser(version=''): if os.path.exists(bak_file): pwd = pSqliteDb('config').where('id=?', (1,)).getField('mysql_root') sock = getSocketFile() - mysql_import_cmd = getServerDir() + '/bin/mysql -S ' + sock + ' -uroot -p' + pwd + \ - ' ' + name + ' < ' + bak_file + my_import_cmd = getServerDir() + '/bin/mysql -S ' + sock + ' -uroot -p' + pwd + \ + ' ' + sync_db + ' < ' + bak_file + mw.execShell(my_import_cmd) db.query("start slave") # db.query("start slave user='{}' password='{}';".format(user, apass)) diff --git a/plugins/mysql/js/mysql.js b/plugins/mysql/js/mysql.js index 760a38f32..4889bafb2 100755 --- a/plugins/mysql/js/mysql.js +++ b/plugins/mysql/js/mysql.js @@ -2234,7 +2234,7 @@ function masterOrSlaveConf(version=''){ for(i in rdata.data){ var v = rdata.data[i]; - var status = "异常"; + var status = "异常"; if (v['Slave_SQL_Running'] == 'Yes' && v['Slave_IO_Running'] == 'Yes'){ status = "正常"; } @@ -2276,6 +2276,26 @@ function masterOrSlaveConf(version=''){ // 添加\ // $(".table_slave_status_list").html(con); + + $('.db_error').click(function(){ + layer.open({ + type: 1, + title: '同步异常信息', + area: '500px', + content:"
\ +
"+v['Last_Error']+"
\ +
\ + \ +
\ +
", + success:function(){ + copyText(v['Last_Error']); + $('.class-copy-db-err').click(function(){ + copyText(v['Last_Error']); + }); + } + }); + }); }); }