mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 13:10:26 +08:00 
			
		
		
		
	优化节点日志:可以批量设置服务错误日志为已修复等
This commit is contained in:
		@@ -12,9 +12,9 @@ type FixLogAction 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 {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
 
 | 
			
		||||
@@ -258,7 +258,7 @@ func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
		NodeId:     0,
 | 
			
		||||
		Role:       nodeconfigs.NodeRoleNode,
 | 
			
		||||
		Offset:     0,
 | 
			
		||||
		Size:       10,
 | 
			
		||||
		Size:       20,
 | 
			
		||||
		Level:      "",
 | 
			
		||||
		FixedState: int32(configutils.BoolStateNo),
 | 
			
		||||
		AllServers: true,
 | 
			
		||||
@@ -279,7 +279,7 @@ func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
		var server = serverResp.Server
 | 
			
		||||
		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 {
 | 
			
		||||
				this.ErrorPage(err)
 | 
			
		||||
				return
 | 
			
		||||
@@ -297,7 +297,7 @@ func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
		var node = nodeResp.Node
 | 
			
		||||
		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 {
 | 
			
		||||
				this.ErrorPage(err)
 | 
			
		||||
				return
 | 
			
		||||
 
 | 
			
		||||
@@ -3,4 +3,14 @@
 | 
			
		||||
  right: 1em;
 | 
			
		||||
  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 */
 | 
			
		||||
@@ -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"}
 | 
			
		||||
@@ -5,10 +5,10 @@
 | 
			
		||||
<div v-if="errorLogs.length > 0">
 | 
			
		||||
    <div class="margin"></div>
 | 
			
		||||
    <div class="ui menu tabular attached">
 | 
			
		||||
        <span class="ui item active"><span class="red">需要修复的错误</span></span>
 | 
			
		||||
        <span class="ui item active"><span class="red">需要修复的错误   <a href="" title="本页已修复" @click.prevent="fixPageLogs"><i class="icon remove small"></i> </a></span></span>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="ui segment attached">
 | 
			
		||||
        <div class="ui icon message" v-for="log in errorLogs" :class="{error: log.level == 'error', success: log.level == 'success'}">
 | 
			
		||||
    <div class="ui segment attached node-logs-box">
 | 
			
		||||
        <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>
 | 
			
		||||
            <div class="content">
 | 
			
		||||
                [{{log.createdTime}}]
 | 
			
		||||
 
 | 
			
		||||
@@ -55,7 +55,28 @@ Tea.context(function () {
 | 
			
		||||
		teaweb.confirm("确定要关闭此错误提示吗?", function () {
 | 
			
		||||
			that.$post(".fixLog")
 | 
			
		||||
				.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 () {
 | 
			
		||||
					teaweb.reload()
 | 
			
		||||
 
 | 
			
		||||
@@ -4,4 +4,17 @@
 | 
			
		||||
		right: 1em;
 | 
			
		||||
		top: 2.2em;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	.content {
 | 
			
		||||
		padding-right: 1em;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.node-logs-box {
 | 
			
		||||
	max-height: 11.6em;
 | 
			
		||||
	overflow-y: auto;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.node-logs-box::-webkit-scrollbar {
 | 
			
		||||
	width: 4px;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user