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