初始提交:OCI 面板前端(含 GenAI 网关一期)

This commit is contained in:
Wang Defa
2026-07-09 15:31:29 +08:00
commit db45a669e3
135 changed files with 25220 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
import { defineStore } from 'pinia'
import { nextTick, ref } from 'vue'
interface SerialTarget {
cfgId: number
instanceId: string
region?: string
instanceName?: string
rootPassword?: string
}
/** 全局串行控制台面板状态:面板挂在 AppLayout,切换路由不销毁会话 */
export const useConsoleStore = defineStore('console', () => {
const show = ref(false)
const cfgId = ref(0)
const instanceId = ref('')
const region = ref<string | undefined>(undefined)
const instanceName = ref('')
const rootPassword = ref('')
/** 打开串行终端;已开着且换了实例时先关旧会话再开新 */
async function openSerial(target: SerialTarget) {
if (show.value) {
if (instanceId.value === target.instanceId && cfgId.value === target.cfgId) return
show.value = false
await nextTick()
}
cfgId.value = target.cfgId
instanceId.value = target.instanceId
region.value = target.region
instanceName.value = target.instanceName ?? ''
rootPassword.value = target.rootPassword ?? ''
show.value = true
}
function close() {
show.value = false
}
return { show, cfgId, instanceId, region, instanceName, rootPassword, openSerial, close }
})