优化实例搜索功能,调整CPU核心数和内存容量的最大值,确保输入更灵活,同时限制返回结果数量至40条。
This commit is contained in:
parent
b1d50572df
commit
a4e6da603e
@ -71,11 +71,11 @@ async def search_instances_v2(
|
||||
query += " AND area_en = %s"
|
||||
params.append(region_name)
|
||||
|
||||
if cpu_cores:
|
||||
if cpu_cores > 0:
|
||||
query += " AND vcpu = %s"
|
||||
params.append(cpu_cores)
|
||||
|
||||
if memory_gb:
|
||||
if memory_gb > 0:
|
||||
query += " AND memory = %s"
|
||||
params.append(memory_gb)
|
||||
|
||||
@ -87,6 +87,9 @@ async def search_instances_v2(
|
||||
# 执行查询
|
||||
cursor.execute(query, params)
|
||||
results = cursor.fetchall()
|
||||
|
||||
if len(results) >= 40:
|
||||
results = results[0:40]
|
||||
|
||||
# 处理结果
|
||||
instances = []
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
<el-input-number
|
||||
v-model="form.cpu_cores"
|
||||
:min="0"
|
||||
:max="64"
|
||||
:max="9999"
|
||||
:step="1"
|
||||
placeholder="所需CPU核心数"
|
||||
class="full-width">
|
||||
@ -29,7 +29,7 @@
|
||||
<el-input-number
|
||||
v-model="form.memory_gb"
|
||||
:min="0"
|
||||
:max="256"
|
||||
:max="99999"
|
||||
:step="0.5"
|
||||
placeholder="所需内存容量(GB)"
|
||||
class="full-width">
|
||||
@ -388,8 +388,8 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
cpu_cores: null,
|
||||
memory_gb: null,
|
||||
cpu_cores: 0,
|
||||
memory_gb: 0,
|
||||
disk_gb: 30, // 默认30GB
|
||||
region: 'us-east-1',
|
||||
disk_type: 'gp3',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user