From 929cde984d9283eb13379fe3e6acc000785d3d0f Mon Sep 17 00:00:00 2001 From: liman <2912882908@qq.com> Date: Tue, 10 Dec 2024 15:37:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20UI=E7=95=8C=E9=9D=A2=E4=BC=98=E5=8C=96?= =?UTF-8?q?=20-=20=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TODOLIST.md | 63 ++++++++- master/static/css/page.css | 6 - master/static/js/home.js | 197 +++++++++++++++++++++++++++- master/views/page/home.html | 64 +++++++-- master/views/public/__header__.html | 37 ++++-- 5 files changed, 340 insertions(+), 27 deletions(-) diff --git a/TODOLIST.md b/TODOLIST.md index f3daa46..57291c6 100755 --- a/TODOLIST.md +++ b/TODOLIST.md @@ -77,7 +77,11 @@ - 增加代码可读性 [ok] - 代码评审和优化 [ok] -- UI界面优化 +- UI界面优化 - 面板 [ok] +- UI界面优化 - 监测器 +- UI界面优化 - 监测报警 +- UI界面优化 - 请求调试 +- UI界面优化 - 工具 - 交互逻辑优化 - [优化]面板数据加载很慢 - 修改bug @@ -146,6 +150,63 @@ created by website-monitor/monitor/business.Initialize in goroutine 1 D:/go/src/github.com/mangenotwork/website-monitor/monitor/business/base.go:42 +0x59 exit status 2 ``` +20. master panic +```azure +024-12-10 15:20:16.895 [Error] mangenotwork/gathertool@v0.4.7/context.go:247 | 【日志】 请求 err = Get "https://www.doubao.com/": dial tcp: lookup www.doubao.com: no such host +2024-12-10 15:20:16.895 [INFO] master/dao/dns.go:16 | NsLookUpLocal... +2024-12-10 15:20:16.895 [ERROR] master/dao/dns.go:30 | lookup www.doubao.com/: no such host +2024-12-10 15:20:16.896 [ERROR] master/dao/dns.go:38 | lookup www.doubao.com/: dnsquery: DNS name contains an invalid character. + + +2024/12/10 15:20:16 [Recovery] 2024/12/10 - 15:20:16 panic recovered: +GET /api/tool/website/collectInfo?host=https://www.doubao.com/ HTTP/1.1 +Host: 127.0.0.1:18888 +Accept: application/json, text/javascript, */*; q=0.01 +Accept-Encoding: gzip, deflate, br, zstd +Accept-Language: zh-CN,zh;q=0.9 +Connection: keep-alive +Cookie: browseKey_o6i66X0=f9f47022c7a777c4; browseSign_o6i66X0=803843fbacc25655efe006543c869752; sign=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFeHBpcmUiOjE3MzM0NTIyNzAsIm5hbWUiOiJhZG1pbiJ9.c0KTOAmLpWL3pPThH_9l_rOIXIhHUD79HilZHzlOW4A +Referer: http://127.0.0.1:18888/home +Sec-Ch-Ua: "Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24" +Sec-Ch-Ua-Mobile: ?0 +Sec-Ch-Ua-Platform: "Windows" +Sec-Fetch-Dest: empty +Sec-Fetch-Mode: cors +Sec-Fetch-Site: same-origin +User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 +X-Requested-With: XMLHttpRequest + + +runtime error: invalid memory address or nil pointer dereference +D:/go1.22.2/src/runtime/panic.go:261 (0xe24be6) + panicmem: panic(memoryError) +D:/go1.22.2/src/runtime/signal_windows.go:401 (0xe24bb6) + sigpanic: panicmem() +D:/go/src/github.com/mangenotwork/website-monitor/master/dao/whois.go:36 (0x142844a) + whois: _, _ = conn.Write([]byte(host + " \r\n")) +D:/go/src/github.com/mangenotwork/website-monitor/master/dao/whois.go:21 (0x14282b9) + Whois: rootRse := whois(RootWhoisServers, host) +D:/go/src/github.com/mangenotwork/website-monitor/master/dao/website.go:278 (0x14268de) + (*websiteDao).Collect: info.Whois = Whois(host) +D:/go/src/github.com/mangenotwork/website-monitor/master/handler/api.go:295 (0x15a1a5a) + CollectWebSite: data := dao.NewWebsite().Collect(host) +D:/go/pkg/mod/github.com/mangenotwork/common@v0.1.3/ginHelper/rw.go:25 (0x15ace29) + API.Handle.func39: h(ctx) +D:/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0x157b28a) + (*Context).Next: c.handlers[c.index](c) +D:/go/src/github.com/mangenotwork/website-monitor/master/routers/base.go:182 (0x15ae554) + API.AuthAPI.func1: c.Next() +D:/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0x15a8db5) + (*Context).Next: c.handlers[c.index](c) +D:/go/pkg/mod/github.com/gin-contrib/gzip@v0.0.6/handler.go:60 (0x15a8d9d) + (*gzipHandler).Handle: c.Next() +D:/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0x1588239) + (*Context).Next: c.handlers[c.index](c) +D:/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/recovery.go:102 (0x1588227) + CustomRecoveryWithWriter.func1: c.Next() +D:/go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0x158737c) +``` + diff --git a/master/static/css/page.css b/master/static/css/page.css index 74713cc..902fd92 100755 --- a/master/static/css/page.css +++ b/master/static/css/page.css @@ -1,5 +1,4 @@ body { - font-size: .875rem; padding-bottom: 20px; } @@ -91,10 +90,6 @@ body { box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25); } -.navbar { - margin-bottom: 20px; -} - .navbar .navbar-toggler { top: .25rem; right: 1rem; @@ -201,7 +196,6 @@ thead tr th { .form-signin { padding-top: 120px; max-width: 330px; - } .form-signin .form-floating:focus-within { diff --git a/master/static/js/home.js b/master/static/js/home.js index 1f4ceb1..3c963f9 100755 --- a/master/static/js/home.js +++ b/master/static/js/home.js @@ -165,6 +165,30 @@ const app = createApp({ api: "/api/monitor/list", list: [], }, + objFidWebsiteInfo: { + id: FidWebsiteInfo, + host: "", + api: function (){ return "/api/tool/website/collectInfo?host=" + this.host; }, + rse: {}, + }, + history: { + add: function (id, value) { return "/api/tool/history?toolID="+id+"&value="+value; }, + get: function (id) { return "/api/tool/history?toolID="+id; }, + clear: function (id) {return "/api/tool/history/clear?toolID="+id; }, + data: [], + }, + objFidNsLookUp: { + id: FidNsLookUp, + host: "", + api: function (){ return "/api/tool/nsLookUp/all?host=" + this.host; }, + rse: {}, + }, + objFidWhois: { + id: FidWhois, + host: "", + api: function (){ return "/api/tool/whois?host=" + this.host; }, + rse: {}, + }, } }, created:function(){ @@ -193,20 +217,24 @@ const app = createApp({ t.alertList.len = t.alertList.list.length; }); }, + refreshAlertList: function () { let t = this; t.getAlertList(); }, + getMonitorList: function () { let t = this; common.AjaxGet(t.monitor.api, function (data) { t.monitor.list = data.data; }); }, + refreshMonitorList: function () { let t = this; t.getMonitorList(); }, + getMonitorErrList: function () { let t = this; common.AjaxGet(t.monitorErrList.api, function (data){ @@ -214,11 +242,13 @@ const app = createApp({ t.monitorErrList.len = t.monitorErrList.list.length; }); }, + monitorErrClear: function () { let t = this; t.isOk = "monitorErrClear"; $("#isOkModal").modal("show"); }, + monitorErrClearSubmit: function () { let t = this; common.AjaxGet(t.monitorErrList.clear, function (data){ @@ -227,6 +257,7 @@ const app = createApp({ $("#isOkModal").modal('toggle'); }); }, + gotoList: function (pg) { let t = this; t.websiteList.page = pg; @@ -242,6 +273,7 @@ const app = createApp({ t.getUriPoint(); $("#setUriModal").modal('show'); }, + getUriPoint: function () { let t = this; common.AjaxGet(t.point.apiList(), function (data){ @@ -251,6 +283,7 @@ const app = createApp({ } }); }, + addUriPoint: function () { let t = this; if (t.point.nowUri === "") { @@ -263,6 +296,7 @@ const app = createApp({ t.getUriPoint(); }); }, + gotoUriPoint: function (hostId, uri) { let t = this; t.point.hostId = hostId; @@ -272,6 +306,7 @@ const app = createApp({ t.getUriPoint(); }); }, + delUriPoint: function (uri) { let t = this; t.point.param.uri = uri; @@ -280,6 +315,7 @@ const app = createApp({ t.getUriPoint(); }); }, + openWebsiteInfo: function (id) { let t = this; t.websiteInfo.hostId = id; @@ -293,6 +329,7 @@ const app = createApp({ } }); }, + refreshWebsiteInfo: function (host, id) { let t = this; t.websiteInfo.host = host; @@ -305,9 +342,11 @@ const app = createApp({ } }); }, + gotoWebsite: function (item) { window.open(item.host, '_blank'); }, + logShow: function (item) { let t = this; t.monitorLog.hostId = item.hostID; @@ -324,6 +363,7 @@ const app = createApp({ } }); }, + loadLog: function () { let t = this; common.AjaxGet(t.monitorLog.loadApi(), function (data){ @@ -335,10 +375,12 @@ const app = createApp({ } }); }, + uploadLog: function () { let t = this; window.location = t.monitorLog.logUpload(); }, + deleteWebsiteOpen: function (item) { let t = this; t.deleteWebsite.hostId = item.hostID; @@ -346,6 +388,7 @@ const app = createApp({ t.isOk = "deleteWebsite"; $("#isOkModal").modal("show"); }, + deleteWebsiteSubmit: function () { let t = this; common.AjaxGet(t.deleteWebsite.api(), function (data){ @@ -355,6 +398,7 @@ const app = createApp({ location.reload(); }); }, + openEditWebsiteConf: function (hostId) { let t = this; t.editWebsiteConf.hostId = hostId; @@ -405,6 +449,7 @@ const app = createApp({ $("#setAlertModal").modal('toggle'); }) }, + openWebsiteUrl: function (item) { let t =this; t.websiteUrl.hostId = item.hostID; @@ -413,6 +458,7 @@ const app = createApp({ $("#urlInfoModal").modal("show"); }); }, + copy: function () { let t = this; let clipboard = new ClipboardJS('.copy'); @@ -424,6 +470,7 @@ const app = createApp({ common.ToastShow("复制失败!请重试或者手动复制内容!"); }); }, + openChart: function (item){ let t = this; t.chartData.hostId = item.hostID; @@ -439,6 +486,7 @@ const app = createApp({ ); $("#chartModal").modal("show"); }, + loadingChart: function () { let t = this; t.$nextTick(() => { @@ -446,6 +494,7 @@ const app = createApp({ } ); }, + DrawChart: function () { let t = this; common.AjaxGetNotAsync(t.chartData.api(), function (data) { @@ -505,6 +554,7 @@ const app = createApp({ // 使用刚指定的配置项和数据显示图表。 myChart.setOption(option); }, + openAlert: function (id) { let t = this; t.websiteAlert.hostId = id; @@ -514,6 +564,7 @@ const app = createApp({ }); $("#alertModal").modal("show"); }, + delAlert: function (id, hostId) { let t = this; common.AjaxGet(t.websiteAlert.del(id), function (data) { @@ -522,7 +573,151 @@ const app = createApp({ t.openAlert(hostId); } }); - } + }, + + submitFidWebsiteInfo: function () { + let t = this; + if (t.objFidWebsiteInfo.host === "") { + common.ToastShow("请输入Host!"); + return + } + $("#FidWebsiteInfoRse").hide(); + $("#FidWebsiteInfoLoading").show(); + common.AjaxGet(t.objFidWebsiteInfo.api(), function (data){ + t.objFidWebsiteInfo.rse = data.data; + $("#FidWebsiteInfoRse").show(); + $("#FidWebsiteInfoLoading").hide(); + t.setHistory(t.objFidWebsiteInfo.id, t.objFidWebsiteInfo.host); + t.getHistory(t.objFidWebsiteInfo.id); + }); + }, + + gotoFidWebsiteInfo: function (value) { + let t = this; + t.objFidWebsiteInfo.host = value; + t.submitFidWebsiteInfo(); + }, + + clearFidWebsiteInfoHistory: function () { + let t = this; + t.clearHistory(t.objFidWebsiteInfo.id); + t.getHistory(t.objFidWebsiteInfo.id); + }, + + getHistory: function (id) { + let t = this; + common.AjaxGet(t.history.get(id), function (data){ + t.history.data = data.data; + }); + }, + + setHistory: function (id, value) { + let t = this; + common.AjaxPost(t.history.add(id, value), "", function (data){ + console.log(data) + }); + }, + + clearHistory: function (id) { + let t = this; + common.AjaxGet(t.history.clear(id), function (data){ + t.history.data = data.data; + }); + }, + + open: function (fid) { + let t = this; + t.getHistory(fid); + switch (fid) { + // 获取网站的T, D, K, 图标 + case FidWebsiteTDKI : + $("#FidWebsiteTDKIModal").modal("show"); + break; + // ip信息查询 + case FidIp : + $("#FidIpModal").modal("show"); + break; + // 查询dns + case FidNsLookUp : + $("#FidNsLookUpModal").modal("show"); + break; + // Whois查询 + case FidWhois : + $("#FidWhoisModal").modal("show"); + break; + // 查询备案 + case FidICP : + $("#FidICPModal").modal("show"); + break; + // 在线ping + case FidPing : + $("#FidPingModal").modal("show"); + break; + // 获取证书 + case FidSSL : + $("#FidSSLModal").modal("show"); + break; + // 网站信息获取 + case FidWebsiteInfo : + $("#FidWebsiteInfoModal").modal("show"); + break; + } + }, + + submitFidNsLookUp: function () { + let t = this; + if (t.objFidNsLookUp.host === "") { + common.ToastShow("请输入Host!"); + return + } + $("#FidNsLookUpRse").hide(); + $("#FidNsLookUpLoading").show(); + common.AjaxGet(t.objFidNsLookUp.api(), function (data){ + t.objFidNsLookUp.rse = data.data; + $("#FidNsLookUpLoading").hide(); + $("#FidNsLookUpRse").show(); + t.setHistory(t.objFidNsLookUp.id, t.objFidNsLookUp.host); + t.getHistory(t.objFidNsLookUp.id); + }); + }, + + gotoFidNsLookUp: function (value) { + let t = this; + t.objFidNsLookUp.host = value; + t.submitFidNsLookUp(); + }, + + clearFidNsLookUpHistory: function () { + let t = this; + t.clearHistory(t.objFidNsLookUp.id); + t.getHistory(t.objFidNsLookUp.id); + }, + + submitFidWhois: function () { + let t = this; + if (t.objFidWhois.host === "") { + common.ToastShow("请输入Host!"); + return + } + common.AjaxGet(t.objFidWhois.api(), function (data){ + t.objFidWhois.rse = data.data; + t.setHistory(t.objFidWhois.id, t.objFidWhois.host); + t.getHistory(t.objFidWhois.id); + }); + }, + + gotoFidWhois: function (value) { + let t = this; + t.objFidWhois.host = value; + t.submitFidWhois(); + }, + + clearFidWhoisHistory: function () { + let t = this; + t.clearHistory(t.objFidWhois.id); + t.getHistory(t.objFidWhois.id); + }, + }, computed: { }, diff --git a/master/views/page/home.html b/master/views/page/home.html index 1894686..30cf932 100755 --- a/master/views/page/home.html +++ b/master/views/page/home.html @@ -5,10 +5,30 @@
{[ template "__menu__.html" . ]} -
- +
+ +
+ +
+ + + + + +
+ +
+
@@ -21,13 +41,15 @@ {[ SVG "arrow-repeat" 18 18 ]}
-
+