fix: service item display logic

This commit is contained in:
naiba 2024-12-01 21:57:13 +08:00
parent dae8f7f24e
commit 6846c897ef
2 changed files with 6 additions and 5 deletions

View File

@ -32,7 +32,7 @@ jobs:
- uses: robinraju/release-downloader@v1
with:
repository: nezhahq/admin-frontend
tag: v1.0.12
tag: v1.0.13
fileName: dist.zip
latest: true
extract: true
@ -45,7 +45,7 @@ jobs:
- uses: robinraju/release-downloader@v1
with:
repository: nezhahq/user-frontend
tag: v1.0.5
tag: v1.0.6
fileName: dist.zip
latest: true
extract: true

View File

@ -27,15 +27,16 @@ func listService(c *gin.Context) (*model.ServiceResponse, error) {
singleton.AlertsLock.RLock()
defer singleton.AlertsLock.RUnlock()
var stats map[uint64]model.ServiceResponseItem
var statsStore map[uint64]model.CycleTransferStats
var cycleTransferStats map[uint64]model.CycleTransferStats
copier.Copy(&stats, singleton.ServiceSentinelShared.LoadStats())
copier.Copy(&statsStore, singleton.AlertsCycleTransferStatsStore)
copier.Copy(&cycleTransferStats, singleton.AlertsCycleTransferStatsStore)
_, isMember := c.Get(model.CtxKeyAuthorizedUser)
authorized := isMember // TODO || isViewPasswordVerfied
for k, service := range stats {
if !authorized {
if !service.Service.EnableShowInService {
delete(stats, k)
continue
}
service.Service = &model.Service{Name: service.Service.Name}
stats[k] = service
@ -43,7 +44,7 @@ func listService(c *gin.Context) (*model.ServiceResponse, error) {
}
return []interface {
}{
stats, statsStore,
stats, cycleTransferStats,
}, nil
})
if err != nil {