Add disk space display to runner capabilities page
Some checks failed
Build and Release / Lint (push) Failing after 2m2s
Build and Release / Unit Tests (push) Successful in 2m56s
Build and Release / Create Release (push) Has been skipped
Build and Release / Build Binaries (amd64, darwin) (push) Has been skipped
Build and Release / Build Binaries (amd64, linux) (push) Has been skipped
Build and Release / Build Binaries (amd64, windows) (push) Has been skipped
Build and Release / Build Binaries (arm64, darwin) (push) Has been skipped
Build and Release / Build Binaries (arm64, linux) (push) Has been skipped
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 1m3s
Some checks failed
Build and Release / Lint (push) Failing after 2m2s
Build and Release / Unit Tests (push) Successful in 2m56s
Build and Release / Create Release (push) Has been skipped
Build and Release / Build Binaries (amd64, darwin) (push) Has been skipped
Build and Release / Build Binaries (amd64, linux) (push) Has been skipped
Build and Release / Build Binaries (amd64, windows) (push) Has been skipped
Build and Release / Build Binaries (arm64, darwin) (push) Has been skipped
Build and Release / Build Binaries (arm64, linux) (push) Has been skipped
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 1m3s
- Add DiskInfo struct to RunnerCapability for disk space data - Add disk space progress bar with color coding (green/yellow/red) - Add Int64ToFloat64 and DivideFloat64 template helper functions - Add locale strings for disk space labels and warnings - Show disk usage percentage, free space, and total space - Display warning icons when disk usage is high (85%+) or critical (95%+) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
3a1075d6a0
commit
a68d691750
@ -3,6 +3,14 @@
|
||||
|
||||
package structs
|
||||
|
||||
// DiskInfo holds disk space information for a runner
|
||||
type DiskInfo struct {
|
||||
Total uint64 `json:"total_bytes"`
|
||||
Free uint64 `json:"free_bytes"`
|
||||
Used uint64 `json:"used_bytes"`
|
||||
UsedPercent float64 `json:"used_percent"`
|
||||
}
|
||||
|
||||
// RunnerCapability represents the detailed capabilities of a runner
|
||||
type RunnerCapability struct {
|
||||
OS string `json:"os"`
|
||||
@ -14,6 +22,7 @@ type RunnerCapability struct {
|
||||
Tools map[string][]string `json:"tools,omitempty"`
|
||||
Features *CapabilityFeatures `json:"features,omitempty"`
|
||||
Limitations []string `json:"limitations,omitempty"`
|
||||
Disk *DiskInfo `json:"disk,omitempty"`
|
||||
}
|
||||
|
||||
// CapabilityFeatures represents feature support flags
|
||||
|
||||
@ -50,6 +50,8 @@ func NewFuncMap() template.FuncMap {
|
||||
"SliceUtils": NewSliceUtils,
|
||||
"newSlice": func() []any { return []any{} },
|
||||
"Append": func(s []any, v any) []any { return append(s, v) },
|
||||
"Int64ToFloat64": func(i uint64) float64 { return float64(i) },
|
||||
"DivideFloat64": func(a, b float64) float64 { if b == 0 { return 0 }; return a / b },
|
||||
"JsonUtils": NewJsonUtils,
|
||||
"DateUtils": NewDateUtils,
|
||||
|
||||
|
||||
@ -3708,6 +3708,11 @@
|
||||
"actions.runners.capabilities.tools": "Tools",
|
||||
"actions.runners.capabilities.limitations": "Limitations",
|
||||
"actions.runners.capabilities.available": "Available",
|
||||
"actions.runners.capabilities.disk": "Disk Space",
|
||||
"actions.runners.capabilities.disk_free": "free",
|
||||
"actions.runners.capabilities.disk_total": "total",
|
||||
"actions.runners.capabilities.disk_warning": "Low disk space",
|
||||
"actions.runners.capabilities.disk_critical": "Critical: disk almost full",
|
||||
"actions.runs.all_workflows": "All Workflows",
|
||||
"actions.runs.commit": "Commit",
|
||||
"actions.runs.scheduled": "Scheduled",
|
||||
|
||||
@ -66,6 +66,30 @@
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
{{if .RunnerCapabilities.Disk}}
|
||||
<div class="tw-mt-3">
|
||||
<strong>{{ctx.Locale.Tr "actions.runners.capabilities.disk"}}:</strong>
|
||||
<div class="tw-mt-1">
|
||||
{{$diskUsed := .RunnerCapabilities.Disk.UsedPercent}}
|
||||
{{$diskFreeGB := DivideFloat64 (Int64ToFloat64 .RunnerCapabilities.Disk.Free) 1073741824.0}}
|
||||
{{$diskTotalGB := DivideFloat64 (Int64ToFloat64 .RunnerCapabilities.Disk.Total) 1073741824.0}}
|
||||
{{$diskUsedInt := printf "%.0f" $diskUsed}}
|
||||
<div class="ui small progress {{if ge $diskUsed 95.0}}red{{else if ge $diskUsed 85.0}}yellow{{else}}green{{end}}" data-percent="{{$diskUsedInt}}">
|
||||
<div class="bar" style="width: {{$diskUsedInt}}%;">
|
||||
<div class="progress">{{printf "%.1f" $diskUsed}}%</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tw-text-sm tw-text-secondary tw-mt-1">
|
||||
{{printf "%.1f" $diskFreeGB}} GB {{ctx.Locale.Tr "actions.runners.capabilities.disk_free"}} / {{printf "%.1f" $diskTotalGB}} GB {{ctx.Locale.Tr "actions.runners.capabilities.disk_total"}}
|
||||
{{if ge $diskUsed 95.0}}
|
||||
<span class="ui red text tw-ml-2">{{svg "octicon-alert" 14}} {{ctx.Locale.Tr "actions.runners.capabilities.disk_critical"}}</span>
|
||||
{{else if ge $diskUsed 85.0}}
|
||||
<span class="ui yellow text tw-ml-2">{{svg "octicon-alert" 14}} {{ctx.Locale.Tr "actions.runners.capabilities.disk_warning"}}</span>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
{{if .RunnerCapabilities.Limitations}}
|
||||
<div class="tw-mt-2">
|
||||
<strong>{{ctx.Locale.Tr "actions.runners.capabilities.limitations"}}:</strong>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user