mirror of
https://github.com/nezhahq/nezha.git
synced 2025-01-22 12:48:14 -05:00
fix: service item display logic
This commit is contained in:
parent
dae8f7f24e
commit
6846c897ef
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@ -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
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user