1
This commit is contained in:
parent
22ea512030
commit
1601c8dc5a
@ -39,8 +39,9 @@
|
|||||||
<!-- 状态列 -->
|
<!-- 状态列 -->
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
<template v-if="column.key === 'status'">
|
<template v-if="column.key === 'status'">
|
||||||
<span :style="{ color: instanceStatus.get(record.status)?.color }">{{ instanceStatus.get(record.status)?.text
|
<span :style="{ color: instanceStatus.get(record.status)?.color }">{{
|
||||||
}}</span>
|
instanceStatus.get(record.status)?.text
|
||||||
|
}}</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 规格详情列 -->
|
<!-- 规格详情列 -->
|
||||||
@ -66,6 +67,18 @@
|
|||||||
{{ payTypeDic.get(record.price_type) }}
|
{{ payTypeDic.get(record.price_type) }}
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template v-else-if="column.key === 'ssh_link'">
|
||||||
|
<span>
|
||||||
|
{{
|
||||||
|
record.ssh_link
|
||||||
|
? JSON.parse(record.ssh_link)?.root_password|| 'N/A'
|
||||||
|
: 'N/A'
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
<!-- 操作列 -->
|
<!-- 操作列 -->
|
||||||
<template v-else-if="column.key === 'actions'">
|
<template v-else-if="column.key === 'actions'">
|
||||||
<div class="action-buttons">
|
<div class="action-buttons">
|
||||||
@ -84,9 +97,9 @@
|
|||||||
<template #icon>
|
<template #icon>
|
||||||
<CheckCircleOutlined />
|
<CheckCircleOutlined />
|
||||||
</template>
|
</template>
|
||||||
jupyterlab
|
jupyterlab
|
||||||
</a-menu-item>
|
</a-menu-item>
|
||||||
|
|
||||||
<a-menu-item key="reset">
|
<a-menu-item key="reset">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<redo-outlined />
|
<redo-outlined />
|
||||||
@ -158,7 +171,7 @@
|
|||||||
</a-modal>
|
</a-modal>
|
||||||
|
|
||||||
<!-- 释放确认模态框 -->
|
<!-- 释放确认模态框 -->
|
||||||
<a-modal v-model:open="releaseModalVisible" title="确认释放" @ok="confirmRelease" @cancel="releaseModalVisible = false" >
|
<a-modal v-model:open="releaseModalVisible" title="确认释放" @ok="confirmRelease" @cancel="releaseModalVisible = false">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<exclamation-circle-outlined class="warning-icon"
|
<exclamation-circle-outlined class="warning-icon"
|
||||||
style="color: #ff4d4f; font-size: 24px; margin-right: 12px;" />
|
style="color: #ff4d4f; font-size: 24px; margin-right: 12px;" />
|
||||||
@ -177,12 +190,11 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, onMounted, computed } from 'vue'
|
import { ref, onMounted, computed } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { ExclamationCircleOutlined, ReloadOutlined, EyeOutlined, DownOutlined, RedoOutlined, DeleteOutlined,CheckCircleOutlined } from '@ant-design/icons-vue'
|
import { ExclamationCircleOutlined, ReloadOutlined, EyeOutlined, DownOutlined, RedoOutlined, DeleteOutlined, CheckCircleOutlined } from '@ant-design/icons-vue'
|
||||||
import type { TableColumnType } from 'ant-design-vue'
|
import type { TableColumnType } from 'ant-design-vue'
|
||||||
import { message } from 'ant-design-vue'
|
import { message } from 'ant-design-vue'
|
||||||
import { hostCaseList } from '@/apis/admin'
|
import { hostCaseList } from '@/apis/admin'
|
||||||
import { releaseCase, reStartCase } from '@/apis/home'
|
import { releaseCase, reStartCase } from '@/apis/home'
|
||||||
import { get } from 'http'
|
|
||||||
import { payTypeDic, instanceStatus } from '@/utils/dict'
|
import { payTypeDic, instanceStatus } from '@/utils/dict'
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
@ -219,7 +231,7 @@ const mockData = ref([])
|
|||||||
|
|
||||||
// 表格列定义
|
// 表格列定义
|
||||||
const columns = ref<TableColumnType[]>([
|
const columns = ref<TableColumnType[]>([
|
||||||
{ title: '实例ID', dataIndex: 'id', key: 'id', width: 100,fixed: 'left' },
|
{ title: '实例ID', dataIndex: 'id', key: 'id', width: 100, fixed: 'left' },
|
||||||
{ title: '名称', dataIndex: 'name', key: 'name', width: 200 },
|
{ title: '名称', dataIndex: 'name', key: 'name', width: 200 },
|
||||||
{ title: '状态', dataIndex: 'status', key: 'status', width: 200 },
|
{ title: '状态', dataIndex: 'status', key: 'status', width: 200 },
|
||||||
{ title: '规格详情', dataIndex: 'spec', key: 'spec', width: 250 },
|
{ title: '规格详情', dataIndex: 'spec', key: 'spec', width: 250 },
|
||||||
@ -228,7 +240,7 @@ const columns = ref<TableColumnType[]>([
|
|||||||
{ title: '释放时间', dataIndex: 'release_at', key: 'release_at', width: 250 },
|
{ title: '释放时间', dataIndex: 'release_at', key: 'release_at', width: 250 },
|
||||||
{ title: '停机时间', dataIndex: 'down_at', key: 'down_at', width: 250 },
|
{ title: '停机时间', dataIndex: 'down_at', key: 'down_at', width: 250 },
|
||||||
{ title: 'SSH登录', dataIndex: 'ssh_link', key: 'ssh_link', width: 250 },
|
{ title: 'SSH登录', dataIndex: 'ssh_link', key: 'ssh_link', width: 250 },
|
||||||
{ title: '操作', key: 'actions', width: 150,fixed:'right' }
|
{ title: '操作', key: 'actions', width: 150, fixed: 'right' }
|
||||||
])
|
])
|
||||||
|
|
||||||
const getDataList = async () => {
|
const getDataList = async () => {
|
||||||
@ -345,7 +357,7 @@ const confirmRelease = async () => {
|
|||||||
const res = await releaseCase(currentInstance.value.id)
|
const res = await releaseCase(currentInstance.value.id)
|
||||||
message.success({ content: '实例释放成功', key: 'release' })
|
message.success({ content: '实例释放成功', key: 'release' })
|
||||||
releaseModalVisible.value = false
|
releaseModalVisible.value = false
|
||||||
getDataList()
|
getDataList()
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
message.error(error)
|
message.error(error)
|
||||||
releaseModalVisible.value = false
|
releaseModalVisible.value = false
|
||||||
@ -385,15 +397,15 @@ const handleRent = () => {
|
|||||||
|
|
||||||
const handleJupyterLab = async (record: any) => {
|
const handleJupyterLab = async (record: any) => {
|
||||||
try {
|
try {
|
||||||
if(record.ssh_link){
|
if (record.ssh_link) {
|
||||||
const linkObj = JSON.parse(record.ssh_link)
|
const linkObj = JSON.parse(record.ssh_link)
|
||||||
if(linkObj.proxy_host && linkObj.jupyter_token){
|
if (linkObj.proxy_host && linkObj.jupyter_token && linkObj.jupyter_port) {
|
||||||
const baseUrl = `http://${linkObj.proxy_host}:5784/jupyter?token=${linkObj.jupyter_token}`
|
const baseUrl = `http://${linkObj.proxy_host}:${linkObj.jupyter_port}/jupyter/lab?token=${linkObj.jupyter_token}`
|
||||||
console.log("====",baseUrl)
|
console.log("====", baseUrl)
|
||||||
// window.open(baseUrl, '_blank', 'noopener,noreferrer')
|
window.open(baseUrl, '_blank', 'noopener,noreferrer')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('打开 JupyterLab 失败:', error)
|
console.error('打开 JupyterLab 失败:', error)
|
||||||
message.error('打开 JupyterLab 失败,请稍后重试')
|
message.error('打开 JupyterLab 失败,请稍后重试')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user