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

View File

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