修改日志列宽度,详情宽度

This commit is contained in:
zhanghongqing
2018-08-27 21:16:47 +08:00
parent 18bfc299e4
commit 2fac813097
2 changed files with 18 additions and 39 deletions

View File

@@ -1,16 +1,4 @@
$(function(){ $(function(){
//扩展jquery增加全局函数
$.ipcommon=function(){
return {};
}
$.extend($.ipcommon, {
ipType:[],
ipPattern:[],
portPattern:[],
protocol:[],
direction:[]
});
$("select[name$='isHexbin']").each(function(){ $("select[name$='isHexbin']").each(function(){
setIsHexBin(this); setIsHexBin(this);
}); });
@@ -33,9 +21,9 @@ $(function(){
text=$(element).text().trim() text=$(element).text().trim()
} }
//增加换行 //增加换行
var count = Math.floor(text.length/34); var count = Math.floor(text.length/52);
for(var i=1;i<=count;i++){ for(var i=1;i<=count;i++){
text=text.substring(0,i*34-1)+"\n"+text.substring(i*34-1); text=text.substring(0,i*52-1)+"\n"+text.substring(i*52-1);
} }
//特殊字符转义 //特殊字符转义
text=text.replace(/[<>&"]/g,function(c){return {'<':'&lt;','>':'&gt;','&':'&amp;','"':'&quot;'}[c];}); text=text.replace(/[<>&"]/g,function(c){return {'<':'&lt;','>':'&gt;','&':'&amp;','"':'&quot;'}[c];});
@@ -49,7 +37,7 @@ $(function(){
}) })
html +="</div>"; html +="</div>";
top.$.jBox(html,{height:400,width:400,title:"<i class='icon-book-open'></i> Log Info",showIcon:false,opacity:0.5}); top.$.jBox(html,{height:450,width:600,title:"<i class='icon-book-open'></i> Log Info",showIcon:false,opacity:0.5});
}) })
var tree2 = $("select[name=lableTest]").treeMultiselect({ var tree2 = $("select[name=lableTest]").treeMultiselect({
searchable: true, searchable: true,
@@ -1465,7 +1453,6 @@ var initCommIpVal=function(){
//ip类型处理 //ip类型处理
if(ipType){ if(ipType){
var arr=ipType.split(','); var arr=ipType.split(',');
$.ipcommon.ipType=$("select[name$='ipPattern'] option");
$("select[name$='ipType'] option").each(function(){ $("select[name$='ipType'] option").each(function(){
var has=false; var has=false;
for(var type in arr){ for(var type in arr){
@@ -1478,14 +1465,13 @@ var initCommIpVal=function(){
} }
} }
if(!has){ if(!has){
$(this).remove(); $(this).attr("disabled",true);
} }
}); });
} }
//ip格式处理 //ip格式处理
if(ipPattern){ if(ipPattern){
arr=ipPattern.split(','); arr=ipPattern.split(',');
$.ipcommon.ipPattern=$("select[name$='ipPattern'] option");
$("select[name$='ipPattern'] option").each(function(){ $("select[name$='ipPattern'] option").each(function(){
var has=false; var has=false;
for(var type in arr){ for(var type in arr){
@@ -1498,16 +1484,13 @@ var initCommIpVal=function(){
} }
} }
if(!has){ if(!has){
$(this).remove(); $(this).attr("disabled",true);
} }
}); });
}else{
$.ipcommon.ipPattern=[];
} }
//端口格式处理 //端口格式处理
if(portPattern){ if(portPattern){
arr=portPattern.split(','); arr=portPattern.split(',');
$.ipcommon.portPattern=$("select[name$='portPattern'] option");
$("select[name$='portPattern'] option").each(function(){ $("select[name$='portPattern'] option").each(function(){
var has=false; var has=false;
for(var type in arr){ for(var type in arr){
@@ -1520,16 +1503,13 @@ var initCommIpVal=function(){
} }
} }
if(!has){ if(!has){
$(this).remove(); $(this).attr("disabled",true);
} }
}); });
}else{
$.ipcommon.portPattern=[];
} }
//方向处理 //方向处理
if(direction){ if(direction){
arr=direction.split(','); arr=direction.split(',');
$.ipcommon.direction=$("select[name$='direction'] option");
$("select[name$='direction'] option").each(function(){ $("select[name$='direction'] option").each(function(){
var has=false; var has=false;
for(var type in arr){ for(var type in arr){
@@ -1542,16 +1522,13 @@ var initCommIpVal=function(){
} }
} }
if(!has){ if(!has){
$(this).remove(); $(this).attr("disabled",true);
} }
}); });
}else{
$.ipcommon.direction=[];
} }
//协议处理 //协议处理
if(protocol){ if(protocol){
arr=protocol.split(','); arr=protocol.split(',');
$.ipcommon.protocol=$("select[name$='protocol'] option");
$("select[name$='protocol'] option").each(function(){ $("select[name$='protocol'] option").each(function(){
var has=false; var has=false;
for(var type in arr){ for(var type in arr){
@@ -1564,10 +1541,8 @@ var initCommIpVal=function(){
} }
} }
if(!has){ if(!has){
$(this).remove(); $(this).attr("disabled",true);
} }
}); });
}else{
$.ipcommon.protocol=[];
} }
} }

View File

@@ -10,7 +10,7 @@ $(document).ready(function() {
this.title=str; this.title=str;
}); });
var fontSize = 0; var fontSize = 0;
$("table.logTb th").each(function(){ $("table.logTb th").each(function(j){
// 判断是否支持currentStyle属性 是IE 否FF or Chrome // 判断是否支持currentStyle属性 是IE 否FF or Chrome
var finalStyle = this.currentStyle ? this.currentStyle : document.defaultView.getComputedStyle(this , null); var finalStyle = this.currentStyle ? this.currentStyle : document.defaultView.getComputedStyle(this , null);
fontSize = (finalStyle.fontSize).replace("px",""); fontSize = (finalStyle.fontSize).replace("px","");
@@ -20,13 +20,17 @@ $(document).ready(function() {
// URL列加宽 // URL列加宽
var th = this; var th = this;
var thText = this.innerText; var thText = this.innerText;
$("table.logTb td").each(function(){ //将字符串过宽的列增加宽度
$("table.logTb tbody tr").each(function(){
$(this).find("td").each(function(i){
var tdText = this.innerText; var tdText = this.innerText;
if((tdText.trim().length > thText.trim().length) && (thText == "URL" || thText == "Log URI")){ if((tdText.trim().length > thText.trim().length) && j==i && tdText.trim().length>7){
th.setAttribute('width','110px'); var px = getPixelsCount(thText,fontSize)+100;
th.setAttribute('width',px+'px');
} }
}); });
}); });
});
var tdString = ""; var tdString = "";
$("table.logTb tbody tr").each(function(){ $("table.logTb tbody tr").each(function(){