storagenode/console: diskSpaceInfo extended with overused diskspace, getDashboardData updated.

Change-Id: I44db26661a8dfb45b5d8e9fcb7511f63deb88cad
This commit is contained in:
Qweder93 2020-12-08 16:55:16 +02:00 committed by Nikolai Siedov
parent c8e8fea052
commit 2f62cdf491
2 changed files with 7 additions and 0 deletions

View File

@ -8,4 +8,5 @@ type DiskSpaceInfo struct {
Used int64 `json:"used"` Used int64 `json:"used"`
Available int64 `json:"available"` Available int64 `json:"available"`
Trash int64 `json:"trash"` Trash int64 `json:"trash"`
Overused int64 `json:"overused"`
} }

View File

@ -5,6 +5,7 @@ package console
import ( import (
"context" "context"
"math"
"time" "time"
"github.com/spacemonkeygo/monkit/v3" "github.com/spacemonkeygo/monkit/v3"
@ -210,6 +211,11 @@ func (s *Service) GetDashboardData(ctx context.Context) (_ *Dashboard, err error
Trash: trash, Trash: trash,
} }
overused := s.allocatedDiskSpace.Int64() - pieceTotal - trash
if overused < 0 {
data.DiskSpace.Overused = int64(math.Abs(float64(overused)))
}
data.Bandwidth = BandwidthInfo{ data.Bandwidth = BandwidthInfo{
Used: bandwidthUsage, Used: bandwidthUsage,
} }