Skip to content

Commit 0b8ed9b

Browse files
committed
Add MountBarLimit config option to server stats
1 parent 18436e9 commit 0b8ed9b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

internal/glance/templates/server-stats.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@
125125
</div>
126126
{{- end }}
127127
<div class="progress-bar progress-bar-combined">
128-
{{- if .Info.Mountpoints }}
129-
<div class="progress-value{{ if ge ((index .Info.Mountpoints 0).UsedPercent) 85 }} progress-value-notice{{ end }}" style="--percent: {{ (index .Info.Mountpoints 0).UsedPercent }}"></div>
130-
{{- if ge (len .Info.Mountpoints) 2 }}
131-
<div class="progress-value{{ if ge ((index .Info.Mountpoints 1).UsedPercent) 85 }} progress-value-notice{{ end }}" style="--percent: {{ (index .Info.Mountpoints 1).UsedPercent }}"></div>
128+
{{$limit := .MountBarLimit}}
129+
{{- range $i,$mount := .Info.Mountpoints }}
130+
{{if lt $i $limit }}
131+
<div class="progress-value{{ if ge .UsedPercent 85 }} progress-value-notice{{ end }}" style="--percent: {{ .UsedPercent }}"></div>
132132
{{- end }}
133133
{{- end }}
134134
</div>

internal/glance/widget-server-stats.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ type serverStatsRequest struct {
9191
StatusText string `yaml:"-"`
9292
Name string `yaml:"name"`
9393
HideSwap bool `yaml:"hide-swap"`
94+
MountBarLimit int `yaml:"mount-bar-limit"`
9495
Type string `yaml:"type"`
9596
URL string `yaml:"url"`
9697
Token string `yaml:"token"`

0 commit comments

Comments
 (0)