关于页运行状态、代理关联租户与步进框修复
This commit is contained in:
+3
-2
@@ -113,8 +113,9 @@ export const mockConfigs: OciConfig[] = [
|
||||
promotionStatus: 'EXPIRED',
|
||||
multiRegion: true,
|
||||
multiCompartment: true,
|
||||
proxyId: null,
|
||||
proxyName: '',
|
||||
// 与 mockProxies[0].usedBy = 1 呼应:主号经东京 socks5 出站
|
||||
proxyId: 1,
|
||||
proxyName: '东京 socks5',
|
||||
}),
|
||||
cfg({
|
||||
id: 2,
|
||||
|
||||
+17
-1
@@ -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) {
|
||||
|
||||
@@ -181,6 +181,17 @@ export function getAbout(): Promise<AboutInfo> {
|
||||
buildTime: '2026-07-09T12:00Z',
|
||||
goVersion: 'go1.26.4',
|
||||
platform: 'linux/amd64',
|
||||
startedAt: '2026-07-01T08:23:00+08:00',
|
||||
uptimeSeconds: 1053360, // 12 天 4 小时 36 分
|
||||
resources: {
|
||||
cpuAvgPercent: 1.4,
|
||||
numCpu: 4,
|
||||
goroutines: 36,
|
||||
memHeapBytes: 50537000,
|
||||
memSysBytes: 101187000,
|
||||
dbEngine: 'sqlite',
|
||||
dbBytes: 13212000,
|
||||
},
|
||||
})
|
||||
return request('/about')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user