@ -666,12 +666,35 @@ function mysqlCommonFuncLockSQL(){
var tbody = '' ;
for ( var i = 0 ; i < items . length ; i ++ ) {
var t = '<tr>' ;
t += '<td>' + items [ i ] [ 'table_schema' ] + '</td>' ;
t += '<td>' + items [ i ] [ 'table_name' ] + '</td>' ;
t += '<td>' + items [ i ] [ 'trx_id' ] + '</td>' ;
t += '<td>' + items [ i ] [ 'trx_state' ] + '</td>' ;
t += '<td>' + items [ i ] [ 'trx_started' ] + '</td>' ;
t += '<td>' + items [ i ] [ 'processlist_id' ] + '</td>' ;
t += '<td>' + items [ i ] [ 'info' ] + '</td>' ;
t += '<td>' + items [ i ] [ 'user' ] + '</td>' ;
t += '<td>' + items [ i ] [ 'host' ] + '</td>' ;
t += '<td>' + items [ i ] [ 'db' ] + '</td>' ;
t += '<td>' + items [ i ] [ 'command' ] + '</td>' ;
t += '<td>' + items [ i ] [ 'state' ] + '</td>' ;
t += '<td>' + items [ i ] [ 'sql_kill_blocking_query' ] + '</td>' ;
t += '<td><a class="exec btlink" index="' + i + '">执行</a></td>' ;
t += '</tr>' ;
tbody += t ;
}
$ ( '#mysql_data_id tbody' ) . html ( tbody ) ;
$ ( '#mysql_data_id tbody .exec' ) . click ( function ( ) {
var index = $ ( this ) . attr ( 'index' ) ;
var pid = items [ index ] [ 'processlist_id' ] ;
myPostCB ( 'kill_lock_pid' , { 'sid' : sid , 'pid' : pid } , function ( rdata ) {
var data = rdata . data ;
showMsg ( data . msg , function ( ) {
if ( data . status ) {
renderSQL ( ) ;
}
} , { icon : data . status ? 1 : 2 } , 2000 ) ;
} ) ;
} ) ;
} else {
layer . msg ( data . msg , { icon : 2 } ) ;
}
@ -681,20 +704,46 @@ function mysqlCommonFuncLockSQL(){
layer . open ( {
type : 1 ,
title : "查看当前锁阻塞的SQL" ,
area : [ '8 00px' , '400px' ] ,
area : [ '10 00px' , '400px' ] ,
closeBtn : 1 ,
shadeClose : false ,
content : ' < div class = "bt-form pd20 divtable taskdivtable" > \
< div class = "mr20 pull-left" style = "border-right: 1px solid #ccc; padding-right: 20px;" > \
< button id = "kill_all" type = "button" class = "btn btn-default btn-sm" > 关闭所有阻塞 < / b u t t o n > \
< / d i v > \
< hr / > \
< table class = "table table-hover" id = "mysql_data_id" > \
< thead > \
< th style = "width:100px;" > 库名 < / t h > \
< th style = "width:50px;" > 表名 < / t h > \
< th style = "width:80px;" > 事务ID < / t h > \
< th style = "width:80px;" > 事务状态 < / t h > \
< th style = "width:220px;" > 执行时间 < / t h > \
< th style = "width:100px;" > 线程ID < / t h > \
< th style = "width:50px;" > Info < / t h > \
< th style = "width:50px;" > user < / t h > \
< th style = "width:50px;" > host < / t h > \
< th style = "width:50px;" > db < / t h > \
< th style = "width:50px;" > command < / t h > \
< th style = "width:50px;" > state < / t h > \
< th style = "width:140px;" > kill < / t h > \
< th style = "width:50px;" > 操作 < / t h > \
< / t h e a d > \
< tbody > < / t b o d y > \
< / t a b l e > \
< / d i v > ' ,
success : function ( i , l ) {
renderSQL ( ) ;
$ ( '#kill_all' ) . unbind ( 'click' ) . click ( function ( ) {
var sid = mysqlGetSid ( ) ;
myPostCB ( 'kill_all_lock' , { 'sid' : sid } , function ( rdata ) {
var data = rdata . data ;
showMsg ( data . msg , function ( ) {
if ( data . status ) {
renderSQL ( ) ;
}
} , { icon : data . status ? 1 : 2 } , 2000 ) ;
} ) ;
} ) ;
}
} ) ;
}