From f3b27e042c7eac349bfef6d0dcf89b397164a599 Mon Sep 17 00:00:00 2001
From: kongdeqiang <kongdeqiang@960204@163.com>
Date: 星期一, 01 十二月 2025 22:15:35 +0800
Subject: [PATCH] fix:ospf主监测表提交
---
src/main/resources/templates/common/aside.html | 14
src/main/java/com/wgcloud/entity/OspfInfo.java | 10
src/main/java/com/wgcloud/controller/OspfMonitorController.java | 166 ++++++++
src/main/resources/templates/ospfMonitor/list.html | 122 ++++++
src/main/java/com/wgcloud/mapper/OspfMonitorMapper.java | 39 +
src/main/java/com/wgcloud/filter/AuthRestFilter.java | 6
src/main/resources/templates/ospfInfo/add.html | 9
src/main/resources/mybatis/mapper/OspfMonitorMapper.xml | 192 +++++++++
src/main/resources/templates/ospfMonitor/view.html | 279 +++++++++++++
src/main/resources/mybatis/mapper/OspfInfoMapper.xml | 34 +
src/main/java/com/wgcloud/controller/OspfInfoController.java | 20
src/main/java/com/wgcloud/service/OspfMonitorService.java | 98 ++++
src/main/resources/static/js/ospfInfo.js | 3
src/main/resources/static/js/ospfMonitor.js | 26 +
src/main/java/com/wgcloud/entity/OspfMonitor.java | 18
src/main/resources/templates/ospfInfo/list.html | 2
src/main/resources/templates/ospfMonitor/add.html | 107 +++++
17 files changed, 1,128 insertions(+), 17 deletions(-)
diff --git a/src/main/java/com/wgcloud/controller/OspfInfoController.java b/src/main/java/com/wgcloud/controller/OspfInfoController.java
index 928cf36..21db5a6 100644
--- a/src/main/java/com/wgcloud/controller/OspfInfoController.java
+++ b/src/main/java/com/wgcloud/controller/OspfInfoController.java
@@ -5,9 +5,11 @@
import com.github.pagehelper.PageInfo;
import com.wgcloud.entity.AccountInfo;
import com.wgcloud.entity.OspfInfo;
+import com.wgcloud.entity.OspfMonitor;
import com.wgcloud.entity.SnmpInfo;
import com.wgcloud.service.LogInfoService;
import com.wgcloud.service.OspfInfoService;
+import com.wgcloud.service.OspfMonitorService;
import com.wgcloud.util.HostUtil;
import com.wgcloud.util.PageUtil;
import com.wgcloud.util.ResDataUtils;
@@ -28,6 +30,7 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
/**
@@ -47,6 +50,8 @@
@Resource
private OspfInfoService OspfInfoService;
+ @Resource
+ private OspfMonitorService ospfMonitorService;
@Resource
private LogInfoService logInfoService;
@Autowired
@@ -124,9 +129,16 @@
String errorMsg = "淇濆瓨ospf鐩戞祴閿欒";
try {
if (StringUtils.isEmpty(ospfInfo.getId())) {
-
+ OspfMonitor ospfMonitor = ospfMonitorService.selectById(ospfInfo.getMonitorId());
+ ospfInfo.setMonitorIp(ospfMonitor.getHostname());
+ ospfInfo.setMonitorUsername(ospfMonitor.getUsername());
+ ospfInfo.setMonitorPassword(ospfMonitor.getPassword());
OspfInfoService.save(ospfInfo);
} else {
+ OspfMonitor ospfMonitor = ospfMonitorService.selectById(ospfInfo.getMonitorId());
+ ospfInfo.setMonitorIp(ospfMonitor.getHostname());
+ ospfInfo.setMonitorUsername(ospfMonitor.getUsername());
+ ospfInfo.setMonitorPassword(ospfMonitor.getPassword());
OspfInfoService.updateById(ospfInfo);
}
@@ -143,14 +155,16 @@
OspfInfo ospfInfo = new OspfInfo();
try {
if (StringUtils.isEmpty(id)) {
- //娣诲姞椤甸潰榛樿鍊硷紝snmp绔彛涓�161锛屽洟浣撳悕绉颁负public
ospfInfo.setAreaNum("0");
model.addAttribute("ospfInfo", ospfInfo);
-
+ List<OspfMonitor> ospfMonitors = ospfMonitorService.selectAllByParams(null);
+ model.addAttribute("monitors",ospfMonitors);
return "ospfInfo/add";
}
ospfInfo = OspfInfoService.selectById(id);
+ List<OspfMonitor> ospfMonitors = ospfMonitorService.selectAllByParams(null);
+ model.addAttribute("monitors",ospfMonitors);
model.addAttribute("ospfInfo", ospfInfo);
} catch (Exception e) {
logger.error(errorMsg, e);
diff --git a/src/main/java/com/wgcloud/controller/OspfMonitorController.java b/src/main/java/com/wgcloud/controller/OspfMonitorController.java
new file mode 100644
index 0000000..7c025aa
--- /dev/null
+++ b/src/main/java/com/wgcloud/controller/OspfMonitorController.java
@@ -0,0 +1,166 @@
+package com.wgcloud.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.wgcloud.entity.OspfInfo;
+import com.wgcloud.entity.OspfMonitor;
+import com.wgcloud.service.LogInfoService;
+import com.wgcloud.service.OspfInfoService;
+import com.wgcloud.service.OspfMonitorService;
+import com.wgcloud.util.PageUtil;
+import com.wgcloud.util.TokenUtils;
+import com.wgcloud.util.staticvar.StaticKeys;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.mvc.support.RedirectAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @version v3.3
+ * @ClassName:OspfInfoController.java
+ * @author: http://www.wgstart.com
+ * @date: 2021骞�1鏈�16鏃�
+ * @Description: 绯荤粺鐢熸垚鐨勬棩蹇楃鐞�
+ * @Copyright: 2019-2021 wgcloud. All rights reserved.
+ */
+@Controller
+@RequestMapping("/ospfMonitor")
+public class OspfMonitorController {
+
+
+ private static final Logger logger = LoggerFactory.getLogger(OspfMonitorController.class);
+
+ @Resource
+ private OspfMonitorService monitorService;
+ @Resource
+ private LogInfoService logInfoService;
+
+ /**
+ * 鏍规嵁鏉′欢鏌ヨ鏃ュ織淇℃伅鍒楄〃
+ *
+ * @param model
+ * @param request
+ * @return
+ */
+ @RequestMapping(value = "list")
+ public String OspfInfoList(OspfMonitor OspfInfo, Model model, HttpServletRequest request) {
+ Map<String, Object> params = new HashMap<String, Object>();
+ try {
+ StringBuffer url = new StringBuffer();
+ String hostname = null;
+ if (!StringUtils.isEmpty(OspfInfo.getHostname())) {
+ hostname = OspfInfo.getHostname();
+ params.put("hostname", hostname.trim());
+ url.append("&hostname=").append(hostname);
+ }
+ if (!StringUtils.isEmpty(OspfInfo.getState())) {
+ params.put("state", OspfInfo.getState());
+ url.append("&state=").append(OspfInfo.getState());
+ }
+ PageInfo pageInfo = monitorService.selectByParams(params, OspfInfo.getPage(), OspfInfo.getPageSize());
+ PageUtil.initPageNumber(pageInfo, model);
+
+ model.addAttribute("pageUrl", "/ospfMonitor/list?1=1" + url.toString());
+ model.addAttribute("page", pageInfo);
+ model.addAttribute("ospfInfo", OspfInfo);
+ } catch (Exception e) {
+ logger.error("鏌ヨ鏃ュ織鍒楄〃閿欒", e);
+ }
+ return "ospfMonitor/list";
+ }
+
+ /**
+ * 鏌ョ湅鏃ュ織淇℃伅
+ *
+ * @param model
+ * @param request
+ * @return
+ */
+ @RequestMapping(value = "view")
+ public String viewOspfInfo(Model model, HttpServletRequest request) {
+ String id = request.getParameter("id");
+ OspfMonitor OspfInfo;
+ try {
+ OspfInfo = monitorService.selectById(id);
+ model.addAttribute("ospfMonitor", OspfInfo);
+ } catch (Exception e) {
+ logger.error("鏌ョ湅鏃ュ織淇℃伅閿欒", e);
+ }
+ return "ospfMonitor/view";
+ }
+
+ /**
+ * 淇濆瓨ospf
+ *
+ * @param ospfInfo
+ * @param model
+ * @param request
+ * @return
+ */
+ @RequestMapping(value = "save")
+ public String saveOspfInfo(OspfMonitor ospfInfo, Model model, HttpServletRequest request) {
+ String errorMsg = "淇濆瓨ospf鐩戞祴閿欒";
+ try {
+ if (StringUtils.isEmpty(ospfInfo.getId())) {
+
+ monitorService.save(ospfInfo);
+ } else {
+ monitorService.updateById(ospfInfo);
+ }
+
+ } catch (Exception e) {
+ logger.error(errorMsg, e);
+ }
+ return "redirect:/ospfMonitor/list";
+ }
+
+ @RequestMapping(value = "edit")
+ public String edit(Model model, HttpServletRequest request) {
+ String errorMsg = "缂栬緫ospf鐩戞祴璁惧";
+ String id = request.getParameter("id");
+ OspfMonitor ospfInfo = new OspfMonitor();
+ try {
+ if (StringUtils.isEmpty(id)) {
+ //娣诲姞椤甸潰榛樿鍊硷紝snmp绔彛涓�161锛屽洟浣撳悕绉颁负public
+ model.addAttribute("ospfMonitor", ospfInfo);
+
+ return "ospfMonitor/add";
+ }
+
+ ospfInfo = monitorService.selectById(id);
+ model.addAttribute("ospfMonitor", ospfInfo);
+ } catch (Exception e) {
+ logger.error(errorMsg, e);
+ logInfoService.save(errorMsg, e.toString(), StaticKeys.LOG_XTCZ);
+ }
+ return "ospfMonitor/add";
+ }
+
+ @RequestMapping(value = "del")
+ public String delete(Model model, HttpServletRequest request, RedirectAttributes redirectAttributes) {
+ String errorMsg = "鍒犻櫎ospf鐩戞祴璁惧閿欒";
+ OspfMonitor ospfMonitor = new OspfMonitor();
+ try {
+ if (!StringUtils.isEmpty(request.getParameter("id"))) {
+ String[] ids = request.getParameter("id").split(",");
+ for (String id : ids) {
+ ospfMonitor = monitorService.selectById(id);
+ }
+ monitorService.deleteById(ids);
+ }
+ } catch (Exception e) {
+ logger.error(errorMsg, e);
+ logInfoService.save(errorMsg, e.toString(), StaticKeys.LOG_XTCZ);
+ }
+ return "redirect:/ospfMonitor/list";
+ }
+
+}
diff --git a/src/main/java/com/wgcloud/entity/OspfInfo.java b/src/main/java/com/wgcloud/entity/OspfInfo.java
index e6e4440..58ca318 100644
--- a/src/main/java/com/wgcloud/entity/OspfInfo.java
+++ b/src/main/java/com/wgcloud/entity/OspfInfo.java
@@ -49,7 +49,7 @@
- private String monitorUserName;
+ private String monitorUsername;
private String monitorPassword;
@@ -116,16 +116,16 @@
this.monitorIp = monitorIp;
}
- public void setMonitorUserName(String monitorUserName) {
- this.monitorUserName = monitorUserName;
+ public void setMonitorUsername(String monitorUsername) {
+ this.monitorUsername = monitorUsername;
}
public void setMonitorPassword(String monitorPassword) {
this.monitorPassword = monitorPassword;
}
- public String getMonitorUserName() {
- return monitorUserName;
+ public String getMonitorUsername() {
+ return monitorUsername;
}
public String getMonitorPassword() {
diff --git a/src/main/java/com/wgcloud/entity/OspfMonitor.java b/src/main/java/com/wgcloud/entity/OspfMonitor.java
index f8cf9a8..2ef893d 100644
--- a/src/main/java/com/wgcloud/entity/OspfMonitor.java
+++ b/src/main/java/com/wgcloud/entity/OspfMonitor.java
@@ -37,7 +37,25 @@
*/
private Date createTime;
+ private String username;
+ private String password;
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
public String getHostname() {
return hostname;
diff --git a/src/main/java/com/wgcloud/filter/AuthRestFilter.java b/src/main/java/com/wgcloud/filter/AuthRestFilter.java
index f10978f..ca72ddc 100644
--- a/src/main/java/com/wgcloud/filter/AuthRestFilter.java
+++ b/src/main/java/com/wgcloud/filter/AuthRestFilter.java
@@ -33,7 +33,7 @@
"/systemInfoOpen/", "/systemInfo/agentList", "/agentLogGo/minTask", "/agentGo/minTask", "/agentDiskGo/minTask", "/dceInfo/agentList",
"/login/toLogin", "/login/login", "/appInfo/agentList", "/dockerInfo/agentList", "/portInfo/agentList", "/license/",
"/static/", "/resources/", "/log/agentList", "/customInfo/agentList", "/agentCustomGo/minTask", "/dbInfo/agentList", "/agentDbTableGo/minTask",
- "/agentHeathMonitorGo/minTask", "/agentDceInfoGo/minTask", "/agentSnmpInfoGo/minTask", "/snmpInfo/agentList","/api/","/dp/getTop","/dp/getWb","/dp/getError","/dp/getCount"};
+ "/agentHeathMonitorGo/minTask", "/agentDceInfoGo/minTask", "/agentSnmpInfoGo/minTask", "/snmpInfo/agentList","/api/","/dp/getTop","/dp/getWb","/dp/getError","/dp/getCount","/dp/getInfo"};
//鍏紬鐪嬫澘URL
@@ -201,6 +201,10 @@
session.setAttribute("menuActive", "63");
return;
}
+ if (uri.indexOf("/ospfMonitor") > -1) {
+ session.setAttribute("menuActive", "64");
+ return;
+ }
if (uri.indexOf("/tuopu/tuopuListHost") > -1) {
session.setAttribute("menuActive", "71");
return;
diff --git a/src/main/java/com/wgcloud/mapper/OspfMonitorMapper.java b/src/main/java/com/wgcloud/mapper/OspfMonitorMapper.java
new file mode 100644
index 0000000..f05a897
--- /dev/null
+++ b/src/main/java/com/wgcloud/mapper/OspfMonitorMapper.java
@@ -0,0 +1,39 @@
+package com.wgcloud.mapper;
+
+import com.wgcloud.entity.OspfInfo;
+import com.wgcloud.entity.OspfMonitor;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @version v3.3
+ * @ClassName:LogInfoDao.java
+ * @author: http://www.wgstart.com
+ * @date: 2021骞�1鏈�16鏃�
+ * @Description: 鏌ョ湅鏃ュ織淇℃伅
+ * @Copyright: 2019-2021 wgcloud. All rights reserved.
+ */
+@Repository
+public interface OspfMonitorMapper {
+
+
+ public List<OspfMonitor> selectAllByParams(Map<String, Object> map);
+
+ public int countByParams(Map<String, Object> params) throws Exception;
+
+ public List<OspfMonitor> selectByParams(Map<String, Object> params) throws Exception;
+
+ public OspfMonitor selectById(String id) throws Exception;
+
+ public void save(OspfMonitor LogInfo) throws Exception;
+
+ public int deleteById(String[] id) throws Exception;
+
+ public void insertList(List<OspfMonitor> recordList) throws Exception;
+
+ public int deleteByDate(Map<String, Object> map) throws Exception;
+
+ public void updateById(OspfMonitor ospfInfo);
+}
diff --git a/src/main/java/com/wgcloud/service/OspfMonitorService.java b/src/main/java/com/wgcloud/service/OspfMonitorService.java
new file mode 100644
index 0000000..d64c05a
--- /dev/null
+++ b/src/main/java/com/wgcloud/service/OspfMonitorService.java
@@ -0,0 +1,98 @@
+package com.wgcloud.service;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.wgcloud.entity.OspfInfo;
+import com.wgcloud.entity.OspfMonitor;
+import com.wgcloud.mapper.OspfInfoMapper;
+import com.wgcloud.mapper.OspfMonitorMapper;
+import com.wgcloud.util.DateUtil;
+import com.wgcloud.util.UUIDUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @version v3.3
+ * @ClassName:OspfMonitorService.java
+ * @author: http://www.wgstart.com
+ * @date: 2021骞�1鏈�16鏃�
+ * @Description: OspfMonitorService.java
+ * @Copyright: 2019-2021 wgcloud. All rights reserved.
+ */
+@Service
+public class OspfMonitorService {
+
+ @Autowired
+ private RouterConnectionService routerConnectionService;
+
+ private static final Logger logger = LoggerFactory.getLogger(OspfMonitorService.class);
+
+ public PageInfo selectByParams(Map<String, Object> params, int currPage, int pageSize) throws Exception {
+ PageHelper.startPage(currPage, pageSize);
+ List<OspfMonitor> list = ospfMonitorMapper.selectByParams(params);
+ PageInfo<OspfMonitor> pageInfo = new PageInfo<OspfMonitor>(list);
+ return pageInfo;
+ }
+
+ public void saveRecord(List<OspfMonitor> recordList) throws Exception {
+ if (recordList.size() < 1) {
+ return;
+ }
+ Map<String, Object> map = new HashMap<String, Object>();
+ for (OspfMonitor as : recordList) {
+ as.setId(UUIDUtil.getUUID());
+ as.setCreateTime(DateUtil.getNowTime());
+ }
+ ospfMonitorMapper.insertList(recordList);
+ }
+
+ public void save(OspfMonitor ospfMonitor) {
+ ospfMonitor.setId(UUIDUtil.getUUID());
+ ospfMonitor.setCreateTime(DateUtil.getNowTime());
+ try {
+ ospfMonitorMapper.save(ospfMonitor);
+ } catch (Exception e) {
+ logger.error("淇濆瓨鏃ュ織淇℃伅寮傚父锛�", e);
+ }
+ }
+
+ public void updateById(OspfMonitor ospfMonitor)
+ throws Exception {
+ if (StringUtils.isEmpty(ospfMonitor.getHostname())) {
+ ospfMonitor.setHostname(ospfMonitor.getHostname().trim());
+ }
+ ospfMonitorMapper.updateById(ospfMonitor);
+ }
+
+ public int countByParams(Map<String, Object> params) throws Exception {
+ return ospfMonitorMapper.countByParams(params);
+ }
+
+ public int deleteById(String[] id) throws Exception {
+ return ospfMonitorMapper.deleteById(id);
+ }
+
+ public OspfMonitor selectById(String id) throws Exception {
+ return ospfMonitorMapper.selectById(id);
+ }
+
+ public List<OspfMonitor> selectAllByParams(Map<String, Object> params) throws Exception {
+ return ospfMonitorMapper.selectAllByParams(params);
+ }
+
+ public int deleteByDate(Map<String, Object> map) throws Exception{
+ return ospfMonitorMapper.deleteByDate(map);
+ }
+
+ @Autowired
+ private OspfMonitorMapper ospfMonitorMapper;
+
+
+}
diff --git a/src/main/resources/mybatis/mapper/OspfInfoMapper.xml b/src/main/resources/mybatis/mapper/OspfInfoMapper.xml
index 3d7e309..9f523a0 100644
--- a/src/main/resources/mybatis/mapper/OspfInfoMapper.xml
+++ b/src/main/resources/mybatis/mapper/OspfInfoMapper.xml
@@ -7,11 +7,15 @@
<result column="INFO_CONTENT" property="infoContent" jdbcType="CHAR" />
<result column="AREA_NUM" property="areaNum" jdbcType="CHAR" />
<result column="STATE" property="state" jdbcType="CHAR" />
+ <result column="MONITOR_ID" property="monitorId" jdbcType="CHAR" />
+ <result column="MONITOR_IP" property="monitorIp" jdbcType="CHAR" />
+ <result column="MONITOR_USERNAME" property="monitorUsername" jdbcType="CHAR" />
+ <result column="MONITOR_PASSWORD" property="monitorPassword" jdbcType="CHAR" />
<result column="CREATE_TIME" property="createTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="tableColumnList">
- ID,HOST_NAME, INFO_CONTENT, STATE,AREA_NUM,CREATE_TIME
+ ID,HOST_NAME, INFO_CONTENT, STATE,AREA_NUM,CREATE_TIME,MONITOR_ID,MONITOR_IP,MONITOR_USERNAME,MONITOR_PASSWORD
</sql>
<sql id="queryByParams">
@@ -96,15 +100,15 @@
<when test="_databaseId == 'oracle'">
begin
<foreach collection="list" item="item" index="index">
- INSERT INTO OSPF_INFO (ID,HOST_NAME,INFO_CONTENT,STATE,AREA_NUM,CREATE_TIME) VALUES
- (#{item.id},#{item.hostname},#{item.infoContent},#{item.state},#{item.areaNum},#{item.createTime});
+ INSERT INTO OSPF_INFO (ID,HOST_NAME,INFO_CONTENT,STATE,AREA_NUM,CREATE_TIME,MONITOR_IP,MONITOR_ID,MONITOR_USERNAME,MONITOR_PASSWORD) VALUES
+ (#{item.id},#{item.hostname},#{item.infoContent},#{item.state},#{item.areaNum},#{item.createTime},#{item.monitorIp},#{item.monitorId},#{item.monitorUsername},#{item.monitorPassword});
</foreach>
end;
</when>
<otherwise>
- INSERT INTO OSPF_INFO (ID,HOST_NAME,INFO_CONTENT,STATE,AREA_NUM,CREATE_TIME) VALUES
+ INSERT INTO OSPF_INFO (ID,HOST_NAME,INFO_CONTENT,STATE,AREA_NUM,CREATE_TIME,MONITOR_IP,MONITOR_ID,MONITOR_USERNAME,MONITOR_PASSWORD) VALUES
<foreach collection="list" item="item" index="index" separator="," >
- (#{item.id},#{item.hostname},#{item.infoContent},#{item.state},#{item.areaNum},#{item.createTime})
+ (#{item.id},#{item.hostname},#{item.infoContent},#{item.state},#{item.areaNum},#{item.createTime},#{item.monitorIp},#{item.monitorId},#{item.monitorUsername},#{item.monitorPassword})
</foreach>
</otherwise>
</choose>
@@ -118,6 +122,10 @@
<if test="infoContent != null">INFO_CONTENT,</if>
<if test="state != null" >STATE,</if>
<if test="areaNum != null" >AREA_NUM,</if>
+ <if test="monitorIp != null" >MONITOR_IP,</if>
+ <if test="monitorId != null" >MONITOR_ID,</if>
+ <if test="monitorUsername != null" >MONITOR_USERNAME,</if>
+ <if test="monitorPassword != null" >MONITOR_PASSWORD,</if>
<if test="createTime != null" >CREATE_TIME</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
@@ -126,6 +134,10 @@
<if test="infoContent != null" >#{infoContent},</if>
<if test="state != null" >#{state},</if>
<if test="areaNum != null" >#{areaNum},</if>
+ <if test="monitorIp != null" >#{monitorIp},</if>
+ <if test="monitorId != null" >#{monitorId},</if>
+ <if test="monitorUsername != null" >#{monitorUsername},</if>
+ <if test="monitorPassword != null" >#{monitorPassword},</if>
<if test="createTime != null" >#{createTime}</if>
</trim>
</insert>
@@ -178,6 +190,18 @@
<if test="createTime != null">
CREATE_TIME = #{createTime},
</if>
+ <if test="monitorIp != null">
+ MONITOR_IP = #{monitorIp},
+ </if>
+ <if test="monitorId != null">
+ MONITOR_ID = #{monitorId},
+ </if>
+ <if test="monitorUsername != null">
+ MONITOR_USERNAME = #{monitorUsername},
+ </if>
+ <if test="monitorPassword != null">
+ MONITOR_PASSWORD = #{monitorPassword},
+ </if>
</set>
WHERE ID = #{id}
</update>
diff --git a/src/main/resources/mybatis/mapper/OspfMonitorMapper.xml b/src/main/resources/mybatis/mapper/OspfMonitorMapper.xml
new file mode 100644
index 0000000..f383b5e
--- /dev/null
+++ b/src/main/resources/mybatis/mapper/OspfMonitorMapper.xml
@@ -0,0 +1,192 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.wgcloud.mapper.OspfMonitorMapper">
+ <resultMap id="resultMap" type="com.wgcloud.entity.OspfMonitor">
+ <id column="ID" property="id" jdbcType="CHAR" />
+ <result column="HOST_NAME" property="hostname" jdbcType="CHAR" />
+ <result column="INFO_CONTENT" property="infoContent" jdbcType="CHAR" />
+ <result column="STATE" property="state" jdbcType="CHAR" />
+ <result column="USERNAME" property="username" jdbcType="CHAR" />
+ <result column="PASSWORD" property="password" jdbcType="CHAR" />
+ <result column="CREATE_TIME" property="createTime" jdbcType="TIMESTAMP" />
+ </resultMap>
+
+ <sql id="tableColumnList">
+ ID,HOST_NAME, INFO_CONTENT, STATE,USERNAME,PASSWORD,CREATE_TIME
+ </sql>
+
+ <sql id="queryByParams">
+ <if test="hostname != null">
+ <choose>
+ <when test="_databaseId == 'oracle'">
+ <![CDATA[ AND HOST_NAME LIKE CONCAT(CONCAT('%',#{hostname}),'%') ]]>
+ </when>
+ <otherwise>
+ <![CDATA[ AND HOST_NAME LIKE CONCAT('%',#{hostname},'%') ]]>
+ </otherwise>
+ </choose>
+ </if>
+ <if test="hostnameNe != null">
+ <choose>
+ <when test="_databaseId == 'oracle'">
+ <![CDATA[ AND HOST_NAME NOT LIKE CONCAT(CONCAT('%',#{hostnameNe}),'%') ]]>
+ </when>
+ <otherwise>
+ <![CDATA[ AND HOST_NAME NOT LIKE CONCAT('%',#{hostnameNe},'%') ]]>
+ </otherwise>
+ </choose>
+ </if>
+ <if test="startTime != null and endTime !=null and startTime !='' and endTime != '' ">
+ <if test="_databaseId == 'mysql'">
+ <![CDATA[ AND CREATE_TIME >= #{startTime} and CREATE_TIME <=#{endTime}]]>
+ </if>
+ <if test="_databaseId == 'postgresql'">
+ <![CDATA[ AND CREATE_TIME >= cast(#{startTime} as timestamp) and CREATE_TIME <= cast(#{endTime} as timestamp)]]>
+ </if>
+ <if test="_databaseId == 'oracle'">
+ <![CDATA[ AND CREATE_TIME >= to_date(#{startTime},'yyyy-MM-dd hh24:mi:ss') and CREATE_TIME <= to_date(#{endTime},'yyyy-MM-dd hh24:mi:ss')]]>
+ </if>
+ </if>
+ <if test="state != null">
+ <![CDATA[ AND STATE = #{state} ]]>
+ </if>
+ <if test="areaNum != null">
+ <![CDATA[ AND AREA_NUM = #{areaNum} ]]>
+ </if>
+ </sql>
+
+
+ <select id="selectById" resultMap="resultMap" parameterType="java.lang.String">
+ SELECT
+ <include refid="tableColumnList" />
+ FROM OSPF_MONITOR WHERE ID=#{id}
+ </select>
+
+
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+ DELETE FROM OSPF_MONITOR WHERE ID = #{id}
+ </delete>
+
+ <delete id="deleteByDate" parameterType="map">
+ DELETE FROM OSPF_MONITOR WHERE
+ <if test="_databaseId == 'mysql'">
+ <![CDATA[ CREATE_TIME <=#{endTime}]]>
+ </if>
+ <if test="_databaseId == 'postgresql'">
+ <![CDATA[ CREATE_TIME <= cast(#{endTime} as timestamp)]]>
+ </if>
+ <if test="_databaseId == 'oracle'">
+ <![CDATA[ CREATE_TIME <= to_date(#{endTime},'yyyy-MM-dd hh24:mi:ss')]]>
+ </if>
+ </delete>
+
+
+ <delete id="deleteByAccHname" parameterType="map">
+ DELETE FROM OSPF_MONITOR WHERE ACCOUNT = #{account} AND HOST_NAME = #{hostname}
+ </delete>
+
+ <delete id="deleteById" parameterType="java.lang.String">
+ DELETE FROM OSPF_MONITOR WHERE ID IN
+ <foreach item="item" index="index" collection="array" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ </delete>
+
+ <insert id="insertList" parameterType="java.util.List" >
+ <choose>
+ <when test="_databaseId == 'oracle'">
+ begin
+ <foreach collection="list" item="item" index="index">
+ INSERT INTO OSPF_MONITOR (ID,HOST_NAME,INFO_CONTENT,STATE,USERNAME,PASSWORD,CREATE_TIME) VALUES
+ (#{item.id},#{item.hostname},#{item.infoContent},#{item.state},#{item.username},#{item.password},#{item.createTime});
+ </foreach>
+ end;
+ </when>
+ <otherwise>
+ INSERT INTO OSPF_MONITOR (ID,HOST_NAME,INFO_CONTENT,STATE,USERNAME,PASSWORD,CREATE_TIME) VALUES
+ <foreach collection="list" item="item" index="index" separator="," >
+ (#{item.id},#{item.hostname},#{item.infoContent},#{item.state},#{item.username},#{item.password},#{item.createTime})
+ </foreach>
+ </otherwise>
+ </choose>
+ </insert>
+
+ <insert id="save" parameterType="com.wgcloud.entity.OspfMonitor">
+ INSERT INTO OSPF_MONITOR
+ <trim prefix="(" suffix=")" suffixOverrides="," >
+ <if test="id != null" >ID,</if>
+ <if test="hostname != null" > HOST_NAME,</if>
+ <if test="infoContent != null">INFO_CONTENT,</if>
+ <if test="state != null" >STATE,</if>
+ <if test="username != null" >USERNAME,</if>
+ <if test="password != null" >PASSWORD,</if>
+ <if test="createTime != null" >CREATE_TIME</if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides="," >
+ <if test="id != null" >#{id},</if>
+ <if test="hostname != null" >#{hostname},</if>
+ <if test="infoContent != null" >#{infoContent},</if>
+ <if test="state != null" >#{state},</if>
+ <if test="username != null" >#{username},</if>
+ <if test="password != null" >#{password},</if>
+ <if test="createTime != null" >#{createTime}</if>
+ </trim>
+ </insert>
+
+
+ <select id="countByParams" parameterType="map" resultType="java.lang.Integer">
+ SELECT count(*) FROM OSPF_MONITOR t
+ <where>
+ <include refid="queryByParams" />
+ </where>
+ </select>
+
+
+ <select id="selectAllByParams" parameterType="map" resultMap="resultMap">
+ SELECT
+ <include refid="tableColumnList" />
+ FROM OSPF_MONITOR t
+ <where>
+ <include refid="queryByParams" />
+ </where>
+ ORDER BY CREATE_TIME DESC
+ </select>
+
+ <select id="selectByParams" parameterType="map" resultMap="resultMap">
+ SELECT
+ <include refid="tableColumnList" />
+ FROM OSPF_MONITOR
+ <where>
+ <include refid="queryByParams" />
+ </where>
+ ORDER BY CREATE_TIME DESC
+ </select>
+
+
+ <update id="updateById" parameterType="com.wgcloud.entity.OspfMonitor">
+ UPDATE OSPF_MONITOR
+ <set>
+ <if test="hostname != null">
+ HOST_NAME = #{hostname},
+ </if>
+ <if test="infoContent != null">
+ INFO_CONTENT = #{infoContent},
+ </if>
+ <if test="state != null">
+ STATE = #{state},
+ </if>
+ <if test="username != null">
+ USERNAME = #{username},
+ </if>
+ <if test="password != null">
+ PASSWORD = #{password},
+ </if>
+ <if test="createTime != null">
+ CREATE_TIME = #{createTime},
+ </if>
+ </set>
+ WHERE ID = #{id}
+ </update>
+
+
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/static/js/ospfInfo.js b/src/main/resources/static/js/ospfInfo.js
index 3cad2f6..0c03f02 100644
--- a/src/main/resources/static/js/ospfInfo.js
+++ b/src/main/resources/static/js/ospfInfo.js
@@ -10,6 +10,9 @@
function add() {
window.location.href = "/tssw/ospfInfo/edit";
}
+function edit(id){
+ window.location.href = "/tssw/ospfInfo/edit?id="+id;
+}
function del(id) {
if(confirm('浣犵‘瀹氳鍒犻櫎鍚楋紵鍚屾椂涔熷皢鍒犻櫎瀵瑰簲鐨刼spf鏁版嵁')) {
diff --git a/src/main/resources/static/js/ospfMonitor.js b/src/main/resources/static/js/ospfMonitor.js
new file mode 100644
index 0000000..eddfe93
--- /dev/null
+++ b/src/main/resources/static/js/ospfMonitor.js
@@ -0,0 +1,26 @@
+
+function view(id) {
+ window.location.href = "/tssw/ospfMonitor/edit?id="+id;
+}
+
+function searchByAccount() {
+ window.location.href = "/tssw/ospfMonitor/list?account="+$("#account").val();
+}
+
+function add() {
+ window.location.href = "/tssw/ospfMonitor/edit";
+}
+function edit(id){
+ window.location.href = "/tssw/ospfMonitor/edit?id="+id;
+}
+
+
+function del(id) {
+ if(confirm('浣犵‘瀹氳鍒犻櫎鍚楋紵鍚屾椂涔熷皢鍒犻櫎瀵瑰簲鐨刼spf鏁版嵁')) {
+ window.location.href = "/tssw/ospfMonitor/del?id=" + id;
+ }
+}
+
+function cancel(){
+ history.back();
+}
diff --git a/src/main/resources/templates/common/aside.html b/src/main/resources/templates/common/aside.html
index e369ca0..f94a063 100644
--- a/src/main/resources/templates/common/aside.html
+++ b/src/main/resources/templates/common/aside.html
@@ -273,6 +273,17 @@
</a>
</li>
<li class="nav-item">
+ <th:block th:if="${session.menuActive eq '64'}">
+ <a th:href="@{'/ospfMonitor/list'}" class="nav-link active">
+ </th:block>
+ <th:block th:unless="${session.menuActive eq '64'}">
+ <a th:href="@{'/ospfMonitor/list'}" class="nav-link">
+ </th:block>
+ <i class="far fa-circle nav-icon"></i>
+ <p>OSPF涓荤洃娴�</p>
+ </a>
+ </li>
+ <li class="nav-item">
<th:block th:if="${session.menuActive eq '63'}">
<a th:href="@{'/ospfInfo/list'}" class="nav-link active">
</th:block>
@@ -280,9 +291,10 @@
<a th:href="@{'/ospfInfo/list'}" class="nav-link">
</th:block>
<i class="far fa-circle nav-icon"></i>
- <p>OSPF鐩戞祴</p>
+ <p>OSPF琚洃娴�</p>
</a>
</li>
+
</ul>
</li>
diff --git a/src/main/resources/templates/ospfInfo/add.html b/src/main/resources/templates/ospfInfo/add.html
index 7c40259..b4384c9 100644
--- a/src/main/resources/templates/ospfInfo/add.html
+++ b/src/main/resources/templates/ospfInfo/add.html
@@ -56,12 +56,19 @@
</div>
<div class="form-group">
<label><font color="red">*</font>OSPF鍖哄煙鍙�</label>
- <input type="text" autocomplete="off" th:value="${ospfInfo.areaNum}" class="validate[required,maxSize[50]] form-control" name="areaNum" id="areaNum" placeholder="濡�0">
+ <input type="text" autocomplete="off" th:value="${ospfInfo.areaNum}" class="validate[maxSize[50]] form-control" name="areaNum" id="areaNum" placeholder="濡�0">
</div>
<div class="form-group">
<label>鎻忚堪</label>
<input type="text" autocomplete="off" th:value="${ospfInfo.infoContent}" class="validate[maxSize[50]] form-control" name="infoContent" id="infoContent" placeholder="濡備氦鎹㈡満01">
</div>
+ <div class="form-group">
+ <label><font color="red">*</font>鐩戞祴涓昏澶�</label>
+ <select class="validate[required] form-control" name="monitorId" id="monitorId">
+ <option value="" label="璇烽�夋嫨"></option>
+ <option th:each="item: ${monitors}" th:value="${item.id}" th:text="${item.infoContent}" th:selected="${ospfInfo !=null}?${item.id eq ospfInfo.monitorId}">
+ </select>
+ </div>
</div>
<!-- /.card-body -->
diff --git a/src/main/resources/templates/ospfInfo/list.html b/src/main/resources/templates/ospfInfo/list.html
index 7fb3707..88bf711 100644
--- a/src/main/resources/templates/ospfInfo/list.html
+++ b/src/main/resources/templates/ospfInfo/list.html
@@ -38,7 +38,7 @@
<div class="col-md-12">
<div class="card">
<div class="card-header">
- <h3 class="card-title"><i class="nav-icon fa fa-cloud"></i> OSPF璁惧鐩戞祴鍒楄〃</h3>
+ <h3 class="card-title"><i class="nav-icon fa fa-cloud"></i> OSPF琚澶囩洃娴嬪垪琛�</h3>
<div class=" float-sm-right">
<!-- SEARCH FORM -->
<form class="form-inline ml-3" th:action="@{'/ospfInfo/list'}">
diff --git a/src/main/resources/templates/ospfMonitor/add.html b/src/main/resources/templates/ospfMonitor/add.html
new file mode 100644
index 0000000..1ca8e80
--- /dev/null
+++ b/src/main/resources/templates/ospfMonitor/add.html
@@ -0,0 +1,107 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <div th:replace="common/header.html"></div>
+
+
+</head>
+<body th:class="${application.sidebarCollapse}">
+<div th:replace="common/chart.html"></div>
+
+<div class="wrapper">
+
+ <div th:replace="common/navbar.html"></div>
+
+ <div th:replace="common/aside.html"></div>
+
+ <!-- Content Wrapper. Contains page content -->
+ <div class="content-wrapper" style="font-size:0.90rem">
+ <!-- Content Header (Page header) -->
+ <section class="content-header">
+ <div class="container-fluid">
+ <div class="row mb-2">
+ <div class="col-sm-6">
+ <h1></h1>
+ </div>
+ <div class="col-sm-6">
+ <ol class="breadcrumb float-sm-right">
+ <li class="breadcrumb-item active"></li>
+ </ol>
+ </div>
+ </div>
+ </div><!-- /.container-fluid -->
+ </section>
+
+ <!-- Main content -->
+ <section class="content">
+ <div class="container-fluid">
+ <div class="row">
+
+ <div class="col-md-10">
+ <div class="card card-primary">
+ <div class="card-header">
+ <h3 class="card-title">娣诲姞OSPF涓荤洃娴嬭澶囦俊鎭�</h3>
+ <div class=" float-sm-right">
+ <a href="javascript:history.back()">杩斿洖</a>
+ </div>
+ </div>
+ <!-- /.card-header -->
+ <!-- form start -->
+ <form role="form" id="form1" th:action="@{'/ospfMonitor/save'}">
+ <input type="hidden" name="id" th:value="${ospfMonitor.id}"/>
+ <div class="card-body">
+ <div class="form-group">
+ <label><font color="red">*</font>璁惧IP</label>
+ <input type="text" autocomplete="off" th:value="${ospfMonitor.hostname}" class="validate[required,maxSize[50]] form-control" name="hostname" id="hostname" placeholder="杈撳叆IP">
+ </div>
+ <div class="form-group">
+ <label>鎻忚堪</label>
+ <input type="text" autocomplete="off" th:value="${ospfMonitor.infoContent}" class="validate[required,maxSize[50]] form-control" name="infoContent" id="infoContent" placeholder="濡備氦鎹㈡満01">
+ </div>
+ <div class="form-group">
+ <label>鐢ㄦ埛鍚�</label>
+ <input type="text" autocomplete="off" th:value="${ospfMonitor.username}" class="validate[required,maxSize[50]] form-control" name="username" id="username" placeholder="">
+ </div>
+ <div class="form-group">
+ <label>瀵嗙爜</label>
+ <input type="text" autocomplete="off" th:value="${ospfMonitor.password}" class="validate[required,maxSize[50]] form-control" name="password" id="password" placeholder="">
+ </div>
+ </div>
+ <!-- /.card-body -->
+
+ <div class="card-footer">
+ <button type="submit" class="btn btn-primary btn-sm" style="margin-right:10px;">淇� 瀛�</button>
+ <button type="button" th:onclick="goback()" class="btn bg-gradient-danger btn-sm">杩� 鍥�</button>
+ </div>
+
+ </form>
+ <!-- /.card-body -->
+ </div>
+ <!-- /.card -->
+
+
+ </div>
+
+ </div>
+ </div>
+ </section>
+ </div>
+
+
+ <div th:replace="common/footer.html"></div>
+
+</div>
+<!-- ./wrapper -->
+<link rel="stylesheet" th:href="@{'/static/js/jQuery/validationEngine.jquery.css'}" type="text/css"/>
+<script th:src="@{'/static/js/jQuery/jquery.validationEngine-zh_CN.js'}" type="text/javascript" charset="utf-8"></script>
+<script th:src="@{'/static/js/jQuery/jquery.validationEngine.js'}" type="text/javascript" charset="utf-8"></script>
+<script th:inline="javascript">
+ $(document).ready(function(){
+ $("#form1").validationEngine();
+ });
+ function goback() {
+ history.back();
+ }
+</script>
+</body>
+</html>
diff --git a/src/main/resources/templates/ospfMonitor/list.html b/src/main/resources/templates/ospfMonitor/list.html
new file mode 100644
index 0000000..4a5dfc1
--- /dev/null
+++ b/src/main/resources/templates/ospfMonitor/list.html
@@ -0,0 +1,122 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <div th:replace="common/header.html"></div>
+
+
+</head>
+<body th:class="${application.sidebarCollapse}">
+<div th:replace="common/chart.html"></div>
+
+<div class="wrapper">
+
+ <div th:replace="common/navbar.html"></div>
+
+ <div th:replace="common/aside.html"></div>
+
+ <!-- Content Wrapper. Contains page content -->
+ <div class="content-wrapper" style="font-size:0.90rem">
+ <!-- Content Header (Page header) -->
+ <section class="content-header" style="height:38px">
+ <div class="container-fluid">
+ <div class="row mb-2" style="margin-top: -7px;">
+ <div class="col-sm-6"></div>
+ <div class="col-sm-6">
+ <ol class="breadcrumb float-sm-right">
+ <li class="breadcrumb-item"><a href="javascript:history.back()">杩斿洖涓婄骇</a></li>
+ </ol>
+ </div>
+ </div>
+ </div><!-- /.container-fluid -->
+ </section>
+
+ <!-- Main content -->
+ <section class="content">
+ <div class="container-fluid">
+ <div class="row">
+
+ <div class="col-md-12">
+ <div class="card">
+ <div class="card-header">
+ <h3 class="card-title"><i class="nav-icon fa fa-cloud"></i> OSPF涓荤洃娴嬭澶囧垪琛�</h3>
+ <div class=" float-sm-right">
+ <!-- SEARCH FORM -->
+ <form class="form-inline ml-3" th:action="@{'/ospfMonitor/list'}">
+ <th:block th:if="${session.LOGIN_KEY.role != 'guest'}">
+ <button type="button" onclick="add()" class="btn btn-primary btn-sm" style="margin-right:5px;">娣诲姞</button>
+ </th:block>
+ <div class="input-group input-group-sm">
+ <input class="form-control" id="hostname" name="hostname" autocomplete="off" th:value="${ospfMonitor.hostname}" type="text" placeholder="杈撳叆璁惧IP">
+ <div class="input-group-append">
+ <button class="btn btn-primary" type="submit">
+ <i class="fas fa-search"></i>
+ </button>
+ </div>
+ </div>
+ </form>
+ </div>
+ </div>
+ <!-- /.card-header -->
+ <div class="card-body">
+ <table class="table table-bordered table-hover">
+ <thead>
+ <tr>
+ <th style="width: 20px"> <input type="checkbox" value="" name="checkall" id="checkall"></th>
+ <th style="width: 60px">搴忓彿</th>
+ <th title="鎻忚堪">鎻忚堪</th>
+ <th title="璁惧IP">璁惧IP</th>
+ <th title="鐢ㄦ埛鍚�">鐢ㄦ埛鍚�</th>
+ <th title="瀵嗙爜">瀵嗙爜</th>
+ </tr>
+ </th:block>
+ </thead>
+ <tbody>
+ <th:block th:each="item,iterStat : ${page.list}">
+ <tr>
+ <td><input type="checkbox" th:value="${item.id}" name="todo2" th:id="${item.id}+'_check'"/></td>
+ <td th:text="${iterStat.index+1}">1</td>
+ <td th:text="${item.infoContent}"><span th:text="${#strings.abbreviate(item.infoContent,20)}"></span></td>
+ <td th:text="${item.hostname}"></td>
+ <td th:text="${item.username}"></td>
+ <td th:text="${item.password}"></td>
+ <td>
+ <th:block th:if="${session.LOGIN_KEY.role != 'guest'}">
+ <button type="button" th:onclick="del([[${item.id}]])" class="btn bg-gradient-danger btn-sm">鍒犻櫎</button>
+ <button type="button" th:onclick="edit([[${item.id}]])" class="btn bg-gradient-primary btn-sm">缂栬緫</button>
+ </th:block>
+ </td>
+ </th:block>
+ </tbody>
+ </table>
+ </div>
+ <!-- /.card-body -->
+ <div th:replace="common/page.html"></div>
+ </div>
+ <!-- /.card -->
+
+
+ </div>
+
+ </div>
+ </div>
+ </section>
+ </div>
+
+
+ <div th:replace="common/footer.html"></div>
+ <script th:src="@{'/static/js/jQuery/jquery.form.min.js'}" type="text/javascript" charset="utf-8"></script>
+
+</div>
+<!-- ./wrapper -->
+
+<script th:src="@{'/static/js/ospfMonitor.js?v=3.3.9'}"></script>
+<script th:inline="javascript">
+
+ var msg = [[${msg}]];
+ if(msg!='' && msg!=null){
+ toastr.info(msg);
+ }
+</script>
+
+</body>
+</html>
diff --git a/src/main/resources/templates/ospfMonitor/view.html b/src/main/resources/templates/ospfMonitor/view.html
new file mode 100644
index 0000000..50a7fe2
--- /dev/null
+++ b/src/main/resources/templates/ospfMonitor/view.html
@@ -0,0 +1,279 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <div th:replace="common/header.html"></div>
+
+
+</head>
+<body th:class="${application.sidebarCollapse}">
+<div th:replace="common/chart.html"></div>
+
+<div class="wrapper">
+
+ <div th:replace="common/navbar.html"></div>
+
+ <div th:replace="common/aside.html"></div>
+
+ <!-- Content Wrapper. Contains page content -->
+ <div class="content-wrapper" style="font-size:0.90rem">
+ <!-- Content Header (Page header) -->
+ <section class="content-header">
+ <div class="container-fluid">
+ <div class="row mb-2">
+ <div class="col-sm-6">
+ <h1></h1>
+ </div>
+ <div class="col-sm-6">
+ <ol class="breadcrumb float-sm-right">
+ <li class="breadcrumb-item active"></li>
+ </ol>
+ </div>
+ </div>
+ </div><!-- /.container-fluid -->
+ </section>
+
+ <!-- Main content -->
+ <section class="content">
+ <div class="container-fluid">
+ <div class="row">
+
+ <div class="col-md-12">
+ <div class="card card-primary">
+ <div class="card-header">
+ <h3 class="card-title">OSPF涓昏澶囩洃娴嬩俊鎭�</h3>
+ <div class=" float-sm-right">
+ <a href="javascript:history.back()">杩斿洖</a>
+ </div>
+ </div>
+ <!-- /.card-header -->
+ <!-- form start -->
+ <form role="form">
+ <div class="card-body">
+ <div class="form-group">
+ <label>璁惧IP</label>
+ <div><span th:text="${snmpMonitor.hostname}"></span></div>
+ </div>
+ </div>
+ <!-- /.card-body -->
+ </form>
+ <!-- /.card-body -->
+
+ <div class="row">
+ <div class="col-12 table-responsive">
+ <table class="table table-striped"><tbody><tr>
+ <th:block th:each="item : ${amList}">
+ <th:block th:if="${item.code eq am}">
+ <td width="2%" style="vertical-align:bottom;"> <button type="button" title="褰撳墠宸叉樉绀鸿鏃堕棿娈靛浘琛�" class="btn btn-block btn-outline-danger btn-sm disabled" th:text="${item.msg}">Primary</button></td>
+ </th:block>
+ <th:block th:unless="${item.code eq am}">
+ <td width="2%" style="vertical-align:bottom;"> <button type="button" th:onclick="viewDate([[${snmpInfo.id}]],[[${item.code}]])" class="btn btn-block btn-outline-primary btn-sm" th:text="${item.msg}">Primary</button></td>
+ </th:block>
+ </th:block>
+
+ <td width="10%">
+ <form class="form-inline ml-3 float-sm-right" action="/tssw/snmpInfo/view">
+ <input type="hidden" name="id" th:value="${snmpMonitor.id}"/>
+ <div class="input-group input-group-sm">
+ <input type="text" autocomplete="off" value="" class="validate[maxSize[50]] form-control" th:value="${startTime}" name="startTime" id="startTime" placeholder="寮�濮嬫椂闂�" style="margin-right:5px;">
+ <label style="margin-right:5px;">鑷�</label>
+ <input type="text" autocomplete="off" value="" class="validate[maxSize[50]] form-control" th:value="${endTime}" name="endTime" id="endTime" placeholder="缁撴潫鏃堕棿" style="margin-right:5px;">
+ <button type="submit" class="btn btn-primary btn-sm" style="margin-right:5px;">鏌ヨ</button>
+ <button type="button" onclick="resetParam()" class="btn bg-danger btn-sm" style="margin-right:5px;">閲嶇疆</button>
+ </div>
+ </form>
+ </td>
+ <td width="2%" style="vertical-align:bottom;text-align: right"><button type="button" th:onclick="excelExport([[${snmpMonitor.id}]],[[${am}]])" class="btn btn-primary btn-sm">瀵煎嚭Excel</button></td>
+ </tr></tbody></table>
+ </div>
+ <!-- /.col -->
+ </div>
+
+ </div>
+ <!-- /.card -->
+
+
+ </div>
+
+ </div>
+ </div>
+ </section>
+ </div>
+
+
+ <div th:replace="common/footer.html"></div>
+
+</div>
+<!-- ./wrapper -->
+
+<script th:src="@{'/static/js/snmp.js?v=3.4.1'}"></script>
+
+
+<script th:inline="javascript">
+ var startTimeResponse =[[${startTime}]];
+ var endTimeResponse =[[${endTime}]];
+ $(document).ready(function(){
+ var startTime = $('#startTime');
+ if(startTime!=null && startTime != undefined){
+ startTime.daterangepicker({
+ singleDatePicker: true,
+ timePicker: true,
+ timePicker24Hour : true,
+ "opens": "center",
+ "locale": {
+ format: 'YYYY-MM-DD HH:mm',
+ applyLabel: "搴旂敤",
+ cancelLabel: "鍙栨秷",
+ daysOfWeek: ['鏃�', '涓�', '浜�', '涓�', '鍥�', '浜�', '鍏�'],
+ monthNames: ['涓�鏈�', '浜屾湀', '涓夋湀', '鍥涙湀', '浜旀湀', '鍏湀', '涓冩湀', '鍏湀', '涔濇湀', '鍗佹湀', '鍗佷竴鏈�', '鍗佷簩鏈�'],
+ }
+ });
+ if(startTimeResponse=='' || startTimeResponse==null){
+ startTime.val("");
+ }
+ }
+
+ var endTime = $('#endTime');
+ if(endTime!=null && endTime != undefined){
+ endTime.daterangepicker({
+ singleDatePicker: true,
+ timePicker: true,
+ timePicker24Hour : true,
+ "opens": "center",
+ "locale": {
+ format: 'YYYY-MM-DD HH:mm',
+ applyLabel: "搴旂敤",
+ cancelLabel: "鍙栨秷",
+ daysOfWeek: ['鏃�', '涓�', '浜�', '涓�', '鍥�', '浜�', '鍏�'],
+ monthNames: ['涓�鏈�', '浜屾湀', '涓夋湀', '鍥涙湀', '浜旀湀', '鍏湀', '涓冩湀', '鍏湀', '涔濇湀', '鍗佹湀', '鍗佷竴鏈�', '鍗佷簩鏈�'],
+ }
+ });
+ if(endTimeResponse=='' || endTimeResponse==null){
+ endTime.val("");
+ }
+ }
+ });
+
+ function resetParam(){
+ $("#startTime").val("");
+ $("#endTime").val("");
+ }
+
+ var snmpStateJson =[[${snmpStateList}]];
+ $(function() {
+ var chart = new G2.Chart({
+ container: 'snmpStateJson',
+ forceFit: true,
+ height: 400,
+ padding: [30, 40, 70, 48]
+ });
+ chart.axis('dateStr', {
+ label: {
+ textStyle: {
+ fill: '#aaaaaa'
+ }
+ }
+ });
+ chart.axis('sentAvgDouble', false);
+ chart.tooltip({
+ crosshairs: false
+ });
+ chart.legend({
+ position: 'top-center'
+ });
+ chart.source(snmpStateJson, {
+ recvAvgDouble: {
+ alias: '鍏ュ彛MB/绉�',
+ min: 0,
+ max: [[${snmpAvgMax}]]
+ },
+ sentAvgDouble: {
+ alias: '鍑哄彛MB/绉�',
+ min: 0,
+ max: [[${snmpAvgMax}]]
+ }
+ });
+ chart.scale('dateStr',{tickCount: 12,alias: '鏃堕棿'});
+ chart.line().position('dateStr*recvAvgDouble').color('#1890ff');
+ chart.line().position('dateStr*sentAvgDouble').color('#2fc25b');
+ chart.render();
+
+ var chartCpuPer = new G2.Chart({
+ container: 'cpuStateJson',
+ forceFit: true,
+ height: 400,
+ padding: [30, 40, 70, 40]
+ });
+ chartCpuPer.axis('dateStr', {
+ label: {
+ textStyle: {
+ fill: '#aaaaaa'
+ }
+ }
+ });
+ chartCpuPer.axis('cpuPerDouble', {
+ label: {
+ textStyle: {
+ fill: '#aaaaaa'
+ }
+ }
+ });
+ chartCpuPer.tooltip({
+ crosshairs: false
+ });
+ chartCpuPer.legend({
+ position: 'top-center'
+ });
+ chartCpuPer.source(snmpStateJson, {
+ cpuPerDouble: {
+ alias: 'cpu浣跨敤鐜�%'
+ }
+ });
+ chartCpuPer.scale('dateStr',{tickCount: 12,alias: '鏃堕棿'});
+ chartCpuPer.line().position('dateStr*cpuPerDouble').color('#1890ff');
+ chartCpuPer.render();
+
+ var chartMem = new G2.Chart({
+ container: 'memStateJson',
+ forceFit: true,
+ height: 400,
+ padding: [30, 40, 70, 40]
+ });
+ chartMem.axis('dateStr', {
+ label: {
+ textStyle: {
+ fill: '#aaaaaa'
+ }
+ }
+ });
+ chartMem.axis('memPerDouble', {
+ label: {
+ textStyle: {
+ fill: '#aaaaaa'
+ }
+ }
+ });
+ chartMem.tooltip({
+ crosshairs: false
+ });
+ chartMem.legend({
+ position: 'top-center'
+ });
+ chartMem.source(snmpStateJson, {
+ memPerDouble: {
+ alias: '浣跨敤鐜�%'
+ }
+ });
+ chartMem.scale('dateStr', {tickCount: 12, alias: '鏃堕棿'});
+ chartMem.line().position('dateStr*memPerDouble').color('#8B78F6');
+ chartMem.render();
+ })
+
+ var msg = [[${msg}]];
+ if(msg!='' && msg!=null){
+ toastr.info(msg);
+ }
+</script>
+
+
+</body>
+</html>
--
Gitblit v1.9.1