对运行日志和IP名单进行操作时,及时更新左侧菜单Badge

This commit is contained in:
GoEdgeLab
2022-08-18 09:28:09 +08:00
parent 95c63c11e8
commit 0a5cc87c89
9 changed files with 48 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ package logs
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/types"
"strings"
@@ -29,5 +30,8 @@ func (this *FixAction) RunPost(params struct {
return
}
// 通知左侧数字Badge更新
helpers.NotifyNodeLogsCountChange()
this.Success()
}

View File

@@ -4,6 +4,7 @@ package logs
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
@@ -21,5 +22,8 @@ func (this *FixAllAction) RunPost(params struct {
return
}
// 通知左侧数字Badge更新
helpers.NotifyNodeLogsCountChange()
this.Success()
}

View File

@@ -4,6 +4,7 @@ package logs
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
@@ -20,5 +21,8 @@ func (this *ReadAllLogsAction) RunPost(params struct {
return
}
// 通知左侧数字Badge更新
helpers.NotifyNodeLogsCountChange()
this.Success()
}

View File

@@ -4,6 +4,7 @@ package logs
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
@@ -22,5 +23,8 @@ func (this *ReadLogsAction) RunPost(params struct {
return
}
// 通知左侧数字Badge更新
helpers.NotifyNodeLogsCountChange()
this.Success()
}

View File

@@ -4,6 +4,7 @@ package iplists
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
@@ -23,5 +24,8 @@ func (this *DeleteAction) RunPost(params struct {
return
}
// 通知左侧菜单Badge更新
helpers.NotifyIPItemsCountChanges()
this.Success()
}

View File

@@ -3,6 +3,7 @@ package iplists
import (
"github.com/TeaOSLab/EdgeAdmin/internal/oplogs"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
@@ -22,5 +23,8 @@ func (this *DeleteIPAction) RunPost(params struct {
return
}
// 通知左侧菜单Badge更新
helpers.NotifyIPItemsCountChanges()
this.Success()
}

View File

@@ -4,6 +4,7 @@ package iplists
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/types"
"strings"
@@ -33,5 +34,8 @@ func (this *DeleteItemsAction) RunPost(params struct {
return
}
// 通知左侧菜单Badge更新
helpers.NotifyIPItemsCountChanges()
this.Success()
}

View File

@@ -4,6 +4,7 @@ package iplists
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
)
@@ -20,5 +21,8 @@ func (this *ReadAllAction) RunPost(params struct{}) {
return
}
// 通知左侧菜单Badge更新
helpers.NotifyIPItemsCountChanges()
this.Success()
}

View File

@@ -22,6 +22,22 @@ import (
var nodeLogsCountChanges = make(chan bool, 1)
var ipItemsCountChanges = make(chan bool, 1)
func NotifyNodeLogsCountChange() {
select {
case nodeLogsCountChanges <- true:
default:
}
}
func NotifyIPItemsCountChanges() {
select {
case ipItemsCountChanges <- true:
default:
}
}
// 运行日志
var countUnreadNodeLogs int64 = 0
var nodeLogsType = ""