diff --git a/src/api/one-class-page/virtualMachine.js b/src/api/one-class-page/virtualMachine.js index 3a0bbc2..24bc86e 100644 --- a/src/api/one-class-page/virtualMachine.js +++ b/src/api/one-class-page/virtualMachine.js @@ -252,6 +252,13 @@ export function postNamespace(data) { }) } +export function deleteNamespace(namespace) { + return request({ + url: '/virtual/v1/harvester/namespaces/' + namespace, + method: 'delete' + }) +} + export function getHostNetwork(name) { return request({ url: '/virtual/v1/network.harvesterhci.io.nodenetworks/harvester-system/' + name + '-vlan', @@ -281,9 +288,9 @@ export function createImages(data) { data: data }) } -export function deleteImage(name) { +export function deleteImage(name, namespace = 'default') { return request({ - url: '/virtual/v1/harvester/harvesterhci.io.virtualmachineimages/default/' + name, + url: `/virtual/v1/harvester/harvesterhci.io.virtualmachineimages/${namespace}/` + name, method: 'delete' }) } diff --git a/src/router/modules/virtualMachine.js b/src/router/modules/virtualMachine.js index c5ae907..1dfbc99 100644 --- a/src/router/modules/virtualMachine.js +++ b/src/router/modules/virtualMachine.js @@ -164,11 +164,18 @@ const virtualMachineRouter = { }, { path: 'create', - component: () => import('@/views/virtualMachine/imagesCreate.vue'), + component: () => import('@/views/virtualMachine/image/edit'), name: 'imagesCreate', meta: { activeMenu: '/virtual/images' }, hidden: true }, + { + path: 'edit', + component: () => import('@/views/virtualMachine/image/edit'), + name: 'imagesEdit', + meta: { activeMenu: '/virtual/images' }, + hidden: true + }, { path: 'detail', component: () => import('@/views/virtualMachine/image/detail'), diff --git a/src/utils/get-Kube-List.js b/src/utils/get-Kube-List.js index 86338c4..d6b71ad 100644 --- a/src/utils/get-Kube-List.js +++ b/src/utils/get-Kube-List.js @@ -423,7 +423,7 @@ const getImagesList = () => { obj.progress = res.data[item].status?.progress === 100 ? '已完成' : '未完成' obj.creationTime = res.data[item].metadata.creationTimestamp obj.aliveTime = res.data[item].metadata.fields[3] - obj.size = Number((res.data[item].status.size / 1024 / 1024).toString().match(/^\d+(?:\.\d{0,2})?/)) + 'MB' + obj.size = Number((res.data[item].status?.size / 1024 / 1024).toString().match(/^\d+(?:\.\d{0,2})?/)) + 'MB' obj.aliveTime = obj.aliveTime.replace('d', '天') obj.aliveTime = obj.aliveTime.replace('h', '小时') obj.aliveTime = obj.aliveTime.replace('m', '分钟') diff --git a/src/views/virtualMachine/image/detail.vue b/src/views/virtualMachine/image/detail.vue index 874f27b..d540d38 100644 --- a/src/views/virtualMachine/image/detail.vue +++ b/src/views/virtualMachine/image/detail.vue @@ -1,8 +1,8 @@