节点运行日志可以按照节点ID设置为已读

This commit is contained in:
GoEdgeLab
2022-08-25 18:27:15 +08:00
parent 9a0eeef3e8
commit 8cd0195cbc
4 changed files with 27 additions and 0 deletions

View File

@@ -120,6 +120,8 @@ func (this *IndexAction) RunGet(params struct {
return
}
var firstUnreadNodeMap maps.Map = nil
var logs = []maps.Map{}
for _, log := range logsResp.NodeLogs {
// 节点信息
@@ -132,6 +134,13 @@ func (this *IndexAction) RunGet(params struct {
continue
}
if params.Type == "unread" && firstUnreadNodeMap == nil {
firstUnreadNodeMap = maps.Map{
"id": node.Id,
"name": node.Name,
}
}
// 服务信息
var serverMap = maps.Map{"id": 0}
if log.ServerId > 0 {
@@ -174,5 +183,7 @@ func (this *IndexAction) RunGet(params struct {
}
this.Data["logs"] = logs
this.Data["firstUnreadNode"] = firstUnreadNodeMap
this.Show()
}

View File

@@ -5,6 +5,7 @@ package logs
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
@@ -14,9 +15,13 @@ type ReadLogsAction struct {
func (this *ReadLogsAction) RunPost(params struct {
LogIds []int64
NodeId int64
}) {
_, err := this.RPC().NodeLogRPC().UpdateNodeLogsRead(this.AdminContext(), &pb.UpdateNodeLogsReadRequest{
NodeLogIds: params.LogIds,
NodeId: params.NodeId,
Role: nodeconfigs.NodeRoleNode,
})
if err != nil {
this.ErrorPage(err)