1.完善页面展示效果,添加/修改(默认)规则,添加应用全部改成弹窗式
This commit is contained in:
parent
3370a18e25
commit
08e3184998
|
|
@ -114,5 +114,10 @@
|
|||
<artifactId>aspectjweaver</artifactId>
|
||||
<version>1.8.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ai.cloud</groupId>
|
||||
<artifactId>skywalking-alarm</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -1,359 +1,343 @@
|
|||
package com.ai.cloud.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.ai.cloud.service.inter.IAlarmRuleSer;
|
||||
import com.ai.cloud.util.Constants;
|
||||
import com.ai.cloud.util.common.StringUtil;
|
||||
import com.ai.cloud.vo.mvo.AlarmRuleMVO;
|
||||
import com.ai.cloud.vo.svo.ConfigArgs;
|
||||
import com.ai.cloud.vo.svo.MailInfo;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.sun.activation.registries.MailcapTokenizer;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
@Controller
|
||||
public class AlarmRuleCtl {
|
||||
|
||||
@Autowired
|
||||
IAlarmRuleSer alarmRuleSer;
|
||||
@Autowired
|
||||
IAlarmRuleSer alarmRuleSer;
|
||||
|
||||
private static Logger logger = LogManager.getLogger(AlarmRuleCtl.class);
|
||||
private static Logger logger = LogManager.getLogger(AlarmRuleCtl.class);
|
||||
|
||||
/***
|
||||
* 查询用户默认规则
|
||||
*
|
||||
* @param root
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/alarmRule/default", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
|
||||
@ResponseBody
|
||||
public String queryUserDefaultAlarmRule(HttpServletRequest request, ModelMap root, @RequestBody String json)
|
||||
throws Exception {
|
||||
HttpSession session = request.getSession();
|
||||
String uid = (String) session.getAttribute("uid");
|
||||
/***
|
||||
* 查询用户默认规则
|
||||
*
|
||||
* @param root
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/alarmRule/default", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
|
||||
@ResponseBody
|
||||
public String queryUserDefaultAlarmRule(HttpServletRequest request, ModelMap root, @RequestBody String json)
|
||||
throws Exception {
|
||||
HttpSession session = request.getSession();
|
||||
String uid = (String) session.getAttribute("uid");
|
||||
|
||||
JSONObject reJson = new JSONObject();
|
||||
JSONObject reJson = new JSONObject();
|
||||
|
||||
if (StringUtil.isBlank(uid)) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "用户会话超时");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
if (StringUtil.isBlank(uid)) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "用户会话超时");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
AlarmRuleMVO ruleMVO = new AlarmRuleMVO();
|
||||
ruleMVO.setUid(uid);
|
||||
AlarmRuleMVO ruleMVO = new AlarmRuleMVO();
|
||||
ruleMVO.setUid(uid);
|
||||
|
||||
ruleMVO = alarmRuleSer.queryUserDefaultAlarmRule(ruleMVO);
|
||||
ruleMVO = alarmRuleSer.queryUserDefaultAlarmRule(ruleMVO);
|
||||
|
||||
if (ruleMVO != null && !StringUtil.isBlank(ruleMVO.getRuleId())) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_OK);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "查询到默认数据");
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_DATA, JSON.toJSONString(ruleMVO));
|
||||
} else {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未查询到默认数据");
|
||||
}
|
||||
if (ruleMVO != null && !StringUtil.isBlank(ruleMVO.getRuleId())) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_OK);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "查询到默认数据");
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_DATA, JSON.toJSONString(ruleMVO));
|
||||
} else {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未查询到默认数据");
|
||||
}
|
||||
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
/***
|
||||
* 查询用户默认规则
|
||||
*
|
||||
* @param root
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/alarmRule/{appId}", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
|
||||
@ResponseBody
|
||||
public String queryAppAlarmRule(HttpServletRequest request, ModelMap root, @PathVariable("appId") String appId)
|
||||
throws Exception {
|
||||
HttpSession session = request.getSession();
|
||||
String uid = (String) session.getAttribute("uid");
|
||||
/***
|
||||
* 查询用户默认规则
|
||||
*
|
||||
* @param root
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/alarmRule/{appId}", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
|
||||
@ResponseBody
|
||||
public String queryAppAlarmRule(HttpServletRequest request, ModelMap root, @PathVariable("appId") String appId)
|
||||
throws Exception {
|
||||
HttpSession session = request.getSession();
|
||||
String uid = (String) session.getAttribute("uid");
|
||||
|
||||
JSONObject reJson = new JSONObject();
|
||||
JSONObject reJson = new JSONObject();
|
||||
|
||||
if (StringUtil.isBlank(uid)) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "用户会话超时");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
if (StringUtil.isBlank(uid)) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "用户会话超时");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
AlarmRuleMVO ruleMVO = new AlarmRuleMVO();
|
||||
ruleMVO.setAppId(appId);
|
||||
ruleMVO.setUid(uid);
|
||||
AlarmRuleMVO ruleMVO = new AlarmRuleMVO();
|
||||
ruleMVO.setAppId(appId);
|
||||
ruleMVO.setUid(uid);
|
||||
|
||||
ruleMVO = alarmRuleSer.queryAppAlarmRule(ruleMVO);
|
||||
ruleMVO = alarmRuleSer.queryAppAlarmRule(ruleMVO);
|
||||
|
||||
if (ruleMVO != null && !StringUtil.isBlank(ruleMVO.getRuleId())) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_OK);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "查询到默认数据");
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_DATA, JSON.toJSONString(ruleMVO));
|
||||
} else {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未查询到默认数据");
|
||||
}
|
||||
if (ruleMVO != null && !StringUtil.isBlank(ruleMVO.getRuleId())) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_OK);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "查询到默认数据");
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_DATA, JSON.toJSONString(ruleMVO));
|
||||
} else {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未查询到默认数据");
|
||||
}
|
||||
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
/***
|
||||
* 创建用户默认规则
|
||||
*
|
||||
* @param root
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/alarmRule/create", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
|
||||
@ResponseBody
|
||||
public String createAppAlarmRule(HttpServletRequest request, ModelMap root, @RequestBody String jsonStr)
|
||||
throws Exception {
|
||||
HttpSession session = request.getSession();
|
||||
String uid = (String) session.getAttribute("uid");
|
||||
/***
|
||||
* 创建用户默认规则
|
||||
*
|
||||
* @param root
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/alarmRule/create", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
|
||||
@ResponseBody
|
||||
public String createAppAlarmRule(HttpServletRequest request, ModelMap root, @RequestBody String jsonStr)
|
||||
throws Exception {
|
||||
HttpSession session = request.getSession();
|
||||
String uid = (String) session.getAttribute("uid");
|
||||
|
||||
JSONObject reJson = new JSONObject();
|
||||
JSONObject reJson = new JSONObject();
|
||||
|
||||
if (StringUtil.isBlank(uid)) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "用户会话超时");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
if (StringUtil.isBlank(uid)) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "用户会话超时");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
JSONObject json = JSON.parseObject(jsonStr);
|
||||
if (!json.containsKey("isGlobal")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到isGlobal参数信息");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
String isGlobal = json.getString("isGlobal");
|
||||
if (!json.containsKey("period")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到告警间隔参数信息");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
String period = json.getString("period");
|
||||
if (!json.containsKey("todoType")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到操作类型参数信息");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
String todoType = json.getString("todoType");
|
||||
JSONObject json = JSON.parseObject(jsonStr);
|
||||
if (!json.containsKey("isGlobal")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到isGlobal参数信息");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
String isGlobal = json.getString("isGlobal");
|
||||
if (!json.containsKey("period")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到告警间隔参数信息");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
String period = json.getString("period");
|
||||
if (!json.containsKey("todoType")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到操作类型参数信息");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
String todoType = json.getString("todoType");
|
||||
|
||||
String mailTo = null;
|
||||
String mailCc = null;
|
||||
if (Constants.TODO_TYPE_0.equals(todoType)) {
|
||||
if (!json.containsKey("mailTo")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到邮件发送人信息");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
mailTo = json.getString("mailTo").replace("\n", "");
|
||||
if (json.containsKey("mailCc")) {
|
||||
mailCc = json.getString("mailCc").replace("\n", "");
|
||||
}
|
||||
} else if (Constants.TODO_TYPE_1.equals(todoType)) {
|
||||
if (!json.containsKey("urlCall")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到回调接口信息");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
} else {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未定义告警操作类型");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
String mailTo = null;
|
||||
String mailCc = null;
|
||||
if (Constants.TODO_TYPE_0.equals(todoType)) {
|
||||
if (!json.containsKey("mailTo")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到邮件发送人信息");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
mailTo = json.getString("mailTo").replace("\n", "");
|
||||
if (json.containsKey("mailCc")) {
|
||||
mailCc = json.getString("mailCc").replace("\n", "");
|
||||
}
|
||||
} else if (Constants.TODO_TYPE_1.equals(todoType)) {
|
||||
if (!json.containsKey("urlCall")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到回调接口信息");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
} else {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未定义告警操作类型");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
AlarmRuleMVO srchRuleMVO = new AlarmRuleMVO();
|
||||
srchRuleMVO.setUid(uid);
|
||||
srchRuleMVO.setSts(Constants.STR_VAL_A);
|
||||
srchRuleMVO.setIsGlobal(isGlobal);
|
||||
AlarmRuleMVO srchRuleMVO = new AlarmRuleMVO();
|
||||
srchRuleMVO.setUid(uid);
|
||||
srchRuleMVO.setSts(Constants.STR_VAL_A);
|
||||
srchRuleMVO.setIsGlobal(isGlobal);
|
||||
|
||||
// 判断是否为全局规则
|
||||
if (Constants.IS_GLOBAL_FALG_1.equals(isGlobal)) {
|
||||
srchRuleMVO = alarmRuleSer.queryUserDefaultAlarmRule(srchRuleMVO);
|
||||
if (srchRuleMVO != null && !StringUtil.isBlank(srchRuleMVO.getRuleId())) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "默认告警规则已经存在");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
} else {
|
||||
if (!json.containsKey("appId")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到appId参数信息");
|
||||
return reJson.toJSONString();
|
||||
} else {
|
||||
srchRuleMVO.setAppId(json.getString("appId"));
|
||||
srchRuleMVO = alarmRuleSer.queryAppAlarmRule(srchRuleMVO);
|
||||
if (srchRuleMVO != null && !StringUtil.isBlank(srchRuleMVO.getRuleId())) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "当前应用已经存在告警规则");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
}
|
||||
}
|
||||
// 判断是否为全局规则
|
||||
if (Constants.IS_GLOBAL_FALG_1.equals(isGlobal)) {
|
||||
srchRuleMVO = alarmRuleSer.queryUserDefaultAlarmRule(srchRuleMVO);
|
||||
if (srchRuleMVO != null && !StringUtil.isBlank(srchRuleMVO.getRuleId())) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "默认告警规则已经存在");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
} else {
|
||||
if (!json.containsKey("appId")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到appId参数信息");
|
||||
return reJson.toJSONString();
|
||||
} else {
|
||||
srchRuleMVO.setAppId(json.getString("appId"));
|
||||
srchRuleMVO = alarmRuleSer.queryAppAlarmRule(srchRuleMVO);
|
||||
if (srchRuleMVO != null && !StringUtil.isBlank(srchRuleMVO.getRuleId())) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "当前应用已经存在告警规则");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AlarmRuleMVO ruleMVO = new AlarmRuleMVO();
|
||||
ruleMVO.setUid(uid);
|
||||
ruleMVO.setAppId(json.getString("appId"));
|
||||
ruleMVO.setSts(Constants.STR_VAL_A);
|
||||
ruleMVO.setIsGlobal(isGlobal);
|
||||
ruleMVO.setTodoType(todoType);
|
||||
JSONObject confArgs = new JSONObject();
|
||||
confArgs.put("period", period);
|
||||
if (Constants.TODO_TYPE_0.equals(todoType)) {
|
||||
// 设置邮件相关的信息
|
||||
JSONObject mailInfo = new JSONObject();
|
||||
AlarmRuleMVO ruleMVO = new AlarmRuleMVO();
|
||||
ruleMVO.setUid(uid);
|
||||
ruleMVO.setAppId(json.getString("appId"));
|
||||
ruleMVO.setSts(Constants.STR_VAL_A);
|
||||
ruleMVO.setIsGlobal(isGlobal);
|
||||
ruleMVO.setTodoType(todoType);
|
||||
JSONObject confArgs = new JSONObject();
|
||||
confArgs.put("period", period);
|
||||
if (Constants.TODO_TYPE_0.equals(todoType)) {
|
||||
// 设置邮件相关的信息
|
||||
JSONObject mailInfo = new JSONObject();
|
||||
|
||||
String[] mailToList = mailTo.split(Constants.MAIL_SPLIT_CHAR);
|
||||
String[] mailToList = mailTo.split(Constants.MAIL_SPLIT_CHAR);
|
||||
|
||||
if (!StringUtil.isBlank(mailCc)) {
|
||||
String[] mailCcList = mailCc.split(Constants.MAIL_SPLIT_CHAR);
|
||||
mailInfo.put("mailCc", mailCcList);
|
||||
}
|
||||
if (!StringUtil.isBlank(mailCc)) {
|
||||
String[] mailCcList = mailCc.split(Constants.MAIL_SPLIT_CHAR);
|
||||
mailInfo.put("mailCc", mailCcList);
|
||||
}
|
||||
|
||||
mailInfo.put("mailTo", mailToList);
|
||||
confArgs.put("mailInfo", mailInfo);
|
||||
} else if (Constants.TODO_TYPE_1.equals(todoType)) {
|
||||
// 设置接口相关的信息
|
||||
JSONObject urlInfo = new JSONObject();
|
||||
urlInfo.put("urlCall", json.getString("urlCall"));
|
||||
confArgs.put("urlInfo", urlInfo);
|
||||
}
|
||||
mailInfo.put("mailTo", mailToList);
|
||||
confArgs.put("mailInfo", mailInfo);
|
||||
} else if (Constants.TODO_TYPE_1.equals(todoType)) {
|
||||
// 设置接口相关的信息
|
||||
JSONObject urlInfo = new JSONObject();
|
||||
urlInfo.put("urlCall", json.getString("urlCall"));
|
||||
confArgs.put("urlInfo", urlInfo);
|
||||
}
|
||||
|
||||
ruleMVO.setConfigArgs(confArgs.toJSONString());
|
||||
ConfigArgs configArgs = new ConfigArgs();
|
||||
configArgs.setPeriod(json.getInteger("period"));
|
||||
MailInfo mailInfo = new MailInfo();
|
||||
mailInfo.setMailCc(json.getString("mailCc").toString().trim().split(","));
|
||||
mailInfo.setMailTo(json.getString("mailTo").toString().trim().split(","));
|
||||
configArgs.setMailInfo(mailInfo);
|
||||
ruleMVO.setConfigArgs(configArgs);
|
||||
|
||||
try {
|
||||
ruleMVO = alarmRuleSer.createAlarmRule(ruleMVO);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_OK);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "操作成功");
|
||||
try {
|
||||
ruleMVO = alarmRuleSer.createAlarmRule(ruleMVO);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_OK);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "操作成功");
|
||||
|
||||
} catch (Exception e) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "创建告警规则失败");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "创建告警规则失败");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
/***
|
||||
* 创建用户默认规则
|
||||
*
|
||||
* @param root
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/alarmRule/modify", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
|
||||
@ResponseBody
|
||||
public String modifyAppAlarmRule(HttpServletRequest request, ModelMap root, @RequestBody String jsonStr)
|
||||
throws Exception {
|
||||
HttpSession session = request.getSession();
|
||||
String uid = (String) session.getAttribute("uid");
|
||||
/***
|
||||
* 创建用户默认规则
|
||||
*
|
||||
* @param root
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/alarmRule/modify", method = RequestMethod.POST, produces = "application/json; charset=UTF-8")
|
||||
@ResponseBody
|
||||
public String modifyAppAlarmRule(HttpServletRequest request, ModelMap root, @RequestBody String jsonStr)
|
||||
throws Exception {
|
||||
HttpSession session = request.getSession();
|
||||
String uid = (String) session.getAttribute("uid");
|
||||
|
||||
JSONObject reJson = new JSONObject();
|
||||
JSONObject reJson = new JSONObject();
|
||||
|
||||
if (StringUtil.isBlank(uid)) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "用户会话超时");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
if (StringUtil.isBlank(uid)) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "用户会话超时");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
JSONObject json = JSON.parseObject(jsonStr);
|
||||
if (!json.containsKey("isGlobal")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到isGlobal参数信息");
|
||||
}
|
||||
String isGlobal = json.getString("isGlobal");
|
||||
if (!json.containsKey("period")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到告警间隔参数信息");
|
||||
}
|
||||
String period = json.getString("period");
|
||||
if (!json.containsKey("todoType")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到操作类型参数信息");
|
||||
}
|
||||
String ruleId = json.getString("ruleId");
|
||||
if (!json.containsKey("ruleId")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到告警规则参数信息");
|
||||
}
|
||||
String todoType = json.getString("todoType");
|
||||
String mailTo = null;
|
||||
String mailCc = null;
|
||||
if (Constants.TODO_TYPE_0.equals(todoType)) {
|
||||
if (!json.containsKey("mailTo")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到邮件发送人信息");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
mailTo = json.getString("mailTo").replace("\n", "");
|
||||
if (json.containsKey("mailCc")) {
|
||||
mailCc = json.getString("mailCc").replace("\n", "");
|
||||
}
|
||||
} else if (Constants.TODO_TYPE_1.equals(todoType)) {
|
||||
if (!json.containsKey("urlCall")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到回调接口信息");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
} else {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未定义告警操作类型");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
JSONObject json = JSON.parseObject(jsonStr);
|
||||
if (!json.containsKey("isGlobal")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到isGlobal参数信息");
|
||||
}
|
||||
String isGlobal = json.getString("isGlobal");
|
||||
if (!json.containsKey("period")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到告警间隔参数信息");
|
||||
}
|
||||
String period = json.getString("period");
|
||||
if (!json.containsKey("todoType")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到操作类型参数信息");
|
||||
}
|
||||
String ruleId = json.getString("ruleId");
|
||||
if (!json.containsKey("ruleId")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到告警规则参数信息");
|
||||
}
|
||||
String todoType = json.getString("todoType");
|
||||
String mailTo = null;
|
||||
String mailCc = null;
|
||||
if (Constants.TODO_TYPE_0.equals(todoType)) {
|
||||
if (!json.containsKey("mailTo")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到邮件发送人信息");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
mailTo = json.getString("mailTo").replace("\n", "");
|
||||
if (json.containsKey("mailCc")) {
|
||||
mailCc = json.getString("mailCc").replace("\n", "");
|
||||
}
|
||||
} else if (Constants.TODO_TYPE_1.equals(todoType)) {
|
||||
if (!json.containsKey("urlCall")) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未找到回调接口信息");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
} else {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "未定义告警操作类型");
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
AlarmRuleMVO ruleMVO = new AlarmRuleMVO();
|
||||
ruleMVO.setRuleId(ruleId);
|
||||
ruleMVO.setTodoType(todoType);
|
||||
JSONObject confArgs = new JSONObject();
|
||||
confArgs.put("period", period);
|
||||
if (Constants.TODO_TYPE_0.equals(todoType)) {
|
||||
// 设置邮件相关的信息
|
||||
JSONObject mailInfo = new JSONObject();
|
||||
AlarmRuleMVO ruleMVO = new AlarmRuleMVO();
|
||||
ruleMVO.setRuleId(ruleId);
|
||||
ruleMVO.setTodoType(todoType);
|
||||
ConfigArgs configArgs = new ConfigArgs();
|
||||
configArgs.setPeriod(json.getInteger("period"));
|
||||
MailInfo mailInfo = new MailInfo();
|
||||
mailInfo.setMailCc(json.getString("mailCc").toString().trim().split(","));
|
||||
mailInfo.setMailTo(json.getString("mailTo").toString().trim().split(","));
|
||||
configArgs.setMailInfo(mailInfo);
|
||||
ruleMVO.setConfigArgs(configArgs);
|
||||
|
||||
String[] mailToList = mailTo.split(Constants.MAIL_SPLIT_CHAR);
|
||||
try {
|
||||
ruleMVO = alarmRuleSer.modifyAlarmRule(ruleMVO);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_OK);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "操作成功");
|
||||
|
||||
if (!StringUtil.isBlank(mailCc)) {
|
||||
String[] mailCcList = mailCc.split(Constants.MAIL_SPLIT_CHAR);
|
||||
mailInfo.put("mailCc", mailCcList);
|
||||
}
|
||||
|
||||
mailInfo.put("mailTo", mailToList);
|
||||
confArgs.put("mailInfo", mailInfo);
|
||||
} else if (Constants.TODO_TYPE_1.equals(todoType)) {
|
||||
// 设置接口相关的信息
|
||||
JSONObject urlInfo = new JSONObject();
|
||||
urlInfo.put("urlCall", json.getString("urlCall"));
|
||||
confArgs.put("urlInfo", urlInfo);
|
||||
}
|
||||
ruleMVO.setConfigArgs(confArgs.toJSONString());
|
||||
|
||||
try {
|
||||
ruleMVO = alarmRuleSer.modifyAlarmRule(ruleMVO);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_OK);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "操作成功");
|
||||
|
||||
} catch (Exception e) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "创建告警规则失败");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT, Constants.JSON_RESULT_KEY_RESULT_FAIL);
|
||||
reJson.put(Constants.JSON_RESULT_KEY_RESULT_MSG, "创建告警规则失败");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
package com.ai.cloud.controller;
|
||||
|
||||
import com.ai.cloud.service.inter.IAlarmRuleSer;
|
||||
import com.ai.cloud.vo.mvo.AlarmRuleMVO;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/alarm-rule")
|
||||
public class AlarmRuleMaintainCtl {
|
||||
|
||||
@Autowired
|
||||
IAlarmRuleSer alarmRuleSer;
|
||||
|
||||
private static Logger logger = LogManager.getLogger(AlarmRuleMaintainCtl.class);
|
||||
|
||||
@RequestMapping("/toCreate")
|
||||
public String create() {
|
||||
return "alarm-rule/createAlarm-rule";
|
||||
}
|
||||
|
||||
@RequestMapping("/list/{appId}")
|
||||
public String listInfo(HttpServletRequest request, ModelMap model, @PathVariable("appId") String appId, String ruleId, String appCode,String isGlobal) {
|
||||
HttpSession session = request.getSession();
|
||||
String uid = (String) session.getAttribute("uid");
|
||||
AlarmRuleMVO ruleMVO = new AlarmRuleMVO();
|
||||
if (!"default".equals(appId)) {
|
||||
ruleMVO.setAppId(appId);
|
||||
}
|
||||
ruleMVO.setUid(uid);
|
||||
if (!"default".equals(appId)) {
|
||||
ruleMVO = alarmRuleSer.queryAppAlarmRule(ruleMVO);
|
||||
ruleMVO.setAppId(appId);
|
||||
} else {
|
||||
ruleMVO = alarmRuleSer.queryUserDefaultAlarmRule(ruleMVO);
|
||||
}
|
||||
|
||||
ruleMVO.setAppCode(appCode);
|
||||
model.addAttribute("ruleMVO", ruleMVO);
|
||||
ruleMVO.setIsGlobal(isGlobal);
|
||||
return "alarm-rule/createAlarm-rule";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.ai.cloud.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/app")
|
||||
public class AppMaintainCtl {
|
||||
@RequestMapping("/create")
|
||||
public String create() {
|
||||
return "app/createApp";
|
||||
}
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@ import org.apache.logging.log4j.LogManager;
|
|||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
|
|
@ -64,8 +65,8 @@ public class AuthFileCtl {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (propertyValue.startsWith("$")){
|
||||
if (request.getParameter((propertyValue.substring(1))) != null ) {
|
||||
if (propertyValue.startsWith("$")) {
|
||||
if (request.getParameter((propertyValue.substring(1))) != null) {
|
||||
value.setValue(request.getParameter(propertyValue.substring(1)));
|
||||
}
|
||||
}
|
||||
|
|
@ -112,4 +113,10 @@ public class AuthFileCtl {
|
|||
|
||||
return reJson.toJSONString();
|
||||
}
|
||||
|
||||
@RequestMapping("/download/{appCode}")
|
||||
public String toDownloadAuthFile(@PathVariable("appCode") String appCode, ModelMap root) throws Exception {
|
||||
root.addAttribute("appCode", appCode);
|
||||
return "auth-file/authFile";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
package com.ai.cloud.dao.impl;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
import com.ai.cloud.dao.inter.IAlarmRuleMDAO;
|
||||
import com.ai.cloud.vo.mvo.AlarmRuleMVO;
|
||||
import com.ai.cloud.vo.svo.ConfigArgs;
|
||||
import com.google.gson.Gson;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -16,103 +14,102 @@ import org.springframework.jdbc.support.GeneratedKeyHolder;
|
|||
import org.springframework.jdbc.support.KeyHolder;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.ai.cloud.dao.inter.IAlarmRuleMDAO;
|
||||
import com.ai.cloud.vo.mvo.AlarmRuleMVO;
|
||||
import java.sql.*;
|
||||
|
||||
@Repository
|
||||
public class AlarmRuleMDAO implements IAlarmRuleMDAO {
|
||||
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
@Autowired
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
private static Logger logger = LogManager.getLogger(AlarmRuleMDAO.class);
|
||||
private static Logger logger = LogManager.getLogger(AlarmRuleMDAO.class);
|
||||
|
||||
@Override
|
||||
public AlarmRuleMVO queryUserDefaultAlarmRule(AlarmRuleMVO rule) {
|
||||
final AlarmRuleMVO ruleMVO = new AlarmRuleMVO();
|
||||
String sql = "select rule_id,app_id,uid,config_args,is_global,todo_type,create_time,sts,modify_time from alarm_rule a where a.uid = ? and a.is_global = '1' and a.sts='A'";
|
||||
final Object[] params = new Object[] { rule.getUid() };
|
||||
jdbcTemplate.query(sql, params, new RowCallbackHandler() {
|
||||
@Override
|
||||
public void processRow(ResultSet rs) throws SQLException {
|
||||
ruleMVO.setRuleId(rs.getString("rule_id"));
|
||||
ruleMVO.setAppId(rs.getString("app_id"));
|
||||
ruleMVO.setUid(rs.getString("uid"));
|
||||
ruleMVO.setConfigArgs(rs.getString("config_args"));
|
||||
ruleMVO.setIsGlobal(rs.getString("is_global"));
|
||||
ruleMVO.setTodoType(rs.getString("todo_type"));
|
||||
ruleMVO.setCreateTime(rs.getTimestamp("create_time"));
|
||||
ruleMVO.setSts(rs.getString("sts"));
|
||||
ruleMVO.setModifyTime(rs.getTimestamp("modify_time"));
|
||||
}
|
||||
});
|
||||
logger.info("result : {}", ruleMVO);
|
||||
return ruleMVO;
|
||||
}
|
||||
@Override
|
||||
public AlarmRuleMVO queryUserDefaultAlarmRule(AlarmRuleMVO rule) {
|
||||
final AlarmRuleMVO ruleMVO = new AlarmRuleMVO();
|
||||
String sql = "select rule_id,app_id,uid,config_args,is_global,todo_type,create_time,sts,modify_time from alarm_rule a where a.uid = ? and a.is_global = '1' and a.sts='A'";
|
||||
final Object[] params = new Object[]{rule.getUid()};
|
||||
jdbcTemplate.query(sql, params, new RowCallbackHandler() {
|
||||
@Override
|
||||
public void processRow(ResultSet rs) throws SQLException {
|
||||
ruleMVO.setRuleId(rs.getString("rule_id"));
|
||||
ruleMVO.setAppId(rs.getString("app_id"));
|
||||
ruleMVO.setUid(rs.getString("uid"));
|
||||
ruleMVO.setConfigArgs(new Gson().fromJson(rs.getString("config_args"), ConfigArgs.class));
|
||||
ruleMVO.setIsGlobal(rs.getString("is_global"));
|
||||
ruleMVO.setTodoType(rs.getString("todo_type"));
|
||||
ruleMVO.setCreateTime(rs.getTimestamp("create_time"));
|
||||
ruleMVO.setSts(rs.getString("sts"));
|
||||
ruleMVO.setModifyTime(rs.getTimestamp("modify_time"));
|
||||
}
|
||||
});
|
||||
logger.info("result : {}", ruleMVO);
|
||||
return ruleMVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlarmRuleMVO queryAppAlarmRule(AlarmRuleMVO rule) {
|
||||
final AlarmRuleMVO ruleMVO = new AlarmRuleMVO();
|
||||
String sql = "select rule_id,app_id,uid,config_args,is_global,todo_type,create_time,sts,modify_time from alarm_rule a where a.uid = ? and app_id = ? and a.is_global = '0' and a.sts='A'";
|
||||
final Object[] params = new Object[] { rule.getUid(), rule.getAppId() };
|
||||
jdbcTemplate.query(sql, params, new RowCallbackHandler() {
|
||||
@Override
|
||||
public void processRow(ResultSet rs) throws SQLException {
|
||||
ruleMVO.setRuleId(rs.getString("rule_id"));
|
||||
ruleMVO.setAppId(rs.getString("app_id"));
|
||||
ruleMVO.setUid(rs.getString("uid"));
|
||||
ruleMVO.setConfigArgs(rs.getString("config_args"));
|
||||
ruleMVO.setIsGlobal(rs.getString("is_global"));
|
||||
ruleMVO.setTodoType(rs.getString("todo_type"));
|
||||
ruleMVO.setCreateTime(rs.getTimestamp("create_time"));
|
||||
ruleMVO.setSts(rs.getString("sts"));
|
||||
ruleMVO.setModifyTime(rs.getTimestamp("modify_time"));
|
||||
}
|
||||
});
|
||||
logger.info("result : {}", ruleMVO);
|
||||
return ruleMVO;
|
||||
}
|
||||
@Override
|
||||
public AlarmRuleMVO queryAppAlarmRule(AlarmRuleMVO rule) {
|
||||
final AlarmRuleMVO ruleMVO = new AlarmRuleMVO();
|
||||
String sql = "select rule_id,app_id,uid,config_args,is_global,todo_type,create_time,sts,modify_time from alarm_rule a where a.uid = ? and app_id = ? and a.is_global = '0' and a.sts='A'";
|
||||
final Object[] params = new Object[]{rule.getUid(), rule.getAppId()};
|
||||
jdbcTemplate.query(sql, params, new RowCallbackHandler() {
|
||||
@Override
|
||||
public void processRow(ResultSet rs) throws SQLException {
|
||||
ruleMVO.setRuleId(rs.getString("rule_id"));
|
||||
ruleMVO.setAppId(rs.getString("app_id"));
|
||||
ruleMVO.setUid(rs.getString("uid"));
|
||||
ruleMVO.setConfigArgs(new Gson().fromJson(rs.getString("config_args"), ConfigArgs.class));
|
||||
ruleMVO.setIsGlobal(rs.getString("is_global"));
|
||||
ruleMVO.setTodoType(rs.getString("todo_type"));
|
||||
ruleMVO.setCreateTime(rs.getTimestamp("create_time"));
|
||||
ruleMVO.setSts(rs.getString("sts"));
|
||||
ruleMVO.setModifyTime(rs.getTimestamp("modify_time"));
|
||||
}
|
||||
});
|
||||
logger.info("result : {}", ruleMVO);
|
||||
return ruleMVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlarmRuleMVO createAlarmRule(final AlarmRuleMVO ruleMVO) {
|
||||
final String sql = "insert into alarm_rule (app_id,uid,config_args,is_global,todo_type,create_time,sts,modify_time) values (?,?,?,?,?,sysdate(),?,sysdate())";
|
||||
KeyHolder keyHolder = new GeneratedKeyHolder();
|
||||
@Override
|
||||
public AlarmRuleMVO createAlarmRule(final AlarmRuleMVO ruleMVO) {
|
||||
final String sql = "insert into alarm_rule (app_id,uid,config_args,is_global,todo_type,create_time,sts,modify_time) values (?,?,?,?,?,sysdate(),?,sysdate())";
|
||||
KeyHolder keyHolder = new GeneratedKeyHolder();
|
||||
|
||||
int count = jdbcTemplate.update(new PreparedStatementCreator() {
|
||||
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
|
||||
PreparedStatement pstmt = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
|
||||
int i = 0;
|
||||
pstmt.setString(++i, ruleMVO.getAppId());
|
||||
pstmt.setString(++i, ruleMVO.getUid());
|
||||
pstmt.setString(++i, ruleMVO.getConfigArgs());
|
||||
pstmt.setString(++i, ruleMVO.getIsGlobal());
|
||||
pstmt.setString(++i, ruleMVO.getTodoType());
|
||||
pstmt.setString(++i, ruleMVO.getSts());
|
||||
return pstmt;
|
||||
}
|
||||
}, keyHolder);
|
||||
logger.info("创建应用成功:{}", keyHolder.getKey().intValue());
|
||||
ruleMVO.setRuleId(keyHolder.getKey().toString());
|
||||
int count = jdbcTemplate.update(new PreparedStatementCreator() {
|
||||
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
|
||||
PreparedStatement pstmt = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
|
||||
int i = 0;
|
||||
pstmt.setString(++i, ruleMVO.getAppId());
|
||||
pstmt.setString(++i, ruleMVO.getUid());
|
||||
pstmt.setString(++i, new Gson().toJson(ruleMVO.getConfigArgs()));
|
||||
pstmt.setString(++i, ruleMVO.getIsGlobal());
|
||||
pstmt.setString(++i, ruleMVO.getTodoType());
|
||||
pstmt.setString(++i, ruleMVO.getSts());
|
||||
return pstmt;
|
||||
}
|
||||
}, keyHolder);
|
||||
logger.info("创建应用成功:{}", keyHolder.getKey().intValue());
|
||||
ruleMVO.setRuleId(keyHolder.getKey().toString());
|
||||
|
||||
return ruleMVO;
|
||||
}
|
||||
return ruleMVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlarmRuleMVO modifyAlarmRule(final AlarmRuleMVO ruleMVO) {
|
||||
final String sql = "update alarm_rule set config_args = ?,todo_type = ? where rule_id = ?";
|
||||
@Override
|
||||
public AlarmRuleMVO modifyAlarmRule(final AlarmRuleMVO ruleMVO) {
|
||||
final String sql = "update alarm_rule set config_args = ?,todo_type = ? where rule_id = ?";
|
||||
|
||||
int count = jdbcTemplate.update(new PreparedStatementCreator() {
|
||||
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
|
||||
PreparedStatement pstmt = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
|
||||
int i = 0;
|
||||
pstmt.setString(++i, ruleMVO.getConfigArgs());
|
||||
pstmt.setString(++i, ruleMVO.getTodoType());
|
||||
pstmt.setString(++i, ruleMVO.getRuleId());
|
||||
return pstmt;
|
||||
}
|
||||
});
|
||||
int count = jdbcTemplate.update(new PreparedStatementCreator() {
|
||||
public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
|
||||
PreparedStatement pstmt = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
|
||||
int i = 0;
|
||||
pstmt.setString(++i, new Gson().toJson(ruleMVO.getConfigArgs()));
|
||||
pstmt.setString(++i, ruleMVO.getTodoType());
|
||||
pstmt.setString(++i, ruleMVO.getRuleId());
|
||||
return pstmt;
|
||||
}
|
||||
});
|
||||
|
||||
return ruleMVO;
|
||||
}
|
||||
return ruleMVO;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@ package com.ai.cloud.vo.svo;
|
|||
import java.sql.Timestamp;
|
||||
|
||||
public class AlarmRuleSVO {
|
||||
|
||||
|
||||
private String appCode;
|
||||
|
||||
private String ruleId;
|
||||
|
||||
private String appId;
|
||||
|
|
@ -13,8 +15,8 @@ public class AlarmRuleSVO {
|
|||
private String isGlobal;
|
||||
|
||||
private String todoType;
|
||||
|
||||
private String configArgs;
|
||||
|
||||
private ConfigArgs configArgs;
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
|
|
@ -46,11 +48,11 @@ public class AlarmRuleSVO {
|
|||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getConfigArgs() {
|
||||
public ConfigArgs getConfigArgs() {
|
||||
return configArgs;
|
||||
}
|
||||
|
||||
public void setConfigArgs(String configArgs) {
|
||||
public void setConfigArgs(ConfigArgs configArgs) {
|
||||
this.configArgs = configArgs;
|
||||
}
|
||||
|
||||
|
|
@ -101,4 +103,11 @@ public class AlarmRuleSVO {
|
|||
+ sts + ", modifyTime=" + modifyTime + "]";
|
||||
}
|
||||
|
||||
public String getAppCode() {
|
||||
return appCode;
|
||||
}
|
||||
|
||||
public void setAppCode(String appCode) {
|
||||
this.appCode = appCode;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
package com.ai.cloud.vo.svo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class ConfigArgs implements Serializable {
|
||||
|
||||
private int period;
|
||||
|
||||
private MailInfo mailInfo;
|
||||
|
||||
public MailInfo getMailInfo() {
|
||||
return mailInfo;
|
||||
}
|
||||
|
||||
public void setMailInfo(MailInfo mailInfo) {
|
||||
this.mailInfo = mailInfo;
|
||||
}
|
||||
|
||||
public int getPeriod() {
|
||||
return period;
|
||||
}
|
||||
|
||||
public void setPeriod(int period) {
|
||||
this.period = period;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.ai.cloud.vo.svo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class MailInfo implements Serializable {
|
||||
private String[] mailTo;
|
||||
private String[] mailCc;
|
||||
|
||||
public String[] getMailTo() {
|
||||
return mailTo;
|
||||
}
|
||||
|
||||
public void setMailTo(String[] mailTo) {
|
||||
this.mailTo = mailTo;
|
||||
}
|
||||
|
||||
public String[] getMailCc() {
|
||||
return mailCc;
|
||||
}
|
||||
|
||||
public void setMailCc(String[] mailCc) {
|
||||
this.mailCc = mailCc;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
jdbc.driverClassName=com.mysql.jdbc.Driver
|
||||
jdbc.url=jdbc:mysql://10.1.241.20:31306/sw_db
|
||||
jdbc.username=sw_dbusr01
|
||||
jdbc.password=sw_dbusr01
|
||||
jdbc.url=jdbc:mysql://10.1.228.202:31316/test
|
||||
jdbc.username=devrdbusr21
|
||||
jdbc.password=devrdbusr21
|
||||
jdbc.maxTotal=200
|
||||
jdbc.maxIdle=50
|
||||
jdbc.maxWaitMillis=1000
|
||||
|
|
|
|||
|
|
@ -194,3 +194,34 @@ ENGINE = InnoDB;
|
|||
SET SQL_MODE=@OLD_SQL_MODE;
|
||||
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
|
||||
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
||||
|
||||
|
||||
CREATE TABLE `test`.`auth_file_config` (
|
||||
`config_id` INT(11) NOT NULL,
|
||||
`key` VARCHAR(200) NOT NULL,
|
||||
`value0` VARCHAR(200) NULL,
|
||||
`value1` VARCHAR(200) NULL DEFAULT NULL,
|
||||
`value2` VARCHAR(200) NULL DEFAULT NULL,
|
||||
`value3` VARCHAR(200) NULL DEFAULT NULL,
|
||||
`value4` VARCHAR(200) NULL DEFAULT NULL,
|
||||
`key_desc` VARCHAR(500) NULL,
|
||||
`sts` VARCHAR(2) NULL,
|
||||
PRIMARY KEY (`config_id`));
|
||||
|
||||
|
||||
INSERT INTO `test`.`auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('1', 'buriedpoint.printf', 'false', 'false', '是否打印数据', 'A');
|
||||
INSERT INTO `test`.`auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('2', 'buriedpoint.max_exception_stack_length', '4000', '4000', '埋点异常的最大长度', 'A');
|
||||
INSERT INTO `test`.`auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('3', 'buriedpoint.businesskey_max_length', '300', '300', '业务字段的最大长度', 'A');
|
||||
INSERT INTO `test`.`auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('4', 'buriedpoint.exclusive_exceptions', '$exclusiveException', '$exclusiveException', '过滤异常', 'A');
|
||||
INSERT INTO `test`.`auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('5', 'sender.connect_percent', '100', '100', '最大发送者的连接数阀比例', 'A');
|
||||
INSERT INTO `test`.`auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('6', 'sender.servers_addr', '#servers_addr', '#servers_addr_1', '发送服务端配置', 'A');
|
||||
INSERT INTO `test`.`auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('7', 'sender.max_copy_num', '2', '2', '最大发送的副本数量', 'A');
|
||||
INSERT INTO `test`.`auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('8', 'sender.max_send_length', '20000', '20000', '发送的最大长度', 'A');
|
||||
INSERT INTO `test`.`auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('9', 'sender.retry_get_sender_wait_interval', '2000', '2000', '当没有Sender时,尝试获取sender的等待周期', 'A');
|
||||
INSERT INTO `test`.`auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('10', 'sender.is_off', 'false', 'false', '是否开启发送消息', 'A');
|
||||
INSERT INTO `test`.`auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('11', 'consumer.max_consumer', '2', '2', '最大消费线程数', 'A');
|
||||
INSERT INTO `test`.`auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('12', 'consumer.max_wait_time', '5', '5', '消费者最大等待时间', 'A');
|
||||
INSERT INTO `test`.`auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('13', 'consumer.consumer_fail_retry_wait_interval', '50', '50', '发送失败等待时间 ', 'A');
|
||||
INSERT INTO `test`.`auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('14', 'buffer.buffer_max_size', '18000', '18000', '每个Buffer的最大个数', 'A');
|
||||
INSERT INTO `test`.`auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('15', 'buffer.pool_size', '5', '5', 'Buffer池的最大长度', 'A');
|
||||
INSERT INTO `test`.`auth_file_config` (`config_id`, `key`, `value0`, `value1`, `key_desc`, `sts`) VALUES ('16', 'senderchecker.check_polling_time', '200', '200', '发送检查线程检查周期', 'A');
|
||||
|
|
@ -1,31 +1,37 @@
|
|||
body {
|
||||
background:#EEEEEE
|
||||
background: #EEEEEE
|
||||
}
|
||||
|
||||
.progress {
|
||||
height: 15px;
|
||||
margin-bottom:0px;
|
||||
height: 15px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
font-size: 10px;
|
||||
line-height:15px;
|
||||
|
||||
font-size: 10px;
|
||||
line-height: 15px;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.progress-bar-white {
|
||||
background-image: none;
|
||||
background-color: #FFFFFF;
|
||||
background-image: none;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
.highlight {
|
||||
background-color: #D8ECF6;
|
||||
|
||||
.highlight {
|
||||
background-color: #D8ECF6;
|
||||
}
|
||||
|
||||
.progress-bar-a {
|
||||
background-color: #f0ad4e;
|
||||
}
|
||||
.progress-bar-b {
|
||||
background-color: #5cb85c;
|
||||
}
|
||||
.progress-bar-c {
|
||||
background-color: #5bc0de;
|
||||
background-color: #f0ad4e;
|
||||
}
|
||||
|
||||
.progress-bar-b {
|
||||
background-color: #5cb85c;
|
||||
}
|
||||
|
||||
.progress-bar-c {
|
||||
background-color: #5bc0de;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,59 @@
|
|||
<#import "../lib/ai.cloud/common.ftl" as common>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta charset="utf-8">
|
||||
<title>Sky Walking</title>
|
||||
<meta name="generator" content="Bootply"/>
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<link href="${base}/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link href="${base}/css/login.css" rel="stylesheet"/>
|
||||
<!-- script references -->
|
||||
</head>
|
||||
<body>
|
||||
<div class="form-horizontal" id="crtAlarmDiv">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label">应用名称:</label>
|
||||
<div class="col-sm-4">
|
||||
<p class="form-control-static" id="appName">${ruleMVO.appCode}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="period" class="col-sm-4 control-label">告警频率:</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="period" placeholder="告警发送时间间隔(秒)"
|
||||
value="${(ruleMVO.configArgs.period)!''}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="todoType" class="col-sm-4 control-label">告警操作:</label>
|
||||
<div class="col-sm-4">
|
||||
<p class="form-control-static">发送邮件</p>
|
||||
<input id="todoType" type="hidden" value="0"/>
|
||||
</div>
|
||||
</div>
|
||||
<div id="mailTempDiv" style="display:block">
|
||||
<div class="form-group">
|
||||
<label for="mailTemp" class="col-sm-4 control-label">收件人地址:</label>
|
||||
<div class="col-sm-4">
|
||||
<textarea class="form-control" id="mailTo" rows="3" placeholder="收件人地址,请英文逗号,分割"><#if (ruleMVO.configArgs.mailInfo.mailTo)??><#list ruleMVO.configArgs.mailInfo.mailTo!'' as node>${node},</#list></#if></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="mailCc" class="col-sm-4 control-label">抄送人地址:</label>
|
||||
<div class="col-sm-4">
|
||||
<textarea class="form-control" id="mailCc" rows="3" placeholder="抄送人地址,请英文逗号,分割"><#if (ruleMVO.configArgs.mailInfo.mailCc)??><#list ruleMVO.configArgs.mailInfo.mailCc as node>${node},</#list></#if></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<input type='hidden' id="ruleId" value="${(ruleMVO.ruleId)!}">
|
||||
<input type='hidden' id="appId" value="${(ruleMVO.appId)!}">
|
||||
<input type='hidden' id="isGlobal" value="${(ruleMVO.isGlobal)!}">
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<#import "../lib/ai.cloud/common.ftl" as common>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta charset="utf-8">
|
||||
<title>Sky Walking</title>
|
||||
<meta name="generator" content="Bootply"/>
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<link href="${base}/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link href="${base}/css/login.css" rel="stylesheet"/>
|
||||
<!-- script references -->
|
||||
</head>
|
||||
<body>
|
||||
<div class="form-horizontal">
|
||||
<div id="createAppDiv">
|
||||
<div class="form-group" style="height: 50px">
|
||||
<label for="appCode" class="col-sm-4 control-label">应用名称:</label>
|
||||
<div class="col-sm-4">
|
||||
<input id="appCode" type="text" class="form-control" placeholder="应用名称"
|
||||
autofocus>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -5,117 +5,29 @@
|
|||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta charset="utf-8">
|
||||
<title>Sky Walking</title>
|
||||
<meta name="generator" content="Bootply" />
|
||||
<meta name="generator" content="Bootply"/>
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<link href="${base}/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link href="${base}/css/login.css" rel="stylesheet">
|
||||
<link href="${base}/css/login.css" rel="stylesheet"/>
|
||||
<!-- script references -->
|
||||
<@common.importJavaScript />
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<!-- 创建应用-->
|
||||
<div id="createAppDiv" style="display:none" class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="appCode" class="col-sm-4 control-label">应用名称:</label>
|
||||
<div class="col-sm-4">
|
||||
<input id="appCode" type="text" class="form-control" placeholder="应用名称"
|
||||
autofocus>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-4 col-sm-4">
|
||||
<button id="crtBtn" class="btn btn-lg btn-primary" type="button">创建应用</button>
|
||||
<button id="cannelBtn" class="btn btn-lg btn-primary" type="button">取消创建</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 创建规则-->
|
||||
<div class="form-horizontal" id="crtAlarmDiv" style="display:none">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label">应用名称:</label>
|
||||
<div class="col-sm-4">
|
||||
<p class="form-control-static" id="appName"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="period" class="col-sm-4 control-label">告警频率:</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="period" placeholder="告警发送时间间隔(秒)">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="todoType" class="col-sm-4 control-label">告警操作:</label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control" id="todoType" >
|
||||
<option value="0">发送邮件</option>
|
||||
<option value="1">回调接口</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div id="mailTempDiv" style="display:block">
|
||||
<div class="form-group">
|
||||
<label for="mailTemp" class="col-sm-4 control-label">收件人地址:</label>
|
||||
<div class="col-sm-4">
|
||||
<textarea class="form-control" id="mailTo" rows="3" placeholder="收件人地址,请英文逗号,分割"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="mailCc" class="col-sm-4 control-label">抄送人地址:</label>
|
||||
<div class="col-sm-4">
|
||||
<textarea class="form-control" id="mailCc" rows="3" placeholder="抄送人地址,请英文逗号,分割"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="callBackDiv" style="display:none">
|
||||
<label for="urlCall" class="col-sm-4 control-label">回调接口:</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="urlCall" placeholder="回调接口地址">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-4 col-sm-4">
|
||||
<input type='hidden' id="ruleId">
|
||||
<input type='hidden' id="appId">
|
||||
<input type='hidden' id="isGlobal">
|
||||
<button id="crtRuleBtn" class="btn btn-lg btn-primary " type="button">创建规则</button>
|
||||
<button id="cannelRuleBtn" class="btn btn-lg btn-primary " type="button">取消创建</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-horizontal" id="authInfo" style="display:none">
|
||||
<div class="form-group">
|
||||
<label for="period" class="col-sm-4 control-label">需要排除的异常</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="exclusiveException" placeholder="java.lang.Exception,java.io.IOException">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="period" class="col-sm-4 control-label">授权文件类型:</label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control" id="authType">
|
||||
<option value="1">外网</option>
|
||||
<option value="0">内网</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-4 col-sm-4">
|
||||
<input type='hidden' id="authAppCode">
|
||||
<button id="export" class="btn btn-lg btn-primary " type="button">生成授权文件</button>
|
||||
<button id="cannelExport" class="btn btn-lg btn-primary " type="button">取消生成</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-condensed">
|
||||
<table class="table table-condensed" style="color: white;">
|
||||
<caption>
|
||||
<button id="crtApp" type="button" class="btn btn-warning" href="#">创建应用</button>
|
||||
<button id="crtApp" type="button" class="btn btn-warning" href="javascript:void(0);">创建应用</button>
|
||||
|
||||
<button id="crtAlarm" type="button" class="btn btn-warning" href="#">默认告警规则</button>
|
||||
<button id="crtAlarm" type="button" class="btn btn-warning" href="javascript:void(0);">默认告警规则</button>
|
||||
|
||||
<button type="button" class="btn btn-success" href="#" onclick="window.location.reload(); return false;">刷新</button>
|
||||
<button type="button" class="btn btn-success" href="javascript:void(0);"
|
||||
onclick="window.location.reload(); return false;">
|
||||
刷新
|
||||
</button>
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
@ -131,9 +43,14 @@
|
|||
<th scope="row">${appInfo_index + 1}</th>
|
||||
<td>${appInfo.appCode!}</td>
|
||||
<td>
|
||||
<button name="conf" appId="${appInfo.appId!}" appCode="${appInfo.appCode!}" type="button" class="btn btn-default btn-xs">配置告警规则</button>
|
||||
<button name="exportAuthInfo" appId="${appInfo.appId!}" appCode="${appInfo.appCode!}" type="button" class="btn btn-default btn-xs">生成授权文件</button>
|
||||
<button name="del" appId="${appInfo.appId!}" type="button" class="btn btn-default btn-xs">删除</button>
|
||||
<button name="conf" appId="${appInfo.appId!}" appCode="${appInfo.appCode!}" type="button"
|
||||
class="btn btn-default btn-xs">配置告警规则
|
||||
</button>
|
||||
<button name="exportAuthInfo" appId="${appInfo.appId!}" appCode="${appInfo.appCode!}" type="button"
|
||||
class="btn btn-default btn-xs">生成授权文件
|
||||
</button>
|
||||
<button name="del" appId="${appInfo.appId!}" type="button" class="btn btn-default btn-xs">删除
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
|
|
@ -142,52 +59,68 @@
|
|||
</table>
|
||||
</div>
|
||||
<div id="authFiledownLoad">
|
||||
|
||||
</div>
|
||||
<#--<iframe id="authFiledownLoad" style="width:0px;height:0px;display:none"></iframe>-->
|
||||
<!-- script references -->
|
||||
<@common.importJavaScript />
|
||||
<script type="text/javascript">
|
||||
$().ready(function(){
|
||||
$("#crtApp").bind("click",function(){
|
||||
$("#cannelRuleBtn").click();
|
||||
$("#createAppDiv").show();
|
||||
});
|
||||
|
||||
$("#crtBtn").bind("click",function(){
|
||||
if($("#appCode").val() == ''){
|
||||
alert("请输入应用名称");
|
||||
return false;
|
||||
}
|
||||
var urlStr = '${base}/appinfo/create';
|
||||
$.ajax({
|
||||
$().ready(function () {
|
||||
$("#crtApp").bind("click", function () {
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
contentType:"application/json",
|
||||
data:"{'appCode':'" + $("#appCode").val() + "'}",
|
||||
dataType: 'json',
|
||||
async : false,
|
||||
success: function(data){
|
||||
console.log(data);
|
||||
var result = data.result;
|
||||
if(result == 'OK'){
|
||||
alert(data.msg);
|
||||
//$("#createAppDiv").hide();
|
||||
window.location.reload();
|
||||
}else{
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function(xhr, type){
|
||||
alert("操作失败");
|
||||
url: "${base}/app/create",
|
||||
success: function (data) {
|
||||
bootbox.dialog({
|
||||
message: data,
|
||||
title: "创建应用",
|
||||
size: "large",
|
||||
locale: "zh_CN",
|
||||
buttons: {
|
||||
"createBtn": {
|
||||
label: '创建应用',
|
||||
callback: function () {
|
||||
if ($("#appCode").val() == '') {
|
||||
alert("请输入应用名称");
|
||||
return false;
|
||||
}
|
||||
var urlStr = '${base}/appinfo/create';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
contentType: "application/json",
|
||||
data: "{'appCode':'" + $("#appCode").val() + "'}",
|
||||
dataType: 'json',
|
||||
async: false,
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
var result = data.result;
|
||||
if (result == 'OK') {
|
||||
alert(data.msg);
|
||||
$("#createAppDiv").hide();
|
||||
window.location.reload();
|
||||
} else {
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
alert("操作失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
"cancelBtn": {
|
||||
label: '取消创建',
|
||||
callback: function () {
|
||||
bootbox.hideAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("button[name='del']").each(function(){
|
||||
$(this).bind("click",function(){
|
||||
$("button[name='del']").each(function () {
|
||||
$(this).bind("click", function () {
|
||||
var appId = $(this).attr("appId");
|
||||
if(appId < 0){
|
||||
if (appId < 0) {
|
||||
alert("请选择应用");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -195,307 +128,235 @@
|
|||
$.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
contentType:"application/json",
|
||||
data:{},
|
||||
contentType: "application/json",
|
||||
data: {},
|
||||
dataType: 'json',
|
||||
async : false,
|
||||
success: function(data){
|
||||
async: false,
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
var result = data.result;
|
||||
if(result == 'OK'){
|
||||
if (result == 'OK') {
|
||||
alert(data.msg);
|
||||
window.location.reload();
|
||||
}else{
|
||||
} else {
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function(xhr, type){
|
||||
error: function (xhr, type) {
|
||||
alert("操作失败");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$("#cannelBtn").bind("click",function(){
|
||||
$("#appCode").val("");
|
||||
$("#createAppDiv").hide();
|
||||
$("#crtAlarm").bind("click", function () {
|
||||
configAlarmRule("default", "所有应用", 1);
|
||||
});
|
||||
|
||||
$("#cannelRuleBtn").bind("click",function(){
|
||||
$("#crtAlarmDiv").hide();
|
||||
});
|
||||
|
||||
$("#crtAlarm").bind("click",function(){
|
||||
$("#cannelBtn").click();
|
||||
$("#crtAlarmDiv").show();
|
||||
|
||||
var urlStr = '${base}/alarmRule/default';
|
||||
$.ajax({
|
||||
function configAlarmRule(appId, appCode, isGlobal) {
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
contentType:"application/json",
|
||||
data:"{}",
|
||||
dataType: 'json',
|
||||
async : false,
|
||||
success: function(data){
|
||||
console.log(data);
|
||||
var result = data.result;
|
||||
$("#isGlobal").val("1");
|
||||
$("#appName").text("所有应用");
|
||||
if(result == 'OK'){
|
||||
var obj = jQuery.parseJSON(data.data);
|
||||
var confArg = jQuery.parseJSON(obj.configArgs);
|
||||
$("#period").val(confArg.period);
|
||||
$("#todoType").val(obj.todoType).change();
|
||||
if(obj.todoType == 1){
|
||||
$("#urlCall").val(confArg.urlInfo.urlCall);
|
||||
}else {
|
||||
$("#mailTo").val(confArg.mailInfo.mailTo);
|
||||
$("#mailCc").val(confArg.mailInfo.mailCc);
|
||||
}
|
||||
$("#ruleId").val(obj.ruleId);
|
||||
$("#crtRuleBtn").text("修改规则");
|
||||
$("#cannelRuleBtn").text("取消修改");
|
||||
$("#appId").val("");
|
||||
url: "${base}/alarm-rule/list/" + appId,
|
||||
data: {
|
||||
"appCode": function () {
|
||||
return appCode;
|
||||
},
|
||||
"isGlobal": function () {
|
||||
return isGlobal;
|
||||
}
|
||||
},
|
||||
error: function(xhr, type){
|
||||
alert("操作失败");
|
||||
success: function (data) {
|
||||
bootbox.dialog({
|
||||
message: data,
|
||||
title: "创建告警规则",
|
||||
size: "large",
|
||||
locale: "zh_CN",
|
||||
buttons: {
|
||||
"createBtn": {
|
||||
label: '创建规则',
|
||||
callback: function () {
|
||||
var ruleId = $("#ruleId").val();
|
||||
var appId = $("#appId").val();//可空
|
||||
var period = $("#period").val();//不可空
|
||||
if (period == null || period.length < 1) {
|
||||
alert("告警频率不能为空");
|
||||
return false;
|
||||
}
|
||||
var isGlobal = $("#isGlobal").val();//不可空
|
||||
if (isGlobal == null || isGlobal.length < 1) {
|
||||
alert("规则标识不能为空");
|
||||
return false;
|
||||
} else {
|
||||
if (isGlobal == 0) {
|
||||
if (appId == null || appId.length < 1) {
|
||||
alert("应用标识不能为空");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var todoType = $("#todoType").val();//不可空
|
||||
if (todoType == null || todoType.length < 1) {
|
||||
alert("告警操作不能为空");
|
||||
return false;
|
||||
}
|
||||
var todoContent = "";
|
||||
var mailTo = $("#mailTo").val();
|
||||
var mailCc = $("#mailCc").val();
|
||||
var ruleId = $("#ruleId").val();
|
||||
var jsonData = "";
|
||||
if (ruleId > 0) {
|
||||
//调用修改规则
|
||||
if (ruleId == null || ruleId.length < 0) {
|
||||
alert("告警规则不能为空");
|
||||
return false;
|
||||
}
|
||||
var urlStr = '${base}/alarmRule/modify';
|
||||
if (todoType == 0) {
|
||||
jsonData = "{ruleId:'" + ruleId + "',appId:'" + appId + "',period:'" + period + "',isGlobal:'" + isGlobal + "',todoType:'" + todoType + "',mailTo:'" + mailTo + "',mailCc:'" + mailCc + "'}";
|
||||
} else if (todoType == 1) {
|
||||
jsonData = "{ruleId:'" + ruleId + "',appId:'" + appId + "',period:'" + period + "',isGlobal:'" + isGlobal + "',todoType:'" + todoType + "',urlCall:'" + urlCall + "'}";
|
||||
} else {
|
||||
alert("请选择正确的告警操作");
|
||||
return false;
|
||||
}
|
||||
//alert(jsonData);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
contentType: "application/json",
|
||||
data: jsonData,
|
||||
dataType: 'json',
|
||||
async: false,
|
||||
success: function (data) {
|
||||
if (data.result == "OK") {
|
||||
alert(data.msg);
|
||||
window.location.reload();
|
||||
} else {
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
alert("操作失败");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
//调用创建规则
|
||||
var urlStr = '${base}/alarmRule/create';
|
||||
if (todoType == 0) {
|
||||
jsonData = "{appId:'" + appId + "',period:'" + period + "',isGlobal:'" + isGlobal + "',todoType:'" + todoType + "',mailTo:'" + mailTo + "',mailCc:'" + mailCc + "'}";
|
||||
} else if (todoType == 1) {
|
||||
jsonData = "{appId:'" + appId + "',period:'" + period + "',isGlobal:'" + isGlobal + "',todoType:'" + todoType + "',urlCall:'" + urlCall + "'}";
|
||||
} else {
|
||||
alert("请选择正确的告警操作");
|
||||
return false;
|
||||
}
|
||||
alert(jsonData);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
contentType: "application/json",
|
||||
data: jsonData,
|
||||
dataType: 'json',
|
||||
async: false,
|
||||
success: function (data) {
|
||||
if (data.result == "OK") {
|
||||
alert(data.msg);
|
||||
window.location.reload();
|
||||
} else {
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
alert("操作失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
"cancelBtn": {
|
||||
label: '取消创建',
|
||||
callback: function () {
|
||||
bootbox.hideAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#todoType").bind("change",function(){
|
||||
if($(this).val() == 0){
|
||||
$("#mailTempDiv").show();
|
||||
$("#callBackDiv").hide();
|
||||
}else if($(this).val() == 1){
|
||||
$("#mailTempDiv").hide();
|
||||
$("#callBackDiv").show();
|
||||
}
|
||||
});
|
||||
|
||||
$("button[name='conf']").each(function(){
|
||||
$(this).bind("click",function(){
|
||||
$("#cannelBtn").click();
|
||||
$("#crtAlarmDiv").show();
|
||||
}
|
||||
|
||||
$("button[name='conf']").each(function () {
|
||||
$(this).bind("click", function () {
|
||||
var appId = $(this).attr("appId");
|
||||
var appCode = $(this).attr("appCode");
|
||||
if(appId < 0){
|
||||
alert("请选择应用");
|
||||
return false;
|
||||
}
|
||||
configAlarmRule(appId, appCode, 0);
|
||||
});
|
||||
});
|
||||
|
||||
var urlStr = '${base}/alarmRule/' + appId;
|
||||
$.ajax({
|
||||
|
||||
$("button[name='exportAuthInfo']").each(function () {
|
||||
$(this).bind("click", function () {
|
||||
var authAppCode = $(this).attr("appCode");
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
contentType:"application/json",
|
||||
data:"{}",
|
||||
dataType: 'json',
|
||||
async : false,
|
||||
success: function(data){
|
||||
console.log(data);
|
||||
var result = data.result;
|
||||
$("#isGlobal").val("0");
|
||||
$("#appId").val(appId);
|
||||
if(result == 'OK'){
|
||||
$("#appName").text(appCode);
|
||||
var obj = jQuery.parseJSON(data.data);
|
||||
var confArg = jQuery.parseJSON(obj.configArgs);
|
||||
$("#period").val(confArg.period);
|
||||
$("#todoType").val(obj.todoType).change();
|
||||
if(obj.todoType == 1){
|
||||
$("#urlCall").val(confArg.urlInfo.urlCall);
|
||||
}else {
|
||||
$("#mailTo").val(confArg.mailInfo.mailTo);
|
||||
$("#mailCc").val(confArg.mailInfo.mailCc);
|
||||
url: "${base}/download/" + authAppCode,
|
||||
success: function (data) {
|
||||
bootbox.dialog({
|
||||
message: data,
|
||||
title: "下载授权文件",
|
||||
size: "large",
|
||||
locale: "zh_CN",
|
||||
buttons: {
|
||||
"downloadBtn": {
|
||||
label: '确认下载',
|
||||
callback: function () {
|
||||
var appCode = $("#authAppCode").val();
|
||||
if (appCode == null) {
|
||||
alert("没有发现应用编码.");
|
||||
return;
|
||||
}
|
||||
var form = $("<form>");//定义一个form表单
|
||||
form.attr("style", "display:none");
|
||||
form.attr("method", "post");
|
||||
form.attr("action", "${base}/exportAuth/" + appCode);
|
||||
var exportData = $("<input>");
|
||||
exportData.attr("type", "hidden");
|
||||
exportData.attr("name", "exportData");
|
||||
exportData.attr("value", (new Date()).getMilliseconds());
|
||||
var exclusiveException = $("<input>");
|
||||
exclusiveException.attr("type", "hidden");
|
||||
exclusiveException.attr("name", "exclusiveException");
|
||||
exclusiveException.attr("value", $("#exclusiveException").val());
|
||||
var authType = $("<input>");
|
||||
authType.attr("type", "hidden");
|
||||
authType.attr("name", "authType");
|
||||
authType.attr("value", $("#authType").val());
|
||||
$("#authFiledownLoad").append(form);//将表单放置在web中
|
||||
form.append(exportData);
|
||||
form.append(exclusiveException);
|
||||
form.append(authType);
|
||||
|
||||
form.submit();//表单提交
|
||||
}
|
||||
},
|
||||
"cancelBtn": {
|
||||
label: '取消下载',
|
||||
callback: function () {
|
||||
bootbox.hideAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#ruleId").val(obj.ruleId);
|
||||
$("#crtRuleBtn").text("修改规则");
|
||||
$("#cannelRuleBtn").text("取消修改");
|
||||
}else{
|
||||
$("#appName").html(appCode+"(<b>使用默认规则</b>)");
|
||||
$("#period").val("");
|
||||
$("#todoType").val("0").change();
|
||||
$("#urlCall").val("");
|
||||
$("#mailTo").val("");
|
||||
$("#mailCc").val("");
|
||||
$("#ruleId").val("");
|
||||
$("#crtRuleBtn").text("创建规则");
|
||||
$("#cannelRuleBtn").text("取消创建");
|
||||
}
|
||||
},
|
||||
error: function(xhr, type){
|
||||
alert("操作失败");
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
//创建规则操作
|
||||
$("#crtRuleBtn").bind("click",function(){
|
||||
var ruleId = $("#ruleId").val();
|
||||
var appId = $("#appId").val();//可空
|
||||
var period = $("#period").val();//不可空
|
||||
if(period == null || period.length < 1){
|
||||
alert("告警频率不能为空");
|
||||
return false;
|
||||
}
|
||||
var isGlobal = $("#isGlobal").val();//不可空
|
||||
if(isGlobal == null || isGlobal.length < 1){
|
||||
alert("规则标识不能为空");
|
||||
return false;
|
||||
}else{
|
||||
if(isGlobal ==0){
|
||||
if(appId == null || appId.length < 1){
|
||||
alert("应用标识不能为空");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#export").bind("click", function () {
|
||||
|
||||
var todoType = $("#todoType").val();//不可空
|
||||
if(todoType == null || todoType.length < 1){
|
||||
alert("告警操作不能为空");
|
||||
return false;
|
||||
}
|
||||
var urlCall = $("#urlCall").val();
|
||||
var todoContent = "";
|
||||
if(todoType == 0){
|
||||
var mailTo = $("#mailTo").val();
|
||||
var mailCc = $("#mailCc").val();
|
||||
}else if(todoType == 1){
|
||||
if(urlCall == null || urlCall.length < 1){
|
||||
alert("回调接口不能为空");
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
alert("告警规则不能为空");
|
||||
return false;
|
||||
}
|
||||
var ruleId = $("#ruleId").val();
|
||||
var jsonData = "";
|
||||
if(ruleId > 0){
|
||||
//调用修改规则
|
||||
if(ruleId == null || ruleId.length < 0){
|
||||
alert("告警规则不能为空");
|
||||
return false;
|
||||
}
|
||||
var urlStr = '${base}/alarmRule/modify';
|
||||
if(todoType ==0){
|
||||
jsonData = "{ruleId:'"+ruleId+"',appId:'"+appId+"',period:'"+period+"',isGlobal:'"+isGlobal+"',todoType:'"+todoType+"',mailTo:'"+mailTo+"',mailCc:'"+mailCc+"'}";
|
||||
}else if(todoType ==1){
|
||||
jsonData = "{ruleId:'"+ruleId+"',appId:'"+appId+"',period:'"+period+"',isGlobal:'"+isGlobal+"',todoType:'"+todoType+"',urlCall:'"+urlCall+"'}";
|
||||
}else{
|
||||
alert("请选择正确的告警操作");
|
||||
return false;
|
||||
}
|
||||
//alert(jsonData);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
contentType:"application/json",
|
||||
data:jsonData,
|
||||
dataType: 'json',
|
||||
async : false,
|
||||
success: function(data){
|
||||
if(data.result == "OK"){
|
||||
alert(data.msg);
|
||||
window.location.reload();
|
||||
}else{
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function(xhr, type){
|
||||
alert("操作失败");
|
||||
}
|
||||
});
|
||||
}else{
|
||||
//调用创建规则
|
||||
var urlStr = '${base}/alarmRule/create';
|
||||
if(todoType ==0){
|
||||
jsonData = "{appId:'"+appId+"',period:'"+period+"',isGlobal:'"+isGlobal+"',todoType:'"+todoType+"',mailTo:'"+mailTo+"',mailCc:'"+mailCc+"'}";
|
||||
}else if(todoType ==1){
|
||||
jsonData = "{appId:'"+appId+"',period:'"+period+"',isGlobal:'"+isGlobal+"',todoType:'"+todoType+"',urlCall:'"+urlCall+"'}";
|
||||
}else{
|
||||
alert("请选择正确的告警操作");
|
||||
return false;
|
||||
}
|
||||
alert(jsonData);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
contentType:"application/json",
|
||||
data:jsonData,
|
||||
dataType: 'json',
|
||||
async : false,
|
||||
success: function(data){
|
||||
if(data.result == "OK"){
|
||||
alert(data.msg);
|
||||
window.location.reload();
|
||||
}else{
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function(xhr, type){
|
||||
alert("操作失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$("button[name='export']").each(function(){
|
||||
$(this).bind("click",function(){
|
||||
var downLoadFrame = document.getElementById('authFiledownLoad');
|
||||
downLoadFrame.src = '${base}/exportAuth/test';
|
||||
});
|
||||
});
|
||||
|
||||
$("button[name='exportAuthInfo']").each(function(){
|
||||
$(this).bind("click",function(){
|
||||
$("#authInfo").show();
|
||||
$("#authAppCode").val($(this).attr("appCode"));
|
||||
//var downLoadFrame = document.getElementById('authFiledownLoad');
|
||||
//downLoadFrame.src = '${base}/exportAuth/test';
|
||||
});
|
||||
});
|
||||
|
||||
$("#export").bind("click",function(){
|
||||
<#--var downLoadFrame = document.getElementById('authFiledownLoad');-->
|
||||
<#--downLoadFrame.src = '${base}/exportAuth/test';-->
|
||||
var appCode = $("#authAppCode").val();
|
||||
if (appCode == null){
|
||||
alert("没有发现应用编码.");
|
||||
return;
|
||||
}
|
||||
var form=$("<form>");//定义一个form表单
|
||||
form.attr("style","display:none");
|
||||
//form.attr("target","${base}/exportAuth/test");
|
||||
form.attr("method","post");
|
||||
form.attr("action","${base}/exportAuth/" + appCode);
|
||||
var exportData=$("<input>");
|
||||
exportData.attr("type","hidden");
|
||||
exportData.attr("name","exportData");
|
||||
exportData.attr("value",(new Date()).getMilliseconds());
|
||||
var exclusiveException=$("<input>");
|
||||
exclusiveException.attr("type","hidden");
|
||||
exclusiveException.attr("name","exclusiveException");
|
||||
exclusiveException.attr("value",$("#exclusiveException").val());
|
||||
var authType=$("<input>");
|
||||
authType.attr("type","hidden");
|
||||
authType.attr("name","authType");
|
||||
authType.attr("value",$("#authType").val());
|
||||
$("#authFiledownLoad").append(form);//将表单放置在web中
|
||||
form.append(exportData);
|
||||
form.append(exclusiveException);
|
||||
form.append(authType);
|
||||
|
||||
form.submit();//表单提交
|
||||
});
|
||||
|
||||
$("#cannelExport").bind("click",function(){
|
||||
$("#cannelExport").bind("click", function () {
|
||||
$("#authInfo").hide();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
<#import "../lib/ai.cloud/common.ftl" as common>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta charset="utf-8">
|
||||
<title>Sky Walking</title>
|
||||
<meta name="generator" content="Bootply"/>
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<link href="${base}/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link href="${base}/css/login.css" rel="stylesheet"/>
|
||||
<!-- script references -->
|
||||
</head>
|
||||
<body>
|
||||
<div class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="period" class="col-sm-4 control-label">需要排除的异常</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" class="form-control" id="exclusiveException"
|
||||
placeholder="java.lang.Exception,java.io.IOException">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="period" class="col-sm-4 control-label">授权文件类型:</label>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-control" id="authType">
|
||||
<option value="1">外网</option>
|
||||
<option value="0">内网</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<input type='hidden' id="authAppCode" value="${appCode}">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -2,57 +2,31 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta charset="utf-8">
|
||||
<title>Sky Walking</title>
|
||||
<meta name="generator" content="Bootply" />
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<link href="${base}/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="${base}/css/index.css" rel="stylesheet">
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta charset="utf-8">
|
||||
<title>Sky Walking</title>
|
||||
<meta name="generator" content="Bootply"/>
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<link href="${base}/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="${base}/css/index.css" rel="stylesheet">
|
||||
<style>
|
||||
.leaf {
|
||||
background-color: white;
|
||||
}
|
||||
</style>
|
||||
<@common.importJavaScript />
|
||||
</head>
|
||||
<body>
|
||||
<input type="hidden" id="baseUrl" value="${base}">
|
||||
<input type="hidden" id="traceId" value="${traceId!''}">
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<a class="navbar-brand" href="./">Sky Walking</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse">
|
||||
<!-- 菜单(不要太多) -->
|
||||
<#--<@common.importMenuInfo menuInfo="${userInfo}" />-->
|
||||
|
||||
<!-- 搜索栏 -->
|
||||
<@common.importSearchInfo isLogin="${userInfo}" />
|
||||
|
||||
<!-- 登录/用户信息块 -->
|
||||
<@common.importUserInfo userInfo="${userInfo}" />
|
||||
|
||||
</div>
|
||||
<!--/.nav-collapse -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="text-center" style="height: 700px">
|
||||
<iframe id="showTraceLog" width="100%" border=2 frameborder=0 marginheight=0 marginwidth=0 scrolling=yes src="" onLoad="iFrameHeight()"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="uid" value="${(userInfo?eval).uid!''}">
|
||||
<!-- script references -->
|
||||
<@common.importJavaScript />
|
||||
<script src="${base}/js/webui-0.1.js"></script>
|
||||
<script>
|
||||
function iFrameHeight() {
|
||||
var ifm= document.getElementById("showTraceLog");
|
||||
var subWeb = document.frames ? document.frames["showTraceLog"].document : ifm.contentDocument;
|
||||
if(ifm != null && subWeb != null) {
|
||||
ifm.height = subWeb.body.scrollHeight;
|
||||
ifm.width = subWeb.body.scrollWidth;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div class="container">
|
||||
<@common.importHeaderInfo userInfo="${userInfo}"/>
|
||||
<div>
|
||||
<div class="col-md-12" style="position:absolute;left:0px;right:0px;margin-top:20px;margin-left: 6px;"
|
||||
id="showTraceLog">
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" id="uid" value="${(userInfo?eval).uid!''}">
|
||||
<script src="${base}/js/webui-0.1.js?1=1"></script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -3,8 +3,11 @@
|
|||
<script src="${base}/js/jquery/jquery-2.1.4.js"></script>
|
||||
<script src="${base}/js/jquery/jquery-ui-1.11.4.js"></script>
|
||||
<script src="${base}/js/jquery/jquery.treetable-3.2.0.js"></script>
|
||||
<script src="${base}/js/jquery/jquery.backstretch.min.js"></script>
|
||||
<script src="${base}/js/jquery/jquery-md5.js"></script>
|
||||
<script src="${base}/js/bootstrap.min-3.3.5.js"></script>
|
||||
<script src="${base}/js/jquery/bootbox.min.js"></script>
|
||||
<script src="${base}/js/scripts.js"></script>
|
||||
</#macro>
|
||||
|
||||
<#-- importMenuInfo -->
|
||||
|
|
@ -21,6 +24,22 @@
|
|||
</ul>
|
||||
</#macro>
|
||||
|
||||
<#macro importHeaderInfo userInfo>
|
||||
<input type="hidden" id="baseUrl" value="${base}">
|
||||
<input type="hidden" id="traceId" value="${traceId!''}">
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<a class="navbar-brand" href="./">Sky Walking</a>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse">
|
||||
<@common.importSearchInfo isLogin="${userInfo}" />
|
||||
<@common.importUserInfo userInfo="${userInfo}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</#macro>
|
||||
|
||||
<#-- importSearchInfo -->
|
||||
<#macro importSearchInfo isLogin>
|
||||
<#assign text>
|
||||
|
|
@ -47,24 +66,28 @@
|
|||
</#assign>
|
||||
<#assign json=text?eval />
|
||||
<#if json.isLogin == '1'>
|
||||
<li class="dropdown"><a href="#" class="dropdown-toggle"
|
||||
data-toggle="dropdown" role="button" aria-haspopup="true"
|
||||
aria-expanded="false"> ${json.userName!} <span class="caret"></span></a>
|
||||
<li class="dropdown">
|
||||
<a href="javascript:void(0);" class="dropdown-toggle"
|
||||
data-toggle="dropdown" role="button" aria-haspopup="true"
|
||||
aria-expanded="false"> ${json.userName!} <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<#if json.menuList??>
|
||||
<#list json.menuList?eval as menu>
|
||||
<li><a name="menuUrl" href="#" url="${menu.url!}">${menu.menuName!}</a></li>
|
||||
<li><a name="menuUrl" href="javascript:void(0);" url="${menu.url!}">${menu.menuName!}</a></li>
|
||||
</#list>
|
||||
<li role="separator" class="divider"></li>
|
||||
</#if>
|
||||
<li><a id="logout" href="#" url="logout">退出</a></li>
|
||||
<li><a id="logout" href="javascript:void(0);" url="logout">退出</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<#else>
|
||||
<li><a id="login" href="#" url="login">登录</a></li>
|
||||
<li><a id="regist" name="menuUrl" href="#" url="regist">注册</a></li>
|
||||
<li><a id="login" href="${base}/login">登录</a></li>
|
||||
<li><a id="regist" name="menuUrl" href="${base}/regist">注册</a></li>
|
||||
</#if>
|
||||
</ul>
|
||||
<script>
|
||||
$('.dropdown-toggle').dropdown();
|
||||
</script>
|
||||
</#macro>
|
||||
|
||||
<#-- dealTraceLog -->
|
||||
|
|
@ -72,7 +95,7 @@
|
|||
<#if valueList??>
|
||||
<div id="row">
|
||||
<div class="col-md-12">
|
||||
<h5 style="color:black">
|
||||
<h5 style="color:white">
|
||||
${traceId!}</br>
|
||||
调度入口IP:${(valueList[0].address)!},开始时间:${beginTime?number_to_datetime},${(valueList?size)!}条调用记录,消耗总时长:${(endTime - beginTime)!'0'}
|
||||
ms。<a id="originLog" href="#">显示原文</a>
|
||||
|
|
@ -250,7 +273,7 @@
|
|||
<div id="collapse${logInfo_index}" class="accordion-body collapse"
|
||||
style="height: 0px; ">
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item" style="word-wrap:break-word">
|
||||
<li class="list-group-item" style="word-wrap:break-word">
|
||||
<strong>服务/方法:</strong>${logInfo.viewPointId!''}</li>
|
||||
<li class="list-group-item">
|
||||
<strong>调用类型:</strong>${logInfo.spanTypeName!'UNKNOWN'}</li>
|
||||
|
|
@ -260,7 +283,8 @@
|
|||
<strong>花费时间:</strong>${logInfo.cost}<strong>毫秒</strong>
|
||||
</li>
|
||||
<li class="list-group-item"><strong>业务字段:</strong>${logInfo.businessKey!}</li>
|
||||
<li class="list-group-item"><strong>应用Code:</strong>${logInfo.applicationId}</li>
|
||||
<li class="list-group-item"><strong>应用Code:</strong>${logInfo.applicationId}
|
||||
</li>
|
||||
<li class="list-group-item"><strong>主机信息:</strong>${logInfo.address!}</li>
|
||||
<li class="list-group-item"><strong>调用进程号:</strong>${logInfo.processNo!}</li>
|
||||
<li class="list-group-item"><strong>异常堆栈:</strong>
|
||||
|
|
@ -285,22 +309,24 @@
|
|||
</#macro>
|
||||
|
||||
<#macro detailTraceLog>
|
||||
<div class="modal fade bs-example-modal-lg" id="detailLog" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" style="display: none;">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal fade bs-example-modal-lg" id="detailLog" tabindex="-1" role="dialog"
|
||||
aria-labelledby="myLargeModalLabel" style="display: none;">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="myLargeModalLabel">日志详细信息</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- form content -->
|
||||
<form class="form-horizontal" id="detailContent">
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
|
||||
aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="myLargeModalLabel">日志详细信息</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- form content -->
|
||||
<form class="form-horizontal" id="detailContent">
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
</#macro>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,66 +2,85 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta charset="utf-8">
|
||||
<title>Sky Walking</title>
|
||||
<meta name="generator" content="Bootply" />
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<link href="${base}/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link href="${base}/css/login.css" rel="stylesheet">
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta charset="utf-8">
|
||||
<title>Sky Walking</title>
|
||||
<meta name="generator" content="Bootply"/>
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<link href="${base}/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link href="${base}/css/login.css" rel="stylesheet">
|
||||
<@common.importJavaScript />
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<form class="form-signin">
|
||||
<h2 class="form-signin-heading">登录</h2>
|
||||
<label for="inputEmail" class="sr-only">用户名/邮箱</label>
|
||||
<input id="a" type="text" class="form-control" placeholder="用户名"
|
||||
autofocus>
|
||||
<label for="inputPassword" class="sr-only">密码</label>
|
||||
<input id="b" type="password" id="inputPassword"
|
||||
class="form-control" placeholder="密码">
|
||||
<button id="login" class="btn btn-lg btn-primary btn-block" type="submit">登录</button>
|
||||
</form>
|
||||
</div>
|
||||
<!-- script references -->
|
||||
<@common.importJavaScript />
|
||||
<script type="text/javascript">
|
||||
$().ready(function(){
|
||||
$("#login").bind("click",function(){
|
||||
if($("#a").val() == ''){
|
||||
alert("请输入用户名");
|
||||
return false;
|
||||
}
|
||||
if($("#b").val() == ''){
|
||||
alert("请输入密码");
|
||||
return false;
|
||||
}
|
||||
var urlStr = '${base}/login/'+$("#a").val()+'/'+$.md5($("#b").val());
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
data:{},
|
||||
dataType: 'json',
|
||||
async : false,
|
||||
success: function(data){
|
||||
console.log(data);
|
||||
var result = data.result;
|
||||
if(result == 'OK'){
|
||||
top.location.href='${base}';
|
||||
}else{
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function(xhr, type){
|
||||
alert("验证失败");
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
</script>
|
||||
<div class="top-context">
|
||||
<div class="inner-bg">
|
||||
<@common.importHeaderInfo userInfo="${userInfo}"/>
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-sm-offset-4" style="margin-top: 100px">
|
||||
<div class="form-top">
|
||||
<div class="form-top-left" style="color:white">
|
||||
<h3>Login to our site</h3>
|
||||
<p>Enter your username and password to log on:</p>
|
||||
</div>
|
||||
<div class="form-top-right">
|
||||
<i class="fa fa-key"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-bottom">
|
||||
<div class="form-group">
|
||||
<input id="loginName" name="loginName" type="text" class="form-control input-lg"
|
||||
placeholder="用户名/邮箱"
|
||||
autofocus>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input id="password" name="password" type="password" id="inputPassword"
|
||||
class="form-control input-lg" placeholder="密码">
|
||||
</div>
|
||||
<button class="btn btn-primary btn-lg btn-block" id="loginBtn">Login</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- script references -->
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$("#loginBtn").bind("click", function () {
|
||||
if ($("#loginName").val() == '') {
|
||||
alert("请输入用户名");
|
||||
return false;
|
||||
}
|
||||
if ($("#password").val() == '') {
|
||||
alert("请输入密码");
|
||||
return false;
|
||||
}
|
||||
var urlStr = '${base}/login/' + $("#loginName").val() + '/' + $.md5($("#password").val());
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
data: {},
|
||||
dataType: 'json',
|
||||
async: false,
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
var result = data.result;
|
||||
if (result == 'OK') {
|
||||
top.location.href = '${base}';
|
||||
} else {
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
alert("验证失败");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -2,68 +2,84 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta charset="utf-8">
|
||||
<title>Sky Walking</title>
|
||||
<meta name="generator" content="Bootply" />
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<link href="${base}/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link href="${base}/css/login.css" rel="stylesheet">
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<meta charset="utf-8">
|
||||
<title>Sky Walking</title>
|
||||
<meta name="generator" content="Bootply"/>
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<link href="${base}/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link href="${base}/css/login.css" rel="stylesheet">
|
||||
<@common.importJavaScript />
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<form class="form-signin">
|
||||
<h2 class="form-signin-heading">注册</h2>
|
||||
<label for="inputEmail" class="sr-only">用户名/邮箱</label>
|
||||
<input id="a" type="text" class="form-control" placeholder="用户名"
|
||||
autofocus>
|
||||
<label for="inputPassword" class="sr-only">密码</label>
|
||||
<input id="b" type="password" id="inputPassword"
|
||||
class="form-control" placeholder="密码">
|
||||
<button id="regist" class="btn btn-lg btn-primary btn-block" type="submit">注册</button>
|
||||
</form>
|
||||
</div>
|
||||
<!-- script references -->
|
||||
<@common.importJavaScript />
|
||||
<script type="text/javascript">
|
||||
$().ready(function(){
|
||||
$("#regist").bind("click",function(){
|
||||
if($("#a").val() == ''){
|
||||
alert("请输入用户名");
|
||||
return false;
|
||||
}
|
||||
if($("#b").val() == ''){
|
||||
alert("请输入密码");
|
||||
return false;
|
||||
}
|
||||
var urlStr = '${base}/regist/'+$("#a").val()+'/'+$.md5($("#b").val());
|
||||
var refUrl = '${base}/login';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
data:{},
|
||||
dataType: 'json',
|
||||
async : false,
|
||||
success: function(data){
|
||||
console.log(data);
|
||||
var result = data.result;
|
||||
if(result == 'OK'){
|
||||
alert(data.msg);
|
||||
window.parent.changeFrameUrl(refUrl);
|
||||
}else{
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function(xhr, type){
|
||||
alert("注册失败");
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
</script>
|
||||
<div class="top-context">
|
||||
<@common.importHeaderInfo userInfo="${userInfo}"/>
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-sm-offset-4" style="margin-top: 100px">
|
||||
<div class="form-top">
|
||||
<div class="form-top-left" style="color:white">
|
||||
<h3>Welcome to register!</h3>
|
||||
<p>Enter your username and password to register our site:</p>
|
||||
</div>
|
||||
<div class="form-top-right">
|
||||
<i class="fa fa-key"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-bottom">
|
||||
<div class="form-group">
|
||||
<input id="loginName" type="text" class="form-control input-lg" placeholder="用户名/邮箱"
|
||||
autofocus>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input id="loginPassword" type="password"
|
||||
class="form-control input-lg" placeholder="密码">
|
||||
</div>
|
||||
<button id="registBtn" class="btn btn-lg btn-primary btn-block">Register</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- script references -->
|
||||
<script type="text/javascript">
|
||||
$().ready(function () {
|
||||
$("#registBtn").bind("click", function () {
|
||||
if ($("#loginName").val() == '') {
|
||||
alert("请输入用户名");
|
||||
return false;
|
||||
}
|
||||
if ($("#loginPassword").val() == '') {
|
||||
alert("请输入密码");
|
||||
return false;
|
||||
}
|
||||
var urlStr = '${base}/regist/' + $("#loginName").val() + '/' + $.md5($("#loginPassword").val());
|
||||
var refUrl = '${base}/login';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
data: {},
|
||||
dataType: 'json',
|
||||
async: false,
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
var result = data.result;
|
||||
if (result == 'OK') {
|
||||
alert(data.msg);
|
||||
window.location.href = refUrl;
|
||||
//window.parent.changeFrameUrl(refUrl);
|
||||
} else {
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
alert("注册失败");
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -2,70 +2,66 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<html>
|
||||
<head>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>traceLog</title>
|
||||
<link rel="stylesheet" href="${base}/css/jquery.treetable.css" />
|
||||
<link rel="stylesheet" href="${base}/css/jquery.treetable.theme.default.css" />
|
||||
<link rel="stylesheet" href="${base}/css/bootstrap.css" />
|
||||
<link rel="stylesheet" href="${base}/css/traceLog.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- show detailTraceLog -->
|
||||
<@common.detailTraceLog />
|
||||
|
||||
<!-- show traceLogInfo -->
|
||||
<@common.dealTraceLog />
|
||||
|
||||
<!-- show originLog -->
|
||||
<@common.importOriginLog />
|
||||
|
||||
<link rel="stylesheet" href="${base}/css/jquery.treetable.css"/>
|
||||
<link rel="stylesheet" href="${base}/css/jquery.treetable.theme.default.css"/>
|
||||
<link rel="stylesheet" href="${base}/css/bootstrap.css"/>
|
||||
<link rel="stylesheet" href="${base}/css/traceLog.css?1=1"/>
|
||||
<!-- script references -->
|
||||
<@common.importJavaScript />
|
||||
<script>
|
||||
$().ready(function(){
|
||||
var table = $('#example-advanced').children();
|
||||
$("#example-advanced").treetable({ expandable: true , indent : 10, clickableNodeNames : true});
|
||||
|
||||
$("#example-advanced tr").click(function() {
|
||||
var selected = $(this).hasClass("highlight");
|
||||
$("#example-advanced tr").removeClass("highlight");
|
||||
if(!selected)
|
||||
$(this).addClass("highlight");
|
||||
});
|
||||
|
||||
$("#originLog").bind("click",function(){
|
||||
if($(this).html() == "显示原文"){
|
||||
$("#originRow").slideDown("slow",function(){
|
||||
$("#tableDiv").slideUp("slow");
|
||||
});
|
||||
$(this).html("显示调用链");
|
||||
}else{
|
||||
$("#tableDiv").slideDown("slow",function(){
|
||||
$("#originRow").slideUp("slow");
|
||||
});
|
||||
$(this).html("显示原文");
|
||||
}
|
||||
});
|
||||
|
||||
$("tr[name='log']").each(function(){
|
||||
var code = $(this).attr("statusCodeStr");
|
||||
if(code != 0 || code=='' ){
|
||||
var node = $(this).attr("data-tt-id");
|
||||
$(this).css("color","red");
|
||||
}
|
||||
});
|
||||
|
||||
$("a[name='detailInfo']").each(function(index,ele){
|
||||
$(this).bind("click",function(){
|
||||
$("#detailContent").html($("#collapse"+index).html());
|
||||
$("#detailLog").modal('show');
|
||||
});
|
||||
});
|
||||
|
||||
$('#example-advanced').treetable('expandAll');
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
<@common.importJavaScript />
|
||||
</head>
|
||||
<body>
|
||||
<!-- show detailTraceLog -->
|
||||
<@common.detailTraceLog />
|
||||
<!-- show traceLogInfo -->
|
||||
<@common.dealTraceLog />
|
||||
<!-- show originLog -->
|
||||
<@common.importOriginLog />
|
||||
<script>
|
||||
$().ready(function () {
|
||||
var table = $('#example-advanced').children();
|
||||
$("#example-advanced").treetable({expandable: true, indent: 10, clickableNodeNames: true});
|
||||
|
||||
$("#example-advanced tr").click(function () {
|
||||
var selected = $(this).hasClass("highlight");
|
||||
$("#example-advanced tr").removeClass("highlight");
|
||||
if (!selected)
|
||||
$(this).addClass("highlight");
|
||||
});
|
||||
|
||||
$("#originLog").bind("click", function () {
|
||||
if ($(this).html() == "显示原文") {
|
||||
$("#originRow").slideDown("slow", function () {
|
||||
$("#tableDiv").slideUp("slow");
|
||||
});
|
||||
$(this).html("显示调用链");
|
||||
} else {
|
||||
$("#tableDiv").slideDown("slow", function () {
|
||||
$("#originRow").slideUp("slow");
|
||||
});
|
||||
$(this).html("显示原文");
|
||||
}
|
||||
});
|
||||
|
||||
$("tr[name='log']").each(function () {
|
||||
var code = $(this).attr("statusCodeStr");
|
||||
if (code != 0 || code == '') {
|
||||
var node = $(this).attr("data-tt-id");
|
||||
$(this).css("color", "red");
|
||||
}
|
||||
});
|
||||
|
||||
$("a[name='detailInfo']").each(function (index, ele) {
|
||||
$(this).bind("click", function () {
|
||||
$("#detailContent").html($("#collapse" + index).html());
|
||||
$("#detailLog").modal('show');
|
||||
});
|
||||
});
|
||||
|
||||
$('#example-advanced').treetable('expandAll');
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 178 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 178 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,377 @@
|
|||
/*! Backstretch - v2.0.4 - 2013-06-19
|
||||
* http://srobbin.com/jquery-plugins/backstretch/
|
||||
* Copyright (c) 2013 Scott Robbin; Licensed MIT */
|
||||
|
||||
;(function ($, window, undefined) {
|
||||
'use strict';
|
||||
|
||||
/* PLUGIN DEFINITION
|
||||
* ========================= */
|
||||
|
||||
$.fn.backstretch = function (images, options) {
|
||||
// We need at least one image or method name
|
||||
if (images === undefined || images.length === 0) {
|
||||
$.error("No images were supplied for Backstretch");
|
||||
}
|
||||
|
||||
/*
|
||||
* Scroll the page one pixel to get the right window height on iOS
|
||||
* Pretty harmless for everyone else
|
||||
*/
|
||||
if ($(window).scrollTop() === 0 ) {
|
||||
window.scrollTo(0, 0);
|
||||
}
|
||||
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
, obj = $this.data('backstretch');
|
||||
|
||||
// Do we already have an instance attached to this element?
|
||||
if (obj) {
|
||||
|
||||
// Is this a method they're trying to execute?
|
||||
if (typeof images == 'string' && typeof obj[images] == 'function') {
|
||||
// Call the method
|
||||
obj[images](options);
|
||||
|
||||
// No need to do anything further
|
||||
return;
|
||||
}
|
||||
|
||||
// Merge the old options with the new
|
||||
options = $.extend(obj.options, options);
|
||||
|
||||
// Remove the old instance
|
||||
obj.destroy(true);
|
||||
}
|
||||
|
||||
obj = new Backstretch(this, images, options);
|
||||
$this.data('backstretch', obj);
|
||||
});
|
||||
};
|
||||
|
||||
// If no element is supplied, we'll attach to body
|
||||
$.backstretch = function (images, options) {
|
||||
// Return the instance
|
||||
return $('body')
|
||||
.backstretch(images, options)
|
||||
.data('backstretch');
|
||||
};
|
||||
|
||||
// Custom selector
|
||||
$.expr[':'].backstretch = function(elem) {
|
||||
return $(elem).data('backstretch') !== undefined;
|
||||
};
|
||||
|
||||
/* DEFAULTS
|
||||
* ========================= */
|
||||
|
||||
$.fn.backstretch.defaults = {
|
||||
centeredX: true // Should we center the image on the X axis?
|
||||
, centeredY: true // Should we center the image on the Y axis?
|
||||
, duration: 5000 // Amount of time in between slides (if slideshow)
|
||||
, fade: 0 // Speed of fade transition between slides
|
||||
};
|
||||
|
||||
/* STYLES
|
||||
*
|
||||
* Baked-in styles that we'll apply to our elements.
|
||||
* In an effort to keep the plugin simple, these are not exposed as options.
|
||||
* That said, anyone can override these in their own stylesheet.
|
||||
* ========================= */
|
||||
var styles = {
|
||||
wrap: {
|
||||
left: 0
|
||||
, top: 0
|
||||
, overflow: 'hidden'
|
||||
, margin: 0
|
||||
, padding: 0
|
||||
, height: '100%'
|
||||
, width: '100%'
|
||||
, zIndex: -999999
|
||||
}
|
||||
, img: {
|
||||
position: 'absolute'
|
||||
, display: 'none'
|
||||
, margin: 0
|
||||
, padding: 0
|
||||
, border: 'none'
|
||||
, width: 'auto'
|
||||
, height: 'auto'
|
||||
, maxHeight: 'none'
|
||||
, maxWidth: 'none'
|
||||
, zIndex: -999999
|
||||
}
|
||||
};
|
||||
|
||||
/* CLASS DEFINITION
|
||||
* ========================= */
|
||||
var Backstretch = function (container, images, options) {
|
||||
this.options = $.extend({}, $.fn.backstretch.defaults, options || {});
|
||||
|
||||
/* In its simplest form, we allow Backstretch to be called on an image path.
|
||||
* e.g. $.backstretch('/path/to/image.jpg')
|
||||
* So, we need to turn this back into an array.
|
||||
*/
|
||||
this.images = $.isArray(images) ? images : [images];
|
||||
|
||||
// Preload images
|
||||
$.each(this.images, function () {
|
||||
$('<img />')[0].src = this;
|
||||
});
|
||||
|
||||
// Convenience reference to know if the container is body.
|
||||
this.isBody = container === document.body;
|
||||
|
||||
/* We're keeping track of a few different elements
|
||||
*
|
||||
* Container: the element that Backstretch was called on.
|
||||
* Wrap: a DIV that we place the image into, so we can hide the overflow.
|
||||
* Root: Convenience reference to help calculate the correct height.
|
||||
*/
|
||||
this.$container = $(container);
|
||||
this.$root = this.isBody ? supportsFixedPosition ? $(window) : $(document) : this.$container;
|
||||
|
||||
// Don't create a new wrap if one already exists (from a previous instance of Backstretch)
|
||||
var $existing = this.$container.children(".backstretch").first();
|
||||
this.$wrap = $existing.length ? $existing : $('<div class="backstretch"></div>').css(styles.wrap).appendTo(this.$container);
|
||||
|
||||
// Non-body elements need some style adjustments
|
||||
if (!this.isBody) {
|
||||
// If the container is statically positioned, we need to make it relative,
|
||||
// and if no zIndex is defined, we should set it to zero.
|
||||
var position = this.$container.css('position')
|
||||
, zIndex = this.$container.css('zIndex');
|
||||
|
||||
this.$container.css({
|
||||
position: position === 'static' ? 'relative' : position
|
||||
, zIndex: zIndex === 'auto' ? 0 : zIndex
|
||||
, background: 'none'
|
||||
});
|
||||
|
||||
// Needs a higher z-index
|
||||
this.$wrap.css({zIndex: -999998});
|
||||
}
|
||||
|
||||
// Fixed or absolute positioning?
|
||||
this.$wrap.css({
|
||||
position: this.isBody && supportsFixedPosition ? 'fixed' : 'absolute'
|
||||
});
|
||||
|
||||
// Set the first image
|
||||
this.index = 0;
|
||||
this.show(this.index);
|
||||
|
||||
// Listen for resize
|
||||
$(window).on('resize.backstretch', $.proxy(this.resize, this))
|
||||
.on('orientationchange.backstretch', $.proxy(function () {
|
||||
// Need to do this in order to get the right window height
|
||||
if (this.isBody && window.pageYOffset === 0) {
|
||||
window.scrollTo(0, 1);
|
||||
this.resize();
|
||||
}
|
||||
}, this));
|
||||
};
|
||||
|
||||
/* PUBLIC METHODS
|
||||
* ========================= */
|
||||
Backstretch.prototype = {
|
||||
resize: function () {
|
||||
try {
|
||||
var bgCSS = {left: 0, top: 0}
|
||||
, rootWidth = this.isBody ? this.$root.width() : this.$root.innerWidth()
|
||||
, bgWidth = rootWidth
|
||||
, rootHeight = this.isBody ? ( window.innerHeight ? window.innerHeight : this.$root.height() ) : this.$root.innerHeight()
|
||||
, bgHeight = bgWidth / this.$img.data('ratio')
|
||||
, bgOffset;
|
||||
|
||||
// Make adjustments based on image ratio
|
||||
if (bgHeight >= rootHeight) {
|
||||
bgOffset = (bgHeight - rootHeight) / 2;
|
||||
if(this.options.centeredY) {
|
||||
bgCSS.top = '-' + bgOffset + 'px';
|
||||
}
|
||||
} else {
|
||||
bgHeight = rootHeight;
|
||||
bgWidth = bgHeight * this.$img.data('ratio');
|
||||
bgOffset = (bgWidth - rootWidth) / 2;
|
||||
if(this.options.centeredX) {
|
||||
bgCSS.left = '-' + bgOffset + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
this.$wrap.css({width: rootWidth, height: rootHeight})
|
||||
.find('img:not(.deleteable)').css({width: bgWidth, height: bgHeight}).css(bgCSS);
|
||||
} catch(err) {
|
||||
// IE7 seems to trigger resize before the image is loaded.
|
||||
// This try/catch block is a hack to let it fail gracefully.
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
// Show the slide at a certain position
|
||||
, show: function (newIndex) {
|
||||
|
||||
// Validate index
|
||||
if (Math.abs(newIndex) > this.images.length - 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Vars
|
||||
var self = this
|
||||
, oldImage = self.$wrap.find('img').addClass('deleteable')
|
||||
, evtOptions = { relatedTarget: self.$container[0] };
|
||||
|
||||
// Trigger the "before" event
|
||||
self.$container.trigger($.Event('backstretch.before', evtOptions), [self, newIndex]);
|
||||
|
||||
// Set the new index
|
||||
this.index = newIndex;
|
||||
|
||||
// Pause the slideshow
|
||||
clearInterval(self.interval);
|
||||
|
||||
// New image
|
||||
self.$img = $('<img />')
|
||||
.css(styles.img)
|
||||
.bind('load', function (e) {
|
||||
var imgWidth = this.width || $(e.target).width()
|
||||
, imgHeight = this.height || $(e.target).height();
|
||||
|
||||
// Save the ratio
|
||||
$(this).data('ratio', imgWidth / imgHeight);
|
||||
|
||||
// Show the image, then delete the old one
|
||||
// "speed" option has been deprecated, but we want backwards compatibilty
|
||||
$(this).fadeIn(self.options.speed || self.options.fade, function () {
|
||||
oldImage.remove();
|
||||
|
||||
// Resume the slideshow
|
||||
if (!self.paused) {
|
||||
self.cycle();
|
||||
}
|
||||
|
||||
// Trigger the "after" and "show" events
|
||||
// "show" is being deprecated
|
||||
$(['after', 'show']).each(function () {
|
||||
self.$container.trigger($.Event('backstretch.' + this, evtOptions), [self, newIndex]);
|
||||
});
|
||||
});
|
||||
|
||||
// Resize
|
||||
self.resize();
|
||||
})
|
||||
.appendTo(self.$wrap);
|
||||
|
||||
// Hack for IE img onload event
|
||||
self.$img.attr('src', self.images[newIndex]);
|
||||
return self;
|
||||
}
|
||||
|
||||
, next: function () {
|
||||
// Next slide
|
||||
return this.show(this.index < this.images.length - 1 ? this.index + 1 : 0);
|
||||
}
|
||||
|
||||
, prev: function () {
|
||||
// Previous slide
|
||||
return this.show(this.index === 0 ? this.images.length - 1 : this.index - 1);
|
||||
}
|
||||
|
||||
, pause: function () {
|
||||
// Pause the slideshow
|
||||
this.paused = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
, resume: function () {
|
||||
// Resume the slideshow
|
||||
this.paused = false;
|
||||
this.next();
|
||||
return this;
|
||||
}
|
||||
|
||||
, cycle: function () {
|
||||
// Start/resume the slideshow
|
||||
if(this.images.length > 1) {
|
||||
// Clear the interval, just in case
|
||||
clearInterval(this.interval);
|
||||
|
||||
this.interval = setInterval($.proxy(function () {
|
||||
// Check for paused slideshow
|
||||
if (!this.paused) {
|
||||
this.next();
|
||||
}
|
||||
}, this), this.options.duration);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
, destroy: function (preserveBackground) {
|
||||
// Stop the resize events
|
||||
$(window).off('resize.backstretch orientationchange.backstretch');
|
||||
|
||||
// Clear the interval
|
||||
clearInterval(this.interval);
|
||||
|
||||
// Remove Backstretch
|
||||
if(!preserveBackground) {
|
||||
this.$wrap.remove();
|
||||
}
|
||||
this.$container.removeData('backstretch');
|
||||
}
|
||||
};
|
||||
|
||||
/* SUPPORTS FIXED POSITION?
|
||||
*
|
||||
* Based on code from jQuery Mobile 1.1.0
|
||||
* http://jquerymobile.com/
|
||||
*
|
||||
* In a nutshell, we need to figure out if fixed positioning is supported.
|
||||
* Unfortunately, this is very difficult to do on iOS, and usually involves
|
||||
* injecting content, scrolling the page, etc.. It's ugly.
|
||||
* jQuery Mobile uses this workaround. It's not ideal, but works.
|
||||
*
|
||||
* Modified to detect IE6
|
||||
* ========================= */
|
||||
|
||||
var supportsFixedPosition = (function () {
|
||||
var ua = navigator.userAgent
|
||||
, platform = navigator.platform
|
||||
// Rendering engine is Webkit, and capture major version
|
||||
, wkmatch = ua.match( /AppleWebKit\/([0-9]+)/ )
|
||||
, wkversion = !!wkmatch && wkmatch[ 1 ]
|
||||
, ffmatch = ua.match( /Fennec\/([0-9]+)/ )
|
||||
, ffversion = !!ffmatch && ffmatch[ 1 ]
|
||||
, operammobilematch = ua.match( /Opera Mobi\/([0-9]+)/ )
|
||||
, omversion = !!operammobilematch && operammobilematch[ 1 ]
|
||||
, iematch = ua.match( /MSIE ([0-9]+)/ )
|
||||
, ieversion = !!iematch && iematch[ 1 ];
|
||||
|
||||
return !(
|
||||
// iOS 4.3 and older : Platform is iPhone/Pad/Touch and Webkit version is less than 534 (ios5)
|
||||
((platform.indexOf( "iPhone" ) > -1 || platform.indexOf( "iPad" ) > -1 || platform.indexOf( "iPod" ) > -1 ) && wkversion && wkversion < 534) ||
|
||||
|
||||
// Opera Mini
|
||||
(window.operamini && ({}).toString.call( window.operamini ) === "[object OperaMini]") ||
|
||||
(operammobilematch && omversion < 7458) ||
|
||||
|
||||
//Android lte 2.1: Platform is Android and Webkit version is less than 533 (Android 2.2)
|
||||
(ua.indexOf( "Android" ) > -1 && wkversion && wkversion < 533) ||
|
||||
|
||||
// Firefox Mobile before 6.0 -
|
||||
(ffversion && ffversion < 6) ||
|
||||
|
||||
// WebOS less than 3
|
||||
("palmGetResource" in window && wkversion && wkversion < 534) ||
|
||||
|
||||
// MeeGo
|
||||
(ua.indexOf( "MeeGo" ) > -1 && ua.indexOf( "NokiaBrowser/8.5.0" ) > -1) ||
|
||||
|
||||
// IE6
|
||||
(ieversion && ieversion <= 6)
|
||||
);
|
||||
}());
|
||||
|
||||
}(jQuery, window));
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
/*! Backstretch - v2.0.4 - 2013-06-19
|
||||
* http://srobbin.com/jquery-plugins/backstretch/
|
||||
* Copyright (c) 2013 Scott Robbin; Licensed MIT */
|
||||
(function(a,d,p){a.fn.backstretch=function(c,b){(c===p||0===c.length)&&a.error("No images were supplied for Backstretch");0===a(d).scrollTop()&&d.scrollTo(0,0);return this.each(function(){var d=a(this),g=d.data("backstretch");if(g){if("string"==typeof c&&"function"==typeof g[c]){g[c](b);return}b=a.extend(g.options,b);g.destroy(!0)}g=new q(this,c,b);d.data("backstretch",g)})};a.backstretch=function(c,b){return a("body").backstretch(c,b).data("backstretch")};a.expr[":"].backstretch=function(c){return a(c).data("backstretch")!==p};a.fn.backstretch.defaults={centeredX:!0,centeredY:!0,duration:5E3,fade:0};var r={left:0,top:0,overflow:"hidden",margin:0,padding:0,height:"100%",width:"100%",zIndex:-999999},s={position:"absolute",display:"none",margin:0,padding:0,border:"none",width:"auto",height:"auto",maxHeight:"none",maxWidth:"none",zIndex:-999999},q=function(c,b,e){this.options=a.extend({},a.fn.backstretch.defaults,e||{});this.images=a.isArray(b)?b:[b];a.each(this.images,function(){a("<img />")[0].src=this});this.isBody=c===document.body;this.$container=a(c);this.$root=this.isBody?l?a(d):a(document):this.$container;c=this.$container.children(".backstretch").first();this.$wrap=c.length?c:a('<div class="backstretch"></div>').css(r).appendTo(this.$container);this.isBody||(c=this.$container.css("position"),b=this.$container.css("zIndex"),this.$container.css({position:"static"===c?"relative":c,zIndex:"auto"===b?0:b,background:"none"}),this.$wrap.css({zIndex:-999998}));this.$wrap.css({position:this.isBody&&l?"fixed":"absolute"});this.index=0;this.show(this.index);a(d).on("resize.backstretch",a.proxy(this.resize,this)).on("orientationchange.backstretch",a.proxy(function(){this.isBody&&0===d.pageYOffset&&(d.scrollTo(0,1),this.resize())},this))};q.prototype={resize:function(){try{var a={left:0,top:0},b=this.isBody?this.$root.width():this.$root.innerWidth(),e=b,g=this.isBody?d.innerHeight?d.innerHeight:this.$root.height():this.$root.innerHeight(),j=e/this.$img.data("ratio"),f;j>=g?(f=(j-g)/2,this.options.centeredY&&(a.top="-"+f+"px")):(j=g,e=j*this.$img.data("ratio"),f=(e-b)/2,this.options.centeredX&&(a.left="-"+f+"px"));this.$wrap.css({width:b,height:g}).find("img:not(.deleteable)").css({width:e,height:j}).css(a)}catch(h){}return this},show:function(c){if(!(Math.abs(c)>this.images.length-1)){var b=this,e=b.$wrap.find("img").addClass("deleteable"),d={relatedTarget:b.$container[0]};b.$container.trigger(a.Event("backstretch.before",d),[b,c]);this.index=c;clearInterval(b.interval);b.$img=a("<img />").css(s).bind("load",function(f){var h=this.width||a(f.target).width();f=this.height||a(f.target).height();a(this).data("ratio",h/f);a(this).fadeIn(b.options.speed||b.options.fade,function(){e.remove();b.paused||b.cycle();a(["after","show"]).each(function(){b.$container.trigger(a.Event("backstretch."+this,d),[b,c])})});b.resize()}).appendTo(b.$wrap);b.$img.attr("src",b.images[c]);return b}},next:function(){return this.show(this.index<this.images.length-1?this.index+1:0)},prev:function(){return this.show(0===this.index?this.images.length-1:this.index-1)},pause:function(){this.paused=!0;return this},resume:function(){this.paused=!1;this.next();return this},cycle:function(){1<this.images.length&&(clearInterval(this.interval),this.interval=setInterval(a.proxy(function(){this.paused||this.next()},this),this.options.duration));return this},destroy:function(c){a(d).off("resize.backstretch orientationchange.backstretch");clearInterval(this.interval);c||this.$wrap.remove();this.$container.removeData("backstretch")}};var l,f=navigator.userAgent,m=navigator.platform,e=f.match(/AppleWebKit\/([0-9]+)/),e=!!e&&e[1],h=f.match(/Fennec\/([0-9]+)/),h=!!h&&h[1],n=f.match(/Opera Mobi\/([0-9]+)/),t=!!n&&n[1],k=f.match(/MSIE ([0-9]+)/),k=!!k&&k[1];l=!((-1<m.indexOf("iPhone")||-1<m.indexOf("iPad")||-1<m.indexOf("iPod"))&&e&&534>e||d.operamini&&"[object OperaMini]"==={}.toString.call(d.operamini)||n&&7458>t||-1<f.indexOf("Android")&&e&&533>e||h&&6>h||"palmGetResource"in d&&e&&534>e||-1<f.indexOf("MeeGo")&&-1<f.indexOf("NokiaBrowser/8.5.0")||k&&6>=k)})(jQuery,window);
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
jQuery(document).ready(function () {
|
||||
var baseUrl = $("#baseUrl").val();
|
||||
$.backstretch(baseUrl + "/img/backgrounds/1.jpg");
|
||||
});
|
||||
|
|
@ -1,76 +1,84 @@
|
|||
function changeFrameUrl(url) {
|
||||
console.info('showTraceLog iframe url change: ' + url);
|
||||
$("#showTraceLog").attr("src", url);
|
||||
console.info('showTraceLog iframe url change: ' + url);
|
||||
$("#showTraceLog").attr("src", url);
|
||||
|
||||
|
||||
//$("#showTraceLog").attr("height",$("#showTraceLog").contentDocument.scrollHeight + 20);
|
||||
}
|
||||
|
||||
$().ready(function() {
|
||||
function drawData(url) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url,
|
||||
success: function (data) {
|
||||
$("#showTraceLog").empty();
|
||||
$("#showTraceLog").html(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var baseUrl = $("#baseUrl").val();
|
||||
var traceId = $("#traceId").val();
|
||||
var uid = $("#uid").val();
|
||||
|
||||
/** 搞个默认值测试*/
|
||||
// traceId = "6fbbe463f5b74873aecaf9eb3511846e123";
|
||||
$().ready(function () {
|
||||
|
||||
changeFrameUrl("");
|
||||
var baseUrl = $("#baseUrl").val();
|
||||
var traceId = $("#traceId").val();
|
||||
var uid = $("#uid").val();
|
||||
|
||||
/** init page */
|
||||
if (traceId != '' && traceId.length > 0) {
|
||||
$("#srchKey").val(traceId);
|
||||
var srchKey = $("#srchKey").val();
|
||||
if (srchKey != "") {
|
||||
changeFrameUrl(baseUrl + "/showTraceLog/" + srchKey);
|
||||
}
|
||||
} else {
|
||||
if(uid>=0){
|
||||
changeFrameUrl(baseUrl + "/applist");
|
||||
}
|
||||
$("#srchKey").val("");
|
||||
}
|
||||
|
||||
/** bind srchBtn */
|
||||
$("#srchBtn").bind("click", function() {
|
||||
var srchKey = $("#srchKey").val();
|
||||
if (srchKey != "") {
|
||||
changeFrameUrl(baseUrl + "/showTraceLog/" + srchKey);
|
||||
}
|
||||
});
|
||||
|
||||
$("a[name='menuUrl']").each(function() {
|
||||
$(this).bind('click', function() {
|
||||
changeFrameUrl(baseUrl + "/" + $(this).attr("url"));
|
||||
});
|
||||
});
|
||||
|
||||
$("#regist").bind('click', function() {
|
||||
changeFrameUrl(baseUrl + "/" + $(this).attr("url"));
|
||||
});
|
||||
|
||||
$("#login").bind('click', function() {
|
||||
changeFrameUrl(baseUrl + "/" + $(this).attr("url"));
|
||||
});
|
||||
|
||||
$("#logout").bind('click', function() {
|
||||
var urlStr = baseUrl + '/logout';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
data:{},
|
||||
dataType: 'json',
|
||||
async : false,
|
||||
success: function(data){
|
||||
console.log(data);
|
||||
var result = data.result;
|
||||
if(result == 'OK'){
|
||||
window.location.reload();
|
||||
}else{
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function(xhr, type){
|
||||
alert("退出失败");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/** 搞个默认值测试*/
|
||||
//traceId = "6fbbe463f5b74873aecaf9eb3511846e123";
|
||||
//changeFrameUrl("");
|
||||
|
||||
/** init page */
|
||||
if (traceId != '' && traceId.length > 0) {
|
||||
$("#srchKey").val(traceId);
|
||||
var srchKey = $("#srchKey").val();
|
||||
if (srchKey != "") {
|
||||
//changeFrameUrl(baseUrl + "/showTraceLog/" + srchKey);
|
||||
drawData(baseUrl + "/showTraceLog/" + srchKey);
|
||||
}
|
||||
} else {
|
||||
if (uid >= 0) {
|
||||
drawData(baseUrl + "/applist");
|
||||
}
|
||||
$("#srchKey").val("");
|
||||
}
|
||||
|
||||
/** bind srchBtn */
|
||||
$("#srchBtn").bind("click", function () {
|
||||
var srchKey = $("#srchKey").val();
|
||||
if (srchKey != "") {
|
||||
drawData(baseUrl + "/showTraceLog/" + srchKey);
|
||||
}
|
||||
});
|
||||
|
||||
$("a[name='menuUrl']").each(function () {
|
||||
$(this).bind('click', function () {
|
||||
drawData(baseUrl + "/" + $(this).attr("url"));
|
||||
});
|
||||
});
|
||||
|
||||
$("#logout").bind('click', function () {
|
||||
var urlStr = baseUrl + '/logout';
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: urlStr,
|
||||
data: {},
|
||||
dataType: 'json',
|
||||
async: false,
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
var result = data.result;
|
||||
if (result == 'OK') {
|
||||
window.location.reload();
|
||||
} else {
|
||||
alert(data.msg);
|
||||
}
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
alert("退出失败");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue