更新 Speed/CreateServerModal.tsx
This commit is contained in:
parent
c453288a58
commit
72016cee81
@ -68,9 +68,9 @@ const CreateServerModal = ({ nodeId, userId, open, onClose }: Props) => {
|
||||
z.literal(''),
|
||||
z.preprocess(Number, z.number().min(0)),
|
||||
]),
|
||||
rateLimit: z.union([ // 新增
|
||||
z.literal(''),
|
||||
z.preprocess(Number, z.number().min(0)),
|
||||
rateLimit: z.union([
|
||||
z.literal(''),
|
||||
z.preprocess(Number, z.number().min(0)),
|
||||
]),
|
||||
accountPassword: password(usKeyboardCharacters()).nonempty(),
|
||||
shouldCreateServer: z.literal(true),
|
||||
@ -83,7 +83,7 @@ const CreateServerModal = ({ nodeId, userId, open, onClose }: Props) => {
|
||||
nodeId: z.preprocess(Number, z.number()),
|
||||
userId: z.preprocess(Number, z.number()),
|
||||
vmid: z.union([
|
||||
z.preprocess(Number, z.number().min(100).max(999999999)),
|
||||
z.preprocess(Number, z.number().int().min(100).max(999999999)),
|
||||
z.literal(''),
|
||||
]),
|
||||
hostname: hostname().max(191).nonempty(),
|
||||
@ -103,6 +103,10 @@ const CreateServerModal = ({ nodeId, userId, open, onClose }: Props) => {
|
||||
z.literal(''),
|
||||
z.preprocess(Number, z.number().min(0)),
|
||||
]),
|
||||
rateLimit: z.union([
|
||||
z.literal(''),
|
||||
z.preprocess(Number, z.number().min(0)),
|
||||
]),
|
||||
accountPassword: password(usKeyboardCharacters()).optional(),
|
||||
shouldCreateServer: z.literal(false),
|
||||
startOnCompletion: z.boolean(),
|
||||
@ -129,6 +133,7 @@ const CreateServerModal = ({ nodeId, userId, open, onClose }: Props) => {
|
||||
snapshotLimit: '0',
|
||||
backupLimit: '',
|
||||
bandwidthLimit: '',
|
||||
rateLimit: '',
|
||||
accountPassword: '',
|
||||
shouldCreateServer: true,
|
||||
startOnCompletion: false,
|
||||
@ -148,6 +153,7 @@ const CreateServerModal = ({ nodeId, userId, open, onClose }: Props) => {
|
||||
snapshotLimit,
|
||||
backupLimit,
|
||||
bandwidthLimit,
|
||||
rateLimit,
|
||||
addressIds,
|
||||
accountPassword,
|
||||
...data
|
||||
@ -165,6 +171,7 @@ const CreateServerModal = ({ nodeId, userId, open, onClose }: Props) => {
|
||||
backups: backupLimit !== '' ? backupLimit : null,
|
||||
bandwidth:
|
||||
bandwidthLimit !== '' ? bandwidthLimit * 1048576 : null,
|
||||
rateLimit: rateLimit !== '' ? Number(rateLimit) : null,
|
||||
addressIds,
|
||||
},
|
||||
accountPassword: accountPassword ? accountPassword : null,
|
||||
@ -257,6 +264,14 @@ const CreateServerModal = ({ nodeId, userId, open, onClose }: Props) => {
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<TextInputForm
|
||||
name={'rateLimit'}
|
||||
label={`${t('rate_limit')} (MiB/s)`}
|
||||
placeholder={
|
||||
t('limit_placeholder') ??
|
||||
'Leave blank for no limit'
|
||||
}
|
||||
/>
|
||||
<TextInputForm
|
||||
name={'accountPassword'}
|
||||
label={tStrings('system_os_password')}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user