fix: 限速输入统一为 Mbps,去掉 mbToBits 转换
- 订阅表单 speed_limit 去掉 bitsToMb/mbToBits 转换,直接存 Mbps
- traffic_limit speed_limit 标签从 KB 改为 Mbps
- 节点组 speed_limit 标签从 KB/s 改为 Mbps
- Display trafficSpeed 类型直接显示 {value} Mbps
Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
parent
5a493fce67
commit
785c832e02
Binary file not shown.
@ -38,7 +38,7 @@ export function Display<T extends number | undefined | null>({
|
||||
}
|
||||
|
||||
if (type === "trafficSpeed") {
|
||||
return value ? `${formatBytes(value).replace("B", "b")}ps` : "0";
|
||||
return value ? `${value} Mbps` : "0";
|
||||
}
|
||||
|
||||
if (type === "number") {
|
||||
|
||||
@ -412,7 +412,7 @@ const NodeGroupForm = ({
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="speed_limit">
|
||||
{t("speedLimit", "Speed Limit (KB/s)")}
|
||||
{t("speedLimit", "Speed Limit (Mbps)")}
|
||||
</Label>
|
||||
<Input
|
||||
id="speed_limit"
|
||||
|
||||
@ -493,12 +493,6 @@ export default function SubscribeForm<T extends Record<string, any>>({
|
||||
placeholder={t("form.noLimit")}
|
||||
type="number"
|
||||
{...field}
|
||||
formatInput={(value) =>
|
||||
unitConversion("bitsToMb", value)
|
||||
}
|
||||
formatOutput={(value) =>
|
||||
unitConversion("mbToBits", value)
|
||||
}
|
||||
onValueChange={(value) => {
|
||||
form.setValue(field.name, value);
|
||||
}}
|
||||
@ -1621,8 +1615,8 @@ export default function SubscribeForm<T extends Record<string, any>>({
|
||||
name: "speed_limit",
|
||||
type: "number",
|
||||
placeholder: t(
|
||||
"form.speedLimitKb",
|
||||
"Speed Limit (kb)"
|
||||
"form.speedLimitMbps",
|
||||
"Speed Limit (Mbps)"
|
||||
),
|
||||
min: 0,
|
||||
onKeyDown: (
|
||||
@ -1640,7 +1634,17 @@ export default function SubscribeForm<T extends Record<string, any>>({
|
||||
},
|
||||
},
|
||||
]}
|
||||
onChange={field.onChange}
|
||||
onChange={(items: any[]) => {
|
||||
field.onChange(
|
||||
items.map((item) => ({
|
||||
...item,
|
||||
stat_value: Number(item.stat_value) || 0,
|
||||
traffic_usage:
|
||||
Number(item.traffic_usage) || 0,
|
||||
speed_limit: Number(item.speed_limit) || 0,
|
||||
}))
|
||||
);
|
||||
}}
|
||||
value={
|
||||
field.value && field.value.length > 0
|
||||
? field.value
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user