更新 ServerBuildSettingsCard.tsx
This commit is contained in:
parent
afdbd1d535
commit
9bd09c8b18
@ -49,6 +49,10 @@ const ServerBuildSettingsCard = () => {
|
||||
z.literal(''),
|
||||
z.preprocess(Number, z.number().min(0)),
|
||||
]),
|
||||
rateLimit: z.union([
|
||||
z.literal(''),
|
||||
z.preprocess(Number, z.number().min(0)),
|
||||
]),
|
||||
bandwidthUsage: z.preprocess(Number, z.number().min(0)),
|
||||
})
|
||||
|
||||
@ -64,6 +68,7 @@ const ServerBuildSettingsCard = () => {
|
||||
bandwidthLimit: server.limits.bandwidth
|
||||
? (server.limits.bandwidth / 1048576).toString()
|
||||
: '',
|
||||
rateLimit: server.limits.rateLimit?.toString() ?? '',
|
||||
bandwidthUsage: (server.usages.bandwidth / 1048576).toString(),
|
||||
},
|
||||
})
|
||||
@ -75,6 +80,7 @@ const ServerBuildSettingsCard = () => {
|
||||
snapshotLimit,
|
||||
backupLimit,
|
||||
bandwidthLimit,
|
||||
rateLimit,
|
||||
bandwidthUsage,
|
||||
...data
|
||||
} = _data as z.infer<typeof schema>
|
||||
@ -88,6 +94,7 @@ const ServerBuildSettingsCard = () => {
|
||||
backupLimit: backupLimit !== '' ? backupLimit : null,
|
||||
bandwidthLimit:
|
||||
bandwidthLimit !== '' ? bandwidthLimit * 1048576 : null,
|
||||
rateLimit: rateLimit !== '' ? Number(rateLimit) : null,
|
||||
bandwidthUsage: bandwidthUsage * 1048576,
|
||||
...data,
|
||||
})
|
||||
@ -103,6 +110,7 @@ const ServerBuildSettingsCard = () => {
|
||||
backupLimit: backupLimit.toString() ?? '',
|
||||
bandwidthLimit:
|
||||
bandwidthLimit !== '' ? bandwidthLimit.toString() : '',
|
||||
rateLimit: rateLimit !== '' ? rateLimit.toString() : '',
|
||||
bandwidthUsage: bandwidthUsage.toString(),
|
||||
})
|
||||
} catch (error) {
|
||||
@ -148,6 +156,14 @@ const ServerBuildSettingsCard = () => {
|
||||
'Leave blank for no limit'
|
||||
}
|
||||
/>
|
||||
<TextInputForm
|
||||
name='rateLimit'
|
||||
label={`${tIndex('rate_limit')} (MiB/s)`}
|
||||
placeholder={
|
||||
tIndex('limit_placeholder') ??
|
||||
'Leave blank for no limit'
|
||||
}
|
||||
/>
|
||||
<TextInputForm
|
||||
name='bandwidthUsage'
|
||||
label={`${tIndex('bandwidth_usage')} (MiB)`}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user