Skip to content

Commit 0857e35

Browse files
ysfscreamKinplemelon
authored andcommitted
fix(listener): adapt the infinity rate
1 parent d2dd4bd commit 0857e35

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

src/components/ListenerDrawer/ListenerDrawer.vue

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,27 +117,36 @@
117117
<el-col :span="12" />
118118
<el-col v-if="!typesWithoutMaxConnectionRate.includes(listenerRecord.type)" :span="12">
119119
<el-form-item :label="t('Gateway.maxConnRate')" prop="max_conn_rate">
120-
<InputWithUnit
120+
<Oneof
121+
class="in-one-row"
121122
v-model="listenerRecord.max_conn_rate"
122-
:units="[{ label: `/${t('Base.second')}`, value: '/s' }]"
123+
:items="[{ type: 'rate' }, { symbols: [INFINITY_VALUE], type: 'enum' }]"
123124
/>
124125
</el-form-item>
125126
</el-col>
126127
<el-col :span="12">
127128
<el-form-item :label="t('Gateway.maxMsgPubRate')" prop="messages_rate">
128-
<InputWithUnit
129+
<Oneof
130+
class="in-one-row"
129131
v-model="listenerRecord.messages_rate"
130-
:units="[{ label: `/${t('Base.second')}`, value: '/s' }]"
132+
:items="[{ type: 'rate' }, { symbols: [INFINITY_VALUE], type: 'enum' }]"
131133
/>
132134
</el-form-item>
133135
</el-col>
134136
<el-col :span="12">
135137
<el-form-item :label="t('Gateway.maxMsgPubTraffic')" prop="bytes_rate">
136-
<InputWithUnit
138+
<Oneof
139+
class="in-one-row"
137140
v-model="listenerRecord.bytes_rate"
138-
:units="[
139-
{ label: `MB/${t('Base.second')}`, value: 'MB/s' },
140-
{ label: `KB/${t('Base.second')}`, value: 'KB/s' },
141+
:items="[
142+
{
143+
type: 'rate',
144+
units: [
145+
{ label: `MB/${t('Base.second')}`, value: 'MB/s' },
146+
{ label: `KB/${t('Base.second')}`, value: 'KB/s' },
147+
],
148+
},
149+
{ symbols: [INFINITY_VALUE], type: 'enum' },
141150
]"
142151
/>
143152
</el-form-item>

src/components/Oneof.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@
6363
:disabled="disabled"
6464
:units="['MB', 'GB', 'KB', 'B']"
6565
/>
66+
<input-with-unit
67+
v-else-if="oneOfInfo.propEnabled.type === 'rate'"
68+
v-model="valueProxy"
69+
:disabled="disabled"
70+
:units="oneOfInfo.propEnabled.units ?? [{ label: `/${$t('Base.second')}`, value: '/s' }]"
71+
/>
6672
<el-input
6773
v-model="valueProxy"
6874
v-else-if="oneOfInfo.propEnabled.type === 'ip_port'"

src/components/SchemaForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ const SchemaForm = defineComponent({
173173
props.needRules,
174174
)
175175

176-
const { createInitValueByType, initRecordByComponents } = useSchemaRecord()
176+
const { initRecordByComponents } = useSchemaRecord()
177177

178178
let formEle: any = null
179179

0 commit comments

Comments
 (0)