关于页运行状态、代理关联租户与步进框修复
CI / test (push) Successful in 25s
Release / release (push) Successful in 25s

This commit is contained in:
2026-07-13 12:21:28 +08:00
parent 2ea5b73de2
commit aea00c2382
9 changed files with 331 additions and 13 deletions
+17 -1
View File
@@ -1,4 +1,4 @@
import { mockProxies } from './mock'
import { mockConfigs, mockProxies } from './mock'
import { mockOn, mocked, request } from './request'
import type { ProxyImportResult, ProxyInfo, ProxyInput } from '@/types/api'
@@ -78,6 +78,22 @@ export function importProxies(text: string): Promise<ProxyImportResult> {
return request('/proxies/import', { method: 'POST', body: { text } })
}
/** 代理侧设置关联租户全集:选中即关联(含从其他代理改挂),未选中即解除 */
export function setProxyTenants(id: number, ociConfigIds: number[]): Promise<{ usedBy: number }> {
if (mockOn) {
const found = mockProxies.find((p) => p.id === id)
if (!found) return Promise.reject(new Error('代理不存在'))
for (const c of mockConfigs) {
if (ociConfigIds.includes(c.id)) Object.assign(c, { proxyId: id, proxyName: found.name })
else if (c.proxyId === id) Object.assign(c, { proxyId: null, proxyName: '' })
}
// 改挂会影响其他代理的引用数,全量重算保持一致
for (const p of mockProxies) p.usedBy = mockConfigs.filter((c) => c.proxyId === p.id).length
return mocked({ usedBy: found.usedBy })
}
return request(`/proxies/${id}/tenants`, { method: 'PUT', body: { ociConfigIds } })
}
/** 手动重测出口地区,同步返回最新视图 */
export function probeProxy(id: number): Promise<ProxyInfo> {
if (mockOn) {