Show CPU core count on EnhancedCPUBar progress bar

This commit is contained in:
rcourtman 2025-11-29 21:47:22 +00:00
parent 0dd65c5db2
commit 46f90e1585
3 changed files with 14 additions and 7 deletions

View file

@ -82,6 +82,9 @@ export function EnhancedCPUBar(props: EnhancedCPUBarProps) {
{/* Label */}
<span class="absolute inset-0 flex items-center justify-center text-[10px] font-semibold text-gray-700 dark:text-gray-100 leading-none pointer-events-none">
{formatPercent(props.usage)}
<Show when={props.cores}>
<span class="ml-1 text-[9px] font-normal opacity-70">({props.cores}c)</span>
</Show>
</span>
</div>

View file

@ -294,8 +294,8 @@ func validateSystemSettings(_ *config.SystemSettings, rawRequest map[string]inte
if !ok {
return fmt.Errorf("discoveryConfig.max_concurrent must be a number")
}
if value <= 0 || value > 1000 {
return fmt.Errorf("discoveryConfig.max_concurrent must be between 1 and 1000")
if value <= 0 || value > 1000 || value != float64(int(value)) {
return fmt.Errorf("discoveryConfig.max_concurrent must be a whole number between 1 and 1000")
}
}

View file

@ -1068,18 +1068,22 @@ func TestValidateSystemSettings_BoundaryConditions(t *testing.T) {
{name: "connectionTimeout: 299.999", input: map[string]interface{}{"connectionTimeout": 299.999}, expectError: false},
{name: "connectionTimeout: 300.001", input: map[string]interface{}{"connectionTimeout": 300.001}, expectError: true},
// Max concurrent boundaries
// Note: The validation is `value <= 0 || value > 1000`, so 0.999 is actually valid
// Max concurrent boundaries - fractional values are rejected since it's a goroutine count
{
name: "max_concurrent: 0.999",
name: "max_concurrent: 0.999 fractional rejected",
input: map[string]interface{}{"discoveryConfig": map[string]interface{}{"max_concurrent": 0.999}},
expectError: false,
expectError: true,
},
{
name: "max_concurrent: 1000.001",
name: "max_concurrent: 1000.001 fractional rejected",
input: map[string]interface{}{"discoveryConfig": map[string]interface{}{"max_concurrent": 1000.001}},
expectError: true,
},
{
name: "max_concurrent: 5.5 fractional rejected",
input: map[string]interface{}{"discoveryConfig": map[string]interface{}{"max_concurrent": 5.5}},
expectError: true,
},
}
for _, tt := range tests {