Authored by qinchao

Merge branch 'master' of http://git.yoho.cn/ops/monitor-ui

package com.ui.ctrl;
import com.alibaba.fastjson.JSON;
import com.ui.common.TagTypeEnum;
import com.ui.contants.HttpUriContants;
import com.ui.http.HttpRestClient;
import com.ui.model.BaseResponse;
... ... @@ -38,10 +40,12 @@ public class InternalDnsCtrl {
@RequestMapping("/toInternalDns")
public ModelAndView toInternalDns(Model model) {
TagReq req=new TagReq();
ModelAndView mv = new ModelAndView("project/internal_domain");
TagReq req = new TagReq();
BaseResponse response=httpRestClient.defaultPost(HttpUriContants.HOST_ALL_GROUPS, req, BaseResponse.class);
model.addAttribute("tags",response.getData());
return new ModelAndView("project/internal_domain");
mv.addObject("tags",response.getData());//获取标签列表
mv.addObject("tagTypeMapJson", JSON.toJSONString(TagTypeEnum.getAllTypeMap()));//获取标签map 层级结构的
return mv;
}
@RequestMapping("save")
... ...
... ... @@ -140,8 +140,10 @@
<label class="col-sm-2 control-label"> <span style="color:red">*</span>SQL:</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="influxSql" name="influxSql"
placeholder="SQL" size="40"/>
<textarea rows="3" cols="40" id="influxSql" name="influxSql" placeholder="SQL"></textarea>
<%-- <input type="text" class="form-control" id="influxSql" name="influxSql"
placeholder="SQL" size="40"/>--%>
</div>
</div>
<!-- <div class="form-group">
... ... @@ -163,8 +165,9 @@
<label class="col-sm-2 control-label"> <span style="color:red">*</span>短信:</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="sms" name="sms"
placeholder="短信,${_}替换符" size="40"/>
<textarea rows="3" cols="40" id="sms" name="sms" placeholder="短信,${_}替换符"></textarea>
<%-- <input type="text" class="form-control" id="sms" name="sms"
placeholder="短信,${_}替换符" size="40"/>--%>
</div>
</div>
<div class="form-group">
... ... @@ -319,13 +322,14 @@
field: "id",
width: "5%"
}, {
title: "列名",
field: "fields",
width: "12%"
title: "短信内容",
field: "sms",
align:"left",
width: "20%"
}, {
title: "数据库",
field: "database",
width: "10%"
width: "8%"
}, {
title: "告警类型",
field: "type",
... ... @@ -380,7 +384,7 @@
}, {
title: "上次执行",
field: "lastTime",
width: "15%"
width: "10%"
}, {
title: "操作",
formatter: function (value, rowData, rowIndex) {
... ... @@ -404,9 +408,11 @@
$("input[name='influxdbs']").val("");
$("input[name='database']").val("");
$("input[name='tags']").val("");
$("input[name='influxSql']").val("");
// $("input[name='influxSql']").val("");
$("#influxSql").val("");
$("input[name='mobile']").val("");
$("input[name='sms']").val("");
// $("input[name='sms']").val("");
$("#sms").val("");
$("input[name='type']").val("");
$("input[name='interval']").val("");
$("input[name='relaxStartTime']").val("");
... ... @@ -435,9 +441,11 @@
$("input[name='influxdbs']").val(taskModel.influxdbs);
$("input[name='database']").val(taskModel.database);
$("input[name='tags']").val(taskModel.tags);
$("input[name='influxSql']").val(taskModel.influxSql);
// $("input[name='influxSql']").val(taskModel.influxSql);
$("#influxSql").val(taskModel.influxSql);
$("input[name='mobile']").val(taskModel.mobile);
$("input[name='sms']").val(taskModel.sms);
// $("input[name='sms']").val(taskModel.sms);
$("#sms").val(taskModel.sms);
$("input[name='type']").val(taskModel.type);
$("input[name='interval']").val(taskModel.interval);
$("input[name='relaxStartTime']").val(taskModel.relaxStartTime);
... ... @@ -504,9 +512,11 @@
var influxdbs = $("input[name='influxdbs']").val();
var database = $("input[name='database']").val();
var tags = $("input[name='tags']").val();
var influxSql = $("input[name='influxSql']").val();
// var influxSql = $("input[name='influxSql']").val();
var influxSql = $("#influxSql").val();
//var mobile = $("input[name='mobile']").val();
var sms = $("input[name='sms']").val();
// var sms = $("input[name='sms']").val();
var sms = $("#sms").val();
var type = $("input[name='type']").val();
var interval = $("input[name='interval']").val();
var relaxStartTime = $("input[name='relaxStartTime']").val();
... ...
... ... @@ -140,15 +140,15 @@
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
<div class="modal-dialog" >
<div class="modal-content"style="width: 850px;">
<div class="modal-header" style="width: 850px">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel"></h4>
</div>
<div class="modal-body">
<div class="modal-body" style="width: 850px;height:560px;overflow-y: scroll;">
<form id="configForm" class="form-horizontal">
<div class="form-group">
<label class="col-sm-2 control-label"> <span style="color:red">*</span>域名:</label>
... ... @@ -201,11 +201,17 @@
<div class="form-group">
<label class="col-sm-2 control-label"> 标签:</label>
<div class="col-sm-8">
<c:forEach items="${tags }" var="tag" varStatus="status">
<div class="col-sm-9">
<div class="col-sm-12" id="appNameContent">
</div>
<%-- <c:forEach items="${tags }" var="tag" varStatus="status">
<input type="checkbox" name="tag-add" value="${tag.groupName}"> ${tag.groupName}
<c:if test="${(status.index+1) % 4 == 0}"><br></c:if>
</c:forEach>
</c:forEach>--%>
</div>
</div>
... ... @@ -565,5 +571,51 @@
}
}
//生成层级结构的标签
var tagTypes = eval(${tagTypeMapJson}); //需要展示的最外层层级
$(function () {//生成标签
$.ajax({
url: contextPath + "/hostGroup/getAllTagsGroupTreegridByType",
type: 'post',
async: false,
dataType: "json",
success: function (data) {
var contentHtml = '';
contentHtml += "<table border=1>";
for (var key in tagTypes) {
contentHtml += "<tr>";
contentHtml += "<td width='60'>";
contentHtml += tagTypes[key];
contentHtml += "</td>";
contentHtml += "<td>";
if (key == "app" || key == "mid") {
contentHtml += constructTr(data.data[key], 1);
} else {
contentHtml += constructTr(data.data[key]);
}
contentHtml += "</td>";
contentHtml += "</tr>";
}
contentHtml += "</table>";
$("#appNameContent").html(contentHtml);
}
});
});
function constructTr(treeData){
var contentHtml="";
$.each(treeData,function(n,value) {
if(n>0&&n%6==0){
contentHtml+='</br>';
}
contentHtml+='<input type="checkbox" name="tag-add" value="'+value.groupName+'">' +value.groupName+'&nbsp;&nbsp;';
if(value.children!=null&&value.children.length>0){
contentHtml += constructTr(value.children);
}
});
return contentHtml;
}
</script>
 
\ No newline at end of file
... ...