fix(providers): 允许 max_probe_interval_minutes 设为 0 并修复零值被覆盖的问题

- 将 max_probe_interval_minutes 校验范围从 2-32 改为 0-32
- 修复 routes.py 中 max_probe_interval_minutes 和 cache_ttl_minutes
  使用 `or` 短路导致零值被默认值覆盖的问题,改用 is not None 判断
- 前端表单同步调整最小值约束和提示文案
- 新增零值校验的单元测试
This commit is contained in:
fawney19
2026-03-07 18:43:28 +08:00
parent 06b483f79d
commit 9cdcce1b5f
5 changed files with 35 additions and 12 deletions

View File

@@ -232,14 +232,14 @@
id="max_probe_interval_minutes"
:model-value="form.max_probe_interval_minutes ?? ''"
type="number"
min="2"
min="0"
max="32"
placeholder="32"
class="h-8"
@update:model-value="(v) => form.max_probe_interval_minutes = parseNumberInput(v, { min: 2, max: 32 }) ?? 32"
@update:model-value="(v) => form.max_probe_interval_minutes = parseNumberInput(v, { min: 0, max: 32 }) ?? 32"
/>
<p class="text-xs text-muted-foreground mt-0.5">
分钟,2-32
分钟,0-32
</p>
</div>
</div>

View File

@@ -100,14 +100,14 @@
id="max_probe_interval_minutes"
:model-value="form.max_probe_interval_minutes ?? ''"
type="number"
min="2"
min="0"
max="32"
placeholder="32"
class="h-8"
@update:model-value="(v) => form.max_probe_interval_minutes = parseNumberInput(v, { min: 2, max: 32 }) ?? 32"
@update:model-value="(v) => form.max_probe_interval_minutes = parseNumberInput(v, { min: 0, max: 32 }) ?? 32"
/>
<p class="text-xs text-muted-foreground mt-0.5">
2-32分钟
0-32分钟
</p>
</div>
</div>