Authored by qinchao

恶意ip显示bug

@@ -10,6 +10,7 @@ import com.ui.model.BaseResponse; @@ -10,6 +10,7 @@ import com.ui.model.BaseResponse;
10 import com.ui.model.domain.MalIpRule; 10 import com.ui.model.domain.MalIpRule;
11 import com.ui.model.req.MaliciousIpRecordReq; 11 import com.ui.model.req.MaliciousIpRecordReq;
12 import com.ui.model.req.PageRequest; 12 import com.ui.model.req.PageRequest;
  13 +import org.apache.commons.lang.StringUtils;
13 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.stereotype.Controller; 15 import org.springframework.stereotype.Controller;
15 import org.springframework.ui.Model; 16 import org.springframework.ui.Model;
@@ -79,6 +80,9 @@ public class MaliciousIpCtrl { @@ -79,6 +80,9 @@ public class MaliciousIpCtrl {
79 @RequestMapping("/getMaliciousDetection") 80 @RequestMapping("/getMaliciousDetection")
80 @ResponseBody 81 @ResponseBody
81 public BaseResponse getMaliciousDetection(MaliciousIpRecordReq req) { 82 public BaseResponse getMaliciousDetection(MaliciousIpRecordReq req) {
  83 + if(StringUtils.isBlank(req.getIp())){
  84 + return null;
  85 + }
82 BaseResponse response = httpClient.defaultPost(HttpUriContants.GET_MIPS_RECORD_FROM_OPS_HBASE, req, 86 BaseResponse response = httpClient.defaultPost(HttpUriContants.GET_MIPS_RECORD_FROM_OPS_HBASE, req,
83 BaseResponse.class); 87 BaseResponse.class);
84 return response; 88 return response;
@@ -129,6 +129,27 @@ @@ -129,6 +129,27 @@
129 <script> 129 <script>
130 $(function () { 130 $(function () {
131 refreshTable(); 131 refreshTable();
  132 +
  133 + $("#hbaseTable").table({
  134 + url: contextPath + "maliciousIp/getMaliciousDetection",
  135 + queryParams:{},
  136 + dataType: 'json',
  137 + striped: true,
  138 + pagination: false,
  139 + //pageSize: 10,
  140 + //sortName: 'count', // 设置默认排序为 name
  141 + //sortOrder: 'desc', // 设置排序为反序 desc
  142 + panelClass: "panel-success",
  143 + loadFilter: function (data) {
  144 + return defaultLoadFilter(data);
  145 + },
  146 + columns: [
  147 + {
  148 + title: "内容",
  149 + field: "reason",
  150 + width: "100%"
  151 + }]
  152 + });
132 }); 153 });
133 154
134 function refreshTable() { 155 function refreshTable() {
@@ -233,31 +254,20 @@ @@ -233,31 +254,20 @@
233 } 254 }
234 255
235 $("#hbasePrefix").val(mip+":"+hbaseTime+":"); 256 $("#hbasePrefix").val(mip+":"+hbaseTime+":");
236 - $("#hbaseTable").table({  
237 - url: contextPath + "maliciousIp/getMaliciousDetection",  
238 - queryParams:{ 257 + refreshHbaseTable(mip,hbaseTime);
  258 +
  259 + $("#myModal").modal('show');
  260 + }
  261 +
  262 + function refreshHbaseTable(mip,hbaseTime) {
  263 + $("#hbaseTable").table("loadLoaclData",[]);
  264 + var param= {
239 ip:mip, 265 ip:mip,
240 timestamp:hbaseTime, 266 timestamp:hbaseTime,
241 type:"forbid" 267 type:"forbid"
242 - },  
243 - dataType: 'json',  
244 - striped: true,  
245 - pagination: false,  
246 - //pageSize: 10,  
247 - //sortName: 'count', // 设置默认排序为 name  
248 - //sortOrder: 'desc', // 设置排序为反序 desc  
249 - panelClass: "panel-success",  
250 - loadFilter: function (data) {  
251 - return defaultLoadFilter(data);  
252 - },  
253 - columns: [  
254 - {  
255 - title: "内容",  
256 - field: "reason",  
257 - width: "100%"  
258 - }]  
259 - });  
260 - $("#myModal").modal('show'); 268 + };
  269 +
  270 + $("#hbaseTable").table("load", param);
261 } 271 }
262 272
263 function showResons(elememt){ 273 function showResons(elememt){