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") {
|
if (type === "trafficSpeed") {
|
||||||
return value ? `${formatBytes(value).replace("B", "b")}ps` : "0";
|
return value ? `${value} Mbps` : "0";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === "number") {
|
if (type === "number") {
|
||||||
|
|||||||
@ -412,7 +412,7 @@ const NodeGroupForm = ({
|
|||||||
|
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor="speed_limit">
|
<Label htmlFor="speed_limit">
|
||||||
{t("speedLimit", "Speed Limit (KB/s)")}
|
{t("speedLimit", "Speed Limit (Mbps)")}
|
||||||
</Label>
|
</Label>
|
||||||
<Input
|
<Input
|
||||||
id="speed_limit"
|
id="speed_limit"
|
||||||
|
|||||||
@ -493,12 +493,6 @@ export default function SubscribeForm<T extends Record<string, any>>({
|
|||||||
placeholder={t("form.noLimit")}
|
placeholder={t("form.noLimit")}
|
||||||
type="number"
|
type="number"
|
||||||
{...field}
|
{...field}
|
||||||
formatInput={(value) =>
|
|
||||||
unitConversion("bitsToMb", value)
|
|
||||||
}
|
|
||||||
formatOutput={(value) =>
|
|
||||||
unitConversion("mbToBits", value)
|
|
||||||
}
|
|
||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
form.setValue(field.name, value);
|
form.setValue(field.name, value);
|
||||||
}}
|
}}
|
||||||
@ -1621,8 +1615,8 @@ export default function SubscribeForm<T extends Record<string, any>>({
|
|||||||
name: "speed_limit",
|
name: "speed_limit",
|
||||||
type: "number",
|
type: "number",
|
||||||
placeholder: t(
|
placeholder: t(
|
||||||
"form.speedLimitKb",
|
"form.speedLimitMbps",
|
||||||
"Speed Limit (kb)"
|
"Speed Limit (Mbps)"
|
||||||
),
|
),
|
||||||
min: 0,
|
min: 0,
|
||||||
onKeyDown: (
|
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={
|
value={
|
||||||
field.value && field.value.length > 0
|
field.value && field.value.length > 0
|
||||||
? field.value
|
? field.value
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user