优化节点日志:可以批量设置服务错误日志为已修复等

This commit is contained in:
GoEdgeLab
2021-11-30 16:43:44 +08:00
parent fbac9c4578
commit bcb079e902
7 changed files with 54 additions and 10 deletions

View File

@@ -12,9 +12,9 @@ type FixLogAction struct {
} }
func (this *FixLogAction) RunPost(params struct { func (this *FixLogAction) RunPost(params struct {
LogId int64 LogIds []int64
}) { }) {
_, err := this.RPC().NodeLogRPC().FixNodeLog(this.AdminContext(), &pb.FixNodeLogRequest{NodeLogId: params.LogId}) _, err := this.RPC().NodeLogRPC().FixNodeLogs(this.AdminContext(), &pb.FixNodeLogsRequest{NodeLogIds: params.LogIds})
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)
return return

View File

@@ -258,7 +258,7 @@ func (this *IndexAction) RunGet(params struct {
NodeId: 0, NodeId: 0,
Role: nodeconfigs.NodeRoleNode, Role: nodeconfigs.NodeRoleNode,
Offset: 0, Offset: 0,
Size: 10, Size: 20,
Level: "", Level: "",
FixedState: int32(configutils.BoolStateNo), FixedState: int32(configutils.BoolStateNo),
AllServers: true, AllServers: true,
@@ -279,7 +279,7 @@ func (this *IndexAction) RunGet(params struct {
var server = serverResp.Server var server = serverResp.Server
if server == nil { if server == nil {
// 设置为已修复 // 设置为已修复
_, err = this.RPC().NodeLogRPC().FixNodeLog(this.AdminContext(), &pb.FixNodeLogRequest{NodeLogId: errorLog.Id}) _, err = this.RPC().NodeLogRPC().FixNodeLogs(this.AdminContext(), &pb.FixNodeLogsRequest{NodeLogIds: []int64{errorLog.Id}})
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)
return return
@@ -297,7 +297,7 @@ func (this *IndexAction) RunGet(params struct {
var node = nodeResp.Node var node = nodeResp.Node
if node == nil || node.NodeCluster == nil { if node == nil || node.NodeCluster == nil {
// 设置为已修复 // 设置为已修复
_, err = this.RPC().NodeLogRPC().FixNodeLog(this.AdminContext(), &pb.FixNodeLogRequest{NodeLogId: errorLog.Id}) _, err = this.RPC().NodeLogRPC().FixNodeLogs(this.AdminContext(), &pb.FixNodeLogsRequest{NodeLogIds: []int64{errorLog.Id}})
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)
return return

View File

@@ -3,4 +3,14 @@
right: 1em; right: 1em;
top: 2.2em; top: 2.2em;
} }
.ui.message .content {
padding-right: 1em;
}
.node-logs-box {
max-height: 11.6em;
overflow-y: auto;
}
.node-logs-box::-webkit-scrollbar {
width: 4px;
}
/*# sourceMappingURL=index.css.map */ /*# sourceMappingURL=index.css.map */

View File

@@ -1 +1 @@
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA,GAAG,QACF,MAAK;EACJ,kBAAA;EACA,UAAA;EACA,UAAA","file":"index.css"} {"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA,GAAG,QACF,MAAK;EACJ,kBAAA;EACA,UAAA;EACA,UAAA;;AAJF,GAAG,QAOF;EACC,kBAAA;;AAIF;EACC,kBAAA;EACA,gBAAA;;AAGD,cAAc;EACb,UAAA","file":"index.css"}

View File

@@ -5,10 +5,10 @@
<div v-if="errorLogs.length > 0"> <div v-if="errorLogs.length > 0">
<div class="margin"></div> <div class="margin"></div>
<div class="ui menu tabular attached"> <div class="ui menu tabular attached">
<span class="ui item active"><span class="red">需要修复的错误</span></span> <span class="ui item active"><span class="red">需要修复的错误 &nbsp; <a href="" title="本页已修复" @click.prevent="fixPageLogs"><i class="icon remove small"></i> </a></span></span>
</div> </div>
<div class="ui segment attached"> <div class="ui segment attached node-logs-box">
<div class="ui icon message" v-for="log in errorLogs" :class="{error: log.level == 'error', success: log.level == 'success'}"> <div class="ui icon message small" v-for="log in errorLogs" :class="{error: log.level == 'error', success: log.level == 'success'}">
<i class="icon warning circle"></i> <i class="icon warning circle"></i>
<div class="content"> <div class="content">
[{{log.createdTime}}] [{{log.createdTime}}]

View File

@@ -55,7 +55,28 @@ Tea.context(function () {
teaweb.confirm("确定要关闭此错误提示吗?", function () { teaweb.confirm("确定要关闭此错误提示吗?", function () {
that.$post(".fixLog") that.$post(".fixLog")
.params({ .params({
logId: logId logIds: logId
})
.success(function () {
teaweb.reload()
})
})
}
this.fixPageLogs = function () {
let logIds = this.errorLogs.map(function (v) {
return v.id
})
if (logIds.length == 0) {
teaweb.reload()
return
}
let that = this
teaweb.confirm("确定要关闭此页错误提示吗?", function () {
that.$post(".fixLog")
.params({
logIds: logIds
}) })
.success(function () { .success(function () {
teaweb.reload() teaweb.reload()

View File

@@ -4,4 +4,17 @@
right: 1em; right: 1em;
top: 2.2em; top: 2.2em;
} }
.content {
padding-right: 1em;
}
}
.node-logs-box {
max-height: 11.6em;
overflow-y: auto;
}
.node-logs-box::-webkit-scrollbar {
width: 4px;
} }