diff --git a/README.md b/README.md index 54d1331683fcfa32a36dba27c490430a47e89540..a5b2b255c586326596769853627d8dfb71e9c0dc 100644 --- a/README.md +++ b/README.md @@ -185,9 +185,9 @@ Agent: java -jar cloud-agent-1.0-SNAPSHOT.jar --spring.config.location=client.pr ![](images/storage.png) -9、下载基础模版 +9、下载基础模版(系统模版选择cloud/v3/Cloud-System-V3.1.qcow2) -> **链接: https://pan.baidu.com/s/1tdzTCCHQQmMtR5DqaTpf3Q 提取码: g6mp** +> **链接: https://pan.baidu.com/s/1bOAeuvFj8hG4skDaoZnYtQ?pwd=1bpn 提取码: 1bpn** 10、安装nginx,配置基础下载地址,并在页面完成模版配置 @@ -276,7 +276,16 @@ server.yaml 和 client.properties 内容分别为management和agent项目下的a 5)、密码只对应默认用户,具体请查看system_info.default_user相关配置 6)、其他配置请参照cloud-init相关配置进行安装 7)、对系统模板请安装qemu-command-agent,并进行相关配置 + + +4、目前只提供Centos7及Ubuntu18.04的系统模版,其他系统模版,请自行实现 + 1)、Centos默认用户名为centos,密码为创建系统时输入的密码 + 2)、Ubuntu默认用户名为ubuntu,密码为创建系统输入的密码 + 3)、系统模版不支持root用户名密码登录,如需root登录,请自行修改 + ``` 9、页面删除主机后,如需要重新加入主机,请删除该主机Agent目录下config.json,然后重启Agent 10、关于提示签名错误问题,请确保管理端跟agent端时间同步 + + diff --git a/cloud-management/src/main/resources/static/css/app.91e79f72.css b/cloud-management/src/main/resources/static/css/app.39e2f20c.css similarity index 93% rename from cloud-management/src/main/resources/static/css/app.91e79f72.css rename to cloud-management/src/main/resources/static/css/app.39e2f20c.css index 9ba67338efbd262efc4ef7ca24ba570d42448ff0..c28d5fa7d5c76d19dcf8ae62742aaa95a4706261 100644 --- a/cloud-management/src/main/resources/static/css/app.91e79f72.css +++ b/cloud-management/src/main/resources/static/css/app.39e2f20c.css @@ -1 +1 @@ -.el-menu-vertical-demo[data-v-fe64f52c]{height:calc(100vh - 60px);overflow:hidden auto}.layout-left[data-v-fe64f52c]{position:relative}.shrink[data-v-fe64f52c]{height:30px;background:#25262d;color:#fff;width:calc(100% - 1px);display:flex;justify-content:center;align-items:center;cursor:pointer;z-index:9999}.table_action button[data-v-22f2dc55],.table_action button[data-v-339ee58b],.table_action button[data-v-4c1fe47a],.table_action button[data-v-6c614e5e],.table_action button[data-v-793a1b64],.table_action button[data-v-8deef832]{margin:.1em}.el-dropdown[data-v-22f2dc55]{vertical-align:top}.el-dropdown+.el-dropdown[data-v-22f2dc55]{margin-left:15px}.el-icon-arrow-down[data-v-22f2dc55]{font-size:12px}.table_action button[data-v-34f52534],.table_action button[data-v-3a3543ac],.table_action button[data-v-63671446]{margin:.1em}.el-dropdown[data-v-34f52534]{vertical-align:top}.el-dropdown+.el-dropdown[data-v-34f52534]{margin-left:15px}.el-icon-arrow-down[data-v-34f52534]{font-size:12px}.main[data-v-2e7ccac2]{margin:0;background-color:#282828;height:100vh;width:100vw;display:flex;flex-direction:column}#top_bar[data-v-2e7ccac2]{background-color:#5c5c5c;color:#fff;font:700 12px Helvetica;padding:6px 5px 4px 5px;border-bottom:1px outset;height:20px}#status[data-v-2e7ccac2]{text-align:center}#sendCtrlAltDelButton[data-v-2e7ccac2]{position:fixed;top:0;right:0;border:1px outset;padding:5px 5px 4px 5px;cursor:pointer}#screen[data-v-2e7ccac2]{flex:1;overflow:hidden;width:100vw;height:100vh}.like[data-v-b397a494]{cursor:pointer;font-size:25px;display:inline-block}.component[data-v-b397a494]{display:grid;grid-template-columns:150px 150px auto;max-width:100%;overflow:hidden}.storage_component[data-v-b397a494]{display:grid;grid-template-columns:150px auto;max-width:100%;overflow:hidden}.table_action button[data-v-3724222a]{margin:.1em}.login-container[data-v-da6fbb2c]{width:100%;height:100%;background-image:url(/img/login_bg.7ae2d8a4.png);background-size:cover}.login-page[data-v-da6fbb2c]{border-radius:10px;margin:0 auto;transform:translateY(180px);width:350px;padding:35px 35px 15px;background:#fff;border:1px solid #eaeaea;box-shadow:0 0 25px #cac6c6}#wjPwd[data-v-da6fbb2c]{text-decoration:none;color:#409eff}#wjPwd[data-v-da6fbb2c]:hover{color:orange}.el-header[data-v-c50e8612]{padding:0;width:100%}.headerMenu[data-v-c50e8612]{display:flex;flex-direction:row-reverse}.wx[data-v-c50e8612]{width:320px;height:320px;background:url(/img/wx.885a0459.png);background-size:contain}.zfb[data-v-c50e8612]{width:320px;height:320px;background:url(/img/zfb.03096d04.png);background-size:contain}#app,#app>div,body,html{width:100vw;height:100vh;margin:0;overflow:hidden!important}.el-aside{height:calc(100vh - 60px)!important}.el-main{overflow:hidden auto!important}.el-main,.main-container{max-height:calc(100vh - 60px)!important}.main-container{overflow:hidden!important}.full_screen_class{padding:0!important;height:100vh!important;max-height:none!important} \ No newline at end of file +.el-menu-vertical-demo[data-v-4d6070e6]{height:calc(100vh - 60px);overflow:hidden auto}.layout-left[data-v-4d6070e6]{position:relative}.shrink[data-v-4d6070e6]{height:30px;background:#25262d;color:#fff;width:calc(100% - 1px);display:flex;justify-content:center;align-items:center;cursor:pointer;z-index:9999}.table_action button[data-v-22f2dc55],.table_action button[data-v-339ee58b],.table_action button[data-v-4c1fe47a],.table_action button[data-v-6c614e5e],.table_action button[data-v-793a1b64],.table_action button[data-v-8deef832]{margin:.1em}.el-dropdown[data-v-22f2dc55]{vertical-align:top}.el-dropdown+.el-dropdown[data-v-22f2dc55]{margin-left:15px}.el-icon-arrow-down[data-v-22f2dc55]{font-size:12px}.table_action button[data-v-34f52534],.table_action button[data-v-3a3543ac],.table_action button[data-v-63671446]{margin:.1em}.el-dropdown[data-v-34f52534]{vertical-align:top}.el-dropdown+.el-dropdown[data-v-34f52534]{margin-left:15px}.el-icon-arrow-down[data-v-34f52534]{font-size:12px}.main[data-v-2e7ccac2]{margin:0;background-color:#282828;height:100vh;width:100vw;display:flex;flex-direction:column}#top_bar[data-v-2e7ccac2]{background-color:#5c5c5c;color:#fff;font:700 12px Helvetica;padding:6px 5px 4px 5px;border-bottom:1px outset;height:20px}#status[data-v-2e7ccac2]{text-align:center}#sendCtrlAltDelButton[data-v-2e7ccac2]{position:fixed;top:0;right:0;border:1px outset;padding:5px 5px 4px 5px;cursor:pointer}#screen[data-v-2e7ccac2]{flex:1;overflow:hidden;width:100vw;height:100vh}.like[data-v-b397a494]{cursor:pointer;font-size:25px;display:inline-block}.component[data-v-b397a494]{display:grid;grid-template-columns:150px 150px auto;max-width:100%;overflow:hidden}.storage_component[data-v-b397a494]{display:grid;grid-template-columns:150px auto;max-width:100%;overflow:hidden}.table_action button[data-v-3724222a]{margin:.1em}.login-container[data-v-da6fbb2c]{width:100%;height:100%;background-image:url(/img/login_bg.7ae2d8a4.png);background-size:cover}.login-page[data-v-da6fbb2c]{border-radius:10px;margin:0 auto;transform:translateY(180px);width:350px;padding:35px 35px 15px;background:#fff;border:1px solid #eaeaea;box-shadow:0 0 25px #cac6c6}#wjPwd[data-v-da6fbb2c]{text-decoration:none;color:#409eff}#wjPwd[data-v-da6fbb2c]:hover{color:orange}.el-header[data-v-c50e8612]{padding:0;width:100%}.headerMenu[data-v-c50e8612]{display:flex;flex-direction:row-reverse}.wx[data-v-c50e8612]{width:320px;height:320px;background:url(/img/wx.885a0459.png);background-size:contain}.zfb[data-v-c50e8612]{width:320px;height:320px;background:url(/img/zfb.03096d04.png);background-size:contain}#app,#app>div,body,html{width:100vw;height:100vh;margin:0;overflow:hidden!important}.el-aside{height:calc(100vh - 60px)!important}.el-main{overflow:hidden auto!important}.el-main,.main-container{max-height:calc(100vh - 60px)!important}.main-container{overflow:hidden!important}.full_screen_class{padding:0!important;height:100vh!important;max-height:none!important} \ No newline at end of file diff --git a/cloud-management/src/main/resources/static/index.html b/cloud-management/src/main/resources/static/index.html index a5d4489a9a1b63dcd09eeb0257a26b165fe8c49a..ad7a468e97819abc34ee5750c1b9f27b9be33ef1 100644 --- a/cloud-management/src/main/resources/static/index.html +++ b/cloud-management/src/main/resources/static/index.html @@ -1 +1 @@ -KVM Cloud
\ No newline at end of file +KVM Cloud
\ No newline at end of file diff --git a/cloud-management/src/main/resources/static/js/app.c1fcb432.js b/cloud-management/src/main/resources/static/js/app.868dfc1b.js similarity index 99% rename from cloud-management/src/main/resources/static/js/app.c1fcb432.js rename to cloud-management/src/main/resources/static/js/app.868dfc1b.js index 363a20d5a7e7c2004078825e4d054b3e2d51f2e5..d97717072b24a502a0b12c8e7b399b32c341562e 100644 --- a/cloud-management/src/main/resources/static/js/app.c1fcb432.js +++ b/cloud-management/src/main/resources/static/js/app.868dfc1b.js @@ -1 +1 @@ -(()=>{var t={50053:(t,e,o)=>{"use strict";o.d(e,{Z:()=>_});o(68309);var s=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"挂载光驱",visible:t.attach_cd_room_dialog_visiable,width:"400px"},on:{"update:visible":function(e){t.attach_cd_room_dialog_visiable=e}}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择光盘镜像"},model:{value:t.attach_cd_room_guest.templateId,callback:function(e){t.$set(t.attach_cd_room_guest,"templateId",e)},expression:"attach_cd_room_guest.templateId"}},t._l(this.iso_template,(function(t){return e("el-option",{key:t.templateId,attrs:{label:t.name,value:t.templateId}})})),1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.attach_cd_room_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.attach_cd_room_guest_click}},[t._v("确 定")])],1)],1)},n=[],a=o(51907),r=o(85617),i=(o(57327),o(41539),o(29924));const l={data:function(){return{attach_cd_room_dialog_visiable:!1,iso_template:[],attach_cd_room_guest:{guestId:0,templateId:""}}},methods:{init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.attach_cd_room_guest.guestId=t.guestId,e.attach_cd_room_guest.templateId="",e.attach_cd_room_dialog_visiable=!0,o.next=5,e.load_iso_template();case 5:case"end":return o.stop()}}),o)})))()},load_iso_template:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,i.A8)().then((function(e){0===e.code&&(t.iso_template=e.data.filter((function(t){return 0==t.templateType&&2===t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},attach_cd_room_guest_click:function(){var t=this;(0,i.FX)(this.attach_cd_room_guest).then((function(e){0===e.code?(t.$emit("onGuestUpdate",e.data),t.attach_cd_room_dialog_visiable=!1):t.$notify.error({title:"错误",message:"挂载虚拟机光驱失败:".concat(e.message)})}))}}},c=l;var u=o(1001),d=(0,u.Z)(c,s,n,!1,null,null,null);const _=d.exports},55050:(t,e,o)=>{"use strict";o.d(e,{Z:()=>_});o(82526),o(41817);var s=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"克隆磁盘"},on:{back:function(e){return t.go_back()}}})],1),e("el-row",[e("el-form",{ref:"cloneForm",staticClass:"demo-ruleForm",attrs:{model:t.clone_volume,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"名称",prop:"description"}},[e("el-input",{model:{value:t.clone_volume.description,callback:function(e){t.$set(t.clone_volume,"description",e)},expression:"clone_volume.description"}})],1),e("el-form-item",{attrs:{label:"存储池",prop:"storageId"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.clone_volume.storageId,callback:function(e){t.$set(t.clone_volume,"storageId",e)},expression:"clone_volume.storageId"}},[e("el-option",{attrs:{label:"随机",value:0}}),t._l(this.storages,(function(t){return e("el-option",{key:t.storageId,attrs:{label:t.description,value:t.storageId}})}))],2)],1),e("el-form-item",{attrs:{label:"磁盘类型",prop:"volumeType"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.clone_volume.volumeType,callback:function(e){t.$set(t.clone_volume,"volumeType",e)},expression:"clone_volume.volumeType"}},[e("el-option",{attrs:{label:"raw",value:"raw"}}),e("el-option",{attrs:{label:"qcow",value:"qcow"}}),e("el-option",{attrs:{label:"qcow2",value:"qcow2"}}),e("el-option",{attrs:{label:"vdi",value:"vdi"}}),e("el-option",{attrs:{label:"vmdk",value:"vmdk"}}),e("el-option",{attrs:{label:"vpc",value:"vpc"}})],1)],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.clone_volume_click}},[t._v("克隆")]),e("el-button",{on:{click:t.go_back}},[t._v("取消")])],1)],1)],1)],1)},n=[],a=o(51907),r=o(85617),i=o(29924);const l={data:function(){return{clone_volume:{sourceVolumeId:0,description:"",storageId:0,volumeType:"qcow2"},storages:[]}},methods:{go_back:function(){this.$emit("back")},notify_volume_update:function(t){this.$emit("onVolumeUpdate",t)},init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.clone_volume.sourceVolumeId=t.volumeId,e.clone_volume.volumeType=t.type,e.clone_volume.description="Clone-"+t.description,e.clone_volume.storageId=t.storageId,o.next=6,(0,i._u)().then((function(t){0==t.code&&(e.storages=t.data)}));case 6:case"end":return o.stop()}}),o)})))()},clone_volume_click:function(){var t=this;this.$confirm("克隆磁盘, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,i.MP)(t.clone_volume).then((function(e){0===e.code?(t.notify_volume_update(e.data.clone),t.notify_volume_update(e.data.source),t.go_back()):t.$notify.error({title:"错误",message:"克隆磁盘失败:".concat(e.message)})}))}))["catch"]((function(){}))}}},c=l;var u=o(1001),d=(0,u.Z)(c,s,n,!1,null,null,null);const _=d.exports},52874:(t,e,o)=>{"use strict";o.d(e,{Z:()=>u});var s=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"创建快照",visible:t.snapshot_dialog_visiable,width:"400px"},on:{"update:visible":function(e){t.snapshot_dialog_visiable=e}}},[e("el-form",{attrs:{model:t.snapshot_volume,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"快照名称"}},[e("el-input",{attrs:{placeholder:"请输入快照名称"},model:{value:t.snapshot_volume.snapshotName,callback:function(e){t.$set(t.snapshot_volume,"snapshotName",e)},expression:"snapshot_volume.snapshotName"}})],1),e("el-form-item",{attrs:{label:"磁盘类型",prop:"volumeType"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.snapshot_volume.snapshotVolumeType,callback:function(e){t.$set(t.snapshot_volume,"snapshotVolumeType",e)},expression:"snapshot_volume.snapshotVolumeType"}},[e("el-option",{attrs:{label:"raw",value:"raw"}}),e("el-option",{attrs:{label:"qcow",value:"qcow"}}),e("el-option",{attrs:{label:"qcow2",value:"qcow2"}}),e("el-option",{attrs:{label:"vdi",value:"vdi"}}),e("el-option",{attrs:{label:"vmdk",value:"vmdk"}}),e("el-option",{attrs:{label:"vpc",value:"vpc"}})],1)],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.snapshot_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.create_volume_snapshot_click}},[t._v("确 定")])],1)],1)},n=[],a=(o(68309),o(29924));const r={data:function(){return{snapshot_volume:{volumeId:0,snapshotName:"",snapshotVolumeType:"qcow2"},snapshot_dialog_visiable:!1}},methods:{init:function(t){this.snapshot_volume.volumeId=t.volumeId,this.snapshot_volume.name="",this.snapshot_volume.snapshotVolumeType=t.type,this.snapshot_dialog_visiable=!0},create_volume_snapshot_click:function(){var t=this;this.$confirm("创建磁盘快照, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,a.Ox)(t.snapshot_volume).then((function(e){0===e.code?t.snapshot_dialog_visiable=!1:t.$notify.error({title:"错误",message:"创建磁盘快照失败:".concat(e.message)})}))}))["catch"]((function(){}))}}},i=r;var l=o(1001),c=(0,l.Z)(i,s,n,!1,null,null,null);const u=c.exports},69147:(t,e,o)=>{"use strict";o.d(e,{Z:()=>u});o(68309);var s=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"创建模版",visible:t.template_dialog_visiable,width:"400px"},on:{"update:visible":function(e){t.template_dialog_visiable=e}}},[e("el-form",{attrs:{model:t.template_volume,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"模版名称"}},[e("el-input",{attrs:{placeholder:"请输入模版名称"},model:{value:t.template_volume.name,callback:function(e){t.$set(t.template_volume,"name",e)},expression:"template_volume.name"}})],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.template_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.create_volume_template_click}},[t._v("确 定")])],1)],1)},n=[],a=o(29924);const r={data:function(){return{template_dialog_visiable:!1,template_volume:{volumeId:0,name:""}}},methods:{init:function(t){this.template_volume.volumeId=t.volumeId,this.template_volume.name="",this.template_dialog_visiable=!0},create_volume_template_click:function(){var t=this;this.$confirm("创建磁盘模版, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,a.Jf)(t.template_volume).then((function(e){0===e.code?t.template_dialog_visiable=!1:t.$notify.error({title:"错误",message:"创建磁盘模版失败:".concat(e.message)})}))}))["catch"]((function(){}))}}},i=r;var l=o(1001),c=(0,l.Z)(i,s,n,!1,null,null,null);const u=c.exports},7488:(t,e,o)=>{"use strict";o.d(e,{Z:()=>c});var s=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"下载磁盘",visible:t.download_dialog_visiable,width:"400px"},on:{"update:visible":function(e){t.download_dialog_visiable=e}}},[e("el-form",{attrs:{model:t.download_volume,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"磁盘类型",prop:"volumeType"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.download_volume.volumeType,callback:function(e){t.$set(t.download_volume,"volumeType",e)},expression:"download_volume.volumeType"}},[e("el-option",{attrs:{label:"raw",value:"raw"}}),e("el-option",{attrs:{label:"qcow",value:"qcow"}}),e("el-option",{attrs:{label:"qcow2",value:"qcow2"}}),e("el-option",{attrs:{label:"vdi",value:"vdi"}}),e("el-option",{attrs:{label:"vmdk",value:"vmdk"}}),e("el-option",{attrs:{label:"vpc",value:"vpc"}})],1)],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.download_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.download_volume_click}},[t._v("下载")])],1)],1)},n=[];o(92222);const a={data:function(){return{download_dialog_visiable:!1,download_volume:{volumeType:"qcow2",volumeId:0}}},methods:{init:function(t){this.download_volume.volumeId=t.volumeId,this.download_volume.volumeType=t.type,this.download_dialog_visiable=!0},download_volume_click:function(){var t="./api/volume/download?volumeId=".concat(this.download_volume.volumeId,"&volumeType=").concat(this.download_volume.volumeType);window.open(t,"_blank"),this.download_dialog_visiable=!1}}},r=a;var i=o(1001),l=(0,i.Z)(r,s,n,!1,null,null,null);const c=l.exports},5558:(t,e,o)=>{"use strict";o.d(e,{Z:()=>J});o(68309),o(82526),o(41817);var s=function(){var t=this,e=t._self._c;return e("div",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"},{name:"loading",rawName:"v-loading",value:t.guest_loading,expression:"guest_loading"}],staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{attrs:{content:"虚拟机详情"},on:{back:t.on_back_click}})],1),e("el-row",{staticStyle:{"text-align":"left",margin:"20px 0"}},[e("el-button",{staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini",disabled:4!==t.show_guest_info.current_guest.status},on:{click:function(e){return t.show_start_guest_click(t.show_guest_info.current_guest)}}},[t._v("启动虚拟机")]),e("el-button",{staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini",disabled:t.show_guest_info.current_guest.status>3},on:{click:function(e){return t.show_stop_guest_click(t.show_guest_info.current_guest)}}},[t._v("停止虚拟机")]),e("el-button",{staticStyle:{width:"90px"},attrs:{type:"danger",size:"mini",disabled:t.show_guest_info.current_guest.status<3},on:{click:function(e){return t.destroy_guest(t.show_guest_info.current_guest)}}},[t._v("销毁虚拟机")]),e("el-button",{directives:[{name:"show",rawName:"v-show",value:0!==t.show_guest_info.current_guest.type,expression:"show_guest_info.current_guest.type !== 0"}],staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini",disabled:2!==t.show_guest_info.current_guest.status},on:{click:function(e){return t.reboot_guest_click(t.show_guest_info.current_guest)}}},[t._v("重启虚拟机")]),e("el-button",{directives:[{name:"show",rawName:"v-show",value:0!==t.show_guest_info.current_guest.type,expression:"show_guest_info.current_guest.type !== 0"}],staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini",disabled:4!==t.show_guest_info.current_guest.status},on:{click:function(e){return t.show_reinstall_guest_click(t.show_guest_info.current_guest)}}},[t._v("重装系统")]),e("el-button",{staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini",disabled:2!==t.show_guest_info.current_guest.status},on:{click:function(e){return t.show_migrate_guest_click(t.show_guest_info.current_guest)}}},[t._v("迁移虚拟机")])],1),e("el-row",{staticStyle:{"text-align":"left",margin:"20px 0"}},[e("el-button",{staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini",disabled:2!==t.show_guest_info.current_guest.status},on:{click:function(e){return t.vnc_click(t.show_guest_info.current_guest)}}},[t._v("远程桌面")]),e("el-button",{directives:[{name:"show",rawName:"v-show",value:0!==t.show_guest_info.current_guest.type,expression:"show_guest_info.current_guest.type !== 0"}],staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini",disabled:4!==t.show_guest_info.current_guest.status},on:{click:function(e){return t.show_modify_guest_click(t.show_guest_info.current_guest)}}},[t._v("修改配置")]),e("el-button",{directives:[{name:"show",rawName:"v-show",value:0!==t.show_guest_info.current_guest.type,expression:"show_guest_info.current_guest.type !== 0"}],staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini",disabled:0!==t.show_guest_info.current_guest.cdRoom},on:{click:function(e){return t.show_attach_cd_room_click(t.show_guest_info.current_guest)}}},[t._v("挂载光驱")]),e("el-button",{directives:[{name:"show",rawName:"v-show",value:0!==t.show_guest_info.current_guest.type,expression:"show_guest_info.current_guest.type !== 0"}],staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini",disabled:0===t.show_guest_info.current_guest.cdRoom},on:{click:function(e){return t.detach_guest_cd_room_click(t.show_guest_info.current_guest)}}},[t._v("卸载光驱")]),e("el-button",{directives:[{name:"show",rawName:"v-show",value:0!==t.show_guest_info.current_guest.type,expression:"show_guest_info.current_guest.type !== 0"}],staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini"},on:{click:function(e){return t.show_attach_network_click(t.show_guest_info.current_guest)}}},[t._v("添加网卡")]),e("el-button",{directives:[{name:"show",rawName:"v-show",value:0!==t.show_guest_info.current_guest.type,expression:"show_guest_info.current_guest.type !== 0"}],staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini"},on:{click:function(e){return t.show_attach_volume_click(t.show_guest_info.current_guest)}}},[t._v("挂载磁盘")])],1),e("el-row",[e("el-descriptions",{attrs:{column:2,size:"medium",border:""}},[e("el-descriptions-item",{attrs:{label:"ID"}},[t._v(t._s(t.show_guest_info.current_guest.guestId))]),e("el-descriptions-item",{attrs:{label:"实例名"}},[t._v(t._s(t.show_guest_info.current_guest.name))]),e("el-descriptions-item",{attrs:{label:"标签"}},[t._v(t._s(t.show_guest_info.current_guest.description))]),e("el-descriptions-item",{attrs:{label:"总线类型"}},[t._v(t._s(t.show_guest_info.current_guest.busType))]),e("el-descriptions-item",{attrs:{label:"CPU"}},[t._v(t._s(t.show_guest_info.current_guest.cpu)+"核")]),e("el-descriptions-item",{attrs:{label:"内存"}},[t._v(t._s(t.get_memory_display_size(t.show_guest_info.current_guest.memory)))]),e("el-descriptions-item",{attrs:{label:"配额"}},[t._v(t._s(t.show_guest_info.current_guest.speed))]),e("el-descriptions-item",{attrs:{label:"光盘"}},[t._v(t._s(t.show_guest_info.template.name))]),e("el-descriptions-item",{attrs:{label:"运行主机"}},[e("el-button",{directives:[{name:"show",rawName:"v-show",value:0!==t.show_guest_info.host.hostId,expression:"show_guest_info.host.hostId !== 0"}],attrs:{type:"text",underline:!1},on:{click:function(e){return t.show_host_info(t.show_guest_info.host.hostId)}}},[t._v(t._s(t.show_guest_info.host.displayName))]),e("span",{directives:[{name:"show",rawName:"v-show",value:0===t.show_guest_info.host.hostId,expression:"show_guest_info.host.hostId === 0"}],attrs:{underline:!1}},[t._v(t._s(t.show_guest_info.host.displayName))])],1),e("el-descriptions-item",{attrs:{label:"架构方案"}},[e("el-button",{directives:[{name:"show",rawName:"v-show",value:0!==t.show_guest_info.scheme.schemeId,expression:"show_guest_info.scheme.schemeId !== 0"}],attrs:{type:"text",underline:!1},on:{click:function(e){return t.show_scheme_info(t.show_guest_info.scheme.schemeId)}}},[t._v(t._s(t.show_guest_info.scheme.name))]),e("span",{directives:[{name:"show",rawName:"v-show",value:0===t.show_guest_info.scheme.schemeId,expression:"show_guest_info.scheme.schemeId === 0"}],attrs:{underline:!1}},[t._v(t._s(t.show_guest_info.scheme.name))])],1),e("el-descriptions-item",{attrs:{label:"虚拟机类型"}},[e("el-tag",[t._v(t._s(0===t.show_guest_info.current_guest.type?"系统":"用户"))])],1),e("el-descriptions-item",{attrs:{label:"虚拟机IP"}},[t._v(t._s(t.show_guest_info.current_guest.guestIp))]),e("el-descriptions-item",{attrs:{label:"上次运行时间"}},[t._v(" "+t._s(t.show_guest_info.current_guest.lastStartTime?t.parse_date(t.show_guest_info.current_guest.lastStartTime):"-")+" ")]),e("el-descriptions-item",{attrs:{label:"状态"}},[e("el-tag",{attrs:{type:2===t.show_guest_info.current_guest.status?"success":"danger"}},[t._v(t._s(t.get_guest_status(t.show_guest_info.current_guest)))])],1)],1)],1),e("br"),e("el-row",[e("el-tabs",{attrs:{type:"border-card"}},[e("el-tab-pane",{attrs:{label:"磁盘"}},[e("el-table",{staticStyle:{width:"100%"},attrs:{"v-loading":t.show_guest_info.volume_loading,data:t.show_guest_info.volumes}},[e("el-table-column",{attrs:{label:"ID",prop:"volumeId",width:"80"}}),e("el-table-column",{attrs:{label:"描述",prop:"description",width:"200"}}),e("el-table-column",{attrs:{label:"容量",prop:"capacity",width:"150"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(t.get_volume_display_size(e.row.capacity))+" ")]}}])}),e("el-table-column",{attrs:{label:"已使用",prop:"allocation",width:"150"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(t.get_volume_display_size(e.row.allocation))+" ")]}}])}),e("el-table-column",{attrs:{label:"路径",prop:"path","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"操作",width:"180"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"text"},on:{click:function(e){return t.show_volume_info(o.row.volumeId)}}},[t._v("详情")]),e("el-button",{staticStyle:{"margin-left":"10px"},attrs:{type:"text",disabled:0===o.row.attach.deviceId},on:{click:function(e){return t.detach_volume_click(o.row)}}},[t._v("卸载磁盘")])]}}])})],1)],1),e("el-tab-pane",{attrs:{label:"网卡"}},[e("el-table",{staticStyle:{width:"100%"},attrs:{"v-loading":t.show_guest_info.network_loading,data:t.show_guest_info.networks}},[e("el-table-column",{attrs:{label:"MAC",prop:"mac",width:"200"}}),e("el-table-column",{attrs:{label:"IP",prop:"ip",width:"200"}}),e("el-table-column",{attrs:{label:"驱动类型",prop:"driveType",width:"150"}}),e("el-table-column",{attrs:{label:"操作"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"text",disabled:0===o.row.deviceId||0===t.show_guest_info.current_guest.type},on:{click:function(e){return t.detach_network_click(o.row)}}},[t._v("卸载网卡")])]}}])})],1)],1)],1)],1)],1),e("ReInstallComponentVue",{directives:[{name:"show",rawName:"v-show",value:1===t.show_type,expression:"show_type === 1"}],ref:"ReInstallComponentVueRef",on:{back:function(e){t.show_type=0},finish:t.on_finish_reinstall}}),e("HostInfoComponent",{directives:[{name:"show",rawName:"v-show",value:2===this.show_type,expression:"this.show_type === 2"}],ref:"HostInfoComponentRef",on:{back:t.show_host_return}}),e("SchemeInfoComponent",{directives:[{name:"show",rawName:"v-show",value:3===this.show_type,expression:"this.show_type === 3"}],ref:"SchemeInfoComponentRef",on:{back:t.show_scheme_return}}),4===this.show_type?e("VolumeInfoComponent",{ref:"VolumeInfoComponentRef",on:{back:t.show_volume_return}}):t._e(),e("AttachDiskComponent",{ref:"AttachDiskComponentRef",on:{onVoumeAttachCallBack:t.on_volume_attach_callback}}),e("AttachCdRoomComponent",{ref:"AttachCdRoomComponentRef",on:{onGuestUpdate:t.on_notify_update_guest_info}}),e("AttachNetworkComponent",{ref:"AttachNetworkComponentRef",on:{onGuestAttachCallback:t.on_network_attach_callback}}),e("ModifyGuestComponent",{ref:"ModifyGuestComponentRef",on:{onGuestUpdate:t.on_notify_update_guest_info}}),e("StartGuestComponent",{ref:"StartGuestComponentRef",on:{onGuestUpdate:t.on_notify_update_guest_info}}),e("StopGuestComponent",{ref:"StopGuestComponentRef",on:{onGuestUpdate:t.on_notify_update_guest_info}}),e("MigrateGuestComponent",{ref:"MigrateGuestComponentRef",on:{onGuestUpdate:t.on_notify_update_guest_info}})],1)},n=[],a=o(51907),r=o(85617),i=(o(57658),o(41539),o(34553),o(40561),o(42173)),l=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"挂载磁盘",visible:t.attach_volume_dialog_visiable,width:"400px"},on:{"update:visible":function(e){t.attach_volume_dialog_visiable=e}}},[e("el-form",{attrs:{model:t.attach_volume_guest,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"磁盘"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择磁盘"},model:{value:t.attach_volume_guest.volumeId,callback:function(e){t.$set(t.attach_volume_guest,"volumeId",e)},expression:"attach_volume_guest.volumeId"}},t._l(this.attach_volumes,(function(t){return e("el-option",{key:t.volumeId,attrs:{label:t.description,value:t.volumeId}})})),1)],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.attach_volume_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.attach_volume_click}},[t._v("确 定")])],1)],1)},c=[],u=o(29924);const d={data:function(){return{attach_volume_dialog_visiable:!1,attach_volumes:[],attach_volume_guest:{guestId:0,volumeId:""}}},methods:{load_all_attach_volumes:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.I2)().then((function(e){0===e.code&&(t.attach_volumes=e.data)}));case 2:case"end":return e.stop()}}),e)})))()},init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.attach_volume_guest.guestId=t.guestId,e.attach_volume_guest.volumeId="",e.attach_volume_dialog_visiable=!0,o.next=5,e.load_all_attach_volumes();case 5:case"end":return o.stop()}}),o)})))()},attach_volume_click:function(){var t=this;(0,u.M8)(this.attach_volume_guest).then((function(e){0===e.code?(t.$emit("onVoumeAttachCallBack",e.data.guest,e.data.volume),t.attach_volume_dialog_visiable=!1):t.$notify.error({title:"错误",message:" 挂载磁盘失败:".concat(e.message)})}))}}},_=d;var p=o(1001),h=(0,p.Z)(_,l,c,!1,null,null,null);const m=h.exports;var f=o(50053),g=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"挂载网卡",visible:t.attach_network_dialog_visiable,width:"400px"},on:{"update:visible":function(e){t.attach_network_dialog_visiable=e}}},[e("el-form",{attrs:{model:t.attach_network_guest,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"网络"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择网络"},model:{value:t.attach_network_guest.networkId,callback:function(e){t.$set(t.attach_network_guest,"networkId",e)},expression:"attach_network_guest.networkId"}},t._l(this.networks,(function(t){return e("el-option",{key:t.networkId,attrs:{label:t.name,value:t.networkId}})})),1)],1),e("el-form-item",{attrs:{label:"驱动"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择网卡驱动"},model:{value:t.attach_network_guest.driveType,callback:function(e){t.$set(t.attach_network_guest,"driveType",e)},expression:"attach_network_guest.driveType"}},[e("el-option",{attrs:{label:"virtio",value:"virtio"}}),e("el-option",{attrs:{label:"rtl8139",value:"rtl8139"}}),e("el-option",{attrs:{label:"e1000",value:"e1000"}})],1)],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.attach_network_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.attach_network_click}},[t._v("确 定")])],1)],1)},w=[];o(57327);const v={data:function(){return{attach_network_dialog_visiable:!1,networks:[],attach_network_guest:{guestId:0,networkId:"",driveType:"virtio"}}},methods:{init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.attach_network_guest.guestId=t.guestId,e.attach_network_guest.networkId="",e.attach_network_dialog_visiable=!0,o.next=5,e.load_all_networks();case 5:case"end":return o.stop()}}),o)})))()},load_all_networks:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.jR)().then((function(e){0===e.code&&(t.networks=e.data.filter((function(t){return 2===t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},attach_network_click:function(){var t=this;(0,u.vJ)(this.attach_network_guest).then((function(e){0===e.code?(t.$emit("onGuestAttachCallback",e.data.guest,e.data.network),t.attach_network_dialog_visiable=!1):t.$notify.error({title:"错误",message:"虚拟机附加网卡失败:".concat(e.message)})}))}}},y=v;var b=(0,p.Z)(y,g,w,!1,null,null,null);const k=b.exports;var I=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"修改配置",visible:t.modify_guest_dialog_visiable,width:"400px"},on:{"update:visible":function(e){t.modify_guest_dialog_visiable=e}}},[e("el-form",{attrs:{model:t.modify_guest,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"名称",prop:"description"}},[e("el-input",{model:{value:t.modify_guest.description,callback:function(e){t.$set(t.modify_guest,"description",e)},expression:"modify_guest.description"}})],1),e("el-form-item",{attrs:{label:"总线方式"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"总线方式"},model:{value:t.modify_guest.busType,callback:function(e){t.$set(t.modify_guest,"busType",e)},expression:"modify_guest.busType"}},[e("el-option",{attrs:{label:"virtio",value:"virtio"}}),e("el-option",{attrs:{label:"ide",value:"ide"}}),e("el-option",{attrs:{label:"scsi",value:"scsi"}})],1)],1),e("el-form-item",{attrs:{label:"计算方案"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择计算方案"},model:{value:t.modify_guest.schemeId,callback:function(e){t.$set(t.modify_guest,"schemeId",e)},expression:"modify_guest.schemeId"}},t._l(this.schemes,(function(t){return e("el-option",{key:t.schemeId,attrs:{label:t.name,value:t.schemeId}})})),1)],1),e("el-form-item",{attrs:{label:"群组"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择群组"},model:{value:t.modify_guest.groupId,callback:function(e){t.$set(t.modify_guest,"groupId",e)},expression:"modify_guest.groupId"}},t._l(this.groups,(function(t){return e("el-option",{key:t.groupId,attrs:{label:t.groupName,value:t.groupId}})})),1)],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.modify_guest_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.modify_guest_click}},[t._v("确 定")])],1)],1)},x=[],C=o(23698);o(92222);const $={data:function(){return{modify_guest_dialog_visiable:!1,groups:[],modify_guest:{guestId:0,groupId:0,busType:"",description:"",schemeId:""}}},methods:{init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.groups=[{groupId:0,groupName:"默认"}],e.modify_guest.guestId=t.guestId,e.modify_guest.groupId=t.groupId,e.modify_guest.description=t.description,e.modify_guest.schemeId=t.schemeId,e.modify_guest.busType=t.busType,e.modify_guest_dialog_visiable=!0,o.next=9,e.load_all_schemes();case 9:return o.next=11,e.load_all_groups();case 11:case"end":return o.stop()}}),o)})))()},load_all_schemes:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.Pu)().then((function(e){0===e.code&&(t.schemes=e.data)}));case 2:case"end":return e.stop()}}),e)})))()},load_all_groups:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.hI)().then((function(e){0===e.code&&(t.groups=[{groupId:0,groupName:"默认"}].concat((0,C.Z)(e.data)))}));case 2:case"end":return e.stop()}}),e)})))()},modify_guest_click:function(){var t=this;(0,u.vi)(this.modify_guest).then((function(e){0===e.code?(t.$emit("onGuestUpdate",e.data),t.modify_guest_dialog_visiable=!1):t.$notify.error({title:"错误",message:" 修改主机信息失败:".concat(e.message)})}))}}},S=$;var Z=(0,p.Z)(S,I,x,!1,null,null,null);const T=Z.exports;var z=o(64148),N=o(54165),V=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"重装虚拟机"},on:{back:t.on_back_click}})],1),e("el-row",[e("el-form",{ref:"reInstallForm",staticClass:"demo-ruleForm",attrs:{model:t.reinstall_guest,"label-width":"100px"}},[e("el-row",[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"安装方式"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择安装方式"},model:{value:t.reinstall_guest.type,callback:function(e){t.$set(t.reinstall_guest,"type",e)},expression:"reinstall_guest.type"}},[e("el-option",{attrs:{label:"ISO镜像",value:0}}),e("el-option",{attrs:{label:"模版安装",value:1}}),e("el-option",{attrs:{label:"快照安装",value:2}}),e("el-option",{attrs:{label:"现有磁盘",value:3}})],1)],1)],1),e("el-col",{attrs:{span:12}},[3!==t.reinstall_guest.type?e("el-form-item",{attrs:{label:"磁盘类型"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.reinstall_guest.volumeType,callback:function(e){t.$set(t.reinstall_guest,"volumeType",e)},expression:"reinstall_guest.volumeType"}},[e("el-option",{attrs:{label:"raw",value:"raw"}}),e("el-option",{attrs:{label:"qcow",value:"qcow"}}),e("el-option",{attrs:{label:"qcow2",value:"qcow2"}}),e("el-option",{attrs:{label:"vdi",value:"vdi"}}),e("el-option",{attrs:{label:"vmdk",value:"vmdk"}}),e("el-option",{attrs:{label:"vpc",value:"vpc"}})],1)],1):t._e()],1)],1),e("el-row",[e("el-col",{attrs:{span:12}},[0===t.reinstall_guest.type?e("el-form-item",{attrs:{label:"ISO模版"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择光盘镜像"},model:{value:t.reinstall_guest.isoTemplateId,callback:function(e){t.$set(t.reinstall_guest,"isoTemplateId",e)},expression:"reinstall_guest.isoTemplateId"}},t._l(this.iso_template,(function(t){return e("el-option",{key:t.templateId,attrs:{label:t.name,value:t.templateId}})})),1)],1):t._e(),1===t.reinstall_guest.type?e("el-form-item",{attrs:{label:"系统模版"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择模版"},model:{value:t.reinstall_guest.diskTemplateId,callback:function(e){t.$set(t.reinstall_guest,"diskTemplateId",e)},expression:"reinstall_guest.diskTemplateId"}},t._l(this.disk_template,(function(t){return e("el-option",{key:t.templateId,attrs:{label:t.name,value:t.templateId}})})),1)],1):t._e(),2===t.reinstall_guest.type?e("el-form-item",{attrs:{label:"快照模版"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择系统快照"},model:{value:t.reinstall_guest.snapshotVolumeId,callback:function(e){t.$set(t.reinstall_guest,"snapshotVolumeId",e)},expression:"reinstall_guest.snapshotVolumeId"}},t._l(this.snapshot_template,(function(t){return e("el-option",{key:t.snapshotVolumeId,attrs:{label:t.name,value:t.snapshotVolumeId}})})),1)],1):t._e(),3===t.reinstall_guest.type?e("el-form-item",{attrs:{label:"可用磁盘"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择系统磁盘"},model:{value:t.reinstall_guest.volumeId,callback:function(e){t.$set(t.reinstall_guest,"volumeId",e)},expression:"reinstall_guest.volumeId"}},t._l(this.attach_volumes,(function(t){return e("el-option",{key:t.volumeId,attrs:{label:t.description,value:t.volumeId}})})),1)],1):t._e()],1),e("el-col",{attrs:{span:12}},[3!==t.reinstall_guest.type?e("el-form-item",{attrs:{label:"存储池"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.reinstall_guest.storageId,callback:function(e){t.$set(t.reinstall_guest,"storageId",e)},expression:"reinstall_guest.storageId"}},[e("el-option",{attrs:{label:"随机",value:0}}),t._l(this.storages,(function(t){return e("el-option",{key:t.storageId,attrs:{label:t.description,value:t.storageId}})}))],2)],1):t._e()],1)],1),e("el-row",[e("el-col",{attrs:{span:12}},[0!==t.reinstall_guest.type?e("el-form-item",{attrs:{label:"密码"}},[e("el-input",{attrs:{"prefix-icon":"el-icon-lock",type:"password","show-password":!0},model:{value:t.reinstall_guest.password,callback:function(e){t.$set(t.reinstall_guest,"password",e)},expression:"reinstall_guest.password"}})],1):t._e()],1),e("el-col",{attrs:{span:12}},[0===t.reinstall_guest.type?e("el-form-item",{attrs:{label:"磁盘大小"}},[e("el-input",{model:{value:t.reinstall_guest.size,callback:function(e){t.$set(t.reinstall_guest,"size",e)},expression:"reinstall_guest.size"}})],1):t._e()],1)],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.reinstall_guest_click}},[t._v("立即重装")]),e("el-button",{on:{click:t.on_back_click}},[t._v("取消")])],1)],1)],1)],1)},R=[];const q={data:function(){return{reinstall_guest:{guestId:0,type:0,volumeType:"qcow2",isoTemplateId:"",diskTemplateId:"",snapshotVolumeId:"",volumeId:"",storageId:0,password:"",size:100},iso_template:[],attach_volumes:[],disk_template:[],storages:[],snapshot_template:[]}},methods:{on_back_click:function(){this.$emit("back")},load_all_attach_volumes:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.I2)().then((function(e){0===e.code&&(t.attach_volumes=e.data)}));case 2:case"end":return e.stop()}}),e)})))()},load_all_template:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.A8)().then((function(e){0===e.code&&(t.iso_template=e.data.filter((function(t){return 0==t.templateType&&2===t.status})),t.disk_template=e.data.filter((function(t){return 2==t.templateType&&2===t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},load_all_storage:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u._u)().then((function(e){0==e.code&&(t.storages=e.data.filter((function(t){return 1==t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},load_all_snapshot:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.GQ)().then((function(e){0==e.code&&(t.snapshot_template=e.data.filter((function(t){return 1==t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:e.show_type=0,e.load_all_attach_volumes(),e.load_all_template(),e.load_all_storage(),e.load_all_snapshot(),e.reinstall_guest.guestId=t.guestId,e.reinstall_guest.isoTemplateId="",e.reinstall_guest.diskTemplateId="",e.reinstall_guest.snapshotVolumeId="",e.reinstall_guest.volumeId="",e.reinstall_guest.password="",e.reinstall_guest.type=0;case 12:case"end":return o.stop()}}),o)})))()},reinstall_guest_click:function(){var t=this;switch(this.reinstall_guest.type){case 0:this.reinstall_guest.diskTemplateId=0,this.reinstall_guest.snapshotVolumeId=0,this.reinstall_guest.volumeId=0;break;case 1:this.reinstall_guest.isoTemplateId=0,this.reinstall_guest.snapshotVolumeId=0,this.reinstall_guest.volumeId=0,this.reinstall_guest.size=0;break;case 2:this.reinstall_guest.isoTemplateId=0,this.reinstall_guest.diskTemplateId=0,this.reinstall_guest.volumeId=0,this.reinstall_guest.size=0;break;case 3:this.reinstall_guest.isoTemplateId=0,this.reinstall_guest.diskTemplateId=0,this.reinstall_guest.snapshotVolumeId=0,this.reinstall_guest.size=0;break}this.$confirm("重装虚拟机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.qB)(t.reinstall_guest).then((function(e){0===e.code?t.$emit("finish",e.data):t.$notify.error({title:"错误",message:"重装虚拟机失败:".concat(e.message)})}))}))["catch"]((function(){}))}}},B=q;var P=(0,p.Z)(B,V,R,!1,null,null,null);const G=P.exports;var U=o(48080),M=o(33094),D=o(72541),F=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"迁移虚拟机",visible:t.migrate_dialog_visiable,width:"400px"},on:{"update:visible":function(e){t.migrate_dialog_visiable=e}}},[e("el-form",{attrs:{model:t.migrate_guest,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"选择主机"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.migrate_guest.hostId,callback:function(e){t.$set(t.migrate_guest,"hostId",e)},expression:"migrate_guest.hostId"}},[e("el-option",{attrs:{label:"随机",value:0}}),t._l(this.hosts,(function(t){return e("el-option",{key:t.hostId,attrs:{label:t.displayName,value:t.hostId,"v-loading":!0}})}))],2)],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.migrate_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.migrate_guest_click}},[t._v("确 定")])],1)],1)},E=[];const O={data:function(){return{migrate_dialog_visiable:!1,migrate_guest:{hostId:0,guestId:0},last_runing_host_id:0,hosts:[]}},methods:{init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.migrate_guest.guestId=t.guestId,e.migrate_guest.hostId=0,e.last_runing_host_id=t.hostId,e.migrate_dialog_visiable=!0,o.next=6,e.load_all_host();case 6:case"end":return o.stop()}}),o)})))()},load_all_host:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.vZ)().then((function(e){0===e.code&&(t.hosts=e.data.filter((function(e){return 1===e.status&&e.hostId!==t.last_runing_host_id})))}));case 2:case"end":return e.stop()}}),e)})))()},migrate_guest_click:function(){var t=this;(0,u.Tb)(this.migrate_guest).then((function(e){0===e.code?(t.$emit("onGuestUpdate",e.data),t.migrate_dialog_visiable=!1):t.$notify.error({title:"错误",message:"迁移虚拟机失败:".concat(e.message)})}))}}},A=O;var L=(0,p.Z)(A,F,E,!1,null,null,null);const j=L.exports;var H=o(73412);const X={name:"GuestInfoComponent",components:{AttachDiskComponent:m,AttachCdRoomComponent:f.Z,AttachNetworkComponent:k,ModifyGuestComponent:T,StartGuestComponent:z.Z,StopGuestComponent:N.Z,MigrateGuestComponent:j,ReInstallComponentVue:G,HostInfoComponent:U.Z,SchemeInfoComponent:M.Z,VolumeInfoComponent:D.Z},mixins:[H.Z,i.Z],created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},data:function(){return{show_type:0,guest_loading:!1,show_guest_info:{guestId:0,volume_loading:!1,network_loading:!1,guest_loading:!0,current_guest:{guestId:0,name:"",description:"",busType:"virtio",cpu:1,memory:524288,speed:500,cdRoom:0,hostId:0,schemeId:0,type:0,networkId:0,status:1,guestIp:""},host:{hostId:0,displayName:"-"},template:{templateId:0,name:"-"},scheme:{schemeId:0,name:"-"},volumes:[],networks:[]}}},methods:{on_volume_attach_callback:function(t,e){this.update_guest_info(t),this.show_guest_info.volumes.push(e)},on_network_attach_callback:function(t,e){this.update_guest_info(t),this.show_guest_info.networks.push(e)},show_host_return:function(){this.show_type=0},show_scheme_return:function(){this.show_type=0},show_volume_return:function(){this.show_type=0},show_host_info:function(t){this.show_type=2,this.$refs.HostInfoComponentRef.init(t)},show_scheme_info:function(t){this.show_type=3,this.$refs.SchemeInfoComponentRef.init(t)},show_volume_info:function(t){var e=this;this.show_type=4,this.$nextTick((function(){e.$refs.VolumeInfoComponentRef.init(t)}))},on_back_click:function(){this.$emit("back")},on_notify_update_guest_info:function(t){this.update_guest_info(t),this.$emit("onGuestUpdate",t)},show_reinstall_guest_click:function(t){this.$refs.ReInstallComponentVueRef.init(t),this.show_type=1},on_finish_reinstall:function(t){this.show_type=0,this.on_notify_update_guest_info(t)},init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.show_type=0,e.guest_loading=!1,e.show_guest_info.guestId=t.guestId,e.show_guest_info.current_guest=t,o.next=6,e.load_current_guest_template(t);case 6:return o.next=8,e.load_current_guest_host(t);case 8:return o.next=10,e.load_current_guest_scheme(t);case 10:return o.next=12,e.load_current_guest_volume(t);case 12:return o.next=14,e.load_current_guest_network(t);case 14:case"end":return o.stop()}}),o)})))()},initGuestId:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.show_type=0,e.guest_loading=!0,o.next=4,(0,u.c$)({guestId:t}).then((function(t){0===t.code?e.init(t.data):e.$alert("获取虚拟机信息失败:".concat(t.message),"提示",{dangerouslyUseHTMLString:!0,confirmButtonText:"返回",type:"error"}).then((function(){e.on_back_click()}))["catch"]((function(){e.on_back_click()}))}))["finally"]((function(){e.guest_loading=!1}));case 4:case"end":return o.stop()}}),o)})))()},load_current_guest_template:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:if(e.show_guest_info.template.templateId=t.cdRoom,e.show_guest_info.template.name="-",!(e.show_guest_info.template.templateId>0)){o.next=5;break}return o.next=5,(0,u.BE)({templateId:t.cdRoom}).then((function(t){0===t.code&&(e.show_guest_info.template.name=t.data.name)}));case 5:case"end":return o.stop()}}),o)})))()},load_current_guest_scheme:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:if(e.show_guest_info.scheme.schemeId=t.schemeId,e.show_guest_info.scheme.name="-",!(e.show_guest_info.scheme.schemeId>0)){o.next=5;break}return o.next=5,(0,u.TQ)({schemeId:t.schemeId}).then((function(t){0===t.code&&(e.show_guest_info.scheme.name=t.data.name)}));case 5:case"end":return o.stop()}}),o)})))()},load_current_guest_host:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:if(e.show_guest_info.host.hostId=t.hostId,e.show_guest_info.host.displayName="-",!(e.show_guest_info.host.hostId>0)){o.next=5;break}return o.next=5,(0,u.KF)({hostId:t.hostId}).then((function(t){0===t.code&&(e.show_guest_info.host.displayName=t.data.displayName)}));case 5:case"end":return o.stop()}}),o)})))()},load_current_guest_volume:function(t){var e=this;this.show_guest_info.volume_loading=!0,(0,u.XR)({guestId:t.guestId}).then((function(t){0===t.code&&(e.show_guest_info.volumes=t.data)}))["finally"]((function(){e.show_guest_info.volume_loading=!1}))},load_current_guest_network:function(t){var e=this;this.show_guest_info.network_loading=!0,(0,u.iN)({guestId:t.guestId}).then((function(t){0===t.code&&(e.show_guest_info.networks=t.data)}))["finally"]((function(){e.show_guest_info.network_loading=!1}))},update_guest_info:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:if(e.show_guest_info.guestId!==t.guestId){o.next=9;break}return e.show_guest_info.current_guest=t,o.next=4,e.load_current_guest_template(t);case 4:return o.next=6,e.load_current_guest_host(t);case 6:return o.next=8,e.load_current_guest_scheme(t);case 8:e.$forceUpdate();case 9:case"end":return o.stop()}}),o)})))()},show_migrate_guest_click:function(t){this.$refs.MigrateGuestComponentRef.init(t)},show_start_guest_click:function(t){this.$refs.StartGuestComponentRef.init(t)},show_attach_network_click:function(t){this.$refs.AttachNetworkComponentRef.init(t)},show_attach_volume_click:function(t){this.$refs.AttachDiskComponentRef.init(t)},show_stop_guest_click:function(t){this.$refs.StopGuestComponentRef.init(t)},show_attach_cd_room_click:function(t){this.$refs.AttachCdRoomComponentRef.init(t)},show_modify_guest_click:function(t){this.$refs.ModifyGuestComponentRef.init(t)},vnc_click:function(t){var e=this.$router.resolve({path:"/Vnc",query:{id:t.guestId,description:t.description}}),o=e.href;window.open(o,"_blank")},detach_guest_cd_room_click:function(t){var e=this;(0,u.n4)({guestId:t.guestId}).then((function(t){0===t.code?(e.$emit("onGuestUpdate",t.data),e.stop_dialog_visiable=!1):e.$notify.error({title:"错误",message:"卸载虚拟机光驱失败:".concat(t.message)})}))},detach_network_click:function(t){var e=this;this.$confirm("卸载当前挂载网卡, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.DZ)({guestId:t.guestId,guestNetworkId:t.guestNetworkId}).then((function(o){if(0===o.code){e.$emit("onGuestUpdate",o.data);var s=e.show_guest_info.networks.findIndex((function(e){return e.guestNetworkId===t.guestNetworkId}));s>=0&&e.show_guest_info.networks.splice(s,1)}else e.$notify.error({title:"错误",message:"虚拟机附加网卡失败:".concat(o.message)})}))}))["catch"]((function(){}))},detach_volume_click:function(t){var e=this;this.$confirm("卸载当前挂载磁盘, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){var o=t.attach;(0,u.PX)({guestId:o.guestId,guestDiskId:o.guestDiskId}).then((function(t){if(0===t.code){var s=e.show_guest_info.volumes.findIndex((function(t){return t.attach.guestDiskId===o.guestDiskId}));s>=0&&e.show_guest_info.volumes.splice(s,1)}else e.$notify.error({title:"错误",message:"卸载磁盘失败:".concat(t.message)})}))}))["catch"]((function(){}))},reboot_guest_click:function(t){var e=this;this.$confirm("重启当前虚拟机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.Qm)({guestId:t.guestId}).then((function(t){0===t.code?e.$emit("onGuestUpdate",t.data):e.$notify.error({title:"错误",message:"重启虚拟机失败:".concat(t.message)})}))}))["catch"]((function(){}))},destroy_guest:function(t){var e=this;this.$confirm("删除当前虚拟机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.yl)({guestId:t.guestId}).then((function(t){0===t.code?e.on_back_click():e.$notify.error({title:"错误",message:"删除虚拟机失败:".concat(t.message)})}))}))["catch"]((function(){}))},dispatch_notify_message:function(t){var e=this;1===t.type&&this.show_guest_info.guestId===t.id&&(0,u.c$)({guestId:t.id}).then((function(t){0==t.code?e.update_guest_info(t.data):2000001==t.code&&e.on_back_click()}))}}},Q=X;var K=(0,p.Z)(Q,s,n,!1,null,null,null);const J=K.exports},48080:(t,e,o)=>{"use strict";o.d(e,{Z:()=>h});var s=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{directives:[{name:"loading",rawName:"v-loading",value:t.host_loading,expression:"host_loading"}],attrs:{content:"主机详情"},on:{back:t.on_back_click}})],1),e("el-row",{staticStyle:{"text-align":"left",margin:"20px 0"}},[e("el-button",{attrs:{type:"success",size:"mini"},on:{click:function(e){return t.register_host(t.show_host)}}},[t._v("重新注册")]),e("el-button",{directives:[{name:"show",rawName:"v-show",value:3!==t.show_host.status,expression:"show_host.status !== 3"}],attrs:{type:"warning",size:"mini"},on:{click:function(e){return t.pasue_host(t.show_host)}}},[t._v("开始维护")]),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_host(t.show_host)}}},[t._v("销毁主机")])],1),e("el-row",[e("el-descriptions",{attrs:{column:2,size:"medium",border:""}},[e("el-descriptions-item",{attrs:{label:"ID"}},[t._v(t._s(t.show_host.hostId))]),e("el-descriptions-item",{attrs:{label:"主机名"}},[t._v(t._s(t.show_host.hostName))]),e("el-descriptions-item",{attrs:{label:"显示名称"}},[t._v(t._s(t.show_host.displayName))]),e("el-descriptions-item",{attrs:{label:"主机IP"}},[t._v(t._s(t.show_host.hostIp))]),e("el-descriptions-item",{attrs:{label:"网卡名称"}},[t._v(t._s(t.show_host.nic))]),e("el-descriptions-item",{attrs:{label:"通信地址"}},[t._v(t._s(t.show_host.uri))]),e("el-descriptions-item",{attrs:{label:"主机架构"}},[t._v(t._s(t.show_host.arch))]),e("el-descriptions-item",{attrs:{label:"虚拟化类型"}},[t._v(t._s(t.show_host.hypervisor))]),e("el-descriptions-item",{attrs:{label:"内存"}},[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"已使用:"+t.get_memory_display_size(t.show_host.allocationMemory)+" / 总共:"+t.get_memory_display_size(t.show_host.totalMemory),placement:"top"}},[e("el-progress",{attrs:{color:"#67C23A",percentage:t.show_host.totalMemory<=0?0:Math.floor(100*t.show_host.allocationMemory/t.show_host.totalMemory)}})],1)],1),e("el-descriptions-item",{attrs:{label:"CPU"}},[e("el-tooltip",{staticClass:"item",staticStyle:{width:"150px"},attrs:{effect:"dark",content:"已使用:"+t.show_host.allocationCpu+"核 / 总共:"+t.show_host.totalCpu+"核",placement:"top"}},[e("el-progress",{attrs:{color:"#67C23A",percentage:t.show_host.totalCpu<=0?0:Math.floor(100*t.show_host.allocationCpu/t.show_host.totalCpu)}})],1)],1),e("el-descriptions-item",{attrs:{label:"Cores"}},[t._v(t._s(t.show_host.cores))]),e("el-descriptions-item",{attrs:{label:"Sockets"}},[t._v(t._s(t.show_host.sockets))]),e("el-descriptions-item",{attrs:{label:"Threads"}},[t._v(t._s(t.show_host.threads))]),e("el-descriptions-item",{attrs:{label:"Eemulator"}},[t._v(t._s(t.show_host.emulator))]),e("el-descriptions-item",{attrs:{label:"状态"}},[e("el-tag",{attrs:{type:1===t.show_host.status?"success":"danger"}},[t._v(t._s(t.get_host_status(t.show_host)))])],1)],1)],1)],1)},n=[],a=o(51907),r=o(85617),i=(o(68309),o(41539),o(73412)),l=o(42173),c=o(29924);const u={name:"HostInfoComponent",data:function(){return{host_loading:!1,show_host:{hostId:0,displayName:"",hostIp:"127.0.0.1",hostName:"-",nic:"-",uri:"http://127.0.0.1:8081",allocationMemory:0,allocationCpu:0,totalMemory:0,totalCpu:0,arch:"-",hypervisor:"QEMU",emulator:"-",cores:0,threads:0,sockets:0,status:1}}},mixins:[i.Z,l.Z],created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},methods:{on_back_click:function(){this.$emit("back")},on_notify_update_host_info:function(t){this.refresh_host(t),this.$emit("onHostUpdate",t)},init_host:function(t){this.show_host=t,this.host_loading=!1},refresh_host:function(t){this.show_host.hostId===t.hostId&&(this.show_host=t)},init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.host_loading=!0,o.next=3,(0,c.KF)({hostId:t}).then((function(t){0===t.code?e.init_host(t.data):e.$alert("获取主机信息失败:".concat(t.message),"提示",{dangerouslyUseHTMLString:!0,confirmButtonText:"返回",type:"error"}).then((function(){e.on_back_click()}))["catch"]((function(){e.on_back_click()}))}))["finally"]((function(){e.host_loading=!1}));case 3:case"end":return o.stop()}}),o)})))()},pasue_host:function(t){var e=this;this.$confirm("维护主机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,c.ol)({hostId:t.hostId}).then((function(t){0===t.code?e.on_notify_update_host_info(t.data):e.$notify.error({title:"错误",message:"暂停主机失败:".concat(t.message)})}))}))["catch"]((function(){}))},register_host:function(t){var e=this;this.$confirm("重新注册主机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,c.XN)({hostId:t.hostId}).then((function(t){0===t.code?e.on_notify_update_host_info(t.data):e.$notify.error({title:"错误",message:"注册主机失败:".concat(t.message)})}))}))["catch"]((function(){}))},destroy_host:function(t){var e=this;this.$confirm("删除当前主机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,c.de)({hostId:t.hostId}).then((function(t){0===t.code?e.on_back_click():e.$notify.error({title:"错误",message:"删除主机失败:".concat(t.message)})}))}))["catch"]((function(){}))},dispatch_notify_message:function(t){var e=this;4===t.type&&this.show_host.hostId===t.id&&(0,c.KF)({hostId:t.id}).then((function(t){0==t.code?e.refresh_host(t.data):2000001==t.code&&e.on_back_click()}))}}},d=u;var _=o(1001),p=(0,_.Z)(d,s,n,!1,null,null,null);const h=p.exports},46455:(t,e,o)=>{"use strict";o.d(e,{Z:()=>_});o(82526),o(41817);var s=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"迁移磁盘"},on:{back:function(e){return t.go_back()}}})],1),e("el-row",[e("el-form",{staticClass:"demo-ruleForm",attrs:{model:t.migrate_volume,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"存储池",prop:"type"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.migrate_volume.storageId,callback:function(e){t.$set(t.migrate_volume,"storageId",e)},expression:"migrate_volume.storageId"}},[e("el-option",{attrs:{label:"随机",value:0}}),t._l(this.storages,(function(t){return e("el-option",{key:t.storageId,attrs:{label:t.description,value:t.storageId}})}))],2)],1),e("el-form-item",{attrs:{label:"磁盘类型",prop:"volumeType"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.migrate_volume.volumeType,callback:function(e){t.$set(t.migrate_volume,"volumeType",e)},expression:"migrate_volume.volumeType"}},[e("el-option",{attrs:{label:"raw",value:"raw"}}),e("el-option",{attrs:{label:"qcow",value:"qcow"}}),e("el-option",{attrs:{label:"qcow2",value:"qcow2"}}),e("el-option",{attrs:{label:"vdi",value:"vdi"}}),e("el-option",{attrs:{label:"vmdk",value:"vmdk"}}),e("el-option",{attrs:{label:"vpc",value:"vpc"}})],1)],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.migrate_volume_click}},[t._v("迁移")]),e("el-button",{on:{click:t.go_back}},[t._v("取消")])],1)],1)],1)],1)},n=[],a=o(51907),r=o(85617),i=o(29924);const l={data:function(){return{migrate_volume:{sourceVolumeId:0,storageId:0,volumeType:"qcow2"},storages:[]}},methods:{go_back:function(){this.$emit("back")},notify_volume_update:function(t){this.$emit("onVolumeUpdate",t)},init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.migrate_volume.sourceVolumeId=t.volumeId,e.migrate_volume.volumeType=t.type,e.migrate_volume.storageId=t.storageId,o.next=5,(0,i._u)().then((function(t){0==t.code&&(e.storages=t.data)}));case 5:case"end":return o.stop()}}),o)})))()},migrate_volume_click:function(){var t=this;this.$confirm("迁移磁盘, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,i.Ct)(t.migrate_volume).then((function(e){0===e.code?(t.notify_volume_update(e.data.migrate),t.notify_volume_update(e.data.source),t.go_back()):t.$notify.error({title:"错误",message:"迁移磁盘失败:".concat(e.message)})}))}))["catch"]((function(){}))}}},c=l;var u=o(1001),d=(0,u.Z)(c,s,n,!1,null,null,null);const _=d.exports},68501:(t,e,o)=>{"use strict";o.d(e,{Z:()=>u});var s=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"磁盘扩容",visible:t.resize_dialog_visiable,width:"300px"},on:{"update:visible":function(e){t.resize_dialog_visiable=e}}},[e("el-form",{attrs:{model:t.resize_volume,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"磁盘大小(GB)"}},[e("el-input",{attrs:{placeholder:"请输入磁盘大小(GB)"},model:{value:t.resize_volume.size,callback:function(e){t.$set(t.resize_volume,"size",e)},expression:"resize_volume.size"}})],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.resize_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.resize_volume_click}},[t._v("确 定")])],1)],1)},n=[],a=o(29924);const r={data:function(){return{resize_dialog_visiable:!1,resize_volume:{volumeId:0,size:100}}},methods:{init:function(t){this.resize_volume.volumeId=t.volumeId,this.resize_volume.size=100,this.resize_dialog_visiable=!0},resize_volume_click:function(){var t=this;this.$confirm("扩容磁盘, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,a.K5)(t.resize_volume).then((function(e){0===e.code?(t.$emit("onVolumeUpdate",e.data),t.resize_dialog_visiable=!1):t.$notify.error({title:"错误",message:"扩容磁盘失败:".concat(e.message)})}))}))["catch"]((function(){}))}}},i=r;var l=o(1001),c=(0,l.Z)(i,s,n,!1,null,null,null);const u=c.exports},33094:(t,e,o)=>{"use strict";o.d(e,{Z:()=>h});o(68309);var s=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{directives:[{name:"loading",rawName:"v-loading",value:t.schme_loading,expression:"schme_loading"}],attrs:{content:"计算方案详情"},on:{back:t.on_back_click}})],1),e("el-row",{staticStyle:{"text-align":"left",margin:"20px 0"}},[e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_scheme(t.show_scheme)}}},[t._v("删除")])],1),e("el-row",[e("el-descriptions",{attrs:{column:2,size:"medium",border:""}},[e("el-descriptions-item",{attrs:{label:"ID"}},[t._v(t._s(t.show_scheme.schemeId))]),e("el-descriptions-item",{attrs:{label:"名称"}},[t._v(t._s(t.show_scheme.name))]),e("el-descriptions-item",{attrs:{label:"配额"}},[t._v(t._s(t.show_scheme.speed))]),e("el-descriptions-item",{attrs:{label:"CPU"}},[t._v(t._s(t.show_scheme.cpu))]),e("el-descriptions-item",{attrs:{label:"内存"}},[t._v(t._s(t.get_memory_display_size(t.show_scheme.memory)))]),e("el-descriptions-item",{attrs:{label:"Cores"}},[t._v(t._s(t.show_scheme.cores))]),e("el-descriptions-item",{attrs:{label:"Sockets"}},[t._v(t._s(t.show_scheme.sockets))]),e("el-descriptions-item",{attrs:{label:"Threads"}},[t._v(t._s(t.show_scheme.threads))])],1)],1)],1)},n=[],a=o(51907),r=o(85617),i=(o(41539),o(73412)),l=o(29924),c=o(42173);const u={name:"SchemeInfoComponent",data:function(){return{schme_loading:!1,show_scheme:{schemeId:0,name:"-",cpu:0,memory:0,speed:0,sockets:0,cores:0,threads:0}}},mixins:[i.Z,c.Z],created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},methods:{on_back_click:function(){this.$emit("back")},on_notify_update_scheme_info:function(t){this.refresh_scheme(t),this.$emit("onSchemeUpdate",t)},refresh_scheme:function(t){this.show_scheme.schemeId===t.schemeId&&(this.show_scheme=t)},init_scheme:function(t){this.show_scheme=t,this.schme_loading=!1},init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.schme_loading=!0,o.next=3,(0,l.TQ)({schemeId:t}).then((function(t){0===t.code?e.init_scheme(t.data):e.$alert("获取计算方案信息失败:".concat(t.message),"提示",{dangerouslyUseHTMLString:!0,confirmButtonText:"返回",type:"error"}).then((function(){e.on_back_click()}))["catch"]((function(){e.on_back_click()}))}))["finally"]((function(){e.host_loading=!1}));case 3:case"end":return o.stop()}}),o)})))()},destroy_scheme:function(t){var e=this;this.$confirm("删除计算方案, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,l.tM)({schemeId:t.schemeId}).then((function(t){0===t.code?e.on_back_click():e.$notify.error({title:"错误",message:"删除计算方案失败:".concat(t.message)})}))}))["catch"]((function(){}))},dispatch_notify_message:function(t){var e=this;8===t.type&&this.show_scheme.schemeId==t.id&&(0,l.TQ)({schemeId:t.id}).then((function(t){0==t.code?e.refresh_scheme(t.data):2000001==t.code&&e.on_back_click()}))}}},d=u;var _=o(1001),p=(0,_.Z)(d,s,n,!1,null,null,null);const h=p.exports},64148:(t,e,o)=>{"use strict";o.d(e,{Z:()=>_});var s=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"启动虚拟机",visible:t.start_dialog_visiable,width:"400px"},on:{"update:visible":function(e){t.start_dialog_visiable=e}}},[e("el-form",{attrs:{model:t.start_guest,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"选择主机"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.start_guest.hostId,callback:function(e){t.$set(t.start_guest,"hostId",e)},expression:"start_guest.hostId"}},[e("el-option",{attrs:{label:"随机",value:0}}),t._l(this.hosts,(function(t){return e("el-option",{key:t.hostId,attrs:{label:t.displayName,value:t.hostId,"v-loading":!0}})}))],2)],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.start_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.start_guest_click}},[t._v("确 定")])],1)],1)},n=[],a=o(51907),r=o(85617),i=(o(57327),o(41539),o(29924));const l={data:function(){return{start_dialog_visiable:!1,start_guest:{hostId:0,guestId:0},hosts:[]}},methods:{init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.start_guest.guestId=t.guestId,e.start_guest.hostId=0,e.start_dialog_visiable=!0,o.next=5,e.load_all_host();case 5:case"end":return o.stop()}}),o)})))()},load_all_host:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,i.vZ)().then((function(e){0===e.code&&(t.hosts=e.data.filter((function(t){return 1==t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},start_guest_click:function(){var t=this;(0,i.NU)(this.start_guest).then((function(e){0===e.code?(t.$emit("onGuestUpdate",e.data),t.start_dialog_visiable=!1):t.$notify.error({title:"错误",message:"启动虚拟机失败:".concat(e.message)})}))}}},c=l;var u=o(1001),d=(0,u.Z)(c,s,n,!1,null,null,null);const _=d.exports},54165:(t,e,o)=>{"use strict";o.d(e,{Z:()=>_});var s=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"关闭虚拟机",visible:t.stop_dialog_visiable,width:"400px"},on:{"update:visible":function(e){t.stop_dialog_visiable=e}}},[e("el-checkbox",{model:{value:t.stop_guest.force,callback:function(e){t.$set(t.stop_guest,"force",e)},expression:"stop_guest.force"}},[t._v("强制关闭")]),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.stop_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.stop_guest_click}},[t._v("确 定")])],1)],1)},n=[],a=o(51907),r=o(85617),i=o(29924);const l={data:function(){return{stop_dialog_visiable:!1,stop_guest:{hostId:0,force:!1}}},methods:{init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:e.stop_guest.guestId=t.guestId,e.stop_guest.force=!1,e.stop_dialog_visiable=!0;case 3:case"end":return o.stop()}}),o)})))()},stop_guest_click:function(){var t=this;this.$confirm("停止当前虚拟机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,i.X)(t.stop_guest).then((function(e){0===e.code?(t.$emit("onGuestUpdate",e.data),t.stop_dialog_visiable=!1):t.$notify.error({title:"错误",message:"启动虚拟机失败:".concat(e.message)})}))}))["catch"]((function(){}))}}},c=l;var u=o(1001),d=(0,u.Z)(c,s,n,!1,null,null,null);const _=d.exports},47315:(t,e,o)=>{"use strict";o.d(e,{Z:()=>h});o(82526),o(41817);var s=function(){var t=this,e=t._self._c;return e("el-card",{directives:[{name:"loading",rawName:"v-loading",value:t.storage_loading,expression:"storage_loading"}],staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{attrs:{content:"存储池详情"},on:{back:t.go_back}})],1),e("el-row",{staticStyle:{"text-align":"left",margin:"20px 0"}},[e("el-button",{attrs:{type:"success",size:"mini"},on:{click:function(e){return t.register_storage(t.show_storage)}}},[t._v("重新注册")]),3!==t.show_storage.status?e("el-button",{attrs:{type:"warning",size:"mini"},on:{click:function(e){return t.pasue_storage(t.show_storage)}}},[t._v("开始维护")]):t._e(),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_storage(t.show_storage)}}},[t._v("销毁存储池")])],1),e("el-row",[e("el-descriptions",{attrs:{column:2,size:"medium",border:""}},[e("el-descriptions-item",{attrs:{label:"ID"}},[t._v(t._s(t.show_storage.storageId))]),e("el-descriptions-item",{attrs:{label:"存储池名"}},[t._v(t._s(t.show_storage.description))]),e("el-descriptions-item",{attrs:{label:"存储池类型"}},[t._v(t._s(t.show_storage.type))]),e("el-descriptions-item",{attrs:{label:"挂载路径"}},[t._v(t._s(t.show_storage.mountPath))]),"nfs"===t.show_storage.type?e("el-descriptions-item",{attrs:{label:"NFS路径"}},[t._v(t._s(JSON.parse(t.show_storage.param).path))]):t._e(),"nfs"===t.show_storage.type?e("el-descriptions-item",{attrs:{label:"NFS地址"}},[t._v(t._s(JSON.parse(t.show_storage.param).uri))]):t._e(),e("el-descriptions-item",{attrs:{label:"容量"}},[t._v(t._s(t.get_volume_display_size(t.show_storage.capacity)))]),e("el-descriptions-item",{attrs:{label:"可用"}},[t._v(t._s(t.get_volume_display_size(t.show_storage.available)))]),e("el-descriptions-item",{attrs:{label:"已申请"}},[t._v(t._s(t.get_volume_display_size(t.show_storage.allocation)))]),e("el-descriptions-item",{attrs:{label:"状态"}},[e("el-tag",{attrs:{type:1===t.show_storage.status?"success":"danger"}},[t._v(t._s(t.get_storage_status(t.show_storage)))])],1)],1)],1)],1)},n=[],a=o(51907),r=o(85617),i=(o(68309),o(41539),o(73412)),l=o(42173),c=o(29924);const u={name:"StorageInfoComponent",data:function(){return{storage_loading:!1,show_storage:{}}},mixins:[i.Z,l.Z],created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},methods:{go_back:function(){this.$emit("back")},init_storage:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:e.show_storage=t,e.storage_loading=!1;case 2:case"end":return o.stop()}}),o)})))()},init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.storage_loading=!0,o.next=3,(0,c.nQ)({storageId:t}).then((function(t){0===t.code?e.init_storage(t.data):e.$alert("获取存储池信息失败:".concat(t.message),"提示",{dangerouslyUseHTMLString:!0,confirmButtonText:"返回",type:"error"}).then((function(){e.go_back()}))["catch"]((function(){e.go_back()}))}))["finally"]((function(){e.storage_loading=!1}));case 3:case"end":return o.stop()}}),o)})))()},notify_storage_update:function(t){this.refresh_storage(t),this.$emit("onStorageUpdate",t)},refresh_storage:function(t){this.show_storage.storageId===t.storageId&&(this.show_storage=t)},pasue_storage:function(t){var e=this;this.$confirm("暂停存储池, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,c.dZ)({storageId:t.storageId}).then((function(t){0===t.code?e.notify_storage_update(t.data):e.$notify.error({title:"错误",message:"暂停存储池失败:".concat(t.message)})}))}))["catch"]((function(){}))},register_storage:function(t){var e=this;this.$confirm("重新注册存储池, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,c.vA)({storageId:t.storageId}).then((function(t){0===t.code?e.notify_storage_update(t.data):e.$notify.error({title:"错误",message:"注册存储池失败:".concat(t.message)})}))}))["catch"]((function(){}))},destroy_storage:function(t){var e=this;this.$confirm("删除存储池, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,c.ye)({storageId:t.storageId}).then((function(t){0===t.code?(e.notify_storage_update(t.data),e.go_back()):e.$notify.error({title:"错误",message:"删除存储池失败:".concat(t.message)})}))}))["catch"]((function(){}))},dispatch_notify_message:function(t){var e=this;7===t.type&&this.show_storage.storageId==t.id&&(0,c.nQ)({storageId:t.id}).then((function(t){0==t.code?e.refresh_storage(t.data):2000001==t.code&&e.go_back()}))}}},d=u;var _=o(1001),p=(0,_.Z)(d,s,n,!1,null,null,null);const h=p.exports},72541:(t,e,o)=>{"use strict";o.d(e,{Z:()=>b});o(82526),o(41817),o(68309);var s=function(){var t=this,e=t._self._c;return e("div",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"},{name:"loading",rawName:"v-loading",value:t.volume_loading,expression:"volume_loading"}],staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{attrs:{content:"磁盘详情"},on:{back:t.go_back}})],1),e("el-row",{staticStyle:{"text-align":"left",margin:"20px 0"}},[e("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(e){return t.show_resize_volume_click(t.show_volume)}}},[t._v("扩容磁盘")]),e("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(e){return t.show_clone_volume_click(t.show_volume)}}},[t._v("克隆磁盘")]),e("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(e){return t.show_migrate_volume_click(t.show_volume)}}},[t._v("迁移磁盘")]),e("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(e){return t.show_create_volume_snapshot_click(t.show_volume)}}},[t._v("创建快照")]),e("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(e){return t.show_create_volume_template_click(t.show_volume)}}},[t._v("创建模版")]),e("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(e){return t.show_download_volume_click(t.show_volume)}}},[t._v("下载磁盘")]),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_volume(t.show_volume)}}},[t._v("销毁磁盘")])],1),e("el-row",[e("el-descriptions",{attrs:{column:2,size:"medium",border:""}},[e("el-descriptions-item",{attrs:{label:"ID"}},[t._v(t._s(t.show_volume.volumeId))]),e("el-descriptions-item",{attrs:{label:"磁盘名"}},[t._v(t._s(t.show_volume.description))]),e("el-descriptions-item",{attrs:{label:"磁盘类型"}},[t._v(t._s(t.show_volume.type))]),e("el-descriptions-item",{attrs:{label:"磁盘路径"}},[t._v(t._s(t.show_volume.path))]),e("el-descriptions-item",{attrs:{label:"磁盘模版"}},[t._v(t._s(this.template?this.template.name:"-"))]),e("el-descriptions-item",{attrs:{label:"父级路径"}},[t._v(t._s(t.show_volume.backingPath))]),e("el-descriptions-item",{attrs:{label:"磁盘存储池"}},[e("el-button",{attrs:{type:"text",underline:!1},on:{click:function(e){return t.show_storage_info(t.show_volume.storageId)}}},[t._v(" "+t._s(this.storage?this.storage.description:t.show_volume.storageId)+" ")])],1),e("el-descriptions-item",{attrs:{label:"挂载主机"}},[t.show_volume.attach?e("el-button",{attrs:{type:"text",underline:!1},on:{click:function(e){return t.show_guest_info(t.show_volume.attach.guestId)}}},[t._v(" "+t._s(t.show_volume.attach.description)+" ")]):t._e(),t.show_volume.attach?t._e():e("span",[t._v("-")])],1),e("el-descriptions-item",{attrs:{label:"磁盘容量"}},[t._v(t._s(t.get_volume_display_size(t.show_volume.capacity)))]),e("el-descriptions-item",{attrs:{label:"物理占用"}},[t._v(t._s(t.get_volume_display_size(t.show_volume.allocation)))]),e("el-descriptions-item",{attrs:{label:"状态"}},[e("el-tag",{attrs:{type:1===t.show_volume.status?"success":"danger"}},[t._v(t._s(t.get_volume_status(t.show_volume)))])],1)],1)],1)],1),e("CloneVolumeComponent",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],ref:"CloneVolumeComponentRef",on:{back:function(e){t.show_type=0},onVolumeUpdate:t.notify_volume_update}}),e("MigrateVolumeComponent",{directives:[{name:"show",rawName:"v-show",value:2===this.show_type,expression:"this.show_type === 2"}],ref:"MigrateVolumeComponentRef",on:{back:function(e){t.show_type=0},onVolumeUpdate:t.notify_volume_update}}),e("GuestInfoComponent",{directives:[{name:"show",rawName:"v-show",value:3===this.show_type,expression:"this.show_type === 3"}],ref:"GuestInfoComponentRef",on:{back:function(e){t.show_type=0}}}),e("StorageInfoComponent",{directives:[{name:"show",rawName:"v-show",value:4===this.show_type,expression:"this.show_type === 4"}],ref:"StorageInfoComponentRef",on:{back:function(e){t.show_type=0}}}),e("DownloadVolumeComponent",{ref:"DownloadVolumeComponentRef"}),e("ResizeVolumeComponent",{ref:"ResizeVolumeComponentRef",on:{onVolumeUpdate:t.notify_volume_update}}),e("CreateVolumeTemplateComponent",{ref:"CreateVolumeTemplateComponentRef"}),e("CreateVolumeSnapshotComponent",{ref:"CreateVolumeSnapshotComponentRef"})],1)},n=[],a=o(51907),r=o(85617),i=(o(41539),o(7488)),l=o(68501),c=o(69147),u=o(52874),d=o(55050),_=o(46455),p=o(47315),h=o(42173),m=o(73412),f=o(29924);const g={name:"VolumeInfoComponent",data:function(){return{volume_loading:!1,show_type:0,show_volume:{},template:{},storage:{}}},components:{DownloadVolumeComponent:i.Z,ResizeVolumeComponent:l.Z,CreateVolumeTemplateComponent:c.Z,CreateVolumeSnapshotComponent:u.Z,CloneVolumeComponent:d.Z,MigrateVolumeComponent:_.Z,StorageInfoComponent:p.Z},beforeCreate:function(){this.$options.components.GuestInfoComponent=o(5558).Z},created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},mixins:[m.Z,h.Z],methods:{go_back:function(){this.$emit("back")},init_volume:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.show_volume=t,e.show_type=0,o.next=4,e.init_volume_template();case 4:return o.next=6,e.init_volume_storage();case 6:case"end":return o.stop()}}),o)})))()},init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.show_type=0,e.volume_loading=!0,o.next=4,(0,f.Rm)({volumeId:t}).then((function(t){0===t.code?e.init_volume(t.data):e.$alert("获取磁盘信息失败:".concat(t.message),"提示",{dangerouslyUseHTMLString:!0,confirmButtonText:"返回",type:"error"}).then((function(){e.go_back()}))["catch"]((function(){e.go_back()}))}))["finally"]((function(){e.volume_loading=!1}));case 4:case"end":return o.stop()}}),o)})))()},notify_volume_update:function(t){this.refresh_volume(t),this.$emit("onVolumeUpdate",t)},refresh_volume:function(t){this.show_volume.volumeId===t.volumeId&&(this.show_volume=t)},init_volume_template:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(0!==t.show_volume.templateId){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,(0,f.BE)({templateId:t.show_volume.templateId}).then((function(e){0==e.code&&(t.template=e.data)}));case 4:case"end":return e.stop()}}),e)})))()},init_volume_storage:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,f.nQ)({storageId:t.show_volume.storageId}).then((function(e){0==e.code&&(t.storage=e.data)}));case 2:case"end":return e.stop()}}),e)})))()},show_resize_volume_click:function(t){this.$refs.ResizeVolumeComponentRef.init(t)},show_clone_volume_click:function(t){this.$refs.CloneVolumeComponentRef.init(t),this.show_type=1},show_migrate_volume_click:function(t){this.$refs.MigrateVolumeComponentRef.init(t),this.show_type=2},show_create_volume_template_click:function(t){this.$refs.CreateVolumeTemplateComponentRef.init(t)},show_create_volume_snapshot_click:function(t){this.$refs.CreateVolumeSnapshotComponentRef.init(t)},show_guest_info:function(t){this.$refs.GuestInfoComponentRef.initGuestId(t),this.show_type=3},show_storage_info:function(t){this.$refs.StorageInfoComponentRef.init(t),this.show_type=4},show_download_volume_click:function(t){this.$refs.DownloadVolumeComponentRef.init(t)},destroy_volume:function(t){var e=this;this.$confirm("删除磁盘, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,f.lp)({volumeId:t.volumeId}).then((function(t){0===t.code?(e.notify_volume_update(t.data),e.go_back()):e.$notify.error({title:"错误",message:"删除磁盘失败:".concat(t.message)})}))}))["catch"]((function(){}))},dispatch_notify_message:function(t){var e=this;2===t.type&&this.show_volume.volumeId===t.id&&(0,f.Rm)({volumeId:t.id}).then((function(t){0==t.code?e.refresh_volume(t.data):2000001==t.code&&e.go_back()}))}}},w=g;var v=o(1001),y=(0,v.Z)(w,s,n,!1,null,null,null);const b=y.exports},29924:(t,e,o)=>{"use strict";o.d(e,{FX:()=>gt,M8:()=>vt,vJ:()=>bt,uT:()=>X,go:()=>_t,is:()=>ht,MP:()=>j,sS:()=>Bt,Az:()=>lt,Ld:()=>y,XY:()=>h,ql:()=>J,Ox:()=>U,o6:()=>$,Mn:()=>V,rL:()=>O,Jf:()=>R,ng:()=>Ut,yl:()=>it,de:()=>I,s4:()=>g,tM:()=>Y,bv:()=>M,ye:()=>T,c4:()=>B,GE:()=>zt,lp:()=>H,n4:()=>wt,PX:()=>yt,DZ:()=>kt,fQ:()=>q,c3:()=>Vt,yL:()=>Gt,hI:()=>qt,c$:()=>tt,Xj:()=>nt,iN:()=>st,z2:()=>et,XR:()=>ot,KF:()=>v,vZ:()=>w,kI:()=>Nt,yj:()=>p,jR:()=>_,I2:()=>F,TQ:()=>K,Pu:()=>Q,Tu:()=>G,GQ:()=>P,nQ:()=>C,_u:()=>x,kH:()=>Rt,IC:()=>at,BE:()=>N,A8:()=>z,jW:()=>rt,lE:()=>Ct,Rm:()=>E,Mm:()=>D,pH:()=>xt,Tb:()=>dt,Ct:()=>A,v_:()=>Pt,vi:()=>ft,Mj:()=>Tt,A6:()=>W,rd:()=>It,ol:()=>b,pz:()=>m,dZ:()=>S,qB:()=>ct,Qm:()=>mt,XN:()=>k,fj:()=>f,vA:()=>Z,a$:()=>$t,h8:()=>Zt,K5:()=>L,NU:()=>ut,X:()=>pt,eV:()=>St});var s=o(45226),n=o(27594),a=(o(41539),o(23157),o(57658),o(19265)),r=o(93069),i=o.n(r),l=o(29076),c=o(67986),u=function(){function t(){(0,s.Z)(this,t),this.baseUrl=""}return(0,n.Z)(t,[{key:"getInsideConfig",value:function(){var t={baseURL:c.BASEURL,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8","X-Token":localStorage.getItem("X-Token")}};return t}},{key:"destroy",value:function(t){delete this.queue[t]}},{key:"interceptors",value:function(t,e){var o=this;t.interceptors.request.use((function(t){return"get"!==t.method.toLowerCase()?t.data=i().stringify(t.data):t.data=!0,t}),(function(t){return Promise.reject(t)})),t.interceptors.response.use((function(t){var e=t.data;if(401===e.code){var o=window.location.hash.toLowerCase();return o&&!o.startsWith("#/login")&&localStorage.setItem("X-Back",window.location.href),l.Z.push({path:"/login"}),t.data}return t.data}),(function(t){o.destroy(e);var s=t.response;if(s){var n=s.status,a=null;switch(n){case 400:a="请求参数错误";break;case 401:a="未授权或token过期,请登录";break;case 413:a="资源大小超过限制";break;case 403:a="跨域访问已被拒绝";break;case 404:a="请求地址出错: ".concat(s.config.url);break;case 408:a="请求超时";break;case 405:a="请求方法不正确";break;case 500:a="服务器内部错误";break;case 501:a="服务器未实现";break;case 502:a="网关错误";break;case 503:a="该服务不可用";break;case 504:a="网关超时";break;case 505:a="HTTP版本不受支持";break;default:a="未知错误status:".concat(n)}return console.log(a),Promise.reject(t)}return Promise.reject(t)}))}},{key:"request",value:function(t){var e=a.Z.create(),o=Object.assign({},t,this.getInsideConfig());return this.interceptors(e,o.url),e(o)}}]),t}();const d=new u;var _=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/network/all",params:t})},p=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/network/info",params:t})},h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/network/create",data:t,method:"PUT"})},m=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/network/maintenance",data:t,method:"POST"})},f=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/network/register",data:t,method:"POST"})},g=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/network/destroy",data:t,method:"DELETE"})},w=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/host/all",params:t})},v=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/host/info",params:t})},y=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/host/create",data:t,method:"PUT"})},b=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/host/maintenance",data:t,method:"POST"})},k=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/host/register",data:t,method:"POST"})},I=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/host/destroy",data:t,method:"DELETE"})},x=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/storage/all",params:t})},C=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/storage/info",params:t})},$=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/storage/create",data:t,method:"PUT"})},S=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/storage/maintenance",data:t,method:"POST"})},Z=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/storage/register",data:t,method:"POST"})},T=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/storage/destroy",data:t,method:"DELETE"})},z=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/template/all",params:t})},N=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/template/info",params:t})},V=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/template/create",data:t,method:"PUT"})},R=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/template/volume/create",data:t,method:"PUT"})},q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/template/download",data:t,method:"POST"})},B=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/template/destroy",data:t,method:"DELETE"})},P=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/snapshot/all",params:t})},G=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/snapshot/info",params:t})},U=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/snapshot/create",data:t,method:"PUT"})},M=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/snapshot/destroy",data:t,method:"DELETE"})},D=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/volume/all",params:t})},F=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/volume/not/attach/all",params:t})},E=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/volume/info",params:t})},O=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/volume/create",data:t,method:"PUT"})},A=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/volume/migrate",data:t,method:"PUT"})},L=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/volume/resize",data:t,method:"POST"})},j=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/volume/clone",data:t,method:"PUT"})},H=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/volume/destroy",data:t,method:"DELETE"})},X=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/volume/destroy/batch",data:t,method:"DELETE"})},Q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/scheme/all",params:t})},K=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/scheme/info",params:t})},J=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/scheme/create",data:t,method:"PUT"})},W=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/scheme/modify",data:t,method:"POST"})},Y=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/scheme/destroy",data:t,method:"DELETE"})},tt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/guest/info",params:t})},et=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/guest/vnc/password",params:t})},ot=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/guest/volume",params:t})},st=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/guest/network",params:t})},nt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/guest/all",params:t})},at=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/guest/system",params:t})},rt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/guest/user",params:t})},it=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/destroy",data:t,method:"DELETE"})},lt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/create",data:t,method:"PUT"})},ct=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/reinstall",data:t,method:"POST"})},ut=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/start",data:t,method:"POST"})},dt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/migrate",data:t,method:"POST"})},_t=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/start/batch",data:t,method:"POST"})},pt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/shutdown",data:t,method:"POST"})},ht=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/shutdown/batch",data:t,method:"POST"})},mt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/reboot",data:t,method:"POST"})},ft=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/modify",data:t,method:"POST"})},gt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/cd/attach",data:t,method:"POST"})},wt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/cd/detach",data:t,method:"POST"})},vt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/disk/attach",data:t,method:"POST"})},yt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/disk/detach",data:t,method:"POST"})},bt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/network/attach",data:t,method:"POST"})},kt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/network/detach",data:t,method:"POST"})},It=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/user/oauth2/login",data:t,method:"POST"})},xt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/user/login",data:t,method:"POST"})},Ct=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/user/list",data:t,method:"GET"})},$t=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/user/register",data:t,method:"PUT"})},St=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/user/state/update",data:t,method:"POST"})},Zt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/user/password/reset",data:t,method:"POST"})},Tt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/user/password/modify",data:t,method:"POST"})},zt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/user/destroy",data:t,method:"DELETE"})},Nt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/user/login/signature",params:t})},Vt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/user/signature",params:t})},Rt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/config",data:t,method:"GET"})},qt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/group/all",params:t})},Bt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/group/create",data:t,method:"PUT"})},Pt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/group/update",data:t,method:"POST"})},Gt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/group/info",params:t})},Ut=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/group/destroy",data:t,method:"DELETE"})}},67986:t=>{t.exports={BASEURL:"."}},73412:(t,e,o)=>{"use strict";o.d(e,{Z:()=>c});o(57658),o(34553),o(40561),o(89554),o(41539),o(54747);var s=o(45226),n=o(27594),a=o(54503),r=(o(83710),o(38862),o(32564),o(23157),o(29076)),i=function(){function t(){(0,s.Z)(this,t),(0,a.Z)(this,"notify_list",[])}return(0,n.Z)(t,[{key:"init",value:function(e){var o=this;if(!t.instance){var s="ws://".concat(window.location.host,"/api/ws/");console.log(new Date,"开始连接通信服务器..."),t.instance=new WebSocket(s),t.instance.onopen=function(){console.log(new Date,"通信服务器连接成功,发送认证信息");var e={command:0,data:localStorage.getItem("X-Token")};t.instance.send(JSON.stringify(e))},t.instance.onerror=function(){console.log(new Date,"出现错误,断开链接,重新开始连接..."),t.instance.close(),t.instance=void 0,setTimeout((function(){o.init(e)}),3e3)},t.instance.onclose=function(){console.log(new Date,"断开链接,等待链接..."),t.instance=void 0,setTimeout((function(){o.init(e)}),3e3)}}t.instance.onmessage=function(t){if(t.data){var o=JSON.parse(t.data);if(1==o.command)console.log(new Date,"WebSocket 登录认证成功.");else if(2==o.command){console.log(new Date,"WebSocket 登录认证Token错误.");var s=window.location.hash.toLowerCase();s&&!s.startsWith("#/login")&&localStorage.setItem("X-Back",window.location.href),r.Z.push({path:"/login"})}else 3==o.command&&e.handle_notify_message(o.data)}}}}]),t}();(0,a.Z)(i,"instance",void 0);const l=new i,c={data:function(){return{}},methods:{init_notify:function(){l.init(this)},subscribe_notify:function(t,e){l.notify_list.push({k:t,n:e})},unsubscribe_notify:function(t){var e=l.notify_list.findIndex((function(e){return e.k===t}));e>=0&&l.notify_list.splice(e,1)},handle_notify_message:function(t){l.notify_list.forEach((function(e){e.n(t)}))}}}},42173:(t,e,o)=>{"use strict";o.d(e,{Z:()=>s});o(56977),o(83710),o(9653),o(74916),o(77601),o(15306),o(24603),o(28450),o(88386),o(39714),o(83650);const s={methods:{get_guest_status:function(t){switch(t.status){case 0:return"正在创建";case 1:return"正在启动";case 2:return"正在运行";case 3:return"正在停止";case 4:return"已停止";case 5:return"重启中";case 6:return"虚拟机错误";case 7:return"正在迁移";default:return"未知状态[".concat(t.status,"]")}},get_host_status:function(t){switch(t.status){case 0:return"正在创建";case 1:return"在线";case 2:return"离线";case 3:return"正在维护";case 4:return"主机错误";default:return"未知状态[".concat(t.status,"]")}},get_network_status:function(t){switch(t.status){case 1:return"正在注册";case 2:return"已就绪";case 3:return"正在维护";case 4:return"正在销毁";case 5:return"网络错误";default:return"未知状态[".concat(t.status,"]")}},get_network_type:function(t){switch(t.type){case 0:return"基础网络";case 1:return"Vlan网络";default:return"未知类型[".concat(t.type,"]")}},get_snapshot_status:function(t){switch(t.status){case 0:return"正在创建";case 1:return"已就绪";case 2:return"快照错误";case 3:return"正在删除";default:return"未知状态[".concat(t.status,"]")}},get_storage_status:function(t){switch(t.status){case 0:return"正在创建";case 1:return"已就绪";case 2:return"正在维护";case 3:return"正在销毁";case 4:return"存储池错误";default:return"未知状态[".concat(t.status,"]")}},get_memory_display_size:function(t){return t>=1048576?(t/1048576).toFixed(2)+" GB":t>=1024?(t/1024).toFixed(2)+" MB":t+" KB"},get_template_status:function(t){switch(t.status){case 0:return"正在创建";case 1:return"下载中";case 2:return"已就绪";case 3:return"模版错误";case 4:return"正在销毁";default:return"未知状态[".concat(t.status,"]")}},get_template_type:function(t){switch(t.templateType){case 0:return"IOS 文件";case 1:return"系统模版";case 2:return"用户模版";default:return"未知模版[".concat(t.templateType,"]")}},get_volume_status:function(t){switch(t.status){case 0:return"正在创建";case 1:return"已就绪";case 2:return"正在挂载";case 3:return"正在卸载";case 4:return"正在克隆";case 5:return"创建模版";case 6:return"创建快照";case 7:return"正在迁移";case 8:return"正在扩容";case 9:return"正在销毁";case 10:return"磁盘错误";default:return"未知状态[".concat(t.status,"]")}},get_volume_display_size:function(t){return t>=1099511627776?(t/1099511627776).toFixed(2)+" TB":t>=1073741824?(t/1073741824).toFixed(2)+" GB":t>=1048576?(t/1048576).toFixed(2)+" MB":t>=1024?(t/1024).toFixed(2)+" KB":t+" bytes"},parse_date:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"yyyy-MM-dd hh:mm:ss";if(!t)return"";t=new Date(Number(t));var o={"M+":t.getMonth()+1,"d+":t.getDate(),"h+":t.getHours(),"m+":t.getMinutes(),"s+":t.getSeconds(),"q+":Math.floor((t.getMonth()+3)/3),S:t.getMilliseconds()};for(var s in/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(t.getFullYear()+"").substr(4-RegExp.$1.length))),o)new RegExp("("+s+")").test(e)&&(e=e.replace(RegExp.$1,1===RegExp.$1.length?o[s]:("00"+o[s]).substr((""+o[s]).length)));return e}}}},38214:(t,e,o)=>{"use strict";o(66992),o(88674),o(19601),o(17727);var s=o(27195),n=function(){var t=this,e=t._self._c;return e("div",{attrs:{id:"app"}},[t.isFullScreen?t._e():e("HeadViewVue"),e("el-container",[t.isFullScreen?t._e():e("NavViewVue"),e("el-main",{staticClass:"main-container",class:t.isFullScreen?"full_screen_class":""},[e("router-view")],1)],1)],1)},a=[],r=function(){var t=this,e=t._self._c;return e("div",{staticClass:"layout-left",attrs:{id:"LayoutLeft"}},[e("div",{staticClass:"shrink",on:{click:t.shrinkMenu}},[e("i",{class:t.isCollapse?"el-icon-s-unfold":"el-icon-s-fold"})]),e("el-menu",{staticClass:"el-menu-vertical-demo",attrs:{collapse:t.isCollapse,"default-active":this.$route.path,router:"","collapse-transition":!1,"background-color":"rgb(52, 73, 94)","text-color":"#fff","active-text-color":"#ffd04b"}},t._l(t.nav_menu_data,(function(o,s){return e("el-menu-item",{key:s,attrs:{index:o.path}},[e("i",{class:o.icon}),e("span",{attrs:{slot:"title"},slot:"title"},[t._v(t._s(o.title))])])})),1)],1)},i=[];const l={data:function(){return{path:"",isCollapse:!0,nav_menu_data:[{path:"/",title:"主页",icon:"el-icon-house"},{path:"/Guest",title:"虚拟机管理",icon:"el-icon-s-platform"},{path:"/Volume",title:"磁盘管理",icon:"el-icon-bank-card"},{path:"/Snapshot",title:"快照管理",icon:"el-icon-copy-document"},{path:"/Network",title:"网络管理",icon:"el-icon-platform-eleme"},{path:"/Host",title:"主机管理",icon:"el-icon-monitor"},{path:"/Storage",title:"存储池管理",icon:"el-icon-coin"},{path:"/Template",title:"模版管理",icon:"el-icon-price-tag"},{path:"/Scheme",title:"计算方案",icon:"el-icon-cpu"},{path:"/Group",title:"群组管理",icon:"el-icon-folder"},{path:"/User",title:"用户管理",icon:"el-icon-s-custom"}]}},created:function(){this.isCollapse="0"!==localStorage.getItem("menu_is_collapse")},methods:{shrinkMenu:function(){this.isCollapse=!this.isCollapse,localStorage.setItem("menu_is_collapse",this.isCollapse?"1":"0")}}},c=l;var u=o(1001),d=(0,u.Z)(c,r,i,!1,null,"fe64f52c",null);const _=d.exports;var p=function(){var t=this,e=t._self._c;return e("el-header",[e("div",{staticStyle:{float:"left","background-color":"#34495e",height:"100%"}},[e("img",{staticStyle:{width:"32px",height:"32px","margin-left":"10px","margin-top":"15px"},attrs:{src:o(66949)}})]),e("div",{staticStyle:{float:"left","background-color":"#34495e",height:"100%"}},[e("h5",{staticStyle:{"font-size":"18px",margin:"20px 0px 20px 10px",color:"white"}},[t._v("KVM Cloud")])]),e("el-menu",{staticClass:"headerMenu",attrs:{mode:"horizontal","background-color":"#34495e","text-color":"#fff","active-text-color":"#ffd04b"},on:{select:t.handleSelect}},[e("el-menu-item",{attrs:{index:"quit"}},[t._v("退出")]),e("el-menu-item",{attrs:{index:"password"}},[t._v("修改密码")])],1),e("el-dialog",{attrs:{title:"修改密码",visible:t.update_password_dialog_visible,center:"",width:"400px","close-on-click-modal":!1,"close-on-press-escape":!1},on:{"update:visible":function(e){t.update_password_dialog_visible=e}}},[e("el-form",{attrs:{model:t.update_password,"label-position":"right","label-width":"80px"}},[e("el-form-item",{attrs:{label:"旧密码",prop:"oldPassword"}},[e("el-input",{attrs:{type:"password","show-password":!0},model:{value:t.update_password.oldPassword,callback:function(e){t.$set(t.update_password,"oldPassword",e)},expression:"update_password.oldPassword"}})],1),e("el-form-item",{attrs:{label:"新密码",prop:"newPassword"}},[e("el-input",{attrs:{type:"password","show-password":!0},model:{value:t.update_password.newPassword,callback:function(e){t.$set(t.update_password,"newPassword",e)},expression:"update_password.newPassword"}})],1),e("el-form-item",{attrs:{label:"确认密码",prop:"confirmPassword"}},[e("el-input",{attrs:{type:"password","show-password":!0},model:{value:t.update_password.confirmPassword,callback:function(e){t.$set(t.update_password,"confirmPassword",e)},expression:"update_password.confirmPassword"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.update_user_password_click}},[t._v("确 定")]),e("el-button",{on:{click:function(e){t.update_password_dialog_visible=!1}}},[t._v("取 消")])],1)],1)],1),e("el-dialog",{attrs:{title:"联系&支持",visible:t.support_dialog_visible,center:"",width:"450px"},on:{"update:visible":function(e){t.support_dialog_visible=e}}},[e("el-tabs",{model:{value:t.supportActiveName,callback:function(e){t.supportActiveName=e},expression:"supportActiveName"}},[e("el-tab-pane",{attrs:{label:"联系作者",name:"concat"}},[e("div",{staticStyle:{"font-size":"15px","line-height":"30px"}},[e("div",[t._v("    本产品开源免费,遵从Apache2.0协议,个人或企业内部可自由的接入和使用,并且将持续提供免费的社区技术支持。")]),e("br"),e("div",[t._v("    为了保证性能,请使用SSD创建NFS存储。数据无价,做删除操作前务必三思,建议对核数据采用异备。")]),e("br"),e("div",[t._v("    如果您在使用中遇到问题或相关建议,请提交issue。如遇紧急问题也可添加作者QQ(153391689)寻求帮助。项目会在适当的时期启动交流群,如有相关需求可发送邮件至153391689@qq.com")]),e("br"),e("div",[t._v("    开源不易,如果KVM Cloud对您带来了帮助,请给作者买杯咖啡吧 :)")]),e("br")])]),e("el-tab-pane",{attrs:{label:"微信捐赠",name:"wx"}},[e("div",{staticClass:"wx"})]),e("el-tab-pane",{attrs:{label:"支付宝捐赠",name:"zfb"}},[e("div",{staticClass:"zfb"})])],1)],1)],1)},h=[],m=(o(57658),o(29924));const f={data:function(){return{update_password_dialog_visible:!1,support_dialog_visible:!1,supportActiveName:"concat",update_password:{oldPassword:"",newPassword:"",confirmPassword:"",nonce:""}}},methods:{handleSelect:function(t){var e=this;switch(t){case"support":this.support_dialog_visible=!0;break;case"password":this.update_password.oldPassword="",this.update_password.newPassword="",this.update_password.confirmPassword="",this.update_password.nonce="",this.update_password_dialog_visible=!0;break;case"quit":this.$confirm("退出登录, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){localStorage.removeItem("X-Token"),e.$router.push({path:"/Login"})}))["catch"]((function(){}));break}},update_user_password_click:function(){var t=this;this.update_password.newPassword==this.update_password.confirmPassword?(0,m.c3)().then((function(e){if(0===e.code){var o=window.sha256_digest(window.sha256_digest(t.update_password.oldPassword+":"+e.data.signature)+":"+e.data.nonce),s=e.data.nonce,n=window.sha256_digest(t.update_password.newPassword+":"+e.data.signature),a={oldPassword:o,newPassword:n,nonce:s};(0,m.Mj)(a).then((function(e){0!==e.code?t.$notify.error({title:"错误",message:"修改密码失败:".concat(e.message)}):t.update_password_dialog_visible=!1}))}else t.$notify.error({title:"错误",message:"修改密码失败:".concat(e.message)})})):this.$notify.error({title:"错误",duration:3e3,message:"新密码与旧密码不一致"})}}},g=f;var w=(0,u.Z)(g,p,h,!1,null,"c50e8612",null);const v=w.exports,y={components:{NavViewVue:_,HeadViewVue:v},provide:function(){var t=this;return{check_full_screen:function(e){t.isFullScreen=e}}},data:function(){return{isFullScreen:!1}}},b=y;var k=(0,u.Z)(b,n,a,!1,null,null,null);const I=k.exports;var x=o(29076),C=o(90408);s["default"].use(C.ZP);const $=new C.ZP.Store({state:{},getters:{},mutations:{},actions:{},modules:{}});var S=o(85114),Z=o.n(S);s["default"].use(Z()),s["default"].config.productionTip=!1,s["default"].prototype.$websocket=void 0,new s["default"]({router:x.Z,store:$,render:function(t){return t(I)}}).$mount("#app")},29076:(t,e,o)=>{"use strict";o.d(e,{Z:()=>ao});var s=o(27195),n=o(42241),a=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"}],staticClass:"box-card"},[e("el-row",{staticClass:"clearfix",staticStyle:{height:"20px"},attrs:{slot:"header"},slot:"header"},[e("el-button",{staticStyle:{float:"left",padding:"3px 0"},attrs:{type:"text"},on:{click:t.show_create_network}},[t._v("创建网络")])],1),e("el-row",[e("el-table",{staticStyle:{width:"100%"},attrs:{"v-loading":t.data_loading,data:t.networks}},[e("el-table-column",{attrs:{label:"ID",prop:"networkId",width:"80"}}),e("el-table-column",{attrs:{label:"名称",prop:"name",width:"120","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"桥接网卡",prop:"bridge",width:"120"}}),e("el-table-column",{attrs:{label:"子网",prop:"subnet",width:"150"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(t._s(e.row.subnet)+"/"+t._s(t.netmask2CIDR(e.row.mask)))]}}])}),e("el-table-column",{attrs:{label:"网络类型",prop:"type",width:"100"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",[t._v(t._s(t.get_network_type(o.row)))])]}}])}),e("el-table-column",{attrs:{label:"状态",prop:"status",width:"100"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",{attrs:{type:2===o.row.status?"success":"danger"}},[t._v(t._s(t.get_network_status(o.row)))])]}}])}),e("el-table-column",{attrs:{label:"操作","min-width":"380"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"",size:"mini"},on:{click:function(e){return t.show_network_info_click(o.row)}}},[t._v("网络详情")]),e("el-button",{attrs:{type:"success",size:"mini"},on:{click:function(e){return t.register_network(o.row)}}},[t._v("重新注册")]),3!==o.row.status?e("el-button",{attrs:{type:"warning",size:"mini"},on:{click:function(e){return t.pasue_network(o.row)}}},[t._v("开始维护")]):t._e(),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_network(o.row)}}},[t._v("销毁网络")])]}}])})],1)],1)],1),e("NetworkInfoComponent",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],ref:"NetworkInfoComponentRef",on:{onNetworkUpdate:t.update_network_info,back:function(e){return t.show_network_list()}}}),e("CreateNetworkComponent",{directives:[{name:"show",rawName:"v-show",value:2===this.show_type,expression:"this.show_type === 2"}],ref:"CreateNetworkComponentRef",on:{onNetworkUpdate:t.update_network_info,back:function(e){return t.show_network_list()}}})],1)],1)],1)},r=[],i=o(51907),l=o(85617),c=(o(68309),o(41539),o(69600),o(21249),o(9653),o(96647),o(83710),o(39714),o(69826),o(34553),o(57658),o(40561),o(42173)),u=o(29924),d=function(){var t=this,e=t._self._c;return e("div",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"},{name:"loading",rawName:"v-loading",value:t.network_loading,expression:"network_loading"}],staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{attrs:{content:"网络详情"},on:{back:t.on_back_click}})],1),e("el-row",{staticStyle:{"text-align":"left",margin:"20px 0"}},[e("el-button",{attrs:{type:"success",size:"mini"},on:{click:function(e){return t.register_network(t.show_network)}}},[t._v("重新注册")]),3!==t.show_network.status?e("el-button",{attrs:{type:"warning",size:"mini"},on:{click:function(e){return t.pasue_network(t.show_network)}}},[t._v("开始维护")]):t._e(),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_network(t.show_network)}}},[t._v("销毁网络")])],1),e("el-row",[e("el-descriptions",{attrs:{column:2,size:"medium",border:""}},[e("el-descriptions-item",{attrs:{label:"ID"}},[t._v(t._s(t.show_network.networkId))]),e("el-descriptions-item",{attrs:{label:"名称"}},[t._v(t._s(t.show_network.name))]),e("el-descriptions-item",{attrs:{label:"起始IP"}},[t._v(t._s(t.show_network.startIp))]),e("el-descriptions-item",{attrs:{label:"结束IP"}},[t._v(t._s(t.show_network.endIp))]),e("el-descriptions-item",{attrs:{label:"网关地址"}},[t._v(t._s(t.show_network.gateway))]),e("el-descriptions-item",{attrs:{label:"子网掩码"}},[t._v(t._s(t.show_network.mask))]),e("el-descriptions-item",{attrs:{label:"子网地址"}},[t._v(t._s(t.show_network.subnet))]),e("el-descriptions-item",{attrs:{label:"广播地址"}},[t._v(t._s(t.show_network.broadcast))]),e("el-descriptions-item",{attrs:{label:"DNS"}},[t._v(t._s(t.show_network.dns))]),e("el-descriptions-item",{attrs:{label:"桥接网卡"}},[t._v(t._s(t.show_network.bridge))]),e("el-descriptions-item",{attrs:{label:"网络类型"}},[t._v(t._s(t.get_network_type(t.show_network)))]),1===t.show_network.type?e("el-descriptions-item",{attrs:{label:"VLAN ID"}},[t._v(t._s(t.show_network.vlanId))]):t._e(),1===t.show_network.type?e("el-descriptions-item",{attrs:{label:"基础网络"}},[e("el-button",{attrs:{type:"text"}},[t._v(t._s(t.get_parent_network(t.show_network).name))])],1):t._e(),e("el-descriptions-item",{attrs:{label:"网络状态"}},[e("el-tag",{attrs:{type:2===t.show_network.status?"success":"danger"}},[t._v(t._s(t.get_network_status(t.show_network)))])],1)],1),e("br"),e("el-tabs",{attrs:{type:"border-card"}},[e("el-tab-pane",{attrs:{label:"系统组件"}},[e("el-table",{staticStyle:{width:"100%"},attrs:{data:t.system_guests}},[e("el-table-column",{attrs:{label:"ID",prop:"guestId",width:"80"}}),e("el-table-column",{attrs:{label:"实例名",prop:"name",width:"200"}}),e("el-table-column",{attrs:{label:"标签",prop:"description",width:"200"}}),e("el-table-column",{attrs:{label:"IP地址",prop:"guestIp",width:"150"}}),e("el-table-column",{attrs:{label:"状态",prop:"status",width:"100"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",{attrs:{type:2===o.row.status?"success":"danger"}},[t._v(t._s(t.get_guest_status(o.row)))])]}}])}),e("el-table-column",{attrs:{label:"操作"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"text"},on:{click:function(e){return t.go_guest_info(o.row.guestId)}}},[t._v("详情")])]}}])})],1)],1)],1)],1)],1),e("GuestInfoComponent",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],ref:"GuestInfoComponentRef",on:{back:function(e){t.show_type=0},onGuestUpdate:t.update_guest_info}})],1)},_=[],p=o(73412),h=o(5558);const m={name:"NetworkInfoComponent",data:function(){return{network_loading:!1,system_guests:[],networks:[],show_type:0,show_network:{networkId:0,name:"",startIp:"",endIp:"",gateway:"",mask:"",subnet:"",broadcast:"",bridge:"",dns:"",type:0,vlanId:100,basicNetworkId:""}}},components:{GuestInfoComponent:h.Z},mixins:[p.Z,c.Z],created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},methods:{on_back_click:function(){this.$emit("back")},on_notify_update_networkt_info:function(t){this.refresh_network(t),this.$emit("onNetworkUpdate",t)},refresh_network:function(t){this.show_network.networkId==t.networkId&&(this.show_network=t)},go_guest_info:function(t){this.show_type=1,this.$refs.GuestInfoComponentRef.initGuestId(t)},init_network:function(t,e){var o=this;return(0,l.Z)((0,i.Z)().mark((function s(){return(0,i.Z)().wrap((function(s){while(1)switch(s.prev=s.next){case 0:return o.show_type=0,o.networks=t,o.show_network=e,o.system_guests=[],s.next=6,o.load_system_guest(e);case 6:case"end":return s.stop()}}),s)})))()},init:function(t){var e=this;return(0,l.Z)((0,i.Z)().mark((function o(){return(0,i.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.show_type=0,e.network_loading=!0,o.next=4,(0,u.yj)({networkId:t}).then((function(t){console.log(t),0===t.code?e.init_network(t.data):e.$alert("获取网络信息失败:".concat(t.message),"提示",{dangerouslyUseHTMLString:!0,confirmButtonText:"返回",type:"error"}).then((function(){e.on_back_click()}))["catch"]((function(){e.on_back_click()}))}))["finally"]((function(){e.host_loading=!1}));case 4:case"end":return o.stop()}}),o)})))()},load_system_guest:function(t){var e=this;return(0,l.Z)((0,i.Z)().mark((function o(){return(0,i.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.system_guests=[],e.network_loading=!0,o.next=4,(0,u.IC)({networkId:t.networkId}).then((function(t){0===t.code&&(e.system_guests=t.data)}))["finally"]((function(){e.network_loading=!1}));case 4:case"end":return o.stop()}}),o)})))()},get_parent_network:function(t){var e=this.networks.find((function(e){return e.networkId===t.basicNetworkId}));return e||{name:"-"}},delete_guest:function(t){var e=this.system_guests.findIndex((function(e){return e.guestId===t}));e>=0&&this.system_guests.splice(e,1)},update_guest_info:function(t){if(0===t.type&&t.networkId===this.show_network.networkId){var e=this.system_guests.findIndex((function(e){return e.guestId===t.guestId}));e>=0?this.$set(this.system_guests,e,t):this.system_guests.push(t),this.$forceUpdate()}},pasue_network:function(t){var e=this;this.$confirm("维护网络, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.pz)({networkId:t.networkId}).then((function(t){0===t.code?e.on_notify_update_networkt_info(t.data):e.$notify.error({title:"错误",message:"暂停网络失败:".concat(t.message)})}))}))["catch"]((function(){}))},register_network:function(t){var e=this;this.$confirm("重新注册网络, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.fj)({networkId:t.networkId}).then((function(t){0===t.code?e.on_notify_update_networkt_info(t.data):e.$notify.error({title:"错误",message:"注册网络失败:".concat(t.message)})}))}))["catch"]((function(){}))},destroy_network:function(t){var e=this;this.$confirm("销毁网络, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.s4)({networkId:t.networkId}).then((function(t){0===t.code?e.on_back_click():e.$notify.error({title:"错误",message:"删除网络失败:".concat(t.message)})}))}))["catch"]((function(){}))},dispatch_notify_message:function(t){var e=this;3===t.type&&this.show_network.networkId===t.id?(0,u.yj)({networkId:t.id}).then((function(t){0==t.code?e.refresh_network(t.data):2000001==t.code&&e.on_back_click()})):1===t.type&&(0,u.c$)({guestId:t.id}).then((function(o){0==o.code?e.update_guest_info(o.data):2000001==o.code&&e.delete_guest(t.id)}))}}},f=m;var g=o(1001),w=(0,g.Z)(f,d,_,!1,null,null,null);const v=w.exports;var y=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"创建网络"},on:{back:function(e){return t.on_back_click()}}})],1),e("el-row",[e("el-form",{ref:"createForm",staticClass:"demo-ruleForm",attrs:{model:t.create_network,"label-width":"100px"}},[e("el-row",{attrs:{gutter:24}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"网络名称",prop:"name"}},[e("el-input",{model:{value:t.create_network.name,callback:function(e){t.$set(t.create_network,"name",e)},expression:"create_network.name"}})],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"网络类型",prop:"type"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.create_network.type,callback:function(e){t.$set(t.create_network,"type",e)},expression:"create_network.type"}},[e("el-option",{attrs:{label:"基础网络",value:0}}),e("el-option",{attrs:{label:"Vlan网络(只允许OpenSitch方式)",value:1}})],1)],1)],1)],1),e("el-row",{attrs:{gutter:24}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"起始IP",prop:"startIp"}},[e("el-input",{model:{value:t.create_network.startIp,callback:function(e){t.$set(t.create_network,"startIp",e)},expression:"create_network.startIp"}})],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"结束IP",prop:"endIp"}},[e("el-input",{model:{value:t.create_network.endIp,callback:function(e){t.$set(t.create_network,"endIp",e)},expression:"create_network.endIp"}})],1)],1)],1),e("el-row",{attrs:{gutter:24}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"网关地址",prop:"gateway"}},[e("el-input",{model:{value:t.create_network.gateway,callback:function(e){t.$set(t.create_network,"gateway",e)},expression:"create_network.gateway"}})],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"子网掩码",prop:"mask"}},[e("el-input",{model:{value:t.create_network.mask,callback:function(e){t.$set(t.create_network,"mask",e)},expression:"create_network.mask"}})],1)],1)],1),e("el-row",{attrs:{gutter:24}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"子网地址",prop:"subnet"}},[e("el-input",{model:{value:t.create_network.subnet,callback:function(e){t.$set(t.create_network,"subnet",e)},expression:"create_network.subnet"}})],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"广播地址",prop:"broadcast"}},[e("el-input",{model:{value:t.create_network.broadcast,callback:function(e){t.$set(t.create_network,"broadcast",e)},expression:"create_network.broadcast"}})],1)],1)],1),e("el-row",{attrs:{gutter:24}},[e("el-col",{attrs:{span:24}},[e("el-form-item",{attrs:{label:"DNS",prop:"dns"}},[e("el-input",{model:{value:t.create_network.dns,callback:function(e){t.$set(t.create_network,"dns",e)},expression:"create_network.dns"}})],1)],1)],1),e("el-row",{attrs:{gutter:24}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"桥接网卡",prop:"bridge"}},[e("el-input",{model:{value:t.create_network.bridge,callback:function(e){t.$set(t.create_network,"bridge",e)},expression:"create_network.bridge"}})],1)],1),e("el-col",{attrs:{span:12}},[1===t.create_network.type?e("div",{staticStyle:{color:"red","font-size":"12px","line-height":"40px"}},[t._v("Vlan为测试状态,只支持Openswitch网络,创建的桥接网卡必须为OVS桥接")]):t._e()])],1),1===t.create_network.type?e("el-row",{attrs:{gutter:24}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"VLAN ID",prop:"vlanId"}},[e("el-input",{model:{value:t.create_network.vlanId,callback:function(e){t.$set(t.create_network,"vlanId",e)},expression:"create_network.vlanId"}})],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"基础网络",prop:"basicNetworkId"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择基础网络"},model:{value:t.create_network.basicNetworkId,callback:function(e){t.$set(t.create_network,"basicNetworkId",e)},expression:"create_network.basicNetworkId"}},t._l(t.networks,(function(t){return e("el-option",{directives:[{name:"show",rawName:"v-show",value:0===t.type,expression:"item.type === 0"}],key:t.networkId,attrs:{label:t.name,value:t.networkId}})})),1)],1)],1)],1):t._e(),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.create_network_click}},[t._v("立即创建")]),e("el-button",{on:{click:t.on_back_click}},[t._v("取消")])],1)],1)],1)],1)},b=[];const k={data:function(){return{networks:[],create_network:{name:"",startIp:"",endIp:"",gateway:"",mask:"",subnet:"",broadcast:"",bridge:"",dns:"",type:0,vlanId:100,basicNetworkId:""}}},methods:{on_back_click:function(){this.$emit("back")},on_notify_update_network:function(t){this.$emit("onNetworkUpdate",t)},init:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.$refs["createForm"]&&t.$refs["createForm"].resetFields(),e.next=3,(0,u.jR)().then((function(e){0==e.code&&(t.networks=e.data)}))["finally"]((function(){t.data_loading=!1}));case 3:case"end":return e.stop()}}),e)})))()},create_network_click:function(){var t=this;0===this.create_network.type&&(this.create_network.vlanId=0,this.create_network.basicNetworkId=0),(0,u.XY)(this.create_network).then((function(e){0===e.code?(t.on_notify_update_network(e.data),t.on_back_click()):t.$notify.error({title:"错误",message:"创建网络失败:".concat(e.message)})}))}}},I=k;var x=(0,g.Z)(I,y,b,!1,null,null,null);const C=x.exports,$={name:"NetworkView",components:{NetworkInfoComponent:v,CreateNetworkComponent:C},data:function(){return{data_loading:!1,show_type:-1,networks:[]}},mounted:function(){this.show_type=0,this.init_view()},created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},mixins:[p.Z,c.Z],methods:{init_view:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.data_loading=!0,e.next=3,(0,u.jR)().then((function(e){0==e.code&&(t.networks=e.data)}))["finally"]((function(){t.data_loading=!1}));case 3:case"end":return e.stop()}}),e)})))()},netmask2CIDR:function(t){return t.split(".").map(Number).map((function(t){return(t>>>0).toString(2)})).join("").split("1").length-1},get_parent_network:function(t){var e=this.networks.find((function(e){return e.networkId===t.basicNetworkId}));return e||{name:"-"}},update_network_info:function(t){var e=this.networks.findIndex((function(e){return e.networkId===t.networkId}));e>=0?this.$set(this.networks,e,t):this.networks.push(t),this.$refs.NetworkInfoComponentRef.refresh_network(t)},dispatch_notify_message:function(t){var e=this;3===t.type&&(0,u.yj)({networkId:t.id}).then((function(o){if(0==o.code)e.update_network_info(o.data);else if(1000001==o.code){var s=e.networks.findIndex((function(e){return e.networkId===t.id}));s>=0&&e.networks.splice(s,1)}e.$forceUpdate()}))},show_network_list:function(){this.show_type=0},show_create_network:function(){this.$refs.CreateNetworkComponentRef.init(),this.show_type=2},show_network_info_click:function(t){this.$refs.NetworkInfoComponentRef.init_network(this.networks,t),this.show_type=1},pasue_network:function(t){var e=this;this.$confirm("维护网络, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.pz)({networkId:t.networkId}).then((function(t){0===t.code?e.update_network_info(t.data):e.$notify.error({title:"错误",message:"暂停网络失败:".concat(t.message)})}))}))["catch"]((function(){}))},register_network:function(t){var e=this;this.$confirm("重新注册网络, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.fj)({networkId:t.networkId}).then((function(t){0===t.code?e.update_network_info(t.data):e.$notify.error({title:"错误",message:"注册网络失败:".concat(t.message)})}))}))["catch"]((function(){}))},destroy_network:function(t){var e=this;this.$confirm("销毁网络, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.s4)({networkId:t.networkId}).then((function(t){0===t.code?(e.update_network_info(t.data),e.show_type=0):e.$notify.error({title:"错误",message:"删除网络失败:".concat(t.message)})}))}))["catch"]((function(){}))}}},S=$;var Z=(0,g.Z)(S,a,r,!1,null,"4c1fe47a",null);const T=Z.exports;var z=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"}],staticClass:"box-card"},[e("el-row",{staticClass:"clearfix",staticStyle:{height:"20px"},attrs:{slot:"header"},slot:"header"},[e("el-button",{staticStyle:{float:"left",padding:"3px 0"},attrs:{type:"text"},on:{click:t.show_create_host}},[t._v("创建主机")])],1),e("el-row",[e("el-table",{staticStyle:{width:"100%"},attrs:{"v-loading":t.data_loading,data:t.hosts}},[e("el-table-column",{attrs:{label:"ID",prop:"hostId",width:"80"}}),e("el-table-column",{attrs:{label:"名称",prop:"displayName","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"主机IP",prop:"hostIp",width:"120"}}),e("el-table-column",{attrs:{label:"CPU",prop:"hostIp",width:"120"},scopedSlots:t._u([{key:"default",fn:function(t){return[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"已使用:"+t.row.allocationCpu+"核 / 总共:"+t.row.totalCpu+"核",placement:"top"}},[e("el-progress",{attrs:{color:"#67C23A",percentage:t.row.totalCpu<=0?0:Math.floor(100*t.row.allocationCpu/t.row.totalCpu)}})],1)]}}])}),e("el-table-column",{attrs:{label:"内存",prop:"hostIp",width:"120"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"已使用:"+t.get_memory_display_size(o.row.allocationMemory)+" / 总共:"+t.get_memory_display_size(o.row.totalMemory),placement:"top"}},[e("el-progress",{attrs:{color:"#67C23A",percentage:o.row.totalMemory<=0?0:Math.floor(100*o.row.allocationMemory/o.row.totalMemory)}})],1)]}}])}),e("el-table-column",{attrs:{label:"状态",prop:"status",width:"100"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",{attrs:{type:1===o.row.status?"success":"danger"}},[t._v(t._s(t.get_host_status(o.row)))])]}}])}),e("el-table-column",{attrs:{label:"操作",width:"400"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"",size:"mini"},on:{click:function(e){return t.show_host_info_click(o.row)}}},[t._v("主机详情")]),e("el-button",{attrs:{type:"success",size:"mini"},on:{click:function(e){return t.register_host(o.row)}}},[t._v("重新注册")]),3!==o.row.status?e("el-button",{attrs:{type:"warning",size:"mini"},on:{click:function(e){return t.pasue_host(o.row)}}},[t._v("开始维护")]):t._e(),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_host(o.row)}}},[t._v("销毁主机")])]}}])})],1)],1)],1),e("HostInfoComponent",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],ref:"HostInfoComponentRef",on:{back:t.show_host_list,onHostUpdate:t.update_host_info}}),e("CreateHostComponent",{directives:[{name:"show",rawName:"v-show",value:2===this.show_type,expression:"this.show_type === 2"}],ref:"CreateHostComponentRef",on:{back:t.show_host_list,onHostUpdate:t.update_host_info}})],1)],1)],1)},N=[],V=o(48080),R=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"创建主机"},on:{back:function(e){return t.on_back_click()}}})],1),e("el-row",[e("el-form",{ref:"createForm",staticClass:"demo-ruleForm",attrs:{model:t.create_host,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"显示名称",prop:"displayName"}},[e("el-input",{model:{value:t.create_host.displayName,callback:function(e){t.$set(t.create_host,"displayName",e)},expression:"create_host.displayName"}})],1),e("el-form-item",{attrs:{label:"主机IP",prop:"hostIp"}},[e("el-input",{model:{value:t.create_host.hostIp,callback:function(e){t.$set(t.create_host,"hostIp",e)},expression:"create_host.hostIp"}})],1),e("el-form-item",{attrs:{label:"网卡名称",prop:"nic"}},[e("el-input",{model:{value:t.create_host.nic,callback:function(e){t.$set(t.create_host,"nic",e)},expression:"create_host.nic"}})],1),e("el-form-item",{attrs:{label:"通信地址",prop:"uri"}},[e("el-input",{model:{value:t.create_host.uri,callback:function(e){t.$set(t.create_host,"uri",e)},expression:"create_host.uri"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.create_host_click}},[t._v("立即创建")]),e("el-button",{on:{click:t.on_back_click}},[t._v("取消")])],1)],1)],1)],1)},q=[];const B={data:function(){return{create_host:{displayName:"",hostIp:"",nic:"",uri:""}}},methods:{on_back_click:function(){this.$emit("back")},on_notify_update_host_info:function(t){this.$emit("onHostUpdate",t)},init:function(){this.$refs["createForm"]&&this.$refs["createForm"].resetFields()},create_host_click:function(){var t=this;(0,u.Ld)(this.create_host).then((function(e){0===e.code?(t.on_notify_update_host_info(e.data),t.on_back_click()):t.$notify.error({title:"错误",message:"创建主机失败:".concat(e.message)})}))}}},P=B;var G=(0,g.Z)(P,R,q,!1,null,null,null);const U=G.exports,M={name:"hostView",components:{HostInfoComponent:V.Z,CreateHostComponent:U},data:function(){return{data_loading:!1,show_type:-1,hosts:[]}},mixins:[p.Z,c.Z],mounted:function(){this.show_type=0,this.init_view()},created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},methods:{init_view:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.data_loading=!0,e.next=3,(0,u.vZ)().then((function(e){0==e.code&&(t.hosts=e.data)}))["finally"]((function(){t.data_loading=!1}));case 3:case"end":return e.stop()}}),e)})))()},show_host_list:function(){this.show_type=0},show_create_host:function(){this.$refs.CreateHostComponentRef.init(),this.show_type=2},show_host_info_click:function(t){this.show_host=t,this.$refs.HostInfoComponentRef.init_host(t),this.show_type=1},update_host_info:function(t){var e=this.hosts.findIndex((function(e){return e.hostId===t.hostId}));e>=0?this.$set(this.hosts,e,t):this.hosts.push(t),this.$refs.HostInfoComponentRef.refresh_host(t)},dispatch_notify_message:function(t){var e=this;4===t.type&&(0,u.KF)({hostId:t.id}).then((function(o){if(0==o.code)e.update_host_info(o.data);else if(7000001==o.code){var s=e.hosts.findIndex((function(e){return e.hostId===t.id}));s>=0&&e.hosts.splice(s,1)}}))},pasue_host:function(t){var e=this;this.$confirm("维护主机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.ol)({hostId:t.hostId}).then((function(t){0===t.code?e.update_host_info(t.data):e.$notify.error({title:"错误",message:"暂停主机失败:".concat(t.message)})}))}))["catch"]((function(){}))},register_host:function(t){var e=this;this.$confirm("重新注册主机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.XN)({hostId:t.hostId}).then((function(t){0===t.code?e.update_host_info(t.data):e.$notify.error({title:"错误",message:"注册主机失败:".concat(t.message)})}))}))["catch"]((function(){}))},destroy_host:function(t){var e=this;this.$confirm("删除当前主机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.de)({hostId:t.hostId}).then((function(o){if(0===o.code){var s=e.hosts.findIndex((function(e){return e.hostId===t.hostId}));s>=0&&e.hosts.splice(s,1),e.show_type=0}else e.$notify.error({title:"错误",message:"删除主机失败:".concat(o.message)})}))}))["catch"]((function(){}))}}},D=M;var F=(0,g.Z)(D,z,N,!1,null,"6c614e5e",null);const E=F.exports;var O=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"}],staticClass:"box-card"},[e("el-row",{staticClass:"clearfix",staticStyle:{height:"20px"},attrs:{slot:"header"},slot:"header"},[e("el-button",{staticStyle:{float:"left",padding:"3px 0"},attrs:{type:"text"},on:{click:t.show_create_storage}},[t._v("创建存储池")])],1),e("el-row",[e("el-table",{staticStyle:{width:"100%"},attrs:{"v-loading":t.data_loading,data:t.storages}},[e("el-table-column",{attrs:{label:"ID",prop:"storageId",width:"80"}}),e("el-table-column",{attrs:{label:"名称",prop:"description","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"类型",prop:"type",width:"120"}}),e("el-table-column",{attrs:{label:"容量",prop:"capacity",width:"120"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"已用:"+t.get_volume_display_size(o.row.allocation)+" / 总共:"+t.get_volume_display_size(o.row.capacity),placement:"top"}},[e("el-progress",{attrs:{color:"#67C23A",percentage:o.row.capacity<=0?0:Math.floor(100*o.row.allocation/o.row.capacity)}})],1)]}}])}),e("el-table-column",{attrs:{label:"状态",prop:"status",width:"110"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",{attrs:{type:1===o.row.status?"success":"danger"}},[t._v(t._s(t.get_storage_status(o.row)))])]}}])}),e("el-table-column",{attrs:{label:"操作",width:"400"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"",size:"mini"},on:{click:function(e){return t.show_storage_info_click(o.row)}}},[t._v("存储池详情")]),e("el-button",{attrs:{type:"success",size:"mini"},on:{click:function(e){return t.register_storage(o.row)}}},[t._v("重新注册")]),2!==o.row.status?e("el-button",{attrs:{type:"warning",size:"mini"},on:{click:function(e){return t.pasue_storage(o.row)}}},[t._v("开始维护")]):t._e(),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_storage(o.row)}}},[t._v("销毁存储池")])]}}])})],1)],1)],1),e("StorageInfoComponent",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],ref:"StorageInfoComponentRef",on:{back:function(e){return t.show_storage_list()},onStorageUpdate:t.update_storate_info}}),e("CreateStorageComponent",{directives:[{name:"show",rawName:"v-show",value:2===this.show_type,expression:"this.show_type === 2"}],ref:"CreateStorageComponentRef",on:{back:function(e){return t.show_storage_list()},onStorageUpdate:t.update_storate_info}})],1)],1)],1)},A=[],L=o(47315),j=(o(82526),o(41817),function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"创建存储池"},on:{back:function(e){return t.on_back_click()}}})],1),e("el-row",[e("el-form",{ref:"createForm",staticClass:"demo-ruleForm",attrs:{model:t.create_storage,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"名称",prop:"description"}},[e("el-input",{model:{value:t.create_storage.description,callback:function(e){t.$set(t.create_storage,"description",e)},expression:"create_storage.description"}})],1),e("el-form-item",{attrs:{label:"存储池类型",prop:"type"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.create_storage.type,callback:function(e){t.$set(t.create_storage,"type",e)},expression:"create_storage.type"}},[e("el-option",{attrs:{label:"NFS",value:"nfs"}})],1)],1),"nfs"===t.create_storage.type?e("el-form-item",{attrs:{label:"NFS路径",prop:"path"}},[e("el-input",{model:{value:t.create_storage.path,callback:function(e){t.$set(t.create_storage,"path",e)},expression:"create_storage.path"}})],1):t._e(),"nfs"===t.create_storage.type?e("el-form-item",{attrs:{label:"NFS地址",prop:"uri"}},[e("el-input",{model:{value:t.create_storage.uri,callback:function(e){t.$set(t.create_storage,"uri",e)},expression:"create_storage.uri"}})],1):t._e(),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.create_storage_click}},[t._v("立即创建")]),e("el-button",{on:{click:t.on_back_click}},[t._v("取消")])],1)],1)],1)],1)}),H=[];o(38862);const X={data:function(){return{create_storage:{description:"",type:"nfs",param:"",path:"",uri:""}}},methods:{on_back_click:function(){this.$emit("back")},on_notify_update_scheme:function(t){this.$emit("onStorageUpdate",t)},init:function(){this.$refs["createForm"]&&this.$refs["createForm"].resetFields()},create_storage_click:function(){var t=this,e={description:this.create_storage.description,name:this.create_storage.name,type:this.create_storage.type,param:"{}"};"nfs"===this.create_storage.type?(e.param=JSON.stringify({path:this.create_storage.path,uri:this.create_storage.uri}),(0,u.o6)(e).then((function(e){0===e.code?(t.on_notify_update_scheme(e.data),t.on_back_click()):t.$notify.error({title:"错误",message:"创建存储池失败:".concat(e.message)})}))):this.$notify.error({title:"错误",message:"不支持的存储池:".concat(this.create_storage.type)})}}},Q=X;var K=(0,g.Z)(Q,j,H,!1,null,null,null);const J=K.exports,W={name:"storageView",components:{StorageInfoComponent:L.Z,CreateStorageComponent:J},data:function(){return{data_loading:!1,show_type:-1,show_storage:{},storages:[]}},mixins:[p.Z,c.Z],mounted:function(){this.show_type=0,this.init_view()},created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},methods:{init_view:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.data_loading=!0,e.next=3,(0,u._u)().then((function(e){0==e.code&&(t.storages=e.data)}))["finally"]((function(){t.data_loading=!1}));case 3:case"end":return e.stop()}}),e)})))()},update_storate_info:function(t){var e=this.storages.findIndex((function(e){return e.storageId===t.storageId}));e>=0?this.$set(this.storages,e,t):this.storages.push(t)},dispatch_notify_message:function(t){var e=this;7===t.type&&(0,u.nQ)({storageId:t.id}).then((function(o){if(0==o.code)e.update_storate_info(o.data);else if(3000001==o.code){var s=e.storages.findIndex((function(e){return e.storageId===t.id}));s>=0&&e.storages.splice(s,1)}}))},show_storage_list:function(){this.show_type=0},show_create_storage:function(){this.$refs.CreateStorageComponentRef.init(),this.show_type=2},show_storage_info_click:function(t){this.$refs.StorageInfoComponentRef.init_storage(t),this.show_type=1},pasue_storage:function(t){var e=this;this.$confirm("暂停存储池, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.dZ)({storageId:t.storageId}).then((function(t){0===t.code?e.update_storate_info(t.data):e.$notify.error({title:"错误",message:"暂停存储池失败:".concat(t.message)})}))}))["catch"]((function(){}))},register_storage:function(t){var e=this;this.$confirm("重新注册存储池, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.vA)({storageId:t.storageId}).then((function(o){0===o.code?t.status=0:e.$notify.error({title:"错误",message:"注册存储池失败:".concat(o.message)})}))}))["catch"]((function(){}))},destroy_storage:function(t){var e=this;this.$confirm("删除存储池, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.ye)({storageId:t.storageId}).then((function(t){0===t.code?(e.update_storate_info(t.data),e.show_type=0):e.$notify.error({title:"错误",message:"删除存储池失败:".concat(t.message)})}))}))["catch"]((function(){}))}}},Y=W;var tt=(0,g.Z)(Y,O,A,!1,null,"793a1b64",null);const et=tt.exports;o(82772);var ot=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"}],staticClass:"box-card"},[e("el-row",{staticClass:"clearfix",staticStyle:{height:"20px"},attrs:{slot:"header"},slot:"header"},[e("el-button",{staticStyle:{float:"left",padding:"3px 0"},attrs:{type:"text"},on:{click:t.show_create_template}},[t._v("创建模版")])],1),e("el-row",[e("el-table",{staticStyle:{width:"100%"},attrs:{"v-loading":t.data_loading,data:t.templates}},[e("el-table-column",{attrs:{label:"ID",prop:"templateId",width:"80"}}),e("el-table-column",{attrs:{label:"名称",prop:"name","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"磁盘类型",prop:"volumeType",width:"120"}}),e("el-table-column",{attrs:{label:"类型",prop:"type",width:"100"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",[t._v(t._s(t.get_template_type(o.row)))])]}}])}),e("el-table-column",{attrs:{label:"状态",prop:"status",width:"120"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",{attrs:{type:2===o.row.status?"success":"danger"}},[t._v(t._s(t.get_template_status(o.row)))])]}}])}),e("el-table-column",{attrs:{label:"操作","min-width":"200"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"",size:"mini"},on:{click:function(e){return t.show_template_info(o.row)}}},[t._v("模版详情")]),0===o.row.uri.indexOf("http://")||0===o.row.uri.indexOf("https://")?e("el-button",{attrs:{type:"warning",size:"mini"},on:{click:function(e){return t.download_template(o.row)}}},[t._v("重新下载")]):t._e(),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_template(o.row)}}},[t._v("销毁模版")])]}}])})],1)],1)],1),e("el-card",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{attrs:{content:"模版详情"},on:{back:t.show_template_list}})],1),e("el-row",{staticStyle:{"text-align":"left",margin:"20px 0"}},[!t.show_template.uri||0!==t.show_template.uri.indexOf("http://")&&0!==t.show_template.uri.indexOf("https://")?t._e():e("el-button",{attrs:{type:"warning",size:"mini"},on:{click:function(e){return t.download_template(t.show_template)}}},[t._v("重新下载")]),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_template(t.show_template)}}},[t._v("销毁模版")])],1),e("el-row",[e("el-descriptions",{attrs:{column:2,size:"medium",border:""}},[e("el-descriptions-item",{attrs:{label:"ID"}},[t._v(t._s(t.show_template.templateId))]),e("el-descriptions-item",{attrs:{label:"模版名"}},[t._v(t._s(t.show_template.name))]),t.show_template.uri&&0===t.show_template.uri.indexOf("http")?e("el-descriptions-item",{attrs:{label:"下载地址"}},[t._v(t._s(t.show_template.uri))]):t._e(),e("el-descriptions-item",{attrs:{label:"模版类型"}},[e("el-tag",[t._v(t._s(t.get_template_type(t.show_template)))])],1),e("el-descriptions-item",{attrs:{label:"状态"}},[e("el-tag",{attrs:{type:2===t.show_template.status?"success":"danger"}},[t._v(t._s(t.get_template_status(t.show_template)))])],1)],1)],1)],1),e("el-card",{directives:[{name:"show",rawName:"v-show",value:2===this.show_type,expression:"this.show_type === 2"}],staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"创建模版"},on:{back:function(e){return t.show_template_list()}}})],1),e("el-row",[e("el-form",{ref:"createForm",staticClass:"demo-ruleForm",attrs:{model:t.create_template,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"名称",prop:"name"}},[e("el-input",{model:{value:t.create_template.name,callback:function(e){t.$set(t.create_template,"name",e)},expression:"create_template.name"}})],1),e("el-form-item",{attrs:{label:"模版类型",prop:"templateType"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.create_template.templateType,callback:function(e){t.$set(t.create_template,"templateType",e)},expression:"create_template.templateType"}},[e("el-option",{attrs:{label:"ISO",value:0}}),e("el-option",{attrs:{label:"系统模版",value:1}}),e("el-option",{attrs:{label:"用户模版",value:2}})],1)],1),2===t.create_template.templateType?e("el-form-item",{attrs:{label:"磁盘类型",prop:"volumeType"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.create_template.volumeType,callback:function(e){t.$set(t.create_template,"volumeType",e)},expression:"create_template.volumeType"}},[e("el-option",{attrs:{label:"raw",value:"raw"}}),e("el-option",{attrs:{label:"qcow",value:"qcow"}}),e("el-option",{attrs:{label:"qcow2",value:"qcow2"}}),e("el-option",{attrs:{label:"vdi",value:"vdi"}}),e("el-option",{attrs:{label:"vmdk",value:"vmdk"}}),e("el-option",{attrs:{label:"vpc",value:"vpc"}})],1)],1):t._e(),e("el-form-item",{attrs:{label:" 下载地址",prop:"uri"}},[e("el-input",{model:{value:t.create_template.uri,callback:function(e){t.$set(t.create_template,"uri",e)},expression:"create_template.uri"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.create_template_click}},[t._v("立即创建")]),e("el-button",{on:{click:t.show_template_list}},[t._v("取消")])],1)],1)],1)],1)],1)],1)],1)},st=[];const nt={name:"templateView",components:{},data:function(){return{data_loading:!1,show_type:0,show_template:{},create_template:{name:"",templateType:0,volumeType:"qcow2",uri:""},templates:[]}},mixins:[p.Z,c.Z],mounted:function(){this.init_view()},created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},methods:{init_view:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.data_loading=!0,e.next=3,(0,u.A8)().then((function(e){0==e.code&&(t.templates=e.data)}))["finally"]((function(){t.data_loading=!1}));case 3:case"end":return e.stop()}}),e)})))()},show_template_list:function(){this.show_type=0},show_create_template:function(){this.$refs["createForm"]&&this.$refs["createForm"].resetFields(),this.show_type=2},show_template_info:function(t){this.show_template=t,this.show_type=1},update_template_info:function(t){var e=this.templates.findIndex((function(e){return e.templateId===t.templateId}));e>=0?this.$set(this.templates,e,t):this.templates.push(t),this.show_template&&this.show_template.templateId===t.templateId&&(this.show_template=t)},dispatch_notify_message:function(t){var e=this;5===t.type&&(0,u.BE)({templateId:t.id}).then((function(o){if(0==o.code)e.update_template_info(o.data);else if(5000001==o.code){var s=e.templates.findIndex((function(e){return e.templateId===t.id}));s>=0&&e.templates.splice(s,1)}}))},create_template_click:function(){var t=this,e={name:this.create_template.name,templateType:this.create_template.templateType,uri:this.create_template.uri,volumeType:this.create_template.volumeType};0===this.create_template.templateType?e.volumeType="raw":1===this.create_template.templateType&&(e.volumeType="qcow2"),(0,u.Mn)(e).then((function(e){0===e.code?(t.update_template_info(e.data),t.show_type=0):t.$notify.error({title:"错误",message:"创建模版失败:".concat(e.message)})}))},download_template:function(t){var e=this;this.$confirm("重新下载模版, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.fQ)({templateId:t.templateId}).then((function(t){0===t.code?e.update_template_info(t.data):e.$notify.error({title:"错误",message:"重新下载模版失败:".concat(t.message)})}))}))["catch"]((function(){}))},destroy_template:function(t){var e=this;this.$confirm("删除模版, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.c4)({templateId:t.templateId}).then((function(t){0===t.code?(e.update_template_info(t.data),e.show_type=0):e.$notify.error({title:"错误",message:"删除模版失败:".concat(t.message)})}))}))["catch"]((function(){}))}}},at=nt;var rt=(0,g.Z)(at,ot,st,!1,null,"8deef832",null);const it=rt.exports;var lt=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"}],staticClass:"box-card"},[e("el-row",[e("el-table",{staticStyle:{width:"100%"},attrs:{"v-loading":t.data_loading,data:t.snapshots}},[e("el-table-column",{attrs:{label:"ID",prop:"snapshotVolumeId",width:"80"}}),e("el-table-column",{attrs:{label:"名称",prop:"name","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"磁盘类型",prop:"type",width:"100"}}),e("el-table-column",{attrs:{label:"磁盘空间",prop:"capacity",width:"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(t.get_volume_display_size(e.row.capacity))+" ")]}}])}),e("el-table-column",{attrs:{label:"物理空间",prop:"allocation",width:"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(t.get_volume_display_size(e.row.allocation))+" ")]}}])}),e("el-table-column",{attrs:{label:"状态",prop:"status",width:"100"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",{attrs:{type:1===o.row.status?"success":"danger"}},[t._v(t._s(t.get_snapshot_status(o.row)))])]}}])}),e("el-table-column",{attrs:{label:"操作",width:"300"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"",size:"mini"},on:{click:function(e){return t.show_snapshot_info(o.row)}}},[t._v("快照详情")]),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_snapshot(o.row)}}},[t._v("销毁快照")])]}}])})],1)],1)],1),e("el-card",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{attrs:{content:"快照详情"},on:{back:t.show_snapshot_list}})],1),e("el-row",{staticStyle:{"text-align":"left",margin:"20px 0"}},[e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_snapshot(t.show_snapshot)}}},[t._v("销毁快照")])],1),e("el-row",[e("el-descriptions",{attrs:{column:2,size:"medium",border:""}},[e("el-descriptions-item",{attrs:{label:"ID"}},[t._v(t._s(t.show_snapshot.snapshotVolumeId))]),e("el-descriptions-item",{attrs:{label:"快照名"}},[t._v(t._s(t.show_snapshot.name))]),e("el-descriptions-item",{attrs:{label:"快照路径"}},[t._v(t._s(t.show_snapshot.volumePath))]),e("el-descriptions-item",{attrs:{label:"快照容量"}},[t._v(t._s(t.get_volume_display_size(t.show_snapshot.capacity)))]),e("el-descriptions-item",{attrs:{label:"物理占有"}},[t._v(t._s(t.get_volume_display_size(t.show_snapshot.allocation)))]),e("el-descriptions-item",{attrs:{label:"磁盘类型"}},[t._v(t._s(t.show_snapshot.type))]),e("el-descriptions-item",{attrs:{label:"存储池"}},[t._v(t._s(t.get_storage_name(t.show_snapshot.storageId)))]),e("el-descriptions-item",{attrs:{label:"状态"}},[e("el-tag",{attrs:{type:1===t.show_snapshot.status?"success":"danger"}},[t._v(t._s(t.get_snapshot_status(t.show_snapshot)))])],1)],1)],1)],1)],1)],1)],1)},ct=[];const ut={name:"snapshotView",components:{},data:function(){return{data_loading:!1,show_type:0,show_snapshot:{},snapshots:[],storages:[]}},mixins:[p.Z,c.Z],mounted:function(){this.init_view()},created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},methods:{init_view:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.data_loading=!0,e.next=3,(0,u._u)().then((function(e){0===e.code&&(t.storages=e.data)}));case 3:return e.next=5,(0,u.GQ)().then((function(e){0==e.code&&(t.snapshots=e.data)}))["finally"]((function(){t.data_loading=!1}));case 5:case"end":return e.stop()}}),e)})))()},get_storage_name:function(t){var e=this.storages.find((function(e){return e.storageId===t}))||{name:"-"};return e.name},show_snapshot_list:function(){this.show_type=0},show_snapshot_info:function(t){this.show_snapshot=t,this.show_type=1},update_snapshot_info:function(t){var e=this.snapshots.findIndex((function(e){return e.snapshotVolumeId===t.snapshotVolumeId}));e>=0?this.$set(this.snapshots,e,t):this.snapshots.push(t),this.show_snapshot&&this.show_snapshot.snapshotVolumeId===t.snapshotVolumeId&&(this.show_snapshot=t)},dispatch_notify_message:function(t){var e=this;6===t.type&&(0,u.Tu)({snapshotVolumeId:t.id}).then((function(o){if(0==o.code)e.update_snapshot_info(o.data);else if(6000001==o.code){var s=e.snapshots.findIndex((function(e){return e.snapshotVolumeId===t.id}));s>=0&&e.snapshots.splice(s,1)}}))},destroy_snapshot:function(t){var e=this;this.$confirm("删除快照, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.bv)({snapshotVolumeId:t.snapshotVolumeId}).then((function(o){if(0===o.code){var s=e.snapshots.findIndex((function(e){return e.snapshotVolumeId===t.snapshotVolumeId}));s>=0&&e.snapshots.splice(s,1),e.show_type=0}else e.$notify.error({title:"错误",message:"删除快照失败:".concat(o.message)})}))}))["catch"]((function(){}))}}},dt=ut;var _t=(0,g.Z)(dt,lt,ct,!1,null,"339ee58b",null);const pt=_t.exports;var ht=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"}],staticClass:"box-card"},[e("el-row",{staticClass:"clearfix",staticStyle:{height:"30px"},attrs:{slot:"header"},slot:"header"},[e("div",{staticStyle:{float:"left"}},[e("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0}},[e("el-form-item",[e("el-button",{attrs:{size:"mini",type:"primary"},on:{click:t.show_create_volume}},[t._v("创建磁盘")])],1),e("el-form-item",[e("el-button",{attrs:{size:"mini",disabled:!t.select_volumes.length,type:"danger"},on:{click:t.batch_destroy_volume_click}},[t._v("批量删除")])],1),e("el-form-item",{attrs:{label:"存储池"}},[e("el-select",{staticStyle:{width:"100%"},on:{change:t.update_show_page},model:{value:t.select_storage_id,callback:function(e){t.select_storage_id=e},expression:"select_storage_id"}},[e("el-option",{attrs:{label:"全部",value:0}}),t._l(this.storages,(function(t){return e("el-option",{key:t.storageId,attrs:{label:t.description,value:t.storageId}})}))],2)],1),e("el-form-item",[e("el-input",{staticStyle:{float:"right","max-width":"300px","margin-bottom":"10px"},attrs:{placeholder:"请输入搜索关键字"},on:{input:t.on_key_word_change},model:{value:t.keyword,callback:function(e){t.keyword=e},expression:"keyword"}})],1)],1)],1)]),e("el-row",[e("el-table",{ref:"volumeTable",staticStyle:{width:"100%"},attrs:{"v-loading":!0,data:t.show_table_volumes},on:{"selection-change":t.handleSelectionChange}},[e("el-table-column",{attrs:{type:"selection",width:"55"}}),e("el-table-column",{attrs:{label:"ID",prop:"volumeId",width:"80"}}),e("el-table-column",{attrs:{label:"名称",prop:"description","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"磁盘类型",prop:"type",width:"100"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",[t._v(t._s(o.row.type))])]}}])}),e("el-table-column",{attrs:{label:"磁盘空间",prop:"capacity",width:"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(t.get_volume_display_size(e.row.capacity))+" ")]}}])}),e("el-table-column",{attrs:{label:"物理空间",prop:"allocation",width:"150"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(t.get_volume_display_size(e.row.allocation))+" ")]}}])}),e("el-table-column",{attrs:{label:"挂载机器",prop:"allocation",width:"120","show-overflow-tooltip":""},scopedSlots:t._u([{key:"default",fn:function(o){return[o.row.attach?e("el-button",{attrs:{type:"text",underline:!1},on:{click:function(e){return t.show_guest_info(o.row.attach.guestId)}}},[t._v(t._s(o.row.attach?o.row.attach.description:"-"))]):t._e(),o.row.attach?t._e():e("span",[t._v(t._s(o.row.attach?o.row.attach.description:"-"))])]}}])}),e("el-table-column",{attrs:{label:"状态",prop:"status",width:"100"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",{attrs:{type:1===o.row.status?"success":"danger"}},[t._v(t._s(t.get_volume_status(o.row)))])]}}])}),e("el-table-column",{attrs:{label:"操作",width:"250"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-dropdown",{attrs:{size:"small","split-button":"",placement:"bottom-end",type:"primary"},on:{click:function(e){return t.show_volume_info(o.row)},command:t.menu_command_click}},[t._v(" 磁盘管理 "),e("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},[e("el-dropdown-item",{attrs:{command:{volume:o.row,command:"info"}}},[t._v("磁盘详情")]),e("el-dropdown-item",{attrs:{command:{volume:o.row,command:"resize"},divided:""}},[t._v("扩容磁盘")]),e("el-dropdown-item",{attrs:{command:{volume:o.row,command:"clone"}}},[t._v("克隆磁盘")]),e("el-dropdown-item",{attrs:{command:{volume:o.row,command:"migrate"}}},[t._v("迁移磁盘")]),e("el-dropdown-item",{attrs:{command:{volume:o.row,command:"snapshote"},divided:""}},[t._v("创建快照")]),e("el-dropdown-item",{attrs:{command:{volume:o.row,command:"template"}}},[t._v("创建模版")]),e("el-dropdown-item",{attrs:{command:{volume:o.row,command:"destroy"},divided:""}},[t._v("销毁磁盘")])],1)],1)]}}])})],1),e("el-pagination",{attrs:{"current-page":t.current_page,"page-size":t.page_size,"page-sizes":[5,10,20,50,100,200],total:t.total_size,layout:"total, sizes, prev, pager, next, jumper"},on:{"size-change":t.on_page_size_change,"current-change":t.on_current_page_change}})],1)],1),e("VolumeInfoComponent",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],ref:"VolumeInfoComponentRef",on:{back:function(e){return t.show_volume_list()},onVolumeUpdate:t.update_volume_info}}),e("el-card",{directives:[{name:"show",rawName:"v-show",value:2===this.show_type,expression:"this.show_type === 2"}],staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"创建磁盘"},on:{back:function(e){return t.show_volume_list()}}})],1),e("el-row",[e("el-form",{ref:"createForm",staticClass:"demo-ruleForm",attrs:{model:t.create_volume,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"名称",prop:"description"}},[e("el-input",{model:{value:t.create_volume.description,callback:function(e){t.$set(t.create_volume,"description",e)},expression:"create_volume.description"}})],1),e("el-form-item",{attrs:{label:"存储池",prop:"type"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.create_volume.storageId,callback:function(e){t.$set(t.create_volume,"storageId",e)},expression:"create_volume.storageId"}},[e("el-option",{attrs:{label:"随机",value:0}}),t._l(this.storages,(function(t){return e("el-option",{key:t.storageId,attrs:{label:t.description,value:t.storageId}})}))],2)],1),e("el-form-item",{attrs:{label:"磁盘类型",prop:"volumeType"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.create_volume.volumeType,callback:function(e){t.$set(t.create_volume,"volumeType",e)},expression:"create_volume.volumeType"}},[e("el-option",{attrs:{label:"raw",value:"raw"}}),e("el-option",{attrs:{label:"qcow",value:"qcow"}}),e("el-option",{attrs:{label:"qcow2",value:"qcow2"}}),e("el-option",{attrs:{label:"vdi",value:"vdi"}}),e("el-option",{attrs:{label:"vmdk",value:"vmdk"}}),e("el-option",{attrs:{label:"vpc",value:"vpc"}})],1)],1),e("el-form-item",{attrs:{label:"磁盘大小(GB)",prop:"volumeSize"}},[t._v(" © "),e("el-input",{model:{value:t.create_volume.volumeSize,callback:function(e){t.$set(t.create_volume,"volumeSize",e)},expression:"create_volume.volumeSize"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.create_volume_click}},[t._v("立即创建")]),e("el-button",{on:{click:t.show_volume_list}},[t._v("取消")])],1)],1)],1)],1),e("CloneVolumeComponent",{directives:[{name:"show",rawName:"v-show",value:3===this.show_type,expression:"this.show_type === 3"}],ref:"CloneVolumeComponentRef",on:{back:function(e){return t.show_volume_list()},onVolumeUpdate:t.update_volume_info}}),e("MigrateVolumeComponent",{directives:[{name:"show",rawName:"v-show",value:4===this.show_type,expression:"this.show_type === 4"}],ref:"MigrateVolumeComponentRef",on:{back:function(e){return t.show_volume_list()},onVolumeUpdate:t.update_volume_info}}),e("UploadVolumeComponent",{directives:[{name:"show",rawName:"v-show",value:5===this.show_type,expression:"this.show_type === 5"}],ref:"UploadVolumeComponentRef",on:{back:function(e){return t.show_volume_list()},onVolumeUpdate:t.update_volume_info}}),e("GuestInfoComponent",{directives:[{name:"show",rawName:"v-show",value:6===this.show_type,expression:"this.show_type === 6"}],ref:"GuestInfoComponentRef",on:{back:t.show_volume_list}}),e("DownloadVolumeComponent",{ref:"DownloadVolumeComponentRef"}),e("ResizeVolumeComponent",{ref:"ResizeVolumeComponentRef",on:{onVolumeUpdate:t.update_volume_info}}),e("CreateVolumeTemplateComponent",{ref:"CreateVolumeTemplateComponentRef"}),e("CreateVolumeSnapshotComponent",{ref:"CreateVolumeSnapshotComponentRef"})],1)],1)],1)},mt=[],ft=(o(57327),o(89554),o(54747),o(73210),o(26699),o(32023),o(7488)),gt=o(68501),wt=o(69147),vt=o(52874),yt=o(55050),bt=o(46455),kt=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"上传磁盘"},on:{back:function(e){return t.go_back()}}})],1),e("el-row",[e("el-form",{ref:"uploadForm",staticClass:"demo-ruleForm",attrs:{model:t.upload_volume,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"名称",prop:"description"}},[e("el-input",{model:{value:t.upload_volume.description,callback:function(e){t.$set(t.upload_volume,"description",e)},expression:"upload_volume.description"}})],1),e("el-form-item",{attrs:{label:"存储池",prop:"storageId"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.upload_volume.storageId,callback:function(e){t.$set(t.upload_volume,"storageId",e)},expression:"upload_volume.storageId"}},[e("el-option",{attrs:{label:"随机",value:0}}),t._l(this.storages,(function(t){return e("el-option",{key:t.storageId,attrs:{label:t.description,value:t.storageId}})}))],2)],1),e("el-form-item",{attrs:{label:"目标磁盘类型",prop:"volumeType"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.upload_volume.volumeType,callback:function(e){t.$set(t.upload_volume,"volumeType",e)},expression:"upload_volume.volumeType"}},[e("el-option",{attrs:{label:"raw",value:"raw"}}),e("el-option",{attrs:{label:"qcow",value:"qcow"}}),e("el-option",{attrs:{label:"qcow2",value:"qcow2"}}),e("el-option",{attrs:{label:"vdi",value:"vdi"}}),e("el-option",{attrs:{label:"vmdk",value:"vmdk"}}),e("el-option",{attrs:{label:"vpc",value:"vpc"}})],1)],1),e("el-form-item",[e("el-upload",{ref:"upload",staticClass:"upload-demo",staticStyle:{"max-width":"300px"},attrs:{action:t.get_upload_uri(),limit:1,"on-success":t.on_upload_success,"on-error":t.on_upload_error,name:"volume",data:t.upload_volume,"file-list":t.upload_file_list,"auto-upload":!1,"show-file-list":!0}},[e("el-button",{attrs:{slot:"trigger",size:"small",type:"primary"},slot:"trigger"},[t._v("选择磁盘")])],1)],1),e("el-form-item",[e("el-button",{attrs:{type:"primary",loading:t.uploading},on:{click:t.upload_volume_click}},[t._v("导入")]),e("el-button",{on:{click:t.go_back}},[t._v("取消")])],1)],1)],1)],1)},It=[];const xt={data:function(){return{uploading:!1,storages:[],upload_file_list:[],upload_volume:{description:"",storageId:0,volumeType:"qcow2"}}},methods:{go_back:function(){this.$emit("back")},get_upload_uri:function(){return"./api/volume/upload"},notify_volume_update:function(t){this.$emit("onVolumeUpdate",t)},init:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.$refs["uploadForm"]&&t.$refs["uploadForm"].resetFields(),t.uploading=!1,t.upload_file_list=[],t.uploading=!1,e.next=6,(0,u._u)().then((function(e){0==e.code&&(t.storages=e.data)}));case 6:case"end":return e.stop()}}),e)})))()},upload_volume_click:function(){this.uploading=!0,this.$refs.upload.submit()},on_upload_success:function(t){this.uploading=!1,0===t.code?(this.notify_volume_update(t.data),this.go_back()):(this.upload_file_list=[],this.$notify.error({title:"错误",message:"上传磁盘失败:".concat(t.message)}))},on_upload_error:function(){this.uploading=!1,this.upload_file_list=[],this.$notify.error({title:"错误",message:"磁盘上传失败。"})}}},Ct=xt;var $t=(0,g.Z)(Ct,kt,It,!1,null,null,null);const St=$t.exports;var Zt=o(72541);const Tt={name:"volumeView",components:{GuestInfoComponent:h.Z,DownloadVolumeComponent:ft.Z,ResizeVolumeComponent:gt.Z,CreateVolumeTemplateComponent:wt.Z,CreateVolumeSnapshotComponent:vt.Z,CloneVolumeComponent:yt.Z,MigrateVolumeComponent:bt.Z,UploadVolumeComponent:St,VolumeInfoComponent:Zt.Z},data:function(){return{data_loading:!1,uploading:!1,show_type:-1,select_storage_id:0,create_volume:{description:"",storageId:0,volumeType:"qcow2",volumeSize:100},keyword:"",volumes:[],storages:[],select_volumes:[],current_page:1,page_size:10,total_size:0}},mixins:[p.Z,c.Z],mounted:function(){this.show_type=0,this.init_view()},created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},computed:{show_table_volumes:function(){return this.volumes.filter((function(t){return void 0===t.isShow||t.isShow}))}},methods:{handleSelectionChange:function(t){this.select_volumes=t},init_view:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.data_loading=!0,e.next=3,(0,u._u)().then((function(e){0==e.code&&(t.storages=e.data)}));case 3:return e.next=5,(0,u.Mm)().then((function(e){0==e.code&&(t.volumes=e.data,t.update_show_page())}))["finally"]((function(){t.data_loading=!1}));case 5:case"end":return e.stop()}}),e)})))()},on_current_page_change:function(t){this.current_page=t,this.update_show_page()},on_page_size_change:function(t){this.page_size=t,this.update_show_page()},show_guest_info:function(t){this.$refs.GuestInfoComponentRef.initGuestId(t),this.show_type=6},on_key_word_change:function(){this.current_page=1,this.update_show_page()},update_show_page:function(){var t=this,e=0,o=this.page_size*(this.current_page-1),s=this.page_size*this.current_page;this.volumes.forEach((function(n,a){var r=!0,i=t.keyword.trim().toLowerCase();if(""!==i){var l=n.attach?n.attach.description.toLowerCase():"";r=""+n.volumeId===i||n.description.toLowerCase().indexOf(i)>=0||l.indexOf(i)>=0}var c=!0;t.select_storage_id>0&&(c=n.storageId===t.select_storage_id),r&&c?(e++,n.isShow=!(e<=o||e>s)):n.isShow=!1,t.$set(t.volumes,a,n)})),this.total_size=e},get_storage_name:function(t){var e=this.storages.find((function(e){return e.storageId===t}))||{description:"-"};return e.description},update_volume_info:function(t){var e=this,o=this.select_volumes.map((function(t){return t.volumeId})),s=this.volumes.findIndex((function(e){return e.volumeId===t.volumeId}));if(s>=0)this.$set(this.volumes,s,t);else{var n=this.page_size*(this.current_page-1);this.volumes.splice(n,0,t)}this.update_show_page(),this.$nextTick((function(){e.volumes.forEach((function(t){o.includes(t.volumeId)&&t.isShow&&e.$refs.volumeTable.toggleRowSelection(t)}))})),this.$refs.VolumeInfoComponentRef.refresh_volume(t)},dispatch_notify_message:function(t){var e=this;2===t.type&&(0,u.Rm)({volumeId:t.id}).then((function(o){if(0==o.code)e.update_volume_info(o.data);else if(4000001==o.code){var s=e.select_volumes.map((function(t){return t.volumeId})),n=e.volumes.findIndex((function(e){return e.volumeId===t.id}));n>=0&&e.volumes.splice(n,1),e.$nextTick((function(){e.volumes.forEach((function(t){s.includes(t.volumeId)&&t.isShow&&e.$refs.volumeTable.toggleRowSelection(t)}))}))}}))},show_volume_list:function(){this.show_type=0},show_create_volume:function(){this.$refs["createForm"]&&this.$refs["createForm"].resetFields(),this.show_type=2},show_upload_volume:function(){this.$refs.UploadVolumeComponentRef.init(),this.show_type=5},show_volume_info:function(t){var e=this;return(0,l.Z)((0,i.Z)().mark((function o(){return(0,i.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:e.$refs.VolumeInfoComponentRef.init_volume(t),e.show_type=1;case 2:case"end":return o.stop()}}),o)})))()},create_volume_click:function(){var t=this;(0,u.rL)(this.create_volume).then((function(e){0===e.code?(t.update_volume_info(e.data),t.show_type=0):t.$notify.error({title:"错误",message:"创建磁盘失败:".concat(e.message)})}))},update_volume_status:function(t,e){var o=this.volumes.find((function(e){return e.volumeId===t}));o&&(o.status=e)},menu_command_click:function(t){switch(t.command){case"info":this.show_volume_info(t.volume);break;case"resize":this.show_resize_volume_click(t.volume);break;case"snapshote":this.show_create_volume_snapshot_click(t.volume);break;case"clone":this.show_clone_volume_click(t.volume);break;case"migrate":this.show_migrate_volume_click(t.volume);break;case"template":this.show_create_volume_template_click(t.volume);break;case"destroy":this.destroy_volume(t.volume);break}},show_download_volume_click:function(t){this.$refs.DownloadVolumeComponentRef.init(t)},show_clone_volume_click:function(t){this.$refs.CloneVolumeComponentRef.init(t),this.show_type=3},show_migrate_volume_click:function(t){this.$refs.MigrateVolumeComponentRef.init(t),this.show_type=4},show_create_volume_template_click:function(t){this.$refs.CreateVolumeTemplateComponentRef.init(t)},show_resize_volume_click:function(t){this.$refs.ResizeVolumeComponentRef.init(t)},show_create_volume_snapshot_click:function(t){this.$refs.CreateVolumeSnapshotComponentRef.init(t)},destroy_volume:function(t){var e=this;this.$confirm("删除磁盘, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){console.log(t),(0,u.lp)({volumeId:t.volumeId}).then((function(t){0===t.code?(e.update_volume_info(t.data),e.show_type=0):e.$notify.error({title:"错误",message:"删除磁盘失败:".concat(t.message)})}))}))["catch"]((function(){}))},batch_destroy_volume_click:function(){var t=this;this.$confirm("批量删除所选磁盘, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){var e=t.select_volumes.map((function(t){return t.volumeId})).join(",");(0,u.uT)({volumeIds:e}).then((function(e){0===e.code?e.data.filter((function(e){t.update_volume_info(e)})):t.$notify.error({title:"错误",message:"批量删除磁盘:".concat(e.message)})}))}))["catch"]((function(){}))}}},zt=Tt;var Nt=(0,g.Z)(zt,ht,mt,!1,null,"22f2dc55",null);const Vt=Nt.exports;var Rt=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"}],staticClass:"box-card"},[e("el-row",{staticClass:"clearfix",staticStyle:{height:"20px"},attrs:{slot:"header"},slot:"header"},[e("el-button",{staticStyle:{float:"left",padding:"3px 0"},attrs:{type:"text"},on:{click:t.show_crate_scheme_info_click}},[t._v("创建计算方案")])],1),e("el-row",[e("el-table",{staticStyle:{width:"100%"},attrs:{"v-loading":t.data_loading,data:t.schemes}},[e("el-table-column",{attrs:{label:"ID",prop:"schemeId",width:"80"}}),e("el-table-column",{attrs:{label:"名称",prop:"name","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"CPU",prop:"cpu",width:"120"}}),e("el-table-column",{attrs:{label:"内存",prop:"memory",width:"200"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(t.get_memory_display_size(e.row.memory))+" ")]}}])}),e("el-table-column",{attrs:{label:"操作","min-width":"380"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"",size:"mini"},on:{click:function(e){return t.show_scheme_info_click(o.row)}}},[t._v("详情")]),e("el-button",{attrs:{type:"",size:"mini"},on:{click:function(e){return t.show_modify_scheme(o.row)}}},[t._v("修改")]),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_scheme(o.row)}}},[t._v("删除")])]}}])})],1)],1)],1),e("SchemeInfoComponent",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],ref:"SchemeInfoComponentRef",on:{back:function(e){return t.show_scheme_list()},onSchemeUpdate:t.update_scheme_info}}),e("CreateSchemeComponent",{directives:[{name:"show",rawName:"v-show",value:2===this.show_type,expression:"this.show_type === 2"}],ref:"CreateSchemeComponentRef",on:{back:function(e){return t.show_scheme_list()},onSchemeUpdate:t.update_scheme_info}}),e("ModifySchemeComponent",{directives:[{name:"show",rawName:"v-show",value:3===this.show_type,expression:"this.show_type === 3"}],ref:"ModifySchemeComponentRef",on:{back:function(e){return t.show_scheme_list()},onSchemeUpdate:t.update_scheme_info}})],1)],1)],1)},qt=[],Bt=o(33094),Pt=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"创建计算方案"},on:{back:function(e){return t.on_back_click()}}})],1),e("el-row",[e("el-form",{ref:"createForm",staticClass:"demo-ruleForm",attrs:{model:t.create_scheme,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"名称",prop:"name"}},[e("el-input",{model:{value:t.create_scheme.name,callback:function(e){t.$set(t.create_scheme,"name",e)},expression:"create_scheme.name"}})],1),e("el-form-item",{attrs:{label:"CPU",prop:"cpu"}},[e("el-input",{model:{value:t.create_scheme.cpu,callback:function(e){t.$set(t.create_scheme,"cpu",e)},expression:"create_scheme.cpu"}})],1),e("el-form-item",{attrs:{label:"内存(MB)",prop:"memory"}},[e("el-input",{model:{value:t.create_scheme.memory,callback:function(e){t.$set(t.create_scheme,"memory",e)},expression:"create_scheme.memory"}})],1),e("el-form-item",{attrs:{label:"配额",prop:"speed"}},[e("el-input",{model:{value:t.create_scheme.speed,callback:function(e){t.$set(t.create_scheme,"speed",e)},expression:"create_scheme.speed"}})],1),e("el-form-item",{attrs:{label:"Cores",prop:"cores"}},[e("el-input",{model:{value:t.create_scheme.cores,callback:function(e){t.$set(t.create_scheme,"cores",e)},expression:"create_scheme.cores"}})],1),e("el-form-item",{attrs:{label:"Sockets",prop:"sockets"}},[e("el-input",{model:{value:t.create_scheme.sockets,callback:function(e){t.$set(t.create_scheme,"sockets",e)},expression:"create_scheme.sockets"}})],1),e("el-form-item",{attrs:{label:"Threads",prop:"threads"}},[e("el-input",{model:{value:t.create_scheme.threads,callback:function(e){t.$set(t.create_scheme,"threads",e)},expression:"create_scheme.threads"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.create_scheme_click}},[t._v("立即创建")]),e("el-button",{on:{click:t.on_back_click}},[t._v("取消")])],1)],1)],1)],1)},Gt=[];const Ut={data:function(){return{create_scheme:{name:"",cpu:1,memory:512,speed:0,sockets:0,cores:0,threads:0}}},methods:{on_back_click:function(){this.$emit("back")},on_notify_update_scheme:function(t){this.$emit("onSchemeUpdate",t)},init:function(){this.$refs["createForm"]&&this.$refs["createForm"].resetFields()},create_scheme_click:function(){var t=this;(0,u.ql)(this.create_scheme).then((function(e){0===e.code?(t.on_notify_update_scheme(e.data),t.on_back_click()):t.$notify.error({title:"错误",message:"创建计算方案失败:".concat(e.message)})}))}}},Mt=Ut;var Dt=(0,g.Z)(Mt,Pt,Gt,!1,null,null,null);const Ft=Dt.exports;var Et=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"修改计算方案"},on:{back:function(e){return t.on_back_click()}}})],1),e("el-row",[e("el-form",{staticClass:"demo-ruleForm",attrs:{model:t.modify_scheme,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"名称",prop:"name"}},[e("el-input",{model:{value:t.modify_scheme.name,callback:function(e){t.$set(t.modify_scheme,"name",e)},expression:"modify_scheme.name"}})],1),e("el-form-item",{attrs:{label:"CPU",prop:"cpu"}},[e("el-input",{model:{value:t.modify_scheme.cpu,callback:function(e){t.$set(t.modify_scheme,"cpu",e)},expression:"modify_scheme.cpu"}})],1),e("el-form-item",{attrs:{label:"内存(MB)",prop:"memory"}},[e("el-input",{model:{value:t.modify_scheme.memory,callback:function(e){t.$set(t.modify_scheme,"memory",e)},expression:"modify_scheme.memory"}})],1),e("el-form-item",{attrs:{label:"配额",prop:"speed"}},[e("el-input",{model:{value:t.modify_scheme.speed,callback:function(e){t.$set(t.modify_scheme,"speed",e)},expression:"modify_scheme.speed"}})],1),e("el-form-item",{attrs:{label:"Cores",prop:"cores"}},[e("el-input",{model:{value:t.modify_scheme.cores,callback:function(e){t.$set(t.modify_scheme,"cores",e)},expression:"modify_scheme.cores"}})],1),e("el-form-item",{attrs:{label:"Sockets",prop:"sockets"}},[e("el-input",{model:{value:t.modify_scheme.sockets,callback:function(e){t.$set(t.modify_scheme,"sockets",e)},expression:"modify_scheme.sockets"}})],1),e("el-form-item",{attrs:{label:"Threads",prop:"threads"}},[e("el-input",{model:{value:t.modify_scheme.threads,callback:function(e){t.$set(t.modify_scheme,"threads",e)},expression:"modify_scheme.threads"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.modify_scheme_click}},[t._v("修改")]),e("el-button",{on:{click:t.on_back_click}},[t._v("取消")])],1)],1)],1)],1)},Ot=[];const At={data:function(){return{modify_scheme:{schemeId:0,name:"",cpu:1,memory:512,speed:0,sockets:0,cores:0,threads:0}}},methods:{on_back_click:function(){this.$emit("back")},on_notify_update_scheme:function(t){this.$emit("onSchemeUpdate",t)},init:function(t){this.modify_scheme.schemeId=t.schemeId,this.modify_scheme.name=t.name,this.modify_scheme.cpu=t.cpu,this.modify_scheme.memory=t.memory/1024,this.modify_scheme.speed=t.speed,this.modify_scheme.sockets=t.sockets,this.modify_scheme.cores=t.cores,this.modify_scheme.threads=t.threads},modify_scheme_click:function(){var t=this;this.$confirm("修改计算方案, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.A6)(t.modify_scheme).then((function(e){0===e.code?(t.on_notify_update_scheme(e.data),t.on_back_click()):t.$notify.error({title:"错误",message:"修改计算方案失败:".concat(e.message)})}))}))["catch"]((function(){}))}}},Lt=At;var jt=(0,g.Z)(Lt,Et,Ot,!1,null,null,null);const Ht=jt.exports,Xt={name:"schemeView",components:{SchemeInfoComponent:Bt.Z,CreateSchemeComponent:Ft,ModifySchemeComponent:Ht},data:function(){return{data_loading:!1,current_scheme_id:0,show_type:-1,show_scheme:{},schemes:[]}},mixins:[p.Z,c.Z],mounted:function(){this.show_type=0,this.init_view()},created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},methods:{init_view:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.data_loading=!0,e.next=3,(0,u.Pu)().then((function(e){0==e.code&&(t.schemes=e.data)}))["finally"]((function(){t.data_loading=!1}));case 3:case"end":return e.stop()}}),e)})))()},update_scheme_info:function(t){var e=this.schemes.findIndex((function(e){return e.schemeId===t.schemeId}));e>=0?this.$set(this.schemes,e,t):this.schemes.push(t),this.$refs.SchemeInfoComponentRef.init_scheme(t),this.$forceUpdate()},dispatch_notify_message:function(t){var e=this;8===t.type&&(0,u.TQ)({schemeId:t.id}).then((function(o){if(0==o.code)e.update_scheme_info(o.data);else if(8000001==o.code){var s=e.schemes.findIndex((function(e){return e.schemeId===t.id}));s>=0&&e.schemes.splice(s,1)}e.$forceUpdate()}))},show_scheme_list:function(){this.show_type=0},show_crate_scheme_info_click:function(){this.$refs.CreateSchemeComponentRef.init(),this.show_type=2},show_modify_scheme:function(t){this.$refs.ModifySchemeComponentRef.init(t),this.show_type=3},show_scheme_info_click:function(t){this.show_scheme=t,this.$refs.SchemeInfoComponentRef.init_scheme(t),this.show_type=1},destroy_scheme:function(t){var e=this;this.$confirm("删除计算方案, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.tM)({schemeId:t.schemeId}).then((function(o){if(0===o.code){var s=e.schemes.findIndex((function(e){return e.schemeId===t.schemeId}));s>=0&&e.schemes.splice(s,1),e.show_type=0}else e.$notify.error({title:"错误",message:"删除计算方案失败:".concat(o.message)})}))}))["catch"]((function(){}))}}},Qt=Xt;var Kt=(0,g.Z)(Qt,Rt,qt,!1,null,"3a3543ac",null);const Jt=Kt.exports;var Wt=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"}],staticClass:"box-card"},[e("el-row",{staticClass:"clearfix",staticStyle:{height:"20px"},attrs:{slot:"header"},slot:"header"},[e("el-button",{staticStyle:{float:"left",padding:"3px 0"},attrs:{type:"text"},on:{click:t.show_crate_group_click}},[t._v("创建群组")])],1),e("el-row",[e("el-table",{staticStyle:{width:"100%"},attrs:{"v-loading":t.data_loading,data:t.groups}},[e("el-table-column",{attrs:{label:"ID",prop:"groupId",width:"80"}}),e("el-table-column",{attrs:{label:"名称",prop:"groupName","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"操作","min-width":"380"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"",size:"mini"},on:{click:function(e){return t.show_modify_group(o.row)}}},[t._v("修改")]),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_group(o.row)}}},[t._v("删除")])]}}])})],1)],1)],1),e("CreateGroupComponent",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],ref:"CreateGroupComponentRef",on:{back:function(e){return t.show_group_list()},onGroupUpdate:t.update_group}}),e("ModifyGroupComponent",{directives:[{name:"show",rawName:"v-show",value:2===this.show_type,expression:"this.show_type === 2"}],ref:"ModifyGroupComponentRef",on:{back:function(e){return t.show_group_list()},onGroupUpdate:t.update_group}})],1)],1)],1)},Yt=[],te=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"创建群组"},on:{back:function(e){return t.on_back_click()}}})],1),e("el-row",[e("el-form",{ref:"createForm",staticClass:"demo-ruleForm",attrs:{model:t.create_group,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"名称",prop:"groupName"}},[e("el-input",{model:{value:t.create_group.groupName,callback:function(e){t.$set(t.create_group,"groupName",e)},expression:"create_group.groupName"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.create_group_click}},[t._v("立即创建")]),e("el-button",{on:{click:t.on_back_click}},[t._v("取消")])],1)],1)],1)],1)},ee=[];const oe={data:function(){return{create_group:{groupName:""}}},methods:{on_back_click:function(){this.$emit("back")},on_notify_update_group:function(t){this.$emit("onGroupUpdate",t)},init:function(){this.$refs["createForm"]&&this.$refs["createForm"].resetFields()},create_group_click:function(){var t=this;(0,u.sS)(this.create_group).then((function(e){0===e.code?(t.on_notify_update_group(e.data),t.on_back_click()):t.$notify.error({title:"错误",message:"创建群组失败:".concat(e.message)})}))}}},se=oe;var ne=(0,g.Z)(se,te,ee,!1,null,null,null);const ae=ne.exports;var re=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"修改群组"},on:{back:function(e){return t.on_back_click()}}})],1),e("el-row",[e("el-form",{staticClass:"demo-ruleForm",attrs:{model:t.modify_group,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"名称",prop:"name"}},[e("el-input",{model:{value:t.modify_group.groupName,callback:function(e){t.$set(t.modify_group,"groupName",e)},expression:"modify_group.groupName"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.modify_group_click}},[t._v("修改")]),e("el-button",{on:{click:t.on_back_click}},[t._v("取消")])],1)],1)],1)],1)},ie=[];const le={data:function(){return{modify_group:{groupId:0,groupName:""}}},methods:{on_back_click:function(){this.$emit("back")},on_notify_update_group:function(t){this.$emit("onSchemeUpdate",t)},init:function(t){this.modify_group.groupId=t.groupId,this.modify_group.groupName=t.groupName},modify_group_click:function(){var t=this;this.$confirm("修改群组, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.v_)(t.modify_group).then((function(e){0===e.code?(t.on_notify_update_group(e.data),t.on_back_click()):t.$notify.error({title:"错误",message:"修改群组失败:".concat(e.message)})}))}))["catch"]((function(){}))}}},ce=le;var ue=(0,g.Z)(ce,re,ie,!1,null,null,null);const de=ue.exports,_e={name:"groupView",components:{CreateGroupComponent:ae,ModifyGroupComponent:de},data:function(){return{data_loading:!1,current_group_id:0,show_type:-1,show_group:{},groups:[]}},mixins:[p.Z,c.Z],mounted:function(){this.show_type=0,this.init_view()},created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},methods:{init_view:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.data_loading=!0,e.next=3,(0,u.hI)().then((function(e){0==e.code&&(t.groups=e.data)}))["finally"]((function(){t.data_loading=!1}));case 3:case"end":return e.stop()}}),e)})))()},update_group:function(t){var e=this.groups.findIndex((function(e){return e.groupId===t.groupId}));e>=0?this.$set(this.groups,e,t):this.groups.push(t),this.$refs.GroupInfoComponentRef.init_group(t),this.$forceUpdate()},dispatch_notify_message:function(t){var e=this;9===t.type&&(0,u.yL)({groupId:t.id}).then((function(o){if(0==o.code)e.update_group(o.data);else if(10000001==o.code){var s=e.groups.findIndex((function(e){return e.groupId===t.id}));s>=0&&e.groups.splice(s,1)}e.$forceUpdate()}))},show_group_list:function(){this.show_type=0},show_crate_group_click:function(){this.show_type=1,this.$refs.CreateGroupComponentRef.init()},show_modify_group:function(t){this.$refs.ModifyGroupComponentRef.init(t),this.show_type=2},destroy_group:function(t){var e=this;this.$confirm("删除群组, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.ng)({groupId:t.groupId}).then((function(o){if(0===o.code){var s=e.groups.findIndex((function(e){return e.groupId===t.groupId}));s>=0&&e.groups.splice(s,1),e.show_type=0}else e.$notify.error({title:"错误",message:"删除群组失败:".concat(o.message)})}))}))["catch"]((function(){}))}}},pe=_e;var he=(0,g.Z)(pe,Wt,Yt,!1,null,"63671446",null);const me=he.exports;var fe=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"}],staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0}},[e("el-form-item",[e("el-button",{attrs:{type:"primary",size:"mini"},on:{click:t.show_create_guest_click}},[t._v("创建虚拟机")])],1),e("el-form-item",[e("el-button",{attrs:{disabled:!t.select_guests.length,type:"primary",size:"mini"},on:{click:t.batch_start_guest_click}},[t._v("批量启动")])],1),e("el-form-item",[e("el-button",{attrs:{disabled:!t.select_guests.length,type:"danger",size:"mini"},on:{click:t.batch_stop_guest_click}},[t._v("批量停止")])],1),e("el-form-item",{attrs:{label:"群组"}},[e("el-select",{staticStyle:{width:"100%"},on:{change:t.update_guest_show_page},model:{value:t.select_group_id,callback:function(e){t.select_group_id=e},expression:"select_group_id"}},[e("el-option",{attrs:{label:"全部",value:-1}}),t._l(this.groups,(function(t){return e("el-option",{key:t.groupId,attrs:{label:t.groupName,value:t.groupId}})}))],2)],1),e("el-form-item",{attrs:{label:"运行主机"}},[e("el-select",{staticStyle:{width:"100%"},on:{change:t.update_guest_show_page},model:{value:t.select_host_id,callback:function(e){t.select_host_id=e},expression:"select_host_id"}},[e("el-option",{attrs:{label:"全部",value:0}}),t._l(this.hosts,(function(t){return e("el-option",{key:t.hostId,attrs:{label:t.displayName,value:t.hostId}})}))],2)],1),e("el-form-item",[e("el-input",{staticStyle:{"margin-bottom":"10px"},attrs:{placeholder:"请输入搜索关键字"},on:{input:t.on_key_word_change},model:{value:t.keyword,callback:function(e){t.keyword=e},expression:"keyword"}})],1)],1)],1),e("el-row",[e("el-table",{ref:"guestTable",staticStyle:{width:"100%"},attrs:{"v-loading":t.data_loading,data:t.show_table_guests},on:{"selection-change":t.handleSelectionChange}},[e("el-table-column",{attrs:{type:"selection",width:"55"}}),e("el-table-column",{attrs:{label:"ID",prop:"guestId",width:"80"}}),e("el-table-column",{attrs:{label:"实例名",prop:"name",width:"180","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"标签",prop:"description",width:"180"}}),e("el-table-column",{attrs:{label:"IP地址",prop:"guestIp",width:"150"}}),e("el-table-column",{attrs:{label:"配置",prop:"cpu",width:"150"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(t._s(e.row.cpu)+"核/"+t._s(t.get_memory_display_size(e.row.memory)))]}}])}),e("el-table-column",{attrs:{label:"类型",width:"100"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",[t._v(t._s(0===o.row.type?"系统主机":"用户主机"))])]}}])}),e("el-table-column",{attrs:{label:"状态",prop:"status",width:"100"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",{attrs:{type:2===o.row.status?"success":"danger"}},[t._v(t._s(t.get_guest_status(o.row)))])]}}])}),e("el-table-column",{attrs:{label:"操作","min-width":"150"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-dropdown",{attrs:{size:"small","split-button":"",placement:"bottom-end",type:"primary"},on:{click:function(e){return t.show_guest_info_click(o.row)},command:t.menu_command_click}},[t._v(" 虚拟机管理 "),e("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},[e("el-dropdown-item",{attrs:{command:{guest:o.row,command:"info"}}},[t._v("虚拟机详情")]),e("el-dropdown-item",{attrs:{command:{guest:o.row,command:"start"},divided:"",disabled:4!==o.row.status}},[t._v("启动虚拟机")]),e("el-dropdown-item",{attrs:{command:{guest:o.row,command:"stop"},disabled:2!==o.row.status}},[t._v("停止虚拟机")]),e("el-dropdown-item",{attrs:{command:{guest:o.row,command:"vnc"},disabled:2!==o.row.status}},[t._v("远程桌面")]),e("el-dropdown-item",{attrs:{command:{guest:o.row,command:"reboot"},disabled:2!==o.row.status}},[t._v("重启虚拟机")]),0!==o.row.type?e("el-dropdown-item",{attrs:{command:{guest:o.row,command:"attach_cd"},disabled:0!==o.row.cdRoom}},[t._v("挂载光驱")]):t._e(),0!==o.row.type?e("el-dropdown-item",{attrs:{command:{guest:o.row,command:"detach_cd"},disabled:0===o.row.cdRoom}},[t._v("卸载光驱")]):t._e(),e("el-dropdown-item",{attrs:{command:{guest:o.row,command:"destroy"},divided:""}},[t._v("销毁虚拟机")])],1)],1)]}}])})],1),e("el-pagination",{attrs:{"current-page":t.current_page,"page-size":t.page_size,"page-sizes":[5,10,20,50,100,200],total:t.total_size,layout:"total, sizes, prev, pager, next, jumper"},on:{"size-change":t.on_page_size_change,"current-change":t.on_current_page_change}})],1)],1),e("GuestInfoComponent",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],ref:"GuestInfoComponentRef",on:{back:t.show_guest_list_page,onGuestUpdate:t.update_guest_info}}),e("CreateGuestComponent",{directives:[{name:"show",rawName:"v-show",value:2===this.show_type,expression:"this.show_type === 2"}],ref:"CreateGuestComponentRef",on:{back:t.show_guest_list_page,onGuestUpdate:t.update_guest_info}})],1)],1),e("AttachCdRoomComponent",{ref:"AttachCdRoomComponentRef",on:{onGuestUpdate:t.update_guest_info}}),e("StartGuestComponent",{ref:"StartGuestComponentRef",on:{onGuestUpdate:t.update_guest_info}}),e("StopGuestComponent",{ref:"StopGuestComponentRef",on:{onGuestUpdate:t.update_guest_info}})],1)},ge=[],we=o(23698),ve=(o(92222),o(64148)),ye=o(54165),be=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"创建虚拟机"},on:{back:t.on_back_click}})],1),e("el-row",[e("el-form",{ref:"createForm",staticClass:"demo-ruleForm",attrs:{model:t.create_guest,"label-width":"100px"}},[e("el-row",[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"标签",prop:"description"}},[e("el-input",{model:{value:t.create_guest.description,callback:function(e){t.$set(t.create_guest,"description",e)},expression:"create_guest.description"}})],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"总线方式"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"总线方式"},model:{value:t.create_guest.busType,callback:function(e){t.$set(t.create_guest,"busType",e)},expression:"create_guest.busType"}},[e("el-option",{attrs:{label:"virtio",value:"virtio"}}),e("el-option",{attrs:{label:"ide",value:"ide"}}),e("el-option",{attrs:{label:"scsi",value:"scsi"}})],1)],1)],1)],1),e("el-row",[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"运行主机"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.create_guest.hostId,callback:function(e){t.$set(t.create_guest,"hostId",e)},expression:"create_guest.hostId"}},[e("el-option",{attrs:{label:"随机",value:0}}),t._l(this.hosts,(function(t){return e("el-option",{key:t.hostId,attrs:{label:t.displayName,value:t.hostId}})}))],2)],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"架构"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择架构"},model:{value:t.create_guest.schemeId,callback:function(e){t.$set(t.create_guest,"schemeId",e)},expression:"create_guest.schemeId"}},t._l(this.schemes,(function(t){return e("el-option",{key:t.schemeId,attrs:{label:t.name,value:t.schemeId}})})),1)],1)],1)],1),e("el-row",[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"网络"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择网络"},model:{value:t.create_guest.networkId,callback:function(e){t.$set(t.create_guest,"networkId",e)},expression:"create_guest.networkId"}},t._l(this.networks,(function(t){return e("el-option",{key:t.networkId,attrs:{label:t.name,value:t.networkId}})})),1)],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"网络驱动"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择网卡驱动"},model:{value:t.create_guest.networkDeviceType,callback:function(e){t.$set(t.create_guest,"networkDeviceType",e)},expression:"create_guest.networkDeviceType"}},[e("el-option",{attrs:{label:"virtio",value:"virtio"}}),e("el-option",{attrs:{label:"rtl8139",value:"rtl8139"}}),e("el-option",{attrs:{label:"e1000",value:"e1000"}})],1)],1)],1)],1),e("el-row",[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"安装方式"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择安装方式"},model:{value:t.create_guest.type,callback:function(e){t.$set(t.create_guest,"type",e)},expression:"create_guest.type"}},[e("el-option",{attrs:{label:"ISO镜像",value:0}}),e("el-option",{attrs:{label:"模版安装",value:1}}),e("el-option",{attrs:{label:"快照安装",value:2}}),e("el-option",{attrs:{label:"现有磁盘",value:3}})],1)],1)],1),e("el-col",{attrs:{span:12}},[3!==t.create_guest.type?e("el-form-item",{attrs:{label:"磁盘类型"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.create_guest.volumeType,callback:function(e){t.$set(t.create_guest,"volumeType",e)},expression:"create_guest.volumeType"}},[e("el-option",{attrs:{label:"raw",value:"raw"}}),e("el-option",{attrs:{label:"qcow",value:"qcow"}}),e("el-option",{attrs:{label:"qcow2",value:"qcow2"}}),e("el-option",{attrs:{label:"vdi",value:"vdi"}}),e("el-option",{attrs:{label:"vmdk",value:"vmdk"}}),e("el-option",{attrs:{label:"vpc",value:"vpc"}})],1)],1):t._e()],1)],1),e("el-row",[e("el-col",{attrs:{span:12}},[0===t.create_guest.type?e("el-form-item",{attrs:{label:"ISO模版"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择光盘镜像"},model:{value:t.create_guest.isoTemplateId,callback:function(e){t.$set(t.create_guest,"isoTemplateId",e)},expression:"create_guest.isoTemplateId"}},t._l(this.iso_template,(function(t){return e("el-option",{key:t.templateId,attrs:{label:t.name,value:t.templateId}})})),1)],1):t._e(),1===t.create_guest.type?e("el-form-item",{attrs:{label:"系统模版"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择模版"},model:{value:t.create_guest.diskTemplateId,callback:function(e){t.$set(t.create_guest,"diskTemplateId",e)},expression:"create_guest.diskTemplateId"}},t._l(this.disk_template,(function(t){return e("el-option",{key:t.templateId,attrs:{label:t.name,value:t.templateId}})})),1)],1):t._e(),2===t.create_guest.type?e("el-form-item",{attrs:{label:"快照模版"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择系统快照"},model:{value:t.create_guest.snapshotVolumeId,callback:function(e){t.$set(t.create_guest,"snapshotVolumeId",e)},expression:"create_guest.snapshotVolumeId"}},t._l(this.snapshot_template,(function(t){return e("el-option",{key:t.snapshotVolumeId,attrs:{label:t.name,value:t.snapshotVolumeId}})})),1)],1):t._e(),3===t.create_guest.type?e("el-form-item",{attrs:{label:"可用磁盘"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择系统磁盘"},model:{value:t.create_guest.volumeId,callback:function(e){t.$set(t.create_guest,"volumeId",e)},expression:"create_guest.volumeId"}},t._l(this.attach_volumes,(function(t){return e("el-option",{key:t.volumeId,attrs:{label:t.description,value:t.volumeId}})})),1)],1):t._e()],1),e("el-col",{attrs:{span:12}},[3!==t.create_guest.type?e("el-form-item",{attrs:{label:"存储池"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.create_guest.storageId,callback:function(e){t.$set(t.create_guest,"storageId",e)},expression:"create_guest.storageId"}},[e("el-option",{attrs:{label:"随机",value:0}}),t._l(this.storages,(function(t){return e("el-option",{key:t.storageId,attrs:{label:t.description,value:t.storageId}})}))],2)],1):t._e()],1)],1),e("el-row",[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"群组"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择群组"},model:{value:t.create_guest.groupId,callback:function(e){t.$set(t.create_guest,"groupId",e)},expression:"create_guest.groupId"}},t._l(this.groups,(function(t){return e("el-option",{key:t.groupId,attrs:{label:t.groupName,value:t.groupId}})})),1)],1)],1),e("el-col",{attrs:{span:12}},[1===t.create_guest.type?e("el-form-item",{attrs:{label:"密码"}},[e("el-input",{attrs:{"show-password":!0,type:"password"},model:{value:t.create_guest.password,callback:function(e){t.$set(t.create_guest,"password",e)},expression:"create_guest.password"}})],1):t._e()],1)],1),e("el-row",[e("el-col",{attrs:{span:12}},[0===t.create_guest.type?e("el-form-item",{attrs:{label:"磁盘大小"}},[e("el-input",{model:{value:t.create_guest.size,callback:function(e){t.$set(t.create_guest,"size",e)},expression:"create_guest.size"}})],1):t._e()],1)],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.create_guest_click}},[t._v("立即创建")]),e("el-button",{on:{click:t.on_back_click}},[t._v("取消")])],1)],1)],1)],1)},ke=[];const Ie={data:function(){return{create_guest:{type:0,groupId:0,password:"",description:"",busType:"virtio",hostId:0,schemeId:"",networkId:"",networkDeviceType:"virtio",volumeType:"qcow2",isoTemplateId:"",diskTemplateId:"",snapshotVolumeId:"",volumeId:"",storageId:0,size:100},iso_template:[],attach_volumes:[],disk_template:[],storages:[],snapshot_template:[],schemes:[],hosts:[],networks:[],groups:[]}},methods:{on_back_click:function(){this.$emit("back")},load_all_attach_volumes:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.I2)().then((function(e){0===e.code&&(t.attach_volumes=e.data)}));case 2:case"end":return e.stop()}}),e)})))()},load_all_template:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.A8)().then((function(e){0===e.code&&(t.iso_template=e.data.filter((function(t){return 0==t.templateType&&2===t.status})),t.disk_template=e.data.filter((function(t){return 2==t.templateType&&2===t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},load_all_storage:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u._u)().then((function(e){0==e.code&&(t.storages=e.data.filter((function(t){return 1==t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},load_all_snapshot:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.GQ)().then((function(e){0==e.code&&(t.snapshot_template=e.data.filter((function(t){return 1==t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},load_all_networks:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.jR)().then((function(e){0===e.code&&(t.networks=e.data.filter((function(t){return 2===t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},load_all_host:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.vZ)().then((function(e){0===e.code&&(t.hosts=e.data.filter((function(t){return 1==t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},load_all_schemes:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.Pu)().then((function(e){0===e.code&&(t.schemes=e.data)}));case 2:case"end":return e.stop()}}),e)})))()},load_all_groups:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.hI)().then((function(e){0===e.code&&(t.groups=[{groupId:0,groupName:"默认"}].concat((0,we.Z)(e.data)))}));case 2:case"end":return e.stop()}}),e)})))()},init:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:t.load_all_attach_volumes(),t.load_all_host(),t.load_all_template(),t.load_all_storage(),t.load_all_schemes(),t.load_all_networks(),t.load_all_snapshot(),t.load_all_groups(),t.$refs["createForm"]&&t.$refs["createForm"].resetFields(),t.create_guest.isoTemplateId="",t.create_guest.diskTemplateId="",t.create_guest.snapshotVolumeId="",t.create_guest.password="",t.create_guest.volumeId="",t.create_guest.type=0,t.create_guest.groupId=0;case 16:case"end":return e.stop()}}),e)})))()},create_guest_click:function(){var t=this;switch(this.create_guest.type){case 0:this.create_guest.diskTemplateId=0,this.create_guest.snapshotVolumeId=0,this.create_guest.volumeId=0,this.create_guest.password="";break;case 1:this.create_guest.isoTemplateId=0,this.create_guest.snapshotVolumeId=0,this.create_guest.volumeId=0,this.create_guest.size=0;break;case 2:this.create_guest.isoTemplateId=0,this.create_guest.diskTemplateId=0,this.create_guest.volumeId=0,this.create_guest.size=0;break;case 3:this.create_guest.isoTemplateId=0,this.create_guest.diskTemplateId=0,this.create_guest.snapshotVolumeId=0,this.create_guest.size=0;break}(0,u.Az)(this.create_guest).then((function(e){0===e.code?(t.$emit("onGuestUpdate",e.data),t.$nextTick((function(){t.on_back_click()}))):t.$notify.error({title:"错误",message:"创建虚拟机失败:".concat(e.message)})}))}}},xe=Ie;var Ce=(0,g.Z)(xe,be,ke,!1,null,null,null);const $e=Ce.exports;var Se=o(50053);const Ze={name:"guestView",components:{StartGuestComponent:ve.Z,StopGuestComponent:ye.Z,GuestInfoComponent:h.Z,CreateGuestComponent:$e,AttachCdRoomComponent:Se.Z},data:function(){return{data_loading:!1,select_host_id:0,select_group_id:-1,show_type:-1,keyword:"",guests:[],storages:[],hosts:[],select_guests:[],groups:[],current_page:1,page_size:10,total_size:0}},mixins:[p.Z,c.Z],mounted:function(){this.show_type=0,this.init_view()},created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},computed:{show_table_guests:function(){return this.guests.filter((function(t){return void 0===t.isShow||t.isShow}))}},methods:{handleSelectionChange:function(t){this.select_guests=t},init_view:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.data_loading=!0,e.next=3,(0,u.jW)().then((function(e){0==e.code&&(t.guests=e.data,t.update_guest_show_page())}))["finally"]((function(){t.data_loading=!1}));case 3:return e.next=5,t.load_all_host();case 5:return e.next=7,t.load_all_groups();case 7:case"end":return e.stop()}}),e)})))()},load_all_host:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.vZ)().then((function(e){0===e.code&&(t.hosts=e.data.filter((function(t){return 1==t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},load_all_groups:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.hI)().then((function(e){0===e.code&&(t.groups=[{groupId:0,groupName:"默认"}].concat((0,we.Z)(e.data)))}));case 2:case"end":return e.stop()}}),e)})))()},on_key_word_change:function(){this.current_page=1,this.update_guest_show_page()},on_current_page_change:function(t){this.current_page=t,this.update_guest_show_page()},on_page_size_change:function(t){this.page_size=t,this.update_guest_show_page()},update_guest_show_page:function(){var t=this,e=0,o=this.page_size*(this.current_page-1),s=this.page_size*this.current_page;this.guests.forEach((function(n,a){var r=!0,i=t.keyword.trim().toLowerCase();""!==i&&(r=""+n.guestId===i||n.description.toLowerCase().indexOf(i)>=0||n.name.toLowerCase().indexOf(i)>=0||n.guestIp.toLowerCase().indexOf(i)>=0);var l=!0;t.select_host_id>0&&(l=n.hostId===t.select_host_id);var c=!0;t.select_group_id>-1&&(c=n.groupId===t.select_group_id),r&&l&&c?(e++,n.isShow=!(e<=o||e>s)):n.isShow=!1,t.$set(t.guests,a,n)})),this.total_size=e},update_guest_info:function(t){var e=this;return(0,l.Z)((0,i.Z)().mark((function o(){var s,n,a;return(0,i.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:s=e.select_guests.map((function(t){return t.guestId})),n=e.guests.findIndex((function(e){return e.guestId===t.guestId})),n>=0?e.$set(e.guests,n,t):1===t.type&&(a=e.page_size*(e.current_page-1),e.guests.splice(a,0,t)),e.update_guest_show_page(),e.$nextTick((function(){e.guests.forEach((function(t){s.includes(t.guestId)&&t.isShow&&e.$refs.guestTable.toggleRowSelection(t)}))}));case 5:case"end":return o.stop()}}),o)})))()},dispatch_notify_message:function(t){var e=this;1===t.type&&(0,u.c$)({guestId:t.id}).then((function(o){if(0==o.code)e.update_guest_info(o.data);else if(2000001==o.code){var s=e.select_guests.map((function(t){return t.guestId})),n=e.guests.findIndex((function(e){return e.guestId===t.id}));n>=0&&e.guests.splice(n,1),e.$nextTick((function(){e.guests.forEach((function(t){s.includes(t.guestId)&&t.isShow&&e.$refs.guestTable.toggleRowSelection(t)}))}))}}))},show_guest_list_page:function(){this.show_type=0},show_host_back:function(){this.show_type=1},show_create_guest_click:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:t.$refs.CreateGuestComponentRef.init(),t.show_type=2;case 2:case"end":return e.stop()}}),e)})))()},reboot_guest_click:function(t){var e=this;this.$confirm("重启当前虚拟机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.Qm)({guestId:t.guestId}).then((function(t){0===t.code?e.update_guest_info(t.data):e.$notify.error({title:"错误",message:"重启虚拟机失败:".concat(t.message)})}))}))["catch"]((function(){}))},detach_guest_cd_room_click:function(t){var e=this;(0,u.n4)({guestId:t.guestId}).then((function(t){0===t.code?(e.update_guest_info(t.data),e.stop_dialog_visiable=!1):e.$notify.error({title:"错误",message:"卸载虚拟机光驱失败:".concat(t.message)})}))},menu_command_click:function(t){switch(t.command){case"info":this.show_guest_info_click(t.guest);break;case"start":this.show_start_guest_click(t.guest);break;case"reboot":this.reboot_guest_click(t.guest);break;case"stop":this.show_stop_guest_click(t.guest);break;case"detach_cd":this.detach_guest_cd_room_click(t.guest);break;case"attach_cd":this.show_attach_cd_room_click(t.guest);break;case"vnc":this.vnc_click(t.guest);break;case"destroy":this.destroy_guest(t.guest);break}},show_guest_info_click:function(t){var e=this;return(0,l.Z)((0,i.Z)().mark((function o(){return(0,i.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:e.$refs.GuestInfoComponentRef.init(t),e.show_type=1;case 2:case"end":return o.stop()}}),o)})))()},show_start_guest_click:function(t){var e=this;return(0,l.Z)((0,i.Z)().mark((function o(){return(0,i.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:e.$refs.StartGuestComponentRef.init(t);case 1:case"end":return o.stop()}}),o)})))()},show_stop_guest_click:function(t){this.$refs.StopGuestComponentRef.init(t)},show_attach_cd_room_click:function(t){this.$refs.AttachCdRoomComponentRef.init(t)},vnc_click:function(t){var e=this.$router.resolve({path:"/Vnc",query:{id:t.guestId,description:t.description}}),o=e.href;window.open(o,"_blank")},destroy_guest:function(t){var e=this;this.$confirm("删除当前虚拟机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.yl)({guestId:t.guestId}).then((function(o){if(0===o.code){var s=e.guests.findIndex((function(e){return e.guestId===t.guestId}));s>=0&&e.guests.splice(s,1),e.show_type=0}else e.$notify.error({title:"错误",message:"删除虚拟机失败:".concat(o.message)})}))}))["catch"]((function(){}))},batch_start_guest_click:function(){var t=this;this.$confirm("启动所选虚拟机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){var e=t.select_guests.map((function(t){return t.guestId})).join(",");(0,u.go)({guestIds:e}).then((function(e){0===e.code?e.data.filter((function(e){t.update_guest_info(e)})):t.$notify.error({title:"错误",message:"批量启动虚拟机失败:".concat(e.message)})}))}))["catch"]((function(){}))},batch_stop_guest_click:function(){var t=this;this.$confirm("停止所选虚拟机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){var e=t.select_guests.map((function(t){return t.guestId})).join(",");(0,u.is)({guestIds:e}).then((function(e){0===e.code?e.data.filter((function(e){t.update_guest_info(e)})):t.$notify.error({title:"错误",message:"批量停止虚拟机失败:".concat(e.message)})}))}))["catch"]((function(){}))}}},Te=Ze;var ze=(0,g.Z)(Te,fe,ge,!1,null,"34f52534",null);const Ne=ze.exports;var Ve=function(){var t=this,e=t._self._c;return e("div",{staticClass:"main"},[e("div",{attrs:{id:"top_bar"}},[e("div",{attrs:{id:"status"}},[t._v(t._s(t.status))]),e("div",{attrs:{id:"sendCtrlAltDelButton"},on:{click:t.on_send_ctrl_alt_del}},[t._v("发送 Ctrl+Alt+Del")])]),e("div",{attrs:{id:"screen"}})])},Re=[],qe=o(78066);const Be={name:"VncView",inject:["check_full_screen"],data:function(){return{id:0,description:"",rfb:null,url:"",status:"连接中..."}},mounted:function(){var t;this.check_full_screen(!0),this.id=this.$route.query.id,this.description=this.$route.query.description,t="https:"===window.location.protocol?"wss":"ws",this.status="正在连接[".concat(this.description,"]..."),this.url="".concat(t,"://").concat(window.location.host,"/api/vnc/").concat(this.id),this.connect()},beforeDestroy:function(){this.check_full_screen(!1)},methods:{connect:function(){var t=this;(0,u.z2)({guestId:this.id}).then((function(e){0===e.code&&(t.rfb=new qe.Z(document.getElementById("screen"),t.url,{credentials:{password:e.data}}),t.rfb.addEventListener("connect",t.on_connect_success),t.rfb.addEventListener("disconnect",t.on_disconnect),t.rfb.addEventListener("credentialsrequired",t.on_required_password),t.rfb.scaleViewport=!1,t.rfb.resizeSession=!1)}))},on_connect_success:function(){this.status="连接成功[".concat(this.description,"]")},on_disconnect:function(t){this.status="远程连接已断开[".concat(this.description,"]"),t.detail.clean&&(this.status="正在重新连接[".concat(this.description,"]..."),this.connect())},on_required_password:function(){var t=this;(0,u.z2)({guestId:this.id}).then((function(e){0===e.code&&e.data&&t.rfb.sendCredentials({password:e.data})}))},on_send_ctrl_alt_del:function(){this.rfb.sendCtrlAltDel(),this.rfb.focus()},sendKey:function(t,e,o){this.rfb.sendKey(t,e,o),this.rfb.focus()}}},Pe=Be;var Ge=(0,g.Z)(Pe,Ve,Re,!1,null,"2e7ccac2",null);const Ue=Ge.exports;var Me=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{staticClass:"box-card"},[e("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[e("span",[t._v("系统汇总")])]),e("el-row",{attrs:{gutter:20}},[e("el-col",{attrs:{span:4}},[e("div",[e("el-statistic",{attrs:{"group-separator":",",value:this.networks.length,title:"网络数量"}})],1)]),e("el-col",{attrs:{span:4}},[e("div",[e("el-statistic",{attrs:{"group-separator":",",value:this.storages.length,title:"存储池数量"}})],1)]),e("el-col",{attrs:{span:4}},[e("div",[e("el-statistic",{attrs:{"group-separator":",",value:this.hosts.length,title:"主机数量"}})],1)]),e("el-col",{attrs:{span:4}},[e("div",[e("el-statistic",{attrs:{"group-separator":",",value:this.guests.length,title:"虚拟机数量"}},[e("template",{slot:"formatter"},[t._v(t._s(t.get_runing_guest_number())+" /"+t._s(this.guests.length))])],2)],1)]),e("el-col",{attrs:{span:4}},[e("div",[e("el-statistic",{attrs:{"group-separator":",",value:this.volumes.length,title:"磁盘数量"}})],1)])],1),e("el-divider"),e("el-card",[e("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[e("span",[t._v("主机信息")])]),e("div",{staticClass:"component"},[e("div",[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"已使用:"+t.get_allocat_cpu()+"核 / 总共:"+t.get_total_cpu()+"核",placement:"top"}},[e("el-progress",{attrs:{format:t.get_cpu_progress_title,type:"circle",percentage:t.totalCpuPercentage,color:"#67C23A"}})],1)],1),e("div",[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"已使用:"+t.get_memory_desplay(t.get_allocat_memory())+" / 总共:"+t.get_memory_desplay(t.get_total_memory()),placement:"top"}},[e("el-progress",{attrs:{format:t.get_memory_progress_title,type:"circle",percentage:t.totalMemoryePercentage,color:"#67C23A"}})],1)],1),e("div",[e("el-table",{staticStyle:{width:"100%"},attrs:{data:t.hosts}},[e("el-table-column",{attrs:{label:"名称",prop:"displayName","max-width":"200","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"主机IP",prop:"hostIp",width:"150","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"CPU","max-width":"150"},scopedSlots:t._u([{key:"default",fn:function(t){return[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"已使用:"+t.row.allocationCpu+"核 / 总共:"+t.row.totalCpu+"核",placement:"top"}},[e("el-progress",{attrs:{color:"#67C23A",percentage:t.row.totalCpu<=0?0:Math.floor(100*t.row.allocationCpu/t.row.totalCpu)}})],1)]}}])}),e("el-table-column",{attrs:{label:"内存","max-width":"150"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"已使用:"+t.get_memory_desplay(o.row.allocationMemory)+" / 总共:"+t.get_memory_desplay(o.row.totalMemory),placement:"top"}},[e("el-progress",{attrs:{color:"#67C23A",percentage:o.row.totalMemory<=0?0:Math.floor(100*o.row.allocationMemory/o.row.totalMemory)}})],1)]}}])}),e("el-table-column")],1)],1)])]),e("el-divider"),e("el-card",[e("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[e("span",[t._v("存储池")])]),e("div",{staticClass:"storage_component"},[e("div",[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"已用:"+t.get_storage_desplay(t.get_allocat_storage())+" / 总共:"+t.get_storage_desplay(t.get_total_capacity()),placement:"top"}},[e("el-progress",{attrs:{type:"circle",format:t.get_storage_progress_title,percentage:t.totalStoragePercentage,color:"#67C23A"}})],1)],1),e("div",[e("el-table",{attrs:{data:t.storages}},[e("el-table-column",{attrs:{label:"名称",prop:"description","max-width":"200","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"类型",prop:"type",width:"120"}}),e("el-table-column",{attrs:{label:"容量",prop:"capacity",width:"150"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"已用:"+t.get_storage_desplay(o.row.allocation)+" / 总共:"+t.get_storage_desplay(o.row.capacity),placement:"top"}},[e("el-progress",{attrs:{color:"#67C23A",percentage:o.row.capacity<=0?0:Math.floor(100*o.row.allocation/o.row.capacity)}})],1)]}}])}),e("el-table-column")],1)],1)])])],1)],1)],1)],1)},De=[];o(91058),o(56977);const Fe={name:"guestView",components:{},data:function(){return{hosts:[],networks:[],storages:[],volumes:[],guests:[],totalStoragePercentage:0,totalCpuPercentage:0,totalMemoryePercentage:0}},mounted:function(){this.init_data()},methods:{init_data:function(){var t=this;(0,u.vZ)().then((function(e){0===e.code&&(t.hosts=e.data,t.totalCpuPercentage=t.get_total_cpu()<=0?0:Math.floor(100*t.get_allocat_cpu()/t.get_total_cpu()),t.totalMemoryePercentage=t.get_total_memory()<=0?0:Math.floor(100*t.get_allocat_memory()/t.get_total_memory()))})),(0,u.jR)().then((function(e){0===e.code&&(t.networks=e.data)})),(0,u._u)().then((function(e){0===e.code&&(t.storages=e.data)})),(0,u.Mm)().then((function(e){0===e.code&&(t.volumes=e.data)})),(0,u.Xj)().then((function(e){0===e.code&&(t.guests=e.data)})),(0,u._u)().then((function(e){0===e.code&&(t.storages=e.data,t.totalStoragePercentage=t.get_total_capacity()<=0?0:parseInt(100*t.get_allocat_storage()/t.get_total_capacity()))}))},get_runing_guest_number:function(){return this.guests.filter((function(t){return 2===t.status})).length},get_storage_desplay:function(t){return t>1099511627776?(t/1099511627776).toFixed(2)+" TB":t>1073741824?(t/1073741824).toFixed(2)+" GB":t>1048576?(t/1048576).toFixed(2)+" MB":t>1024?(t/1024).toFixed(2)+" KB":t+" bytes"},get_memory_desplay:function(t){return t>1048576?(t/1048576).toFixed(2)+" GB":t>1024?(t/1024).toFixed(2)+" MB":void 0},get_total_memory:function(){var t=0;return this.hosts.forEach((function(e){return t+=e.totalMemory})),t},get_allocat_memory:function(){var t=0;return this.hosts.forEach((function(e){return t+=e.allocationMemory})),t},get_total_cpu:function(){var t=0;return this.hosts.forEach((function(e){return t+=e.totalCpu})),t},get_allocat_cpu:function(){var t=0;return this.hosts.forEach((function(e){return t+=e.allocationCpu})),t},locat_cpu:function(){var t=0;return this.hosts.forEach((function(e){return t+=e.allocationCpu})),t},get_total_capacity:function(){var t=0;return this.storages.forEach((function(e){return t+=e.capacity})),t},get_allocat_storage:function(){var t=0;return this.storages.forEach((function(e){return t+=e.allocation})),t},get_cpu_progress_title:function(t){return"总内核:"+t+"%"},get_memory_progress_title:function(t){return"总内存:"+t+"%"},get_storage_progress_title:function(t){return"总存储:"+t+"%"}}},Ee=Fe;var Oe=(0,g.Z)(Ee,Me,De,!1,null,"b397a494",null);const Ae=Oe.exports;var Le=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"}],staticClass:"box-card"},[e("el-row",{staticClass:"clearfix",staticStyle:{height:"20px"},attrs:{slot:"header"},slot:"header"},[e("el-button",{staticStyle:{float:"left",padding:"3px 0"},attrs:{type:"text"},on:{click:t.show_create_user_click}},[t._v("注册用户")])],1),e("el-row",[e("el-table",{staticStyle:{width:"100%"},attrs:{"v-loading":t.data_loading,data:t.users}},[e("el-table-column",{attrs:{label:"ID",prop:"userId",width:"80"}}),e("el-table-column",{attrs:{label:"用户名",prop:"loginName",width:"200"}}),e("el-table-column",{attrs:{label:"状态",prop:"state",width:"180"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",{attrs:{type:0===o.row.state?"success":"danger"}},[t._v(t._s(0===o.row.state?"启用":"禁用"))])]}}])}),e("el-table-column",{attrs:{label:"操作"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"",size:"mini"},on:{click:function(e){return t.show_reset_password_click(o.row)}}},[t._v("重置密码")]),1===o.row.state?e("el-button",{attrs:{type:"success",size:"mini"},on:{click:function(e){return t.update_user_state_click(o.row,0)}}},[t._v("启用")]):t._e(),0===o.row.state?e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.update_user_state_click(o.row,1)}}},[t._v("禁用")]):t._e(),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_user_click(o.row)}}},[t._v("删除")])]}}])})],1)],1)],1),e("el-card",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"注册用户"},on:{back:function(e){return t.show_user_list()}}})],1),e("el-row",[e("el-form",{ref:"createForm",staticClass:"demo-ruleForm",attrs:{model:t.create_user,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"登录名",prop:"loginName"}},[e("el-input",{model:{value:t.create_user.loginName,callback:function(e){t.$set(t.create_user,"loginName",e)},expression:"create_user.loginName"}})],1),e("el-form-item",{attrs:{label:"密码",prop:"password"}},[e("el-input",{attrs:{"show-password":""},model:{value:t.create_user.password,callback:function(e){t.$set(t.create_user,"password",e)},expression:"create_user.password"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.on_create_user_click}},[t._v("注册")]),e("el-button",{on:{click:t.show_user_list}},[t._v("取消")])],1)],1)],1)],1),e("el-dialog",{attrs:{title:"重置密码",visible:t.reset_passwor_dialog_visiable,width:"300px"},on:{"update:visible":function(e){t.reset_passwor_dialog_visiable=e}}},[e("el-form",{ref:"resetPasswordForm",attrs:{model:t.reset_password_user,"label-width":"60px"}},[e("el-form-item",{attrs:{label:"密码"}},[e("el-input",{attrs:{placeholder:"请输入密码","show-password":""},model:{value:t.reset_password_user.password,callback:function(e){t.$set(t.reset_password_user,"password",e)},expression:"reset_password_user.password"}})],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.reset_passwor_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.on_reset_password_click}},[t._v("确 定")])],1)],1)],1)],1)],1)},je=[];const He={name:"userView",components:{},data:function(){return{data_loading:!1,current_loading:!1,reset_passwor_dialog_visiable:!1,show_type:0,create_user:{loginName:"",password:""},reset_password_user:{userId:0,password:""},users:[]}},mounted:function(){this.init_view(),this.show_type=0},methods:{init_view:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.data_loading=!0,e.next=3,(0,u.lE)().then((function(e){0==e.code&&(t.users=e.data)}))["finally"]((function(){t.data_loading=!1}));case 3:case"end":return e.stop()}}),e)})))()},show_user_list:function(){this.show_type=0},show_create_user_click:function(){this.$refs["createForm"]&&this.$refs["createForm"].resetFields(),this.show_type=1},show_reset_password_click:function(t){this.$refs["resetPasswordForm"]&&this.$refs["resetPasswordForm"].resetFields(),this.reset_password_user.userId=t.userId,this.reset_password_user.password="",this.reset_passwor_dialog_visiable=!0},update_user_info:function(t){var e=this.users.findIndex((function(e){return e.userId===t.userId}));e>=0?this.$set(this.users,e,t):this.users.push(t),this.show_user&&this.show_user.userId===t.userId&&(this.show_user=t)},on_create_user_click:function(){var t=this;(0,u.a$)(this.create_user).then((function(e){0===e.code?(t.update_user_info(e.data),t.show_type=0):t.$notify.error({title:"错误",message:"注册用户失败:".concat(e.message)})}))},on_reset_password_click:function(){var t=this;this.$confirm("重置密码, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.h8)(t.reset_password_user).then((function(e){0===e.code?(t.update_user_info(e.data),t.reset_passwor_dialog_visiable=!1):t.$notify.error({title:"错误",message:"重置密码失败:".concat(e.message)})}))}))["catch"]((function(){}))},update_user_state_click:function(t,e){var o=this,s=0===e?"启用用户":"禁用用户";this.$confirm("".concat(s,", 是否继续?"),"提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.eV)({userId:t.userId,state:e}).then((function(t){0===t.code?o.update_user_info(t.data):o.$notify.error({title:"错误",message:"".concat(s,"失败:").concat(t.message)})}))}))["catch"]((function(){}))},destroy_user_click:function(t){var e=this;this.$confirm("删除用户, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.GE)({userId:t.userId}).then((function(o){if(0===o.code){var s=e.users.findIndex((function(e){return e.userId===t.userId}));s>=0&&e.users.splice(s,1)}else e.$notify.error({title:"错误",message:"删除用户失败:".concat(o.message)})}))}))["catch"]((function(){}))}}},Xe=He;var Qe=(0,g.Z)(Xe,Le,je,!1,null,"3724222a",null);const Ke=Qe.exports;var Je=function(){var t=this,e=t._self._c;return e("div",{staticClass:"login-container",attrs:{id:"main"}},["Login"!==t.show_type||this.oauth.enalbe?t._e():e("el-form",{ref:"ruleForm2",staticClass:"demo-ruleForm login-page",attrs:{"label-position":"left","label-width":"0px","status-icon":""}},[e("h3",{staticClass:"title"},[t._v("KVM Cloud Login")]),e("el-form-item",{attrs:{prop:"username"}},[e("el-input",{attrs:{"auto-complete":"off",autofocus:"true",placeholder:"用户名","prefix-icon":"el-icon-s-custom",type:"text"},model:{value:t.loginData.loginName,callback:function(e){t.$set(t.loginData,"loginName",e)},expression:"loginData.loginName"}})],1),e("el-form-item",{attrs:{prop:"password"}},[e("el-input",{attrs:{"show-password":!0,"auto-complete":"off",placeholder:"密码","prefix-icon":"el-icon-lock",type:"password"},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.login.apply(null,arguments)}},model:{value:t.loginData.password,callback:function(e){t.$set(t.loginData,"password",e)},expression:"loginData.password"}})],1),e("el-form-item",{staticStyle:{width:"100%"}},[e("el-button",{staticStyle:{width:"100%"},attrs:{disabled:""==t.loginData.loginName||""==t.loginData.password,loading:t.loading,type:"primary"},on:{click:t.login}},[t._v("登录")])],1)],1),"Loading"===t.show_type?e("el-form",{staticClass:"login-page",attrs:{"label-position":"left","label-width":"0px","status-icon":""}},[e("div",{staticClass:"title"},[t._v(t._s(this.oauth.title))]),e("div",{directives:[{name:"loading",rawName:"v-loading",value:!0,expression:"true"}],staticStyle:{height:"80px","font-size":"30px","margin-bottom":"10px"},attrs:{"element-loading-spinner":"el-icon-loading","element-loading-text":"正在登录,请稍后..."}})]):t._e(),"Error"===t.show_type?e("el-form",{staticClass:"login-page",attrs:{"label-position":"left","label-width":"0px","status-icon":""}},[e("div",{staticClass:"title"},[t._v(t._s(this.oauth.title))]),e("div",[e("strong",{staticStyle:{color:"red"}},[t._v(t._s(this.errorMessage))])]),e("div",{staticClass:"register"},[e("el-link",{attrs:{type:"primary"},on:{click:function(e){return t.go_login()}}},[t._v("重新登录")])],1)]):t._e()],1)},We=[];const Ye={name:"loginView",inject:["check_full_screen"],data:function(){return{loginData:{loginName:"",password:""},oauth:{enable:!1,title:" Oauth2 登录"},show_type:"",errorMessage:"",loading:!1}},mounted:function(){var t=this;this.check_full_screen(!0),(0,u.kH)().then((function(e){if(0===e.code)if(e.data.oauth&&(t.oauth.title=e.data.oauth.title,t.oauth.enable=e.data.oauth.enable),t.oauth.enable){var o=t.$route.query.code;o&&""!==o?(0,u.rd)({code:o}).then((function(e){if(0!==e.code)t.errorMessage="登录失败,服务器返回如下:\r\n".concat(e.message),t.show_type="Error";else{localStorage.setItem("X-Token",e.data.token);var o=localStorage.getItem("X-Back");localStorage.removeItem("X-Back"),o?window.location.href=o:t.$router.push({path:"/"})}})):t.go_login()}else t.show_type="Login";else t.show_type="Login"}))},beforeDestroy:function(){this.check_full_screen(!1)},methods:{login:function(){var t=this;this.loading=!0,(0,u.kI)({loginName:this.loginData.loginName}).then((function(e){if(0===e.code){var o=window.sha256_digest(window.sha256_digest(t.loginData.password+":"+e.data.signature)+":"+e.data.nonce);(0,u.pH)({loginName:t.loginData.loginName,password:o,nonce:e.data.nonce}).then((function(e){if(0===e.code){localStorage.setItem("X-Token",e.data.token);var o=localStorage.getItem("X-Back");localStorage.removeItem("X-Back"),o?window.location.href=o:t.$router.push({path:"/"})}else t.$notify.error({title:"错误",duration:3e3,message:"登录失败:".concat(e.message)})}))["finally"]((function(){t.loading=!1}))}else t.$notify.error({title:"错误",duration:3e3,message:"登录失败:".concat(e.message)})}))["finally"]((function(){t.loading=!1}))},go_login:function(){window.location.href="/login"},show_login:function(){this.show_type="Login"}}},to=Ye;var eo=(0,g.Z)(to,Je,We,!1,null,"da6fbb2c",null);const oo=eo.exports;s["default"].use(n.ZP);var so=[{path:"/",name:"Home",component:Ae},{path:"/Vnc",name:"Vnc",component:Ue},{path:"/Guest",name:"Guest",component:Ne},{path:"/Network",name:"Network",component:T},{path:"/Host",name:"Host",component:E},{path:"/Storage",name:"Storage",component:et},{path:"/Template",name:"Template",component:it},{path:"/Snapshot",name:"Snapshot",component:pt},{path:"/Volume",name:"Volume",component:Vt},{path:"/Scheme",name:"Scheme",component:Jt},{path:"/Group",name:"Group",component:me},{path:"/User",name:"User",component:Ke},{path:"/Login",name:"Login",component:oo}],no=new n.ZP({routes:so});const ao=no},66949:(t,e,o)=>{"use strict";t.exports=o.p+"img/logo.047618b0.png"},24654:()=>{}},e={};function o(s){var n=e[s];if(void 0!==n)return n.exports;var a=e[s]={id:s,loaded:!1,exports:{}};return t[s].call(a.exports,a,a.exports,o),a.loaded=!0,a.exports}o.m=t,(()=>{o.amdO={}})(),(()=>{var t=[];o.O=(e,s,n,a)=>{if(!s){var r=1/0;for(u=0;u=a)&&Object.keys(o.O).every((t=>o.O[t](s[l])))?s.splice(l--,1):(i=!1,a0&&t[u-1][2]>a;u--)t[u]=t[u-1];t[u]=[s,n,a]}})(),(()=>{o.n=t=>{var e=t&&t.__esModule?()=>t["default"]:()=>t;return o.d(e,{a:e}),e}})(),(()=>{o.d=(t,e)=>{for(var s in e)o.o(e,s)&&!o.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})}})(),(()=>{o.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}()})(),(()=>{o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)})(),(()=>{o.r=t=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}})(),(()=>{o.nmd=t=>(t.paths=[],t.children||(t.children=[]),t)})(),(()=>{o.p="/"})(),(()=>{var t={143:0};o.O.j=e=>0===t[e];var e=(e,s)=>{var n,a,[r,i,l]=s,c=0;if(r.some((e=>0!==t[e]))){for(n in i)o.o(i,n)&&(o.m[n]=i[n]);if(l)var u=l(o)}for(e&&e(s);co(38214)));s=o.O(s)})(); \ No newline at end of file +(()=>{var t={50053:(t,e,o)=>{"use strict";o.d(e,{Z:()=>_});o(68309);var s=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"挂载光驱",visible:t.attach_cd_room_dialog_visiable,width:"400px"},on:{"update:visible":function(e){t.attach_cd_room_dialog_visiable=e}}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择光盘镜像"},model:{value:t.attach_cd_room_guest.templateId,callback:function(e){t.$set(t.attach_cd_room_guest,"templateId",e)},expression:"attach_cd_room_guest.templateId"}},t._l(this.iso_template,(function(t){return e("el-option",{key:t.templateId,attrs:{label:t.name,value:t.templateId}})})),1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.attach_cd_room_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.attach_cd_room_guest_click}},[t._v("确 定")])],1)],1)},n=[],a=o(51907),r=o(85617),i=(o(57327),o(41539),o(29924));const l={data:function(){return{attach_cd_room_dialog_visiable:!1,iso_template:[],attach_cd_room_guest:{guestId:0,templateId:""}}},methods:{init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.attach_cd_room_guest.guestId=t.guestId,e.attach_cd_room_guest.templateId="",e.attach_cd_room_dialog_visiable=!0,o.next=5,e.load_iso_template();case 5:case"end":return o.stop()}}),o)})))()},load_iso_template:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,i.A8)().then((function(e){0===e.code&&(t.iso_template=e.data.filter((function(t){return 0==t.templateType&&2===t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},attach_cd_room_guest_click:function(){var t=this;(0,i.FX)(this.attach_cd_room_guest).then((function(e){0===e.code?(t.$emit("onGuestUpdate",e.data),t.attach_cd_room_dialog_visiable=!1):t.$notify.error({title:"错误",message:"挂载虚拟机光驱失败:".concat(e.message)})}))}}},c=l;var u=o(1001),d=(0,u.Z)(c,s,n,!1,null,null,null);const _=d.exports},55050:(t,e,o)=>{"use strict";o.d(e,{Z:()=>_});o(82526),o(41817);var s=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"克隆磁盘"},on:{back:function(e){return t.go_back()}}})],1),e("el-row",[e("el-form",{ref:"cloneForm",staticClass:"demo-ruleForm",attrs:{model:t.clone_volume,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"名称",prop:"description"}},[e("el-input",{model:{value:t.clone_volume.description,callback:function(e){t.$set(t.clone_volume,"description",e)},expression:"clone_volume.description"}})],1),e("el-form-item",{attrs:{label:"存储池",prop:"storageId"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.clone_volume.storageId,callback:function(e){t.$set(t.clone_volume,"storageId",e)},expression:"clone_volume.storageId"}},[e("el-option",{attrs:{label:"随机",value:0}}),t._l(this.storages,(function(t){return e("el-option",{key:t.storageId,attrs:{label:t.description,value:t.storageId}})}))],2)],1),e("el-form-item",{attrs:{label:"磁盘类型",prop:"volumeType"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.clone_volume.volumeType,callback:function(e){t.$set(t.clone_volume,"volumeType",e)},expression:"clone_volume.volumeType"}},[e("el-option",{attrs:{label:"raw",value:"raw"}}),e("el-option",{attrs:{label:"qcow",value:"qcow"}}),e("el-option",{attrs:{label:"qcow2",value:"qcow2"}}),e("el-option",{attrs:{label:"vdi",value:"vdi"}}),e("el-option",{attrs:{label:"vmdk",value:"vmdk"}}),e("el-option",{attrs:{label:"vpc",value:"vpc"}})],1)],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.clone_volume_click}},[t._v("克隆")]),e("el-button",{on:{click:t.go_back}},[t._v("取消")])],1)],1)],1)],1)},n=[],a=o(51907),r=o(85617),i=o(29924);const l={data:function(){return{clone_volume:{sourceVolumeId:0,description:"",storageId:0,volumeType:"qcow2"},storages:[]}},methods:{go_back:function(){this.$emit("back")},notify_volume_update:function(t){this.$emit("onVolumeUpdate",t)},init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.clone_volume.sourceVolumeId=t.volumeId,e.clone_volume.volumeType=t.type,e.clone_volume.description="Clone-"+t.description,e.clone_volume.storageId=t.storageId,o.next=6,(0,i._u)().then((function(t){0==t.code&&(e.storages=t.data)}));case 6:case"end":return o.stop()}}),o)})))()},clone_volume_click:function(){var t=this;this.$confirm("克隆磁盘, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,i.MP)(t.clone_volume).then((function(e){0===e.code?(t.notify_volume_update(e.data.clone),t.notify_volume_update(e.data.source),t.go_back()):t.$notify.error({title:"错误",message:"克隆磁盘失败:".concat(e.message)})}))}))["catch"]((function(){}))}}},c=l;var u=o(1001),d=(0,u.Z)(c,s,n,!1,null,null,null);const _=d.exports},52874:(t,e,o)=>{"use strict";o.d(e,{Z:()=>u});var s=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"创建快照",visible:t.snapshot_dialog_visiable,width:"400px"},on:{"update:visible":function(e){t.snapshot_dialog_visiable=e}}},[e("el-form",{attrs:{model:t.snapshot_volume,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"快照名称"}},[e("el-input",{attrs:{placeholder:"请输入快照名称"},model:{value:t.snapshot_volume.snapshotName,callback:function(e){t.$set(t.snapshot_volume,"snapshotName",e)},expression:"snapshot_volume.snapshotName"}})],1),e("el-form-item",{attrs:{label:"磁盘类型",prop:"volumeType"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.snapshot_volume.snapshotVolumeType,callback:function(e){t.$set(t.snapshot_volume,"snapshotVolumeType",e)},expression:"snapshot_volume.snapshotVolumeType"}},[e("el-option",{attrs:{label:"raw",value:"raw"}}),e("el-option",{attrs:{label:"qcow",value:"qcow"}}),e("el-option",{attrs:{label:"qcow2",value:"qcow2"}}),e("el-option",{attrs:{label:"vdi",value:"vdi"}}),e("el-option",{attrs:{label:"vmdk",value:"vmdk"}}),e("el-option",{attrs:{label:"vpc",value:"vpc"}})],1)],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.snapshot_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.create_volume_snapshot_click}},[t._v("确 定")])],1)],1)},n=[],a=(o(68309),o(29924));const r={data:function(){return{snapshot_volume:{volumeId:0,snapshotName:"",snapshotVolumeType:"qcow2"},snapshot_dialog_visiable:!1}},methods:{init:function(t){this.snapshot_volume.volumeId=t.volumeId,this.snapshot_volume.name="",this.snapshot_volume.snapshotVolumeType=t.type,this.snapshot_dialog_visiable=!0},create_volume_snapshot_click:function(){var t=this;this.$confirm("创建磁盘快照, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,a.Ox)(t.snapshot_volume).then((function(e){0===e.code?t.snapshot_dialog_visiable=!1:t.$notify.error({title:"错误",message:"创建磁盘快照失败:".concat(e.message)})}))}))["catch"]((function(){}))}}},i=r;var l=o(1001),c=(0,l.Z)(i,s,n,!1,null,null,null);const u=c.exports},69147:(t,e,o)=>{"use strict";o.d(e,{Z:()=>u});o(68309);var s=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"创建模版",visible:t.template_dialog_visiable,width:"400px"},on:{"update:visible":function(e){t.template_dialog_visiable=e}}},[e("el-form",{attrs:{model:t.template_volume,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"模版名称"}},[e("el-input",{attrs:{placeholder:"请输入模版名称"},model:{value:t.template_volume.name,callback:function(e){t.$set(t.template_volume,"name",e)},expression:"template_volume.name"}})],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.template_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.create_volume_template_click}},[t._v("确 定")])],1)],1)},n=[],a=o(29924);const r={data:function(){return{template_dialog_visiable:!1,template_volume:{volumeId:0,name:""}}},methods:{init:function(t){this.template_volume.volumeId=t.volumeId,this.template_volume.name="",this.template_dialog_visiable=!0},create_volume_template_click:function(){var t=this;this.$confirm("创建磁盘模版, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,a.Jf)(t.template_volume).then((function(e){0===e.code?t.template_dialog_visiable=!1:t.$notify.error({title:"错误",message:"创建磁盘模版失败:".concat(e.message)})}))}))["catch"]((function(){}))}}},i=r;var l=o(1001),c=(0,l.Z)(i,s,n,!1,null,null,null);const u=c.exports},7488:(t,e,o)=>{"use strict";o.d(e,{Z:()=>c});var s=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"下载磁盘",visible:t.download_dialog_visiable,width:"400px"},on:{"update:visible":function(e){t.download_dialog_visiable=e}}},[e("el-form",{attrs:{model:t.download_volume,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"磁盘类型",prop:"volumeType"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.download_volume.volumeType,callback:function(e){t.$set(t.download_volume,"volumeType",e)},expression:"download_volume.volumeType"}},[e("el-option",{attrs:{label:"raw",value:"raw"}}),e("el-option",{attrs:{label:"qcow",value:"qcow"}}),e("el-option",{attrs:{label:"qcow2",value:"qcow2"}}),e("el-option",{attrs:{label:"vdi",value:"vdi"}}),e("el-option",{attrs:{label:"vmdk",value:"vmdk"}}),e("el-option",{attrs:{label:"vpc",value:"vpc"}})],1)],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.download_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.download_volume_click}},[t._v("下载")])],1)],1)},n=[];o(92222);const a={data:function(){return{download_dialog_visiable:!1,download_volume:{volumeType:"qcow2",volumeId:0}}},methods:{init:function(t){this.download_volume.volumeId=t.volumeId,this.download_volume.volumeType=t.type,this.download_dialog_visiable=!0},download_volume_click:function(){var t="./api/volume/download?volumeId=".concat(this.download_volume.volumeId,"&volumeType=").concat(this.download_volume.volumeType);window.open(t,"_blank"),this.download_dialog_visiable=!1}}},r=a;var i=o(1001),l=(0,i.Z)(r,s,n,!1,null,null,null);const c=l.exports},5558:(t,e,o)=>{"use strict";o.d(e,{Z:()=>J});o(68309),o(82526),o(41817);var s=function(){var t=this,e=t._self._c;return e("div",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"},{name:"loading",rawName:"v-loading",value:t.guest_loading,expression:"guest_loading"}],staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{attrs:{content:"虚拟机详情"},on:{back:t.on_back_click}})],1),e("el-row",{staticStyle:{"text-align":"left",margin:"20px 0"}},[e("el-button",{staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini",disabled:4!==t.show_guest_info.current_guest.status},on:{click:function(e){return t.show_start_guest_click(t.show_guest_info.current_guest)}}},[t._v("启动虚拟机")]),e("el-button",{staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini",disabled:t.show_guest_info.current_guest.status>3},on:{click:function(e){return t.show_stop_guest_click(t.show_guest_info.current_guest)}}},[t._v("停止虚拟机")]),e("el-button",{staticStyle:{width:"90px"},attrs:{type:"danger",size:"mini",disabled:t.show_guest_info.current_guest.status<3},on:{click:function(e){return t.destroy_guest(t.show_guest_info.current_guest)}}},[t._v("销毁虚拟机")]),e("el-button",{directives:[{name:"show",rawName:"v-show",value:0!==t.show_guest_info.current_guest.type,expression:"show_guest_info.current_guest.type !== 0"}],staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini",disabled:2!==t.show_guest_info.current_guest.status},on:{click:function(e){return t.reboot_guest_click(t.show_guest_info.current_guest)}}},[t._v("重启虚拟机")]),e("el-button",{directives:[{name:"show",rawName:"v-show",value:0!==t.show_guest_info.current_guest.type,expression:"show_guest_info.current_guest.type !== 0"}],staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini",disabled:4!==t.show_guest_info.current_guest.status},on:{click:function(e){return t.show_reinstall_guest_click(t.show_guest_info.current_guest)}}},[t._v("重装系统")]),e("el-button",{staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini",disabled:2!==t.show_guest_info.current_guest.status},on:{click:function(e){return t.show_migrate_guest_click(t.show_guest_info.current_guest)}}},[t._v("迁移虚拟机")])],1),e("el-row",{staticStyle:{"text-align":"left",margin:"20px 0"}},[e("el-button",{staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini",disabled:2!==t.show_guest_info.current_guest.status},on:{click:function(e){return t.vnc_click(t.show_guest_info.current_guest)}}},[t._v("远程桌面")]),e("el-button",{directives:[{name:"show",rawName:"v-show",value:0!==t.show_guest_info.current_guest.type,expression:"show_guest_info.current_guest.type !== 0"}],staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini",disabled:4!==t.show_guest_info.current_guest.status},on:{click:function(e){return t.show_modify_guest_click(t.show_guest_info.current_guest)}}},[t._v("修改配置")]),e("el-button",{directives:[{name:"show",rawName:"v-show",value:0!==t.show_guest_info.current_guest.type,expression:"show_guest_info.current_guest.type !== 0"}],staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini",disabled:0!==t.show_guest_info.current_guest.cdRoom},on:{click:function(e){return t.show_attach_cd_room_click(t.show_guest_info.current_guest)}}},[t._v("挂载光驱")]),e("el-button",{directives:[{name:"show",rawName:"v-show",value:0!==t.show_guest_info.current_guest.type,expression:"show_guest_info.current_guest.type !== 0"}],staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini",disabled:0===t.show_guest_info.current_guest.cdRoom},on:{click:function(e){return t.detach_guest_cd_room_click(t.show_guest_info.current_guest)}}},[t._v("卸载光驱")]),e("el-button",{directives:[{name:"show",rawName:"v-show",value:0!==t.show_guest_info.current_guest.type,expression:"show_guest_info.current_guest.type !== 0"}],staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini"},on:{click:function(e){return t.show_attach_network_click(t.show_guest_info.current_guest)}}},[t._v("添加网卡")]),e("el-button",{directives:[{name:"show",rawName:"v-show",value:0!==t.show_guest_info.current_guest.type,expression:"show_guest_info.current_guest.type !== 0"}],staticStyle:{width:"90px"},attrs:{type:"primary",size:"mini"},on:{click:function(e){return t.show_attach_volume_click(t.show_guest_info.current_guest)}}},[t._v("挂载磁盘")])],1),e("el-row",[e("el-descriptions",{attrs:{column:2,size:"medium",border:""}},[e("el-descriptions-item",{attrs:{label:"ID"}},[t._v(t._s(t.show_guest_info.current_guest.guestId))]),e("el-descriptions-item",{attrs:{label:"实例名"}},[t._v(t._s(t.show_guest_info.current_guest.name))]),e("el-descriptions-item",{attrs:{label:"标签"}},[t._v(t._s(t.show_guest_info.current_guest.description))]),e("el-descriptions-item",{attrs:{label:"总线类型"}},[t._v(t._s(t.show_guest_info.current_guest.busType))]),e("el-descriptions-item",{attrs:{label:"CPU"}},[t._v(t._s(t.show_guest_info.current_guest.cpu)+"核")]),e("el-descriptions-item",{attrs:{label:"内存"}},[t._v(t._s(t.get_memory_display_size(t.show_guest_info.current_guest.memory)))]),e("el-descriptions-item",{attrs:{label:"配额"}},[t._v(t._s(t.show_guest_info.current_guest.speed))]),e("el-descriptions-item",{attrs:{label:"光盘"}},[t._v(t._s(t.show_guest_info.template.name))]),e("el-descriptions-item",{attrs:{label:"运行主机"}},[e("el-button",{directives:[{name:"show",rawName:"v-show",value:0!==t.show_guest_info.host.hostId,expression:"show_guest_info.host.hostId !== 0"}],attrs:{type:"text",underline:!1},on:{click:function(e){return t.show_host_info(t.show_guest_info.host.hostId)}}},[t._v(t._s(t.show_guest_info.host.displayName))]),e("span",{directives:[{name:"show",rawName:"v-show",value:0===t.show_guest_info.host.hostId,expression:"show_guest_info.host.hostId === 0"}],attrs:{underline:!1}},[t._v(t._s(t.show_guest_info.host.displayName))])],1),e("el-descriptions-item",{attrs:{label:"架构方案"}},[e("el-button",{directives:[{name:"show",rawName:"v-show",value:0!==t.show_guest_info.scheme.schemeId,expression:"show_guest_info.scheme.schemeId !== 0"}],attrs:{type:"text",underline:!1},on:{click:function(e){return t.show_scheme_info(t.show_guest_info.scheme.schemeId)}}},[t._v(t._s(t.show_guest_info.scheme.name))]),e("span",{directives:[{name:"show",rawName:"v-show",value:0===t.show_guest_info.scheme.schemeId,expression:"show_guest_info.scheme.schemeId === 0"}],attrs:{underline:!1}},[t._v(t._s(t.show_guest_info.scheme.name))])],1),e("el-descriptions-item",{attrs:{label:"虚拟机类型"}},[e("el-tag",[t._v(t._s(0===t.show_guest_info.current_guest.type?"系统":"用户"))])],1),e("el-descriptions-item",{attrs:{label:"虚拟机IP"}},[t._v(t._s(t.show_guest_info.current_guest.guestIp))]),e("el-descriptions-item",{attrs:{label:"上次运行时间"}},[t._v(" "+t._s(t.show_guest_info.current_guest.lastStartTime?t.parse_date(t.show_guest_info.current_guest.lastStartTime):"-")+" ")]),e("el-descriptions-item",{attrs:{label:"状态"}},[e("el-tag",{attrs:{type:2===t.show_guest_info.current_guest.status?"success":"danger"}},[t._v(t._s(t.get_guest_status(t.show_guest_info.current_guest)))])],1)],1)],1),e("br"),e("el-row",[e("el-tabs",{attrs:{type:"border-card"}},[e("el-tab-pane",{attrs:{label:"磁盘"}},[e("el-table",{staticStyle:{width:"100%"},attrs:{"v-loading":t.show_guest_info.volume_loading,data:t.show_guest_info.volumes}},[e("el-table-column",{attrs:{label:"ID",prop:"volumeId",width:"80"}}),e("el-table-column",{attrs:{label:"描述",prop:"description",width:"200"}}),e("el-table-column",{attrs:{label:"容量",prop:"capacity",width:"150"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(t.get_volume_display_size(e.row.capacity))+" ")]}}])}),e("el-table-column",{attrs:{label:"已使用",prop:"allocation",width:"150"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(t.get_volume_display_size(e.row.allocation))+" ")]}}])}),e("el-table-column",{attrs:{label:"路径",prop:"path","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"操作",width:"180"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"text"},on:{click:function(e){return t.show_volume_info(o.row.volumeId)}}},[t._v("详情")]),e("el-button",{staticStyle:{"margin-left":"10px"},attrs:{type:"text",disabled:0===o.row.attach.deviceId},on:{click:function(e){return t.detach_volume_click(o.row)}}},[t._v("卸载磁盘")])]}}])})],1)],1),e("el-tab-pane",{attrs:{label:"网卡"}},[e("el-table",{staticStyle:{width:"100%"},attrs:{"v-loading":t.show_guest_info.network_loading,data:t.show_guest_info.networks}},[e("el-table-column",{attrs:{label:"MAC",prop:"mac",width:"200"}}),e("el-table-column",{attrs:{label:"IP",prop:"ip",width:"200"}}),e("el-table-column",{attrs:{label:"驱动类型",prop:"driveType",width:"150"}}),e("el-table-column",{attrs:{label:"操作"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"text",disabled:0===o.row.deviceId||0===t.show_guest_info.current_guest.type},on:{click:function(e){return t.detach_network_click(o.row)}}},[t._v("卸载网卡")])]}}])})],1)],1)],1)],1)],1),e("ReInstallComponentVue",{directives:[{name:"show",rawName:"v-show",value:1===t.show_type,expression:"show_type === 1"}],ref:"ReInstallComponentVueRef",on:{back:function(e){t.show_type=0},finish:t.on_finish_reinstall}}),e("HostInfoComponent",{directives:[{name:"show",rawName:"v-show",value:2===this.show_type,expression:"this.show_type === 2"}],ref:"HostInfoComponentRef",on:{back:t.show_host_return}}),e("SchemeInfoComponent",{directives:[{name:"show",rawName:"v-show",value:3===this.show_type,expression:"this.show_type === 3"}],ref:"SchemeInfoComponentRef",on:{back:t.show_scheme_return}}),4===this.show_type?e("VolumeInfoComponent",{ref:"VolumeInfoComponentRef",on:{back:t.show_volume_return}}):t._e(),e("AttachDiskComponent",{ref:"AttachDiskComponentRef",on:{onVoumeAttachCallBack:t.on_volume_attach_callback}}),e("AttachCdRoomComponent",{ref:"AttachCdRoomComponentRef",on:{onGuestUpdate:t.on_notify_update_guest_info}}),e("AttachNetworkComponent",{ref:"AttachNetworkComponentRef",on:{onGuestAttachCallback:t.on_network_attach_callback}}),e("ModifyGuestComponent",{ref:"ModifyGuestComponentRef",on:{onGuestUpdate:t.on_notify_update_guest_info}}),e("StartGuestComponent",{ref:"StartGuestComponentRef",on:{onGuestUpdate:t.on_notify_update_guest_info}}),e("StopGuestComponent",{ref:"StopGuestComponentRef",on:{onGuestUpdate:t.on_notify_update_guest_info}}),e("MigrateGuestComponent",{ref:"MigrateGuestComponentRef",on:{onGuestUpdate:t.on_notify_update_guest_info}})],1)},n=[],a=o(51907),r=o(85617),i=(o(57658),o(41539),o(34553),o(40561),o(42173)),l=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"挂载磁盘",visible:t.attach_volume_dialog_visiable,width:"400px"},on:{"update:visible":function(e){t.attach_volume_dialog_visiable=e}}},[e("el-form",{attrs:{model:t.attach_volume_guest,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"磁盘"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择磁盘"},model:{value:t.attach_volume_guest.volumeId,callback:function(e){t.$set(t.attach_volume_guest,"volumeId",e)},expression:"attach_volume_guest.volumeId"}},t._l(this.attach_volumes,(function(t){return e("el-option",{key:t.volumeId,attrs:{label:t.description,value:t.volumeId}})})),1)],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.attach_volume_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.attach_volume_click}},[t._v("确 定")])],1)],1)},c=[],u=o(29924);const d={data:function(){return{attach_volume_dialog_visiable:!1,attach_volumes:[],attach_volume_guest:{guestId:0,volumeId:""}}},methods:{load_all_attach_volumes:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.I2)().then((function(e){0===e.code&&(t.attach_volumes=e.data)}));case 2:case"end":return e.stop()}}),e)})))()},init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.attach_volume_guest.guestId=t.guestId,e.attach_volume_guest.volumeId="",e.attach_volume_dialog_visiable=!0,o.next=5,e.load_all_attach_volumes();case 5:case"end":return o.stop()}}),o)})))()},attach_volume_click:function(){var t=this;(0,u.M8)(this.attach_volume_guest).then((function(e){0===e.code?(t.$emit("onVoumeAttachCallBack",e.data.guest,e.data.volume),t.attach_volume_dialog_visiable=!1):t.$notify.error({title:"错误",message:" 挂载磁盘失败:".concat(e.message)})}))}}},_=d;var p=o(1001),h=(0,p.Z)(_,l,c,!1,null,null,null);const m=h.exports;var f=o(50053),g=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"挂载网卡",visible:t.attach_network_dialog_visiable,width:"400px"},on:{"update:visible":function(e){t.attach_network_dialog_visiable=e}}},[e("el-form",{attrs:{model:t.attach_network_guest,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"网络"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择网络"},model:{value:t.attach_network_guest.networkId,callback:function(e){t.$set(t.attach_network_guest,"networkId",e)},expression:"attach_network_guest.networkId"}},t._l(this.networks,(function(t){return e("el-option",{key:t.networkId,attrs:{label:t.name,value:t.networkId}})})),1)],1),e("el-form-item",{attrs:{label:"驱动"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择网卡驱动"},model:{value:t.attach_network_guest.driveType,callback:function(e){t.$set(t.attach_network_guest,"driveType",e)},expression:"attach_network_guest.driveType"}},[e("el-option",{attrs:{label:"virtio",value:"virtio"}}),e("el-option",{attrs:{label:"rtl8139",value:"rtl8139"}}),e("el-option",{attrs:{label:"e1000",value:"e1000"}})],1)],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.attach_network_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.attach_network_click}},[t._v("确 定")])],1)],1)},w=[];o(57327);const v={data:function(){return{attach_network_dialog_visiable:!1,networks:[],attach_network_guest:{guestId:0,networkId:"",driveType:"virtio"}}},methods:{init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.attach_network_guest.guestId=t.guestId,e.attach_network_guest.networkId="",e.attach_network_dialog_visiable=!0,o.next=5,e.load_all_networks();case 5:case"end":return o.stop()}}),o)})))()},load_all_networks:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.jR)().then((function(e){0===e.code&&(t.networks=e.data.filter((function(t){return 2===t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},attach_network_click:function(){var t=this;(0,u.vJ)(this.attach_network_guest).then((function(e){0===e.code?(t.$emit("onGuestAttachCallback",e.data.guest,e.data.network),t.attach_network_dialog_visiable=!1):t.$notify.error({title:"错误",message:"虚拟机附加网卡失败:".concat(e.message)})}))}}},y=v;var b=(0,p.Z)(y,g,w,!1,null,null,null);const k=b.exports;var I=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"修改配置",visible:t.modify_guest_dialog_visiable,width:"400px"},on:{"update:visible":function(e){t.modify_guest_dialog_visiable=e}}},[e("el-form",{attrs:{model:t.modify_guest,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"名称",prop:"description"}},[e("el-input",{model:{value:t.modify_guest.description,callback:function(e){t.$set(t.modify_guest,"description",e)},expression:"modify_guest.description"}})],1),e("el-form-item",{attrs:{label:"总线方式"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"总线方式"},model:{value:t.modify_guest.busType,callback:function(e){t.$set(t.modify_guest,"busType",e)},expression:"modify_guest.busType"}},[e("el-option",{attrs:{label:"virtio",value:"virtio"}}),e("el-option",{attrs:{label:"ide",value:"ide"}}),e("el-option",{attrs:{label:"scsi",value:"scsi"}})],1)],1),e("el-form-item",{attrs:{label:"计算方案"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择计算方案"},model:{value:t.modify_guest.schemeId,callback:function(e){t.$set(t.modify_guest,"schemeId",e)},expression:"modify_guest.schemeId"}},t._l(this.schemes,(function(t){return e("el-option",{key:t.schemeId,attrs:{label:t.name,value:t.schemeId}})})),1)],1),e("el-form-item",{attrs:{label:"群组"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择群组"},model:{value:t.modify_guest.groupId,callback:function(e){t.$set(t.modify_guest,"groupId",e)},expression:"modify_guest.groupId"}},t._l(this.groups,(function(t){return e("el-option",{key:t.groupId,attrs:{label:t.groupName,value:t.groupId}})})),1)],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.modify_guest_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.modify_guest_click}},[t._v("确 定")])],1)],1)},x=[],C=o(23698);o(92222);const $={data:function(){return{modify_guest_dialog_visiable:!1,groups:[],modify_guest:{guestId:0,groupId:0,busType:"",description:"",schemeId:""}}},methods:{init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.groups=[{groupId:0,groupName:"默认"}],e.modify_guest.guestId=t.guestId,e.modify_guest.groupId=t.groupId,e.modify_guest.description=t.description,e.modify_guest.schemeId=t.schemeId,e.modify_guest.busType=t.busType,e.modify_guest_dialog_visiable=!0,o.next=9,e.load_all_schemes();case 9:return o.next=11,e.load_all_groups();case 11:case"end":return o.stop()}}),o)})))()},load_all_schemes:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.Pu)().then((function(e){0===e.code&&(t.schemes=e.data)}));case 2:case"end":return e.stop()}}),e)})))()},load_all_groups:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.hI)().then((function(e){0===e.code&&(t.groups=[{groupId:0,groupName:"默认"}].concat((0,C.Z)(e.data)))}));case 2:case"end":return e.stop()}}),e)})))()},modify_guest_click:function(){var t=this;(0,u.vi)(this.modify_guest).then((function(e){0===e.code?(t.$emit("onGuestUpdate",e.data),t.modify_guest_dialog_visiable=!1):t.$notify.error({title:"错误",message:" 修改主机信息失败:".concat(e.message)})}))}}},S=$;var Z=(0,p.Z)(S,I,x,!1,null,null,null);const T=Z.exports;var z=o(64148),N=o(54165),V=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"重装虚拟机"},on:{back:t.on_back_click}})],1),e("el-row",[e("el-form",{ref:"reInstallForm",staticClass:"demo-ruleForm",attrs:{model:t.reinstall_guest,"label-width":"100px"}},[e("el-row",[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"安装方式"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择安装方式"},model:{value:t.reinstall_guest.type,callback:function(e){t.$set(t.reinstall_guest,"type",e)},expression:"reinstall_guest.type"}},[e("el-option",{attrs:{label:"ISO镜像",value:0}}),e("el-option",{attrs:{label:"模版安装",value:1}}),e("el-option",{attrs:{label:"快照安装",value:2}}),e("el-option",{attrs:{label:"现有磁盘",value:3}})],1)],1)],1),e("el-col",{attrs:{span:12}},[3!==t.reinstall_guest.type?e("el-form-item",{attrs:{label:"磁盘类型"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.reinstall_guest.volumeType,callback:function(e){t.$set(t.reinstall_guest,"volumeType",e)},expression:"reinstall_guest.volumeType"}},[e("el-option",{attrs:{label:"raw",value:"raw"}}),e("el-option",{attrs:{label:"qcow",value:"qcow"}}),e("el-option",{attrs:{label:"qcow2",value:"qcow2"}}),e("el-option",{attrs:{label:"vdi",value:"vdi"}}),e("el-option",{attrs:{label:"vmdk",value:"vmdk"}}),e("el-option",{attrs:{label:"vpc",value:"vpc"}})],1)],1):t._e()],1)],1),e("el-row",[e("el-col",{attrs:{span:12}},[0===t.reinstall_guest.type?e("el-form-item",{attrs:{label:"ISO模版"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择光盘镜像"},model:{value:t.reinstall_guest.isoTemplateId,callback:function(e){t.$set(t.reinstall_guest,"isoTemplateId",e)},expression:"reinstall_guest.isoTemplateId"}},t._l(this.iso_template,(function(t){return e("el-option",{key:t.templateId,attrs:{label:t.name,value:t.templateId}})})),1)],1):t._e(),1===t.reinstall_guest.type?e("el-form-item",{attrs:{label:"系统模版"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择模版"},model:{value:t.reinstall_guest.diskTemplateId,callback:function(e){t.$set(t.reinstall_guest,"diskTemplateId",e)},expression:"reinstall_guest.diskTemplateId"}},t._l(this.disk_template,(function(t){return e("el-option",{key:t.templateId,attrs:{label:t.name,value:t.templateId}})})),1)],1):t._e(),2===t.reinstall_guest.type?e("el-form-item",{attrs:{label:"快照模版"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择系统快照"},model:{value:t.reinstall_guest.snapshotVolumeId,callback:function(e){t.$set(t.reinstall_guest,"snapshotVolumeId",e)},expression:"reinstall_guest.snapshotVolumeId"}},t._l(this.snapshot_template,(function(t){return e("el-option",{key:t.snapshotVolumeId,attrs:{label:t.name,value:t.snapshotVolumeId}})})),1)],1):t._e(),3===t.reinstall_guest.type?e("el-form-item",{attrs:{label:"可用磁盘"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择系统磁盘"},model:{value:t.reinstall_guest.volumeId,callback:function(e){t.$set(t.reinstall_guest,"volumeId",e)},expression:"reinstall_guest.volumeId"}},t._l(this.attach_volumes,(function(t){return e("el-option",{key:t.volumeId,attrs:{label:t.description,value:t.volumeId}})})),1)],1):t._e()],1),e("el-col",{attrs:{span:12}},[3!==t.reinstall_guest.type?e("el-form-item",{attrs:{label:"存储池"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.reinstall_guest.storageId,callback:function(e){t.$set(t.reinstall_guest,"storageId",e)},expression:"reinstall_guest.storageId"}},[e("el-option",{attrs:{label:"随机",value:0}}),t._l(this.storages,(function(t){return e("el-option",{key:t.storageId,attrs:{label:t.description,value:t.storageId}})}))],2)],1):t._e()],1)],1),e("el-row",[e("el-col",{attrs:{span:12}},[0!==t.reinstall_guest.type?e("el-form-item",{attrs:{label:"密码"}},[e("el-input",{attrs:{"prefix-icon":"el-icon-lock",type:"password","show-password":!0},model:{value:t.reinstall_guest.password,callback:function(e){t.$set(t.reinstall_guest,"password",e)},expression:"reinstall_guest.password"}})],1):t._e()],1),e("el-col",{attrs:{span:12}},[0===t.reinstall_guest.type?e("el-form-item",{attrs:{label:"磁盘大小"}},[e("el-input",{model:{value:t.reinstall_guest.size,callback:function(e){t.$set(t.reinstall_guest,"size",e)},expression:"reinstall_guest.size"}})],1):t._e()],1)],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.reinstall_guest_click}},[t._v("立即重装")]),e("el-button",{on:{click:t.on_back_click}},[t._v("取消")])],1)],1)],1)],1)},R=[];const q={data:function(){return{reinstall_guest:{guestId:0,type:0,volumeType:"qcow2",isoTemplateId:"",diskTemplateId:"",snapshotVolumeId:"",volumeId:"",storageId:0,password:"",size:100},iso_template:[],attach_volumes:[],disk_template:[],storages:[],snapshot_template:[]}},methods:{on_back_click:function(){this.$emit("back")},load_all_attach_volumes:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.I2)().then((function(e){0===e.code&&(t.attach_volumes=e.data)}));case 2:case"end":return e.stop()}}),e)})))()},load_all_template:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.A8)().then((function(e){0===e.code&&(t.iso_template=e.data.filter((function(t){return 0==t.templateType&&2===t.status})),t.disk_template=e.data.filter((function(t){return 2==t.templateType&&2===t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},load_all_storage:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u._u)().then((function(e){0==e.code&&(t.storages=e.data.filter((function(t){return 1==t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},load_all_snapshot:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.GQ)().then((function(e){0==e.code&&(t.snapshot_template=e.data.filter((function(t){return 1==t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:e.show_type=0,e.load_all_attach_volumes(),e.load_all_template(),e.load_all_storage(),e.load_all_snapshot(),e.reinstall_guest.guestId=t.guestId,e.reinstall_guest.isoTemplateId="",e.reinstall_guest.diskTemplateId="",e.reinstall_guest.snapshotVolumeId="",e.reinstall_guest.volumeId="",e.reinstall_guest.password="",e.reinstall_guest.type=0;case 12:case"end":return o.stop()}}),o)})))()},reinstall_guest_click:function(){var t=this;switch(this.reinstall_guest.type){case 0:this.reinstall_guest.diskTemplateId=0,this.reinstall_guest.snapshotVolumeId=0,this.reinstall_guest.volumeId=0;break;case 1:this.reinstall_guest.isoTemplateId=0,this.reinstall_guest.snapshotVolumeId=0,this.reinstall_guest.volumeId=0,this.reinstall_guest.size=0;break;case 2:this.reinstall_guest.isoTemplateId=0,this.reinstall_guest.diskTemplateId=0,this.reinstall_guest.volumeId=0,this.reinstall_guest.size=0;break;case 3:this.reinstall_guest.isoTemplateId=0,this.reinstall_guest.diskTemplateId=0,this.reinstall_guest.snapshotVolumeId=0,this.reinstall_guest.size=0;break}this.$confirm("重装虚拟机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.qB)(t.reinstall_guest).then((function(e){0===e.code?t.$emit("finish",e.data):t.$notify.error({title:"错误",message:"重装虚拟机失败:".concat(e.message)})}))}))["catch"]((function(){}))}}},B=q;var P=(0,p.Z)(B,V,R,!1,null,null,null);const G=P.exports;var U=o(48080),M=o(33094),D=o(72541),F=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"迁移虚拟机",visible:t.migrate_dialog_visiable,width:"400px"},on:{"update:visible":function(e){t.migrate_dialog_visiable=e}}},[e("el-form",{attrs:{model:t.migrate_guest,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"选择主机"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.migrate_guest.hostId,callback:function(e){t.$set(t.migrate_guest,"hostId",e)},expression:"migrate_guest.hostId"}},[e("el-option",{attrs:{label:"随机",value:0}}),t._l(this.hosts,(function(t){return e("el-option",{key:t.hostId,attrs:{label:t.displayName,value:t.hostId,"v-loading":!0}})}))],2)],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.migrate_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.migrate_guest_click}},[t._v("确 定")])],1)],1)},E=[];const O={data:function(){return{migrate_dialog_visiable:!1,migrate_guest:{hostId:0,guestId:0},last_runing_host_id:0,hosts:[]}},methods:{init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.migrate_guest.guestId=t.guestId,e.migrate_guest.hostId=0,e.last_runing_host_id=t.hostId,e.migrate_dialog_visiable=!0,o.next=6,e.load_all_host();case 6:case"end":return o.stop()}}),o)})))()},load_all_host:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.vZ)().then((function(e){0===e.code&&(t.hosts=e.data.filter((function(e){return 1===e.status&&e.hostId!==t.last_runing_host_id})))}));case 2:case"end":return e.stop()}}),e)})))()},migrate_guest_click:function(){var t=this;(0,u.Tb)(this.migrate_guest).then((function(e){0===e.code?(t.$emit("onGuestUpdate",e.data),t.migrate_dialog_visiable=!1):t.$notify.error({title:"错误",message:"迁移虚拟机失败:".concat(e.message)})}))}}},A=O;var L=(0,p.Z)(A,F,E,!1,null,null,null);const j=L.exports;var H=o(73412);const X={name:"GuestInfoComponent",components:{AttachDiskComponent:m,AttachCdRoomComponent:f.Z,AttachNetworkComponent:k,ModifyGuestComponent:T,StartGuestComponent:z.Z,StopGuestComponent:N.Z,MigrateGuestComponent:j,ReInstallComponentVue:G,HostInfoComponent:U.Z,SchemeInfoComponent:M.Z,VolumeInfoComponent:D.Z},mixins:[H.Z,i.Z],created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},data:function(){return{show_type:0,guest_loading:!1,show_guest_info:{guestId:0,volume_loading:!1,network_loading:!1,guest_loading:!0,current_guest:{guestId:0,name:"",description:"",busType:"virtio",cpu:1,memory:524288,speed:500,cdRoom:0,hostId:0,schemeId:0,type:0,networkId:0,status:1,guestIp:""},host:{hostId:0,displayName:"-"},template:{templateId:0,name:"-"},scheme:{schemeId:0,name:"-"},volumes:[],networks:[]}}},methods:{on_volume_attach_callback:function(t,e){this.update_guest_info(t),this.show_guest_info.volumes.push(e)},on_network_attach_callback:function(t,e){this.update_guest_info(t),this.show_guest_info.networks.push(e)},show_host_return:function(){this.show_type=0},show_scheme_return:function(){this.show_type=0},show_volume_return:function(){this.show_type=0},show_host_info:function(t){this.show_type=2,this.$refs.HostInfoComponentRef.init(t)},show_scheme_info:function(t){this.show_type=3,this.$refs.SchemeInfoComponentRef.init(t)},show_volume_info:function(t){var e=this;this.show_type=4,this.$nextTick((function(){e.$refs.VolumeInfoComponentRef.init(t)}))},on_back_click:function(){this.$emit("back")},on_notify_update_guest_info:function(t){this.update_guest_info(t),this.$emit("onGuestUpdate",t)},show_reinstall_guest_click:function(t){this.$refs.ReInstallComponentVueRef.init(t),this.show_type=1},on_finish_reinstall:function(t){this.show_type=0,this.on_notify_update_guest_info(t)},init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.show_type=0,e.guest_loading=!1,e.show_guest_info.guestId=t.guestId,e.show_guest_info.current_guest=t,o.next=6,e.load_current_guest_template(t);case 6:return o.next=8,e.load_current_guest_host(t);case 8:return o.next=10,e.load_current_guest_scheme(t);case 10:return o.next=12,e.load_current_guest_volume(t);case 12:return o.next=14,e.load_current_guest_network(t);case 14:case"end":return o.stop()}}),o)})))()},initGuestId:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.show_type=0,e.guest_loading=!0,o.next=4,(0,u.c$)({guestId:t}).then((function(t){0===t.code?e.init(t.data):e.$alert("获取虚拟机信息失败:".concat(t.message),"提示",{dangerouslyUseHTMLString:!0,confirmButtonText:"返回",type:"error"}).then((function(){e.on_back_click()}))["catch"]((function(){e.on_back_click()}))}))["finally"]((function(){e.guest_loading=!1}));case 4:case"end":return o.stop()}}),o)})))()},load_current_guest_template:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:if(e.show_guest_info.template.templateId=t.cdRoom,e.show_guest_info.template.name="-",!(e.show_guest_info.template.templateId>0)){o.next=5;break}return o.next=5,(0,u.BE)({templateId:t.cdRoom}).then((function(t){0===t.code&&(e.show_guest_info.template.name=t.data.name)}));case 5:case"end":return o.stop()}}),o)})))()},load_current_guest_scheme:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:if(e.show_guest_info.scheme.schemeId=t.schemeId,e.show_guest_info.scheme.name="-",!(e.show_guest_info.scheme.schemeId>0)){o.next=5;break}return o.next=5,(0,u.TQ)({schemeId:t.schemeId}).then((function(t){0===t.code&&(e.show_guest_info.scheme.name=t.data.name)}));case 5:case"end":return o.stop()}}),o)})))()},load_current_guest_host:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:if(e.show_guest_info.host.hostId=t.hostId,e.show_guest_info.host.displayName="-",!(e.show_guest_info.host.hostId>0)){o.next=5;break}return o.next=5,(0,u.KF)({hostId:t.hostId}).then((function(t){0===t.code&&(e.show_guest_info.host.displayName=t.data.displayName)}));case 5:case"end":return o.stop()}}),o)})))()},load_current_guest_volume:function(t){var e=this;this.show_guest_info.volume_loading=!0,(0,u.XR)({guestId:t.guestId}).then((function(t){0===t.code&&(e.show_guest_info.volumes=t.data)}))["finally"]((function(){e.show_guest_info.volume_loading=!1}))},load_current_guest_network:function(t){var e=this;this.show_guest_info.network_loading=!0,(0,u.iN)({guestId:t.guestId}).then((function(t){0===t.code&&(e.show_guest_info.networks=t.data)}))["finally"]((function(){e.show_guest_info.network_loading=!1}))},update_guest_info:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:if(e.show_guest_info.guestId!==t.guestId){o.next=9;break}return e.show_guest_info.current_guest=t,o.next=4,e.load_current_guest_template(t);case 4:return o.next=6,e.load_current_guest_host(t);case 6:return o.next=8,e.load_current_guest_scheme(t);case 8:e.$forceUpdate();case 9:case"end":return o.stop()}}),o)})))()},show_migrate_guest_click:function(t){this.$refs.MigrateGuestComponentRef.init(t)},show_start_guest_click:function(t){this.$refs.StartGuestComponentRef.init(t)},show_attach_network_click:function(t){this.$refs.AttachNetworkComponentRef.init(t)},show_attach_volume_click:function(t){this.$refs.AttachDiskComponentRef.init(t)},show_stop_guest_click:function(t){this.$refs.StopGuestComponentRef.init(t)},show_attach_cd_room_click:function(t){this.$refs.AttachCdRoomComponentRef.init(t)},show_modify_guest_click:function(t){this.$refs.ModifyGuestComponentRef.init(t)},vnc_click:function(t){var e=this.$router.resolve({path:"/Vnc",query:{id:t.guestId,description:t.description}}),o=e.href;window.open(o,"_blank")},detach_guest_cd_room_click:function(t){var e=this;(0,u.n4)({guestId:t.guestId}).then((function(t){0===t.code?(e.$emit("onGuestUpdate",t.data),e.stop_dialog_visiable=!1):e.$notify.error({title:"错误",message:"卸载虚拟机光驱失败:".concat(t.message)})}))},detach_network_click:function(t){var e=this;this.$confirm("卸载当前挂载网卡, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.DZ)({guestId:t.guestId,guestNetworkId:t.guestNetworkId}).then((function(o){if(0===o.code){e.$emit("onGuestUpdate",o.data);var s=e.show_guest_info.networks.findIndex((function(e){return e.guestNetworkId===t.guestNetworkId}));s>=0&&e.show_guest_info.networks.splice(s,1)}else e.$notify.error({title:"错误",message:"虚拟机附加网卡失败:".concat(o.message)})}))}))["catch"]((function(){}))},detach_volume_click:function(t){var e=this;this.$confirm("卸载当前挂载磁盘, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){var o=t.attach;(0,u.PX)({guestId:o.guestId,guestDiskId:o.guestDiskId}).then((function(t){if(0===t.code){var s=e.show_guest_info.volumes.findIndex((function(t){return t.attach.guestDiskId===o.guestDiskId}));s>=0&&e.show_guest_info.volumes.splice(s,1)}else e.$notify.error({title:"错误",message:"卸载磁盘失败:".concat(t.message)})}))}))["catch"]((function(){}))},reboot_guest_click:function(t){var e=this;this.$confirm("重启当前虚拟机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.Qm)({guestId:t.guestId}).then((function(t){0===t.code?e.$emit("onGuestUpdate",t.data):e.$notify.error({title:"错误",message:"重启虚拟机失败:".concat(t.message)})}))}))["catch"]((function(){}))},destroy_guest:function(t){var e=this;this.$confirm("删除当前虚拟机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.yl)({guestId:t.guestId}).then((function(t){0===t.code?e.on_back_click():e.$notify.error({title:"错误",message:"删除虚拟机失败:".concat(t.message)})}))}))["catch"]((function(){}))},dispatch_notify_message:function(t){var e=this;1===t.type&&this.show_guest_info.guestId===t.id&&(0,u.c$)({guestId:t.id}).then((function(t){0==t.code?e.update_guest_info(t.data):2000001==t.code&&e.on_back_click()}))}}},Q=X;var K=(0,p.Z)(Q,s,n,!1,null,null,null);const J=K.exports},48080:(t,e,o)=>{"use strict";o.d(e,{Z:()=>h});var s=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{directives:[{name:"loading",rawName:"v-loading",value:t.host_loading,expression:"host_loading"}],attrs:{content:"主机详情"},on:{back:t.on_back_click}})],1),e("el-row",{staticStyle:{"text-align":"left",margin:"20px 0"}},[e("el-button",{attrs:{type:"success",size:"mini"},on:{click:function(e){return t.register_host(t.show_host)}}},[t._v("重新注册")]),e("el-button",{directives:[{name:"show",rawName:"v-show",value:3!==t.show_host.status,expression:"show_host.status !== 3"}],attrs:{type:"warning",size:"mini"},on:{click:function(e){return t.pasue_host(t.show_host)}}},[t._v("开始维护")]),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_host(t.show_host)}}},[t._v("销毁主机")])],1),e("el-row",[e("el-descriptions",{attrs:{column:2,size:"medium",border:""}},[e("el-descriptions-item",{attrs:{label:"ID"}},[t._v(t._s(t.show_host.hostId))]),e("el-descriptions-item",{attrs:{label:"主机名"}},[t._v(t._s(t.show_host.hostName))]),e("el-descriptions-item",{attrs:{label:"显示名称"}},[t._v(t._s(t.show_host.displayName))]),e("el-descriptions-item",{attrs:{label:"主机IP"}},[t._v(t._s(t.show_host.hostIp))]),e("el-descriptions-item",{attrs:{label:"网卡名称"}},[t._v(t._s(t.show_host.nic))]),e("el-descriptions-item",{attrs:{label:"通信地址"}},[t._v(t._s(t.show_host.uri))]),e("el-descriptions-item",{attrs:{label:"主机架构"}},[t._v(t._s(t.show_host.arch))]),e("el-descriptions-item",{attrs:{label:"虚拟化类型"}},[t._v(t._s(t.show_host.hypervisor))]),e("el-descriptions-item",{attrs:{label:"内存"}},[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"已使用:"+t.get_memory_display_size(t.show_host.allocationMemory)+" / 总共:"+t.get_memory_display_size(t.show_host.totalMemory),placement:"top"}},[e("el-progress",{attrs:{color:"#67C23A",percentage:t.show_host.totalMemory<=0?0:Math.floor(100*t.show_host.allocationMemory/t.show_host.totalMemory)}})],1)],1),e("el-descriptions-item",{attrs:{label:"CPU"}},[e("el-tooltip",{staticClass:"item",staticStyle:{width:"150px"},attrs:{effect:"dark",content:"已使用:"+t.show_host.allocationCpu+"核 / 总共:"+t.show_host.totalCpu+"核",placement:"top"}},[e("el-progress",{attrs:{color:"#67C23A",percentage:t.show_host.totalCpu<=0?0:Math.floor(100*t.show_host.allocationCpu/t.show_host.totalCpu)}})],1)],1),e("el-descriptions-item",{attrs:{label:"Cores"}},[t._v(t._s(t.show_host.cores))]),e("el-descriptions-item",{attrs:{label:"Sockets"}},[t._v(t._s(t.show_host.sockets))]),e("el-descriptions-item",{attrs:{label:"Threads"}},[t._v(t._s(t.show_host.threads))]),e("el-descriptions-item",{attrs:{label:"Eemulator"}},[t._v(t._s(t.show_host.emulator))]),e("el-descriptions-item",{attrs:{label:"状态"}},[e("el-tag",{attrs:{type:1===t.show_host.status?"success":"danger"}},[t._v(t._s(t.get_host_status(t.show_host)))])],1)],1)],1)],1)},n=[],a=o(51907),r=o(85617),i=(o(68309),o(41539),o(73412)),l=o(42173),c=o(29924);const u={name:"HostInfoComponent",data:function(){return{host_loading:!1,show_host:{hostId:0,displayName:"",hostIp:"127.0.0.1",hostName:"-",nic:"-",uri:"http://127.0.0.1:8081",allocationMemory:0,allocationCpu:0,totalMemory:0,totalCpu:0,arch:"-",hypervisor:"QEMU",emulator:"-",cores:0,threads:0,sockets:0,status:1}}},mixins:[i.Z,l.Z],created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},methods:{on_back_click:function(){this.$emit("back")},on_notify_update_host_info:function(t){this.refresh_host(t),this.$emit("onHostUpdate",t)},init_host:function(t){this.show_host=t,this.host_loading=!1},refresh_host:function(t){this.show_host.hostId===t.hostId&&(this.show_host=t)},init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.host_loading=!0,o.next=3,(0,c.KF)({hostId:t}).then((function(t){0===t.code?e.init_host(t.data):e.$alert("获取主机信息失败:".concat(t.message),"提示",{dangerouslyUseHTMLString:!0,confirmButtonText:"返回",type:"error"}).then((function(){e.on_back_click()}))["catch"]((function(){e.on_back_click()}))}))["finally"]((function(){e.host_loading=!1}));case 3:case"end":return o.stop()}}),o)})))()},pasue_host:function(t){var e=this;this.$confirm("维护主机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,c.ol)({hostId:t.hostId}).then((function(t){0===t.code?e.on_notify_update_host_info(t.data):e.$notify.error({title:"错误",message:"暂停主机失败:".concat(t.message)})}))}))["catch"]((function(){}))},register_host:function(t){var e=this;this.$confirm("重新注册主机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,c.XN)({hostId:t.hostId}).then((function(t){0===t.code?e.on_notify_update_host_info(t.data):e.$notify.error({title:"错误",message:"注册主机失败:".concat(t.message)})}))}))["catch"]((function(){}))},destroy_host:function(t){var e=this;this.$confirm("删除当前主机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,c.de)({hostId:t.hostId}).then((function(t){0===t.code?e.on_back_click():e.$notify.error({title:"错误",message:"删除主机失败:".concat(t.message)})}))}))["catch"]((function(){}))},dispatch_notify_message:function(t){var e=this;4===t.type&&this.show_host.hostId===t.id&&(0,c.KF)({hostId:t.id}).then((function(t){0==t.code?e.refresh_host(t.data):2000001==t.code&&e.on_back_click()}))}}},d=u;var _=o(1001),p=(0,_.Z)(d,s,n,!1,null,null,null);const h=p.exports},46455:(t,e,o)=>{"use strict";o.d(e,{Z:()=>_});o(82526),o(41817);var s=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"迁移磁盘"},on:{back:function(e){return t.go_back()}}})],1),e("el-row",[e("el-form",{staticClass:"demo-ruleForm",attrs:{model:t.migrate_volume,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"存储池",prop:"type"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.migrate_volume.storageId,callback:function(e){t.$set(t.migrate_volume,"storageId",e)},expression:"migrate_volume.storageId"}},[e("el-option",{attrs:{label:"随机",value:0}}),t._l(this.storages,(function(t){return e("el-option",{key:t.storageId,attrs:{label:t.description,value:t.storageId}})}))],2)],1),e("el-form-item",{attrs:{label:"磁盘类型",prop:"volumeType"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.migrate_volume.volumeType,callback:function(e){t.$set(t.migrate_volume,"volumeType",e)},expression:"migrate_volume.volumeType"}},[e("el-option",{attrs:{label:"raw",value:"raw"}}),e("el-option",{attrs:{label:"qcow",value:"qcow"}}),e("el-option",{attrs:{label:"qcow2",value:"qcow2"}}),e("el-option",{attrs:{label:"vdi",value:"vdi"}}),e("el-option",{attrs:{label:"vmdk",value:"vmdk"}}),e("el-option",{attrs:{label:"vpc",value:"vpc"}})],1)],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.migrate_volume_click}},[t._v("迁移")]),e("el-button",{on:{click:t.go_back}},[t._v("取消")])],1)],1)],1)],1)},n=[],a=o(51907),r=o(85617),i=o(29924);const l={data:function(){return{migrate_volume:{sourceVolumeId:0,storageId:0,volumeType:"qcow2"},storages:[]}},methods:{go_back:function(){this.$emit("back")},notify_volume_update:function(t){this.$emit("onVolumeUpdate",t)},init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.migrate_volume.sourceVolumeId=t.volumeId,e.migrate_volume.volumeType=t.type,e.migrate_volume.storageId=t.storageId,o.next=5,(0,i._u)().then((function(t){0==t.code&&(e.storages=t.data)}));case 5:case"end":return o.stop()}}),o)})))()},migrate_volume_click:function(){var t=this;this.$confirm("迁移磁盘, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,i.Ct)(t.migrate_volume).then((function(e){0===e.code?(t.notify_volume_update(e.data.migrate),t.notify_volume_update(e.data.source),t.go_back()):t.$notify.error({title:"错误",message:"迁移磁盘失败:".concat(e.message)})}))}))["catch"]((function(){}))}}},c=l;var u=o(1001),d=(0,u.Z)(c,s,n,!1,null,null,null);const _=d.exports},68501:(t,e,o)=>{"use strict";o.d(e,{Z:()=>u});var s=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"磁盘扩容",visible:t.resize_dialog_visiable,width:"300px"},on:{"update:visible":function(e){t.resize_dialog_visiable=e}}},[e("el-form",{attrs:{model:t.resize_volume,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"磁盘大小(GB)"}},[e("el-input",{attrs:{placeholder:"请输入磁盘大小(GB)"},model:{value:t.resize_volume.size,callback:function(e){t.$set(t.resize_volume,"size",e)},expression:"resize_volume.size"}})],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.resize_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.resize_volume_click}},[t._v("确 定")])],1)],1)},n=[],a=o(29924);const r={data:function(){return{resize_dialog_visiable:!1,resize_volume:{volumeId:0,size:100}}},methods:{init:function(t){this.resize_volume.volumeId=t.volumeId,this.resize_volume.size=100,this.resize_dialog_visiable=!0},resize_volume_click:function(){var t=this;this.$confirm("扩容磁盘, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,a.K5)(t.resize_volume).then((function(e){0===e.code?(t.$emit("onVolumeUpdate",e.data),t.resize_dialog_visiable=!1):t.$notify.error({title:"错误",message:"扩容磁盘失败:".concat(e.message)})}))}))["catch"]((function(){}))}}},i=r;var l=o(1001),c=(0,l.Z)(i,s,n,!1,null,null,null);const u=c.exports},33094:(t,e,o)=>{"use strict";o.d(e,{Z:()=>h});o(68309);var s=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{directives:[{name:"loading",rawName:"v-loading",value:t.schme_loading,expression:"schme_loading"}],attrs:{content:"计算方案详情"},on:{back:t.on_back_click}})],1),e("el-row",{staticStyle:{"text-align":"left",margin:"20px 0"}},[e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_scheme(t.show_scheme)}}},[t._v("删除")])],1),e("el-row",[e("el-descriptions",{attrs:{column:2,size:"medium",border:""}},[e("el-descriptions-item",{attrs:{label:"ID"}},[t._v(t._s(t.show_scheme.schemeId))]),e("el-descriptions-item",{attrs:{label:"名称"}},[t._v(t._s(t.show_scheme.name))]),e("el-descriptions-item",{attrs:{label:"配额"}},[t._v(t._s(t.show_scheme.speed))]),e("el-descriptions-item",{attrs:{label:"CPU"}},[t._v(t._s(t.show_scheme.cpu))]),e("el-descriptions-item",{attrs:{label:"内存"}},[t._v(t._s(t.get_memory_display_size(t.show_scheme.memory)))]),e("el-descriptions-item",{attrs:{label:"Cores"}},[t._v(t._s(t.show_scheme.cores))]),e("el-descriptions-item",{attrs:{label:"Sockets"}},[t._v(t._s(t.show_scheme.sockets))]),e("el-descriptions-item",{attrs:{label:"Threads"}},[t._v(t._s(t.show_scheme.threads))])],1)],1)],1)},n=[],a=o(51907),r=o(85617),i=(o(41539),o(73412)),l=o(29924),c=o(42173);const u={name:"SchemeInfoComponent",data:function(){return{schme_loading:!1,show_scheme:{schemeId:0,name:"-",cpu:0,memory:0,speed:0,sockets:0,cores:0,threads:0}}},mixins:[i.Z,c.Z],created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},methods:{on_back_click:function(){this.$emit("back")},on_notify_update_scheme_info:function(t){this.refresh_scheme(t),this.$emit("onSchemeUpdate",t)},refresh_scheme:function(t){this.show_scheme.schemeId===t.schemeId&&(this.show_scheme=t)},init_scheme:function(t){this.show_scheme=t,this.schme_loading=!1},init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.schme_loading=!0,o.next=3,(0,l.TQ)({schemeId:t}).then((function(t){0===t.code?e.init_scheme(t.data):e.$alert("获取计算方案信息失败:".concat(t.message),"提示",{dangerouslyUseHTMLString:!0,confirmButtonText:"返回",type:"error"}).then((function(){e.on_back_click()}))["catch"]((function(){e.on_back_click()}))}))["finally"]((function(){e.host_loading=!1}));case 3:case"end":return o.stop()}}),o)})))()},destroy_scheme:function(t){var e=this;this.$confirm("删除计算方案, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,l.tM)({schemeId:t.schemeId}).then((function(t){0===t.code?e.on_back_click():e.$notify.error({title:"错误",message:"删除计算方案失败:".concat(t.message)})}))}))["catch"]((function(){}))},dispatch_notify_message:function(t){var e=this;8===t.type&&this.show_scheme.schemeId==t.id&&(0,l.TQ)({schemeId:t.id}).then((function(t){0==t.code?e.refresh_scheme(t.data):2000001==t.code&&e.on_back_click()}))}}},d=u;var _=o(1001),p=(0,_.Z)(d,s,n,!1,null,null,null);const h=p.exports},64148:(t,e,o)=>{"use strict";o.d(e,{Z:()=>_});var s=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"启动虚拟机",visible:t.start_dialog_visiable,width:"400px"},on:{"update:visible":function(e){t.start_dialog_visiable=e}}},[e("el-form",{attrs:{model:t.start_guest,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"选择主机"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.start_guest.hostId,callback:function(e){t.$set(t.start_guest,"hostId",e)},expression:"start_guest.hostId"}},[e("el-option",{attrs:{label:"随机",value:0}}),t._l(this.hosts,(function(t){return e("el-option",{key:t.hostId,attrs:{label:t.displayName,value:t.hostId,"v-loading":!0}})}))],2)],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.start_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.start_guest_click}},[t._v("确 定")])],1)],1)},n=[],a=o(51907),r=o(85617),i=(o(57327),o(41539),o(29924));const l={data:function(){return{start_dialog_visiable:!1,start_guest:{hostId:0,guestId:0},hosts:[]}},methods:{init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.start_guest.guestId=t.guestId,e.start_guest.hostId=0,e.start_dialog_visiable=!0,o.next=5,e.load_all_host();case 5:case"end":return o.stop()}}),o)})))()},load_all_host:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,i.vZ)().then((function(e){0===e.code&&(t.hosts=e.data.filter((function(t){return 1==t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},start_guest_click:function(){var t=this;(0,i.NU)(this.start_guest).then((function(e){0===e.code?(t.$emit("onGuestUpdate",e.data),t.start_dialog_visiable=!1):t.$notify.error({title:"错误",message:"启动虚拟机失败:".concat(e.message)})}))}}},c=l;var u=o(1001),d=(0,u.Z)(c,s,n,!1,null,null,null);const _=d.exports},54165:(t,e,o)=>{"use strict";o.d(e,{Z:()=>_});var s=function(){var t=this,e=t._self._c;return e("el-dialog",{attrs:{title:"关闭虚拟机",visible:t.stop_dialog_visiable,width:"400px"},on:{"update:visible":function(e){t.stop_dialog_visiable=e}}},[e("el-checkbox",{model:{value:t.stop_guest.force,callback:function(e){t.$set(t.stop_guest,"force",e)},expression:"stop_guest.force"}},[t._v("强制关闭")]),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.stop_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.stop_guest_click}},[t._v("确 定")])],1)],1)},n=[],a=o(51907),r=o(85617),i=o(29924);const l={data:function(){return{stop_dialog_visiable:!1,stop_guest:{hostId:0,force:!1}}},methods:{init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:e.stop_guest.guestId=t.guestId,e.stop_guest.force=!1,e.stop_dialog_visiable=!0;case 3:case"end":return o.stop()}}),o)})))()},stop_guest_click:function(){var t=this;this.$confirm("停止当前虚拟机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,i.X)(t.stop_guest).then((function(e){0===e.code?(t.$emit("onGuestUpdate",e.data),t.stop_dialog_visiable=!1):t.$notify.error({title:"错误",message:"启动虚拟机失败:".concat(e.message)})}))}))["catch"]((function(){}))}}},c=l;var u=o(1001),d=(0,u.Z)(c,s,n,!1,null,null,null);const _=d.exports},47315:(t,e,o)=>{"use strict";o.d(e,{Z:()=>h});o(82526),o(41817);var s=function(){var t=this,e=t._self._c;return e("el-card",{directives:[{name:"loading",rawName:"v-loading",value:t.storage_loading,expression:"storage_loading"}],staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{attrs:{content:"存储池详情"},on:{back:t.go_back}})],1),e("el-row",{staticStyle:{"text-align":"left",margin:"20px 0"}},[e("el-button",{attrs:{type:"success",size:"mini"},on:{click:function(e){return t.register_storage(t.show_storage)}}},[t._v("重新注册")]),3!==t.show_storage.status?e("el-button",{attrs:{type:"warning",size:"mini"},on:{click:function(e){return t.pasue_storage(t.show_storage)}}},[t._v("开始维护")]):t._e(),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_storage(t.show_storage)}}},[t._v("销毁存储池")])],1),e("el-row",[e("el-descriptions",{attrs:{column:2,size:"medium",border:""}},[e("el-descriptions-item",{attrs:{label:"ID"}},[t._v(t._s(t.show_storage.storageId))]),e("el-descriptions-item",{attrs:{label:"存储池名"}},[t._v(t._s(t.show_storage.description))]),e("el-descriptions-item",{attrs:{label:"存储池类型"}},[t._v(t._s(t.show_storage.type))]),e("el-descriptions-item",{attrs:{label:"挂载路径"}},[t._v(t._s(t.show_storage.mountPath))]),"nfs"===t.show_storage.type?e("el-descriptions-item",{attrs:{label:"NFS路径"}},[t._v(t._s(JSON.parse(t.show_storage.param).path))]):t._e(),"nfs"===t.show_storage.type?e("el-descriptions-item",{attrs:{label:"NFS地址"}},[t._v(t._s(JSON.parse(t.show_storage.param).uri))]):t._e(),e("el-descriptions-item",{attrs:{label:"容量"}},[t._v(t._s(t.get_volume_display_size(t.show_storage.capacity)))]),e("el-descriptions-item",{attrs:{label:"可用"}},[t._v(t._s(t.get_volume_display_size(t.show_storage.available)))]),e("el-descriptions-item",{attrs:{label:"已申请"}},[t._v(t._s(t.get_volume_display_size(t.show_storage.allocation)))]),e("el-descriptions-item",{attrs:{label:"状态"}},[e("el-tag",{attrs:{type:1===t.show_storage.status?"success":"danger"}},[t._v(t._s(t.get_storage_status(t.show_storage)))])],1)],1)],1)],1)},n=[],a=o(51907),r=o(85617),i=(o(68309),o(41539),o(73412)),l=o(42173),c=o(29924);const u={name:"StorageInfoComponent",data:function(){return{storage_loading:!1,show_storage:{}}},mixins:[i.Z,l.Z],created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},methods:{go_back:function(){this.$emit("back")},init_storage:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:e.show_storage=t,e.storage_loading=!1;case 2:case"end":return o.stop()}}),o)})))()},init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.storage_loading=!0,o.next=3,(0,c.nQ)({storageId:t}).then((function(t){0===t.code?e.init_storage(t.data):e.$alert("获取存储池信息失败:".concat(t.message),"提示",{dangerouslyUseHTMLString:!0,confirmButtonText:"返回",type:"error"}).then((function(){e.go_back()}))["catch"]((function(){e.go_back()}))}))["finally"]((function(){e.storage_loading=!1}));case 3:case"end":return o.stop()}}),o)})))()},notify_storage_update:function(t){this.refresh_storage(t),this.$emit("onStorageUpdate",t)},refresh_storage:function(t){this.show_storage.storageId===t.storageId&&(this.show_storage=t)},pasue_storage:function(t){var e=this;this.$confirm("暂停存储池, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,c.dZ)({storageId:t.storageId}).then((function(t){0===t.code?e.notify_storage_update(t.data):e.$notify.error({title:"错误",message:"暂停存储池失败:".concat(t.message)})}))}))["catch"]((function(){}))},register_storage:function(t){var e=this;this.$confirm("重新注册存储池, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,c.vA)({storageId:t.storageId}).then((function(t){0===t.code?e.notify_storage_update(t.data):e.$notify.error({title:"错误",message:"注册存储池失败:".concat(t.message)})}))}))["catch"]((function(){}))},destroy_storage:function(t){var e=this;this.$confirm("删除存储池, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,c.ye)({storageId:t.storageId}).then((function(t){0===t.code?(e.notify_storage_update(t.data),e.go_back()):e.$notify.error({title:"错误",message:"删除存储池失败:".concat(t.message)})}))}))["catch"]((function(){}))},dispatch_notify_message:function(t){var e=this;7===t.type&&this.show_storage.storageId==t.id&&(0,c.nQ)({storageId:t.id}).then((function(t){0==t.code?e.refresh_storage(t.data):2000001==t.code&&e.go_back()}))}}},d=u;var _=o(1001),p=(0,_.Z)(d,s,n,!1,null,null,null);const h=p.exports},72541:(t,e,o)=>{"use strict";o.d(e,{Z:()=>b});o(82526),o(41817),o(68309);var s=function(){var t=this,e=t._self._c;return e("div",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"},{name:"loading",rawName:"v-loading",value:t.volume_loading,expression:"volume_loading"}],staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{attrs:{content:"磁盘详情"},on:{back:t.go_back}})],1),e("el-row",{staticStyle:{"text-align":"left",margin:"20px 0"}},[e("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(e){return t.show_resize_volume_click(t.show_volume)}}},[t._v("扩容磁盘")]),e("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(e){return t.show_clone_volume_click(t.show_volume)}}},[t._v("克隆磁盘")]),e("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(e){return t.show_migrate_volume_click(t.show_volume)}}},[t._v("迁移磁盘")]),e("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(e){return t.show_create_volume_snapshot_click(t.show_volume)}}},[t._v("创建快照")]),e("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(e){return t.show_create_volume_template_click(t.show_volume)}}},[t._v("创建模版")]),e("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(e){return t.show_download_volume_click(t.show_volume)}}},[t._v("下载磁盘")]),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_volume(t.show_volume)}}},[t._v("销毁磁盘")])],1),e("el-row",[e("el-descriptions",{attrs:{column:2,size:"medium",border:""}},[e("el-descriptions-item",{attrs:{label:"ID"}},[t._v(t._s(t.show_volume.volumeId))]),e("el-descriptions-item",{attrs:{label:"磁盘名"}},[t._v(t._s(t.show_volume.description))]),e("el-descriptions-item",{attrs:{label:"磁盘类型"}},[t._v(t._s(t.show_volume.type))]),e("el-descriptions-item",{attrs:{label:"磁盘路径"}},[t._v(t._s(t.show_volume.path))]),e("el-descriptions-item",{attrs:{label:"磁盘模版"}},[t._v(t._s(this.template?this.template.name:"-"))]),e("el-descriptions-item",{attrs:{label:"父级路径"}},[t._v(t._s(t.show_volume.backingPath))]),e("el-descriptions-item",{attrs:{label:"磁盘存储池"}},[e("el-button",{attrs:{type:"text",underline:!1},on:{click:function(e){return t.show_storage_info(t.show_volume.storageId)}}},[t._v(" "+t._s(this.storage?this.storage.description:t.show_volume.storageId)+" ")])],1),e("el-descriptions-item",{attrs:{label:"挂载主机"}},[t.show_volume.attach?e("el-button",{attrs:{type:"text",underline:!1},on:{click:function(e){return t.show_guest_info(t.show_volume.attach.guestId)}}},[t._v(" "+t._s(t.show_volume.attach.description)+" ")]):t._e(),t.show_volume.attach?t._e():e("span",[t._v("-")])],1),e("el-descriptions-item",{attrs:{label:"磁盘容量"}},[t._v(t._s(t.get_volume_display_size(t.show_volume.capacity)))]),e("el-descriptions-item",{attrs:{label:"物理占用"}},[t._v(t._s(t.get_volume_display_size(t.show_volume.allocation)))]),e("el-descriptions-item",{attrs:{label:"状态"}},[e("el-tag",{attrs:{type:1===t.show_volume.status?"success":"danger"}},[t._v(t._s(t.get_volume_status(t.show_volume)))])],1)],1)],1)],1),e("CloneVolumeComponent",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],ref:"CloneVolumeComponentRef",on:{back:function(e){t.show_type=0},onVolumeUpdate:t.notify_volume_update}}),e("MigrateVolumeComponent",{directives:[{name:"show",rawName:"v-show",value:2===this.show_type,expression:"this.show_type === 2"}],ref:"MigrateVolumeComponentRef",on:{back:function(e){t.show_type=0},onVolumeUpdate:t.notify_volume_update}}),e("GuestInfoComponent",{directives:[{name:"show",rawName:"v-show",value:3===this.show_type,expression:"this.show_type === 3"}],ref:"GuestInfoComponentRef",on:{back:function(e){t.show_type=0}}}),e("StorageInfoComponent",{directives:[{name:"show",rawName:"v-show",value:4===this.show_type,expression:"this.show_type === 4"}],ref:"StorageInfoComponentRef",on:{back:function(e){t.show_type=0}}}),e("DownloadVolumeComponent",{ref:"DownloadVolumeComponentRef"}),e("ResizeVolumeComponent",{ref:"ResizeVolumeComponentRef",on:{onVolumeUpdate:t.notify_volume_update}}),e("CreateVolumeTemplateComponent",{ref:"CreateVolumeTemplateComponentRef"}),e("CreateVolumeSnapshotComponent",{ref:"CreateVolumeSnapshotComponentRef"})],1)},n=[],a=o(51907),r=o(85617),i=(o(41539),o(7488)),l=o(68501),c=o(69147),u=o(52874),d=o(55050),_=o(46455),p=o(47315),h=o(42173),m=o(73412),f=o(29924);const g={name:"VolumeInfoComponent",data:function(){return{volume_loading:!1,show_type:0,show_volume:{},template:{},storage:{}}},components:{DownloadVolumeComponent:i.Z,ResizeVolumeComponent:l.Z,CreateVolumeTemplateComponent:c.Z,CreateVolumeSnapshotComponent:u.Z,CloneVolumeComponent:d.Z,MigrateVolumeComponent:_.Z,StorageInfoComponent:p.Z},beforeCreate:function(){this.$options.components.GuestInfoComponent=o(5558).Z},created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},mixins:[m.Z,h.Z],methods:{go_back:function(){this.$emit("back")},init_volume:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.show_volume=t,e.show_type=0,o.next=4,e.init_volume_template();case 4:return o.next=6,e.init_volume_storage();case 6:case"end":return o.stop()}}),o)})))()},init:function(t){var e=this;return(0,r.Z)((0,a.Z)().mark((function o(){return(0,a.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.show_type=0,e.volume_loading=!0,o.next=4,(0,f.Rm)({volumeId:t}).then((function(t){0===t.code?e.init_volume(t.data):e.$alert("获取磁盘信息失败:".concat(t.message),"提示",{dangerouslyUseHTMLString:!0,confirmButtonText:"返回",type:"error"}).then((function(){e.go_back()}))["catch"]((function(){e.go_back()}))}))["finally"]((function(){e.volume_loading=!1}));case 4:case"end":return o.stop()}}),o)})))()},notify_volume_update:function(t){this.refresh_volume(t),this.$emit("onVolumeUpdate",t)},refresh_volume:function(t){this.show_volume.volumeId===t.volumeId&&(this.show_volume=t)},init_volume_template:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(0!==t.show_volume.templateId){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,(0,f.BE)({templateId:t.show_volume.templateId}).then((function(e){0==e.code&&(t.template=e.data)}));case 4:case"end":return e.stop()}}),e)})))()},init_volume_storage:function(){var t=this;return(0,r.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,f.nQ)({storageId:t.show_volume.storageId}).then((function(e){0==e.code&&(t.storage=e.data)}));case 2:case"end":return e.stop()}}),e)})))()},show_resize_volume_click:function(t){this.$refs.ResizeVolumeComponentRef.init(t)},show_clone_volume_click:function(t){this.$refs.CloneVolumeComponentRef.init(t),this.show_type=1},show_migrate_volume_click:function(t){this.$refs.MigrateVolumeComponentRef.init(t),this.show_type=2},show_create_volume_template_click:function(t){this.$refs.CreateVolumeTemplateComponentRef.init(t)},show_create_volume_snapshot_click:function(t){this.$refs.CreateVolumeSnapshotComponentRef.init(t)},show_guest_info:function(t){this.$refs.GuestInfoComponentRef.initGuestId(t),this.show_type=3},show_storage_info:function(t){this.$refs.StorageInfoComponentRef.init(t),this.show_type=4},show_download_volume_click:function(t){this.$refs.DownloadVolumeComponentRef.init(t)},destroy_volume:function(t){var e=this;this.$confirm("删除磁盘, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,f.lp)({volumeId:t.volumeId}).then((function(t){0===t.code?(e.notify_volume_update(t.data),e.go_back()):e.$notify.error({title:"错误",message:"删除磁盘失败:".concat(t.message)})}))}))["catch"]((function(){}))},dispatch_notify_message:function(t){var e=this;2===t.type&&this.show_volume.volumeId===t.id&&(0,f.Rm)({volumeId:t.id}).then((function(t){0==t.code?e.refresh_volume(t.data):2000001==t.code&&e.go_back()}))}}},w=g;var v=o(1001),y=(0,v.Z)(w,s,n,!1,null,null,null);const b=y.exports},29924:(t,e,o)=>{"use strict";o.d(e,{FX:()=>gt,M8:()=>vt,vJ:()=>bt,uT:()=>X,go:()=>_t,is:()=>ht,MP:()=>j,sS:()=>Bt,Az:()=>lt,Ld:()=>y,XY:()=>h,ql:()=>J,Ox:()=>U,o6:()=>$,Mn:()=>V,rL:()=>O,Jf:()=>R,ng:()=>Ut,yl:()=>it,de:()=>I,s4:()=>g,tM:()=>Y,bv:()=>M,ye:()=>T,c4:()=>B,GE:()=>zt,lp:()=>H,n4:()=>wt,PX:()=>yt,DZ:()=>kt,fQ:()=>q,c3:()=>Vt,yL:()=>Gt,hI:()=>qt,c$:()=>tt,Xj:()=>nt,iN:()=>st,z2:()=>et,XR:()=>ot,KF:()=>v,vZ:()=>w,kI:()=>Nt,yj:()=>p,jR:()=>_,I2:()=>F,TQ:()=>K,Pu:()=>Q,Tu:()=>G,GQ:()=>P,nQ:()=>C,_u:()=>x,kH:()=>Rt,IC:()=>at,BE:()=>N,A8:()=>z,jW:()=>rt,lE:()=>Ct,Rm:()=>E,Mm:()=>D,pH:()=>xt,Tb:()=>dt,Ct:()=>A,v_:()=>Pt,vi:()=>ft,Mj:()=>Tt,A6:()=>W,rd:()=>It,ol:()=>b,pz:()=>m,dZ:()=>S,qB:()=>ct,Qm:()=>mt,XN:()=>k,fj:()=>f,vA:()=>Z,a$:()=>$t,h8:()=>Zt,K5:()=>L,NU:()=>ut,X:()=>pt,eV:()=>St});var s=o(45226),n=o(27594),a=(o(41539),o(23157),o(57658),o(19265)),r=o(93069),i=o.n(r),l=o(29076),c=o(67986),u=function(){function t(){(0,s.Z)(this,t),this.baseUrl=""}return(0,n.Z)(t,[{key:"getInsideConfig",value:function(){var t={baseURL:c.BASEURL,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8","X-Token":localStorage.getItem("X-Token")}};return t}},{key:"destroy",value:function(t){delete this.queue[t]}},{key:"interceptors",value:function(t,e){var o=this;t.interceptors.request.use((function(t){return"get"!==t.method.toLowerCase()?t.data=i().stringify(t.data):t.data=!0,t}),(function(t){return Promise.reject(t)})),t.interceptors.response.use((function(t){var e=t.data;if(401===e.code){var o=window.location.hash.toLowerCase();return o&&!o.startsWith("#/login")&&localStorage.setItem("X-Back",window.location.href),l.Z.push({path:"/login"}),t.data}return t.data}),(function(t){o.destroy(e);var s=t.response;if(s){var n=s.status,a=null;switch(n){case 400:a="请求参数错误";break;case 401:a="未授权或token过期,请登录";break;case 413:a="资源大小超过限制";break;case 403:a="跨域访问已被拒绝";break;case 404:a="请求地址出错: ".concat(s.config.url);break;case 408:a="请求超时";break;case 405:a="请求方法不正确";break;case 500:a="服务器内部错误";break;case 501:a="服务器未实现";break;case 502:a="网关错误";break;case 503:a="该服务不可用";break;case 504:a="网关超时";break;case 505:a="HTTP版本不受支持";break;default:a="未知错误status:".concat(n)}return console.log(a),Promise.reject(t)}return Promise.reject(t)}))}},{key:"request",value:function(t){var e=a.Z.create(),o=Object.assign({},t,this.getInsideConfig());return this.interceptors(e,o.url),e(o)}}]),t}();const d=new u;var _=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/network/all",params:t})},p=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/network/info",params:t})},h=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/network/create",data:t,method:"PUT"})},m=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/network/maintenance",data:t,method:"POST"})},f=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/network/register",data:t,method:"POST"})},g=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/network/destroy",data:t,method:"DELETE"})},w=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/host/all",params:t})},v=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/host/info",params:t})},y=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/host/create",data:t,method:"PUT"})},b=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/host/maintenance",data:t,method:"POST"})},k=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/host/register",data:t,method:"POST"})},I=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/host/destroy",data:t,method:"DELETE"})},x=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/storage/all",params:t})},C=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/storage/info",params:t})},$=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/storage/create",data:t,method:"PUT"})},S=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/storage/maintenance",data:t,method:"POST"})},Z=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/storage/register",data:t,method:"POST"})},T=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/storage/destroy",data:t,method:"DELETE"})},z=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/template/all",params:t})},N=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/template/info",params:t})},V=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/template/create",data:t,method:"PUT"})},R=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/template/volume/create",data:t,method:"PUT"})},q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/template/download",data:t,method:"POST"})},B=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/template/destroy",data:t,method:"DELETE"})},P=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/snapshot/all",params:t})},G=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/snapshot/info",params:t})},U=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/snapshot/create",data:t,method:"PUT"})},M=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/snapshot/destroy",data:t,method:"DELETE"})},D=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/volume/all",params:t})},F=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/volume/not/attach/all",params:t})},E=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/volume/info",params:t})},O=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/volume/create",data:t,method:"PUT"})},A=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/volume/migrate",data:t,method:"PUT"})},L=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/volume/resize",data:t,method:"POST"})},j=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/volume/clone",data:t,method:"PUT"})},H=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/volume/destroy",data:t,method:"DELETE"})},X=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/volume/destroy/batch",data:t,method:"DELETE"})},Q=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/scheme/all",params:t})},K=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/scheme/info",params:t})},J=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/scheme/create",data:t,method:"PUT"})},W=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/scheme/modify",data:t,method:"POST"})},Y=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/scheme/destroy",data:t,method:"DELETE"})},tt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/guest/info",params:t})},et=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/guest/vnc/password",params:t})},ot=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/guest/volume",params:t})},st=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/guest/network",params:t})},nt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/guest/all",params:t})},at=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/guest/system",params:t})},rt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/guest/user",params:t})},it=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/destroy",data:t,method:"DELETE"})},lt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/create",data:t,method:"PUT"})},ct=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/reinstall",data:t,method:"POST"})},ut=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/start",data:t,method:"POST"})},dt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/migrate",data:t,method:"POST"})},_t=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/start/batch",data:t,method:"POST"})},pt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/shutdown",data:t,method:"POST"})},ht=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/shutdown/batch",data:t,method:"POST"})},mt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/reboot",data:t,method:"POST"})},ft=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/modify",data:t,method:"POST"})},gt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/cd/attach",data:t,method:"POST"})},wt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/cd/detach",data:t,method:"POST"})},vt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/disk/attach",data:t,method:"POST"})},yt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/disk/detach",data:t,method:"POST"})},bt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/network/attach",data:t,method:"POST"})},kt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/guest/network/detach",data:t,method:"POST"})},It=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/user/oauth2/login",data:t,method:"POST"})},xt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/user/login",data:t,method:"POST"})},Ct=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/user/list",data:t,method:"GET"})},$t=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/user/register",data:t,method:"PUT"})},St=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/user/state/update",data:t,method:"POST"})},Zt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/user/password/reset",data:t,method:"POST"})},Tt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/user/password/modify",data:t,method:"POST"})},zt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/user/destroy",data:t,method:"DELETE"})},Nt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/user/login/signature",params:t})},Vt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/user/signature",params:t})},Rt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/config",data:t,method:"GET"})},qt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/group/all",params:t})},Bt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/group/create",data:t,method:"PUT"})},Pt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/group/update",data:t,method:"POST"})},Gt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"/api/group/info",params:t})},Ut=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.request({url:"api/group/destroy",data:t,method:"DELETE"})}},67986:t=>{t.exports={BASEURL:"."}},73412:(t,e,o)=>{"use strict";o.d(e,{Z:()=>c});o(57658),o(34553),o(40561),o(89554),o(41539),o(54747);var s=o(45226),n=o(27594),a=o(54503),r=(o(83710),o(38862),o(32564),o(23157),o(29076)),i=function(){function t(){(0,s.Z)(this,t),(0,a.Z)(this,"notify_list",[])}return(0,n.Z)(t,[{key:"init",value:function(e){var o=this;if(!t.instance){var s="ws://".concat(window.location.host,"/api/ws/");console.log(new Date,"开始连接通信服务器..."),t.instance=new WebSocket(s),t.instance.onopen=function(){console.log(new Date,"通信服务器连接成功,发送认证信息");var e={command:0,data:localStorage.getItem("X-Token")};t.instance.send(JSON.stringify(e))},t.instance.onerror=function(){console.log(new Date,"出现错误,断开链接,重新开始连接..."),t.instance.close(),t.instance=void 0,setTimeout((function(){o.init(e)}),3e3)},t.instance.onclose=function(){console.log(new Date,"断开链接,等待链接..."),t.instance=void 0,setTimeout((function(){o.init(e)}),3e3)}}t.instance.onmessage=function(t){if(t.data){var o=JSON.parse(t.data);if(1==o.command)console.log(new Date,"WebSocket 登录认证成功.");else if(2==o.command){console.log(new Date,"WebSocket 登录认证Token错误.");var s=window.location.hash.toLowerCase();s&&!s.startsWith("#/login")&&localStorage.setItem("X-Back",window.location.href),r.Z.push({path:"/login"})}else 3==o.command&&e.handle_notify_message(o.data)}}}}]),t}();(0,a.Z)(i,"instance",void 0);const l=new i,c={data:function(){return{}},methods:{init_notify:function(){l.init(this)},subscribe_notify:function(t,e){l.notify_list.push({k:t,n:e})},unsubscribe_notify:function(t){var e=l.notify_list.findIndex((function(e){return e.k===t}));e>=0&&l.notify_list.splice(e,1)},handle_notify_message:function(t){l.notify_list.forEach((function(e){e.n(t)}))}}}},42173:(t,e,o)=>{"use strict";o.d(e,{Z:()=>s});o(56977),o(83710),o(9653),o(74916),o(77601),o(15306),o(24603),o(28450),o(88386),o(39714),o(83650);const s={methods:{get_guest_status:function(t){switch(t.status){case 0:return"正在创建";case 1:return"正在启动";case 2:return"正在运行";case 3:return"正在停止";case 4:return"已停止";case 5:return"重启中";case 6:return"虚拟机错误";case 7:return"正在迁移";default:return"未知状态[".concat(t.status,"]")}},get_host_status:function(t){switch(t.status){case 0:return"正在创建";case 1:return"在线";case 2:return"离线";case 3:return"正在维护";case 4:return"主机错误";default:return"未知状态[".concat(t.status,"]")}},get_network_status:function(t){switch(t.status){case 1:return"正在注册";case 2:return"已就绪";case 3:return"正在维护";case 4:return"正在销毁";case 5:return"网络错误";default:return"未知状态[".concat(t.status,"]")}},get_network_type:function(t){switch(t.type){case 0:return"基础网络";case 1:return"Vlan网络";default:return"未知类型[".concat(t.type,"]")}},get_snapshot_status:function(t){switch(t.status){case 0:return"正在创建";case 1:return"已就绪";case 2:return"快照错误";case 3:return"正在删除";default:return"未知状态[".concat(t.status,"]")}},get_storage_status:function(t){switch(t.status){case 0:return"正在创建";case 1:return"已就绪";case 2:return"正在维护";case 3:return"正在销毁";case 4:return"存储池错误";default:return"未知状态[".concat(t.status,"]")}},get_memory_display_size:function(t){return t>=1048576?(t/1048576).toFixed(2)+" GB":t>=1024?(t/1024).toFixed(2)+" MB":t+" KB"},get_template_status:function(t){switch(t.status){case 0:return"正在创建";case 1:return"下载中";case 2:return"已就绪";case 3:return"模版错误";case 4:return"正在销毁";default:return"未知状态[".concat(t.status,"]")}},get_template_type:function(t){switch(t.templateType){case 0:return"IOS 文件";case 1:return"系统模版";case 2:return"用户模版";default:return"未知模版[".concat(t.templateType,"]")}},get_volume_status:function(t){switch(t.status){case 0:return"正在创建";case 1:return"已就绪";case 2:return"正在挂载";case 3:return"正在卸载";case 4:return"正在克隆";case 5:return"创建模版";case 6:return"创建快照";case 7:return"正在迁移";case 8:return"正在扩容";case 9:return"正在销毁";case 10:return"磁盘错误";default:return"未知状态[".concat(t.status,"]")}},get_volume_display_size:function(t){return t>=1099511627776?(t/1099511627776).toFixed(2)+" TB":t>=1073741824?(t/1073741824).toFixed(2)+" GB":t>=1048576?(t/1048576).toFixed(2)+" MB":t>=1024?(t/1024).toFixed(2)+" KB":t+" bytes"},parse_date:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"yyyy-MM-dd hh:mm:ss";if(!t)return"";t=new Date(Number(t));var o={"M+":t.getMonth()+1,"d+":t.getDate(),"h+":t.getHours(),"m+":t.getMinutes(),"s+":t.getSeconds(),"q+":Math.floor((t.getMonth()+3)/3),S:t.getMilliseconds()};for(var s in/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(t.getFullYear()+"").substr(4-RegExp.$1.length))),o)new RegExp("("+s+")").test(e)&&(e=e.replace(RegExp.$1,1===RegExp.$1.length?o[s]:("00"+o[s]).substr((""+o[s]).length)));return e}}}},19013:(t,e,o)=>{"use strict";o(66992),o(88674),o(19601),o(17727);var s=o(27195),n=function(){var t=this,e=t._self._c;return e("div",{attrs:{id:"app"}},[t.isFullScreen?t._e():e("HeadViewVue"),e("el-container",[t.isFullScreen?t._e():e("NavViewVue"),e("el-main",{staticClass:"main-container",class:t.isFullScreen?"full_screen_class":""},[e("router-view")],1)],1)],1)},a=[],r=function(){var t=this,e=t._self._c;return e("div",{staticClass:"layout-left",attrs:{id:"LayoutLeft"}},[e("div",{staticClass:"shrink",on:{click:t.shrinkMenu}},[e("i",{class:t.isCollapse?"el-icon-s-unfold":"el-icon-s-fold"})]),e("el-menu",{staticClass:"el-menu-vertical-demo",attrs:{collapse:t.isCollapse,"default-active":this.$route.path,router:"","collapse-transition":!1,"background-color":"rgb(52, 73, 94)","text-color":"#fff","active-text-color":"#ffd04b"}},t._l(t.nav_menu_data,(function(o,s){return e("el-menu-item",{key:s,attrs:{index:o.path}},[e("i",{class:o.icon}),e("span",{attrs:{slot:"title"},slot:"title"},[t._v(t._s(o.title))])])})),1)],1)},i=[];const l={data:function(){return{path:"",isCollapse:!0,nav_menu_data:[{path:"/",title:"主页",icon:"el-icon-house"},{path:"/Guest",title:"虚拟机管理",icon:"el-icon-s-platform"},{path:"/Host",title:"主机管理",icon:"el-icon-monitor"},{path:"/Network",title:"网络管理",icon:"el-icon-platform-eleme"},{path:"/Storage",title:"存储池管理",icon:"el-icon-coin"},{path:"/Template",title:"模版管理",icon:"el-icon-price-tag"},{path:"/Scheme",title:"计算方案",icon:"el-icon-cpu"},{path:"/Volume",title:"磁盘管理",icon:"el-icon-bank-card"},{path:"/Snapshot",title:"快照管理",icon:"el-icon-copy-document"},{path:"/Group",title:"群组管理",icon:"el-icon-folder"},{path:"/User",title:"用户管理",icon:"el-icon-s-custom"}]}},created:function(){this.isCollapse="0"!==localStorage.getItem("menu_is_collapse")},methods:{shrinkMenu:function(){this.isCollapse=!this.isCollapse,localStorage.setItem("menu_is_collapse",this.isCollapse?"1":"0")}}},c=l;var u=o(1001),d=(0,u.Z)(c,r,i,!1,null,"4d6070e6",null);const _=d.exports;var p=function(){var t=this,e=t._self._c;return e("el-header",[e("div",{staticStyle:{float:"left","background-color":"#34495e",height:"100%"}},[e("img",{staticStyle:{width:"32px",height:"32px","margin-left":"10px","margin-top":"15px"},attrs:{src:o(66949)}})]),e("div",{staticStyle:{float:"left","background-color":"#34495e",height:"100%"}},[e("h5",{staticStyle:{"font-size":"18px",margin:"20px 0px 20px 10px",color:"white"}},[t._v("KVM Cloud")])]),e("el-menu",{staticClass:"headerMenu",attrs:{mode:"horizontal","background-color":"#34495e","text-color":"#fff","active-text-color":"#ffd04b"},on:{select:t.handleSelect}},[e("el-menu-item",{attrs:{index:"quit"}},[t._v("退出")]),e("el-menu-item",{attrs:{index:"password"}},[t._v("修改密码")])],1),e("el-dialog",{attrs:{title:"修改密码",visible:t.update_password_dialog_visible,center:"",width:"400px","close-on-click-modal":!1,"close-on-press-escape":!1},on:{"update:visible":function(e){t.update_password_dialog_visible=e}}},[e("el-form",{attrs:{model:t.update_password,"label-position":"right","label-width":"80px"}},[e("el-form-item",{attrs:{label:"旧密码",prop:"oldPassword"}},[e("el-input",{attrs:{type:"password","show-password":!0},model:{value:t.update_password.oldPassword,callback:function(e){t.$set(t.update_password,"oldPassword",e)},expression:"update_password.oldPassword"}})],1),e("el-form-item",{attrs:{label:"新密码",prop:"newPassword"}},[e("el-input",{attrs:{type:"password","show-password":!0},model:{value:t.update_password.newPassword,callback:function(e){t.$set(t.update_password,"newPassword",e)},expression:"update_password.newPassword"}})],1),e("el-form-item",{attrs:{label:"确认密码",prop:"confirmPassword"}},[e("el-input",{attrs:{type:"password","show-password":!0},model:{value:t.update_password.confirmPassword,callback:function(e){t.$set(t.update_password,"confirmPassword",e)},expression:"update_password.confirmPassword"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.update_user_password_click}},[t._v("确 定")]),e("el-button",{on:{click:function(e){t.update_password_dialog_visible=!1}}},[t._v("取 消")])],1)],1)],1),e("el-dialog",{attrs:{title:"联系&支持",visible:t.support_dialog_visible,center:"",width:"450px"},on:{"update:visible":function(e){t.support_dialog_visible=e}}},[e("el-tabs",{model:{value:t.supportActiveName,callback:function(e){t.supportActiveName=e},expression:"supportActiveName"}},[e("el-tab-pane",{attrs:{label:"联系作者",name:"concat"}},[e("div",{staticStyle:{"font-size":"15px","line-height":"30px"}},[e("div",[t._v("    本产品开源免费,遵从Apache2.0协议,个人或企业内部可自由的接入和使用,并且将持续提供免费的社区技术支持。")]),e("br"),e("div",[t._v("    为了保证性能,请使用SSD创建NFS存储。数据无价,做删除操作前务必三思,建议对核数据采用异备。")]),e("br"),e("div",[t._v("    如果您在使用中遇到问题或相关建议,请提交issue。如遇紧急问题也可添加作者QQ(153391689)寻求帮助。项目会在适当的时期启动交流群,如有相关需求可发送邮件至153391689@qq.com")]),e("br"),e("div",[t._v("    开源不易,如果KVM Cloud对您带来了帮助,请给作者买杯咖啡吧 :)")]),e("br")])]),e("el-tab-pane",{attrs:{label:"微信捐赠",name:"wx"}},[e("div",{staticClass:"wx"})]),e("el-tab-pane",{attrs:{label:"支付宝捐赠",name:"zfb"}},[e("div",{staticClass:"zfb"})])],1)],1)],1)},h=[],m=(o(57658),o(29924));const f={data:function(){return{update_password_dialog_visible:!1,support_dialog_visible:!1,supportActiveName:"concat",update_password:{oldPassword:"",newPassword:"",confirmPassword:"",nonce:""}}},methods:{handleSelect:function(t){var e=this;switch(t){case"support":this.support_dialog_visible=!0;break;case"password":this.update_password.oldPassword="",this.update_password.newPassword="",this.update_password.confirmPassword="",this.update_password.nonce="",this.update_password_dialog_visible=!0;break;case"quit":this.$confirm("退出登录, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){localStorage.removeItem("X-Token"),e.$router.push({path:"/Login"})}))["catch"]((function(){}));break}},update_user_password_click:function(){var t=this;this.update_password.newPassword==this.update_password.confirmPassword?(0,m.c3)().then((function(e){if(0===e.code){var o=window.sha256_digest(window.sha256_digest(t.update_password.oldPassword+":"+e.data.signature)+":"+e.data.nonce),s=e.data.nonce,n=window.sha256_digest(t.update_password.newPassword+":"+e.data.signature),a={oldPassword:o,newPassword:n,nonce:s};(0,m.Mj)(a).then((function(e){0!==e.code?t.$notify.error({title:"错误",message:"修改密码失败:".concat(e.message)}):t.update_password_dialog_visible=!1}))}else t.$notify.error({title:"错误",message:"修改密码失败:".concat(e.message)})})):this.$notify.error({title:"错误",duration:3e3,message:"新密码与旧密码不一致"})}}},g=f;var w=(0,u.Z)(g,p,h,!1,null,"c50e8612",null);const v=w.exports,y={components:{NavViewVue:_,HeadViewVue:v},provide:function(){var t=this;return{check_full_screen:function(e){t.isFullScreen=e}}},data:function(){return{isFullScreen:!1}}},b=y;var k=(0,u.Z)(b,n,a,!1,null,null,null);const I=k.exports;var x=o(29076),C=o(90408);s["default"].use(C.ZP);const $=new C.ZP.Store({state:{},getters:{},mutations:{},actions:{},modules:{}});var S=o(85114),Z=o.n(S);s["default"].use(Z()),s["default"].config.productionTip=!1,s["default"].prototype.$websocket=void 0,new s["default"]({router:x.Z,store:$,render:function(t){return t(I)}}).$mount("#app")},29076:(t,e,o)=>{"use strict";o.d(e,{Z:()=>ao});var s=o(27195),n=o(42241),a=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"}],staticClass:"box-card"},[e("el-row",{staticClass:"clearfix",staticStyle:{height:"20px"},attrs:{slot:"header"},slot:"header"},[e("el-button",{staticStyle:{float:"left",padding:"3px 0"},attrs:{type:"text"},on:{click:t.show_create_network}},[t._v("创建网络")])],1),e("el-row",[e("el-table",{staticStyle:{width:"100%"},attrs:{"v-loading":t.data_loading,data:t.networks}},[e("el-table-column",{attrs:{label:"ID",prop:"networkId",width:"80"}}),e("el-table-column",{attrs:{label:"名称",prop:"name",width:"120","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"桥接网卡",prop:"bridge",width:"120"}}),e("el-table-column",{attrs:{label:"子网",prop:"subnet",width:"150"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(t._s(e.row.subnet)+"/"+t._s(t.netmask2CIDR(e.row.mask)))]}}])}),e("el-table-column",{attrs:{label:"网络类型",prop:"type",width:"100"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",[t._v(t._s(t.get_network_type(o.row)))])]}}])}),e("el-table-column",{attrs:{label:"状态",prop:"status",width:"100"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",{attrs:{type:2===o.row.status?"success":"danger"}},[t._v(t._s(t.get_network_status(o.row)))])]}}])}),e("el-table-column",{attrs:{label:"操作","min-width":"380"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"",size:"mini"},on:{click:function(e){return t.show_network_info_click(o.row)}}},[t._v("网络详情")]),e("el-button",{attrs:{type:"success",size:"mini"},on:{click:function(e){return t.register_network(o.row)}}},[t._v("重新注册")]),3!==o.row.status?e("el-button",{attrs:{type:"warning",size:"mini"},on:{click:function(e){return t.pasue_network(o.row)}}},[t._v("开始维护")]):t._e(),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_network(o.row)}}},[t._v("销毁网络")])]}}])})],1)],1)],1),e("NetworkInfoComponent",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],ref:"NetworkInfoComponentRef",on:{onNetworkUpdate:t.update_network_info,back:function(e){return t.show_network_list()}}}),e("CreateNetworkComponent",{directives:[{name:"show",rawName:"v-show",value:2===this.show_type,expression:"this.show_type === 2"}],ref:"CreateNetworkComponentRef",on:{onNetworkUpdate:t.update_network_info,back:function(e){return t.show_network_list()}}})],1)],1)],1)},r=[],i=o(51907),l=o(85617),c=(o(68309),o(41539),o(69600),o(21249),o(9653),o(96647),o(83710),o(39714),o(69826),o(34553),o(57658),o(40561),o(42173)),u=o(29924),d=function(){var t=this,e=t._self._c;return e("div",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"},{name:"loading",rawName:"v-loading",value:t.network_loading,expression:"network_loading"}],staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{attrs:{content:"网络详情"},on:{back:t.on_back_click}})],1),e("el-row",{staticStyle:{"text-align":"left",margin:"20px 0"}},[e("el-button",{attrs:{type:"success",size:"mini"},on:{click:function(e){return t.register_network(t.show_network)}}},[t._v("重新注册")]),3!==t.show_network.status?e("el-button",{attrs:{type:"warning",size:"mini"},on:{click:function(e){return t.pasue_network(t.show_network)}}},[t._v("开始维护")]):t._e(),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_network(t.show_network)}}},[t._v("销毁网络")])],1),e("el-row",[e("el-descriptions",{attrs:{column:2,size:"medium",border:""}},[e("el-descriptions-item",{attrs:{label:"ID"}},[t._v(t._s(t.show_network.networkId))]),e("el-descriptions-item",{attrs:{label:"名称"}},[t._v(t._s(t.show_network.name))]),e("el-descriptions-item",{attrs:{label:"起始IP"}},[t._v(t._s(t.show_network.startIp))]),e("el-descriptions-item",{attrs:{label:"结束IP"}},[t._v(t._s(t.show_network.endIp))]),e("el-descriptions-item",{attrs:{label:"网关地址"}},[t._v(t._s(t.show_network.gateway))]),e("el-descriptions-item",{attrs:{label:"子网掩码"}},[t._v(t._s(t.show_network.mask))]),e("el-descriptions-item",{attrs:{label:"子网地址"}},[t._v(t._s(t.show_network.subnet))]),e("el-descriptions-item",{attrs:{label:"广播地址"}},[t._v(t._s(t.show_network.broadcast))]),e("el-descriptions-item",{attrs:{label:"DNS"}},[t._v(t._s(t.show_network.dns))]),e("el-descriptions-item",{attrs:{label:"桥接网卡"}},[t._v(t._s(t.show_network.bridge))]),e("el-descriptions-item",{attrs:{label:"网络类型"}},[t._v(t._s(t.get_network_type(t.show_network)))]),1===t.show_network.type?e("el-descriptions-item",{attrs:{label:"VLAN ID"}},[t._v(t._s(t.show_network.vlanId))]):t._e(),1===t.show_network.type?e("el-descriptions-item",{attrs:{label:"基础网络"}},[e("el-button",{attrs:{type:"text"}},[t._v(t._s(t.get_parent_network(t.show_network).name))])],1):t._e(),e("el-descriptions-item",{attrs:{label:"网络状态"}},[e("el-tag",{attrs:{type:2===t.show_network.status?"success":"danger"}},[t._v(t._s(t.get_network_status(t.show_network)))])],1)],1),e("br"),e("el-tabs",{attrs:{type:"border-card"}},[e("el-tab-pane",{attrs:{label:"系统组件"}},[e("el-table",{staticStyle:{width:"100%"},attrs:{data:t.system_guests}},[e("el-table-column",{attrs:{label:"ID",prop:"guestId",width:"80"}}),e("el-table-column",{attrs:{label:"实例名",prop:"name",width:"200"}}),e("el-table-column",{attrs:{label:"标签",prop:"description",width:"200"}}),e("el-table-column",{attrs:{label:"IP地址",prop:"guestIp",width:"150"}}),e("el-table-column",{attrs:{label:"状态",prop:"status",width:"100"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",{attrs:{type:2===o.row.status?"success":"danger"}},[t._v(t._s(t.get_guest_status(o.row)))])]}}])}),e("el-table-column",{attrs:{label:"操作"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"text"},on:{click:function(e){return t.go_guest_info(o.row.guestId)}}},[t._v("详情")])]}}])})],1)],1)],1)],1)],1),e("GuestInfoComponent",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],ref:"GuestInfoComponentRef",on:{back:function(e){t.show_type=0},onGuestUpdate:t.update_guest_info}})],1)},_=[],p=o(73412),h=o(5558);const m={name:"NetworkInfoComponent",data:function(){return{network_loading:!1,system_guests:[],networks:[],show_type:0,show_network:{networkId:0,name:"",startIp:"",endIp:"",gateway:"",mask:"",subnet:"",broadcast:"",bridge:"",dns:"",type:0,vlanId:100,basicNetworkId:""}}},components:{GuestInfoComponent:h.Z},mixins:[p.Z,c.Z],created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},methods:{on_back_click:function(){this.$emit("back")},on_notify_update_networkt_info:function(t){this.refresh_network(t),this.$emit("onNetworkUpdate",t)},refresh_network:function(t){this.show_network.networkId==t.networkId&&(this.show_network=t)},go_guest_info:function(t){this.show_type=1,this.$refs.GuestInfoComponentRef.initGuestId(t)},init_network:function(t,e){var o=this;return(0,l.Z)((0,i.Z)().mark((function s(){return(0,i.Z)().wrap((function(s){while(1)switch(s.prev=s.next){case 0:return o.show_type=0,o.networks=t,o.show_network=e,o.system_guests=[],s.next=6,o.load_system_guest(e);case 6:case"end":return s.stop()}}),s)})))()},init:function(t){var e=this;return(0,l.Z)((0,i.Z)().mark((function o(){return(0,i.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.show_type=0,e.network_loading=!0,o.next=4,(0,u.yj)({networkId:t}).then((function(t){console.log(t),0===t.code?e.init_network(t.data):e.$alert("获取网络信息失败:".concat(t.message),"提示",{dangerouslyUseHTMLString:!0,confirmButtonText:"返回",type:"error"}).then((function(){e.on_back_click()}))["catch"]((function(){e.on_back_click()}))}))["finally"]((function(){e.host_loading=!1}));case 4:case"end":return o.stop()}}),o)})))()},load_system_guest:function(t){var e=this;return(0,l.Z)((0,i.Z)().mark((function o(){return(0,i.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:return e.system_guests=[],e.network_loading=!0,o.next=4,(0,u.IC)({networkId:t.networkId}).then((function(t){0===t.code&&(e.system_guests=t.data)}))["finally"]((function(){e.network_loading=!1}));case 4:case"end":return o.stop()}}),o)})))()},get_parent_network:function(t){var e=this.networks.find((function(e){return e.networkId===t.basicNetworkId}));return e||{name:"-"}},delete_guest:function(t){var e=this.system_guests.findIndex((function(e){return e.guestId===t}));e>=0&&this.system_guests.splice(e,1)},update_guest_info:function(t){if(0===t.type&&t.networkId===this.show_network.networkId){var e=this.system_guests.findIndex((function(e){return e.guestId===t.guestId}));e>=0?this.$set(this.system_guests,e,t):this.system_guests.push(t),this.$forceUpdate()}},pasue_network:function(t){var e=this;this.$confirm("维护网络, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.pz)({networkId:t.networkId}).then((function(t){0===t.code?e.on_notify_update_networkt_info(t.data):e.$notify.error({title:"错误",message:"暂停网络失败:".concat(t.message)})}))}))["catch"]((function(){}))},register_network:function(t){var e=this;this.$confirm("重新注册网络, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.fj)({networkId:t.networkId}).then((function(t){0===t.code?e.on_notify_update_networkt_info(t.data):e.$notify.error({title:"错误",message:"注册网络失败:".concat(t.message)})}))}))["catch"]((function(){}))},destroy_network:function(t){var e=this;this.$confirm("销毁网络, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.s4)({networkId:t.networkId}).then((function(t){0===t.code?e.on_back_click():e.$notify.error({title:"错误",message:"删除网络失败:".concat(t.message)})}))}))["catch"]((function(){}))},dispatch_notify_message:function(t){var e=this;3===t.type&&this.show_network.networkId===t.id?(0,u.yj)({networkId:t.id}).then((function(t){0==t.code?e.refresh_network(t.data):2000001==t.code&&e.on_back_click()})):1===t.type&&(0,u.c$)({guestId:t.id}).then((function(o){0==o.code?e.update_guest_info(o.data):2000001==o.code&&e.delete_guest(t.id)}))}}},f=m;var g=o(1001),w=(0,g.Z)(f,d,_,!1,null,null,null);const v=w.exports;var y=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"创建网络"},on:{back:function(e){return t.on_back_click()}}})],1),e("el-row",[e("el-form",{ref:"createForm",staticClass:"demo-ruleForm",attrs:{model:t.create_network,"label-width":"100px"}},[e("el-row",{attrs:{gutter:24}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"网络名称",prop:"name"}},[e("el-input",{model:{value:t.create_network.name,callback:function(e){t.$set(t.create_network,"name",e)},expression:"create_network.name"}})],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"网络类型",prop:"type"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.create_network.type,callback:function(e){t.$set(t.create_network,"type",e)},expression:"create_network.type"}},[e("el-option",{attrs:{label:"基础网络",value:0}}),e("el-option",{attrs:{label:"Vlan网络(只允许OpenSitch方式)",value:1}})],1)],1)],1)],1),e("el-row",{attrs:{gutter:24}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"起始IP",prop:"startIp"}},[e("el-input",{model:{value:t.create_network.startIp,callback:function(e){t.$set(t.create_network,"startIp",e)},expression:"create_network.startIp"}})],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"结束IP",prop:"endIp"}},[e("el-input",{model:{value:t.create_network.endIp,callback:function(e){t.$set(t.create_network,"endIp",e)},expression:"create_network.endIp"}})],1)],1)],1),e("el-row",{attrs:{gutter:24}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"网关地址",prop:"gateway"}},[e("el-input",{model:{value:t.create_network.gateway,callback:function(e){t.$set(t.create_network,"gateway",e)},expression:"create_network.gateway"}})],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"子网掩码",prop:"mask"}},[e("el-input",{model:{value:t.create_network.mask,callback:function(e){t.$set(t.create_network,"mask",e)},expression:"create_network.mask"}})],1)],1)],1),e("el-row",{attrs:{gutter:24}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"子网地址",prop:"subnet"}},[e("el-input",{model:{value:t.create_network.subnet,callback:function(e){t.$set(t.create_network,"subnet",e)},expression:"create_network.subnet"}})],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"广播地址",prop:"broadcast"}},[e("el-input",{model:{value:t.create_network.broadcast,callback:function(e){t.$set(t.create_network,"broadcast",e)},expression:"create_network.broadcast"}})],1)],1)],1),e("el-row",{attrs:{gutter:24}},[e("el-col",{attrs:{span:24}},[e("el-form-item",{attrs:{label:"DNS",prop:"dns"}},[e("el-input",{model:{value:t.create_network.dns,callback:function(e){t.$set(t.create_network,"dns",e)},expression:"create_network.dns"}})],1)],1)],1),e("el-row",{attrs:{gutter:24}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"桥接网卡",prop:"bridge"}},[e("el-input",{model:{value:t.create_network.bridge,callback:function(e){t.$set(t.create_network,"bridge",e)},expression:"create_network.bridge"}})],1)],1),e("el-col",{attrs:{span:12}},[1===t.create_network.type?e("div",{staticStyle:{color:"red","font-size":"12px","line-height":"40px"}},[t._v("Vlan为测试状态,只支持Openswitch网络,创建的桥接网卡必须为OVS桥接")]):t._e()])],1),1===t.create_network.type?e("el-row",{attrs:{gutter:24}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"VLAN ID",prop:"vlanId"}},[e("el-input",{model:{value:t.create_network.vlanId,callback:function(e){t.$set(t.create_network,"vlanId",e)},expression:"create_network.vlanId"}})],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"基础网络",prop:"basicNetworkId"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择基础网络"},model:{value:t.create_network.basicNetworkId,callback:function(e){t.$set(t.create_network,"basicNetworkId",e)},expression:"create_network.basicNetworkId"}},t._l(t.networks,(function(t){return e("el-option",{directives:[{name:"show",rawName:"v-show",value:0===t.type,expression:"item.type === 0"}],key:t.networkId,attrs:{label:t.name,value:t.networkId}})})),1)],1)],1)],1):t._e(),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.create_network_click}},[t._v("立即创建")]),e("el-button",{on:{click:t.on_back_click}},[t._v("取消")])],1)],1)],1)],1)},b=[];const k={data:function(){return{networks:[],create_network:{name:"",startIp:"",endIp:"",gateway:"",mask:"",subnet:"",broadcast:"",bridge:"",dns:"",type:0,vlanId:100,basicNetworkId:""}}},methods:{on_back_click:function(){this.$emit("back")},on_notify_update_network:function(t){this.$emit("onNetworkUpdate",t)},init:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.$refs["createForm"]&&t.$refs["createForm"].resetFields(),e.next=3,(0,u.jR)().then((function(e){0==e.code&&(t.networks=e.data)}))["finally"]((function(){t.data_loading=!1}));case 3:case"end":return e.stop()}}),e)})))()},create_network_click:function(){var t=this;0===this.create_network.type&&(this.create_network.vlanId=0,this.create_network.basicNetworkId=0),(0,u.XY)(this.create_network).then((function(e){0===e.code?(t.on_notify_update_network(e.data),t.on_back_click()):t.$notify.error({title:"错误",message:"创建网络失败:".concat(e.message)})}))}}},I=k;var x=(0,g.Z)(I,y,b,!1,null,null,null);const C=x.exports,$={name:"NetworkView",components:{NetworkInfoComponent:v,CreateNetworkComponent:C},data:function(){return{data_loading:!1,show_type:-1,networks:[]}},mounted:function(){this.show_type=0,this.init_view()},created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},mixins:[p.Z,c.Z],methods:{init_view:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.data_loading=!0,e.next=3,(0,u.jR)().then((function(e){0==e.code&&(t.networks=e.data)}))["finally"]((function(){t.data_loading=!1}));case 3:case"end":return e.stop()}}),e)})))()},netmask2CIDR:function(t){return t.split(".").map(Number).map((function(t){return(t>>>0).toString(2)})).join("").split("1").length-1},get_parent_network:function(t){var e=this.networks.find((function(e){return e.networkId===t.basicNetworkId}));return e||{name:"-"}},update_network_info:function(t){var e=this.networks.findIndex((function(e){return e.networkId===t.networkId}));e>=0?this.$set(this.networks,e,t):this.networks.push(t),this.$refs.NetworkInfoComponentRef.refresh_network(t)},dispatch_notify_message:function(t){var e=this;3===t.type&&(0,u.yj)({networkId:t.id}).then((function(o){if(0==o.code)e.update_network_info(o.data);else if(1000001==o.code){var s=e.networks.findIndex((function(e){return e.networkId===t.id}));s>=0&&e.networks.splice(s,1)}e.$forceUpdate()}))},show_network_list:function(){this.show_type=0},show_create_network:function(){this.$refs.CreateNetworkComponentRef.init(),this.show_type=2},show_network_info_click:function(t){this.$refs.NetworkInfoComponentRef.init_network(this.networks,t),this.show_type=1},pasue_network:function(t){var e=this;this.$confirm("维护网络, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.pz)({networkId:t.networkId}).then((function(t){0===t.code?e.update_network_info(t.data):e.$notify.error({title:"错误",message:"暂停网络失败:".concat(t.message)})}))}))["catch"]((function(){}))},register_network:function(t){var e=this;this.$confirm("重新注册网络, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.fj)({networkId:t.networkId}).then((function(t){0===t.code?e.update_network_info(t.data):e.$notify.error({title:"错误",message:"注册网络失败:".concat(t.message)})}))}))["catch"]((function(){}))},destroy_network:function(t){var e=this;this.$confirm("销毁网络, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.s4)({networkId:t.networkId}).then((function(t){0===t.code?(e.update_network_info(t.data),e.show_type=0):e.$notify.error({title:"错误",message:"删除网络失败:".concat(t.message)})}))}))["catch"]((function(){}))}}},S=$;var Z=(0,g.Z)(S,a,r,!1,null,"4c1fe47a",null);const T=Z.exports;var z=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"}],staticClass:"box-card"},[e("el-row",{staticClass:"clearfix",staticStyle:{height:"20px"},attrs:{slot:"header"},slot:"header"},[e("el-button",{staticStyle:{float:"left",padding:"3px 0"},attrs:{type:"text"},on:{click:t.show_create_host}},[t._v("创建主机")])],1),e("el-row",[e("el-table",{staticStyle:{width:"100%"},attrs:{"v-loading":t.data_loading,data:t.hosts}},[e("el-table-column",{attrs:{label:"ID",prop:"hostId",width:"80"}}),e("el-table-column",{attrs:{label:"名称",prop:"displayName","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"主机IP",prop:"hostIp",width:"120"}}),e("el-table-column",{attrs:{label:"CPU",prop:"hostIp",width:"120"},scopedSlots:t._u([{key:"default",fn:function(t){return[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"已使用:"+t.row.allocationCpu+"核 / 总共:"+t.row.totalCpu+"核",placement:"top"}},[e("el-progress",{attrs:{color:"#67C23A",percentage:t.row.totalCpu<=0?0:Math.floor(100*t.row.allocationCpu/t.row.totalCpu)}})],1)]}}])}),e("el-table-column",{attrs:{label:"内存",prop:"hostIp",width:"120"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"已使用:"+t.get_memory_display_size(o.row.allocationMemory)+" / 总共:"+t.get_memory_display_size(o.row.totalMemory),placement:"top"}},[e("el-progress",{attrs:{color:"#67C23A",percentage:o.row.totalMemory<=0?0:Math.floor(100*o.row.allocationMemory/o.row.totalMemory)}})],1)]}}])}),e("el-table-column",{attrs:{label:"状态",prop:"status",width:"100"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",{attrs:{type:1===o.row.status?"success":"danger"}},[t._v(t._s(t.get_host_status(o.row)))])]}}])}),e("el-table-column",{attrs:{label:"操作",width:"400"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"",size:"mini"},on:{click:function(e){return t.show_host_info_click(o.row)}}},[t._v("主机详情")]),e("el-button",{attrs:{type:"success",size:"mini"},on:{click:function(e){return t.register_host(o.row)}}},[t._v("重新注册")]),3!==o.row.status?e("el-button",{attrs:{type:"warning",size:"mini"},on:{click:function(e){return t.pasue_host(o.row)}}},[t._v("开始维护")]):t._e(),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_host(o.row)}}},[t._v("销毁主机")])]}}])})],1)],1)],1),e("HostInfoComponent",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],ref:"HostInfoComponentRef",on:{back:t.show_host_list,onHostUpdate:t.update_host_info}}),e("CreateHostComponent",{directives:[{name:"show",rawName:"v-show",value:2===this.show_type,expression:"this.show_type === 2"}],ref:"CreateHostComponentRef",on:{back:t.show_host_list,onHostUpdate:t.update_host_info}})],1)],1)],1)},N=[],V=o(48080),R=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"创建主机"},on:{back:function(e){return t.on_back_click()}}})],1),e("el-row",[e("el-form",{ref:"createForm",staticClass:"demo-ruleForm",attrs:{model:t.create_host,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"显示名称",prop:"displayName"}},[e("el-input",{model:{value:t.create_host.displayName,callback:function(e){t.$set(t.create_host,"displayName",e)},expression:"create_host.displayName"}})],1),e("el-form-item",{attrs:{label:"主机IP",prop:"hostIp"}},[e("el-input",{model:{value:t.create_host.hostIp,callback:function(e){t.$set(t.create_host,"hostIp",e)},expression:"create_host.hostIp"}})],1),e("el-form-item",{attrs:{label:"网卡名称",prop:"nic"}},[e("el-input",{model:{value:t.create_host.nic,callback:function(e){t.$set(t.create_host,"nic",e)},expression:"create_host.nic"}})],1),e("el-form-item",{attrs:{label:"通信地址",prop:"uri"}},[e("el-input",{model:{value:t.create_host.uri,callback:function(e){t.$set(t.create_host,"uri",e)},expression:"create_host.uri"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.create_host_click}},[t._v("立即创建")]),e("el-button",{on:{click:t.on_back_click}},[t._v("取消")])],1)],1)],1)],1)},q=[];const B={data:function(){return{create_host:{displayName:"",hostIp:"",nic:"",uri:""}}},methods:{on_back_click:function(){this.$emit("back")},on_notify_update_host_info:function(t){this.$emit("onHostUpdate",t)},init:function(){this.$refs["createForm"]&&this.$refs["createForm"].resetFields()},create_host_click:function(){var t=this;(0,u.Ld)(this.create_host).then((function(e){0===e.code?(t.on_notify_update_host_info(e.data),t.on_back_click()):t.$notify.error({title:"错误",message:"创建主机失败:".concat(e.message)})}))}}},P=B;var G=(0,g.Z)(P,R,q,!1,null,null,null);const U=G.exports,M={name:"hostView",components:{HostInfoComponent:V.Z,CreateHostComponent:U},data:function(){return{data_loading:!1,show_type:-1,hosts:[]}},mixins:[p.Z,c.Z],mounted:function(){this.show_type=0,this.init_view()},created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},methods:{init_view:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.data_loading=!0,e.next=3,(0,u.vZ)().then((function(e){0==e.code&&(t.hosts=e.data)}))["finally"]((function(){t.data_loading=!1}));case 3:case"end":return e.stop()}}),e)})))()},show_host_list:function(){this.show_type=0},show_create_host:function(){this.$refs.CreateHostComponentRef.init(),this.show_type=2},show_host_info_click:function(t){this.show_host=t,this.$refs.HostInfoComponentRef.init_host(t),this.show_type=1},update_host_info:function(t){var e=this.hosts.findIndex((function(e){return e.hostId===t.hostId}));e>=0?this.$set(this.hosts,e,t):this.hosts.push(t),this.$refs.HostInfoComponentRef.refresh_host(t)},dispatch_notify_message:function(t){var e=this;4===t.type&&(0,u.KF)({hostId:t.id}).then((function(o){if(0==o.code)e.update_host_info(o.data);else if(7000001==o.code){var s=e.hosts.findIndex((function(e){return e.hostId===t.id}));s>=0&&e.hosts.splice(s,1)}}))},pasue_host:function(t){var e=this;this.$confirm("维护主机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.ol)({hostId:t.hostId}).then((function(t){0===t.code?e.update_host_info(t.data):e.$notify.error({title:"错误",message:"暂停主机失败:".concat(t.message)})}))}))["catch"]((function(){}))},register_host:function(t){var e=this;this.$confirm("重新注册主机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.XN)({hostId:t.hostId}).then((function(t){0===t.code?e.update_host_info(t.data):e.$notify.error({title:"错误",message:"注册主机失败:".concat(t.message)})}))}))["catch"]((function(){}))},destroy_host:function(t){var e=this;this.$confirm("删除当前主机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.de)({hostId:t.hostId}).then((function(o){if(0===o.code){var s=e.hosts.findIndex((function(e){return e.hostId===t.hostId}));s>=0&&e.hosts.splice(s,1),e.show_type=0}else e.$notify.error({title:"错误",message:"删除主机失败:".concat(o.message)})}))}))["catch"]((function(){}))}}},D=M;var F=(0,g.Z)(D,z,N,!1,null,"6c614e5e",null);const E=F.exports;var O=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"}],staticClass:"box-card"},[e("el-row",{staticClass:"clearfix",staticStyle:{height:"20px"},attrs:{slot:"header"},slot:"header"},[e("el-button",{staticStyle:{float:"left",padding:"3px 0"},attrs:{type:"text"},on:{click:t.show_create_storage}},[t._v("创建存储池")])],1),e("el-row",[e("el-table",{staticStyle:{width:"100%"},attrs:{"v-loading":t.data_loading,data:t.storages}},[e("el-table-column",{attrs:{label:"ID",prop:"storageId",width:"80"}}),e("el-table-column",{attrs:{label:"名称",prop:"description","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"类型",prop:"type",width:"120"}}),e("el-table-column",{attrs:{label:"容量",prop:"capacity",width:"120"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"已用:"+t.get_volume_display_size(o.row.allocation)+" / 总共:"+t.get_volume_display_size(o.row.capacity),placement:"top"}},[e("el-progress",{attrs:{color:"#67C23A",percentage:o.row.capacity<=0?0:Math.floor(100*o.row.allocation/o.row.capacity)}})],1)]}}])}),e("el-table-column",{attrs:{label:"状态",prop:"status",width:"110"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",{attrs:{type:1===o.row.status?"success":"danger"}},[t._v(t._s(t.get_storage_status(o.row)))])]}}])}),e("el-table-column",{attrs:{label:"操作",width:"400"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"",size:"mini"},on:{click:function(e){return t.show_storage_info_click(o.row)}}},[t._v("存储池详情")]),e("el-button",{attrs:{type:"success",size:"mini"},on:{click:function(e){return t.register_storage(o.row)}}},[t._v("重新注册")]),2!==o.row.status?e("el-button",{attrs:{type:"warning",size:"mini"},on:{click:function(e){return t.pasue_storage(o.row)}}},[t._v("开始维护")]):t._e(),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_storage(o.row)}}},[t._v("销毁存储池")])]}}])})],1)],1)],1),e("StorageInfoComponent",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],ref:"StorageInfoComponentRef",on:{back:function(e){return t.show_storage_list()},onStorageUpdate:t.update_storate_info}}),e("CreateStorageComponent",{directives:[{name:"show",rawName:"v-show",value:2===this.show_type,expression:"this.show_type === 2"}],ref:"CreateStorageComponentRef",on:{back:function(e){return t.show_storage_list()},onStorageUpdate:t.update_storate_info}})],1)],1)],1)},A=[],L=o(47315),j=(o(82526),o(41817),function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"创建存储池"},on:{back:function(e){return t.on_back_click()}}})],1),e("el-row",[e("el-form",{ref:"createForm",staticClass:"demo-ruleForm",attrs:{model:t.create_storage,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"名称",prop:"description"}},[e("el-input",{model:{value:t.create_storage.description,callback:function(e){t.$set(t.create_storage,"description",e)},expression:"create_storage.description"}})],1),e("el-form-item",{attrs:{label:"存储池类型",prop:"type"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.create_storage.type,callback:function(e){t.$set(t.create_storage,"type",e)},expression:"create_storage.type"}},[e("el-option",{attrs:{label:"NFS",value:"nfs"}})],1)],1),"nfs"===t.create_storage.type?e("el-form-item",{attrs:{label:"NFS路径",prop:"path"}},[e("el-input",{model:{value:t.create_storage.path,callback:function(e){t.$set(t.create_storage,"path",e)},expression:"create_storage.path"}})],1):t._e(),"nfs"===t.create_storage.type?e("el-form-item",{attrs:{label:"NFS地址",prop:"uri"}},[e("el-input",{model:{value:t.create_storage.uri,callback:function(e){t.$set(t.create_storage,"uri",e)},expression:"create_storage.uri"}})],1):t._e(),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.create_storage_click}},[t._v("立即创建")]),e("el-button",{on:{click:t.on_back_click}},[t._v("取消")])],1)],1)],1)],1)}),H=[];o(38862);const X={data:function(){return{create_storage:{description:"",type:"nfs",param:"",path:"",uri:""}}},methods:{on_back_click:function(){this.$emit("back")},on_notify_update_scheme:function(t){this.$emit("onStorageUpdate",t)},init:function(){this.$refs["createForm"]&&this.$refs["createForm"].resetFields()},create_storage_click:function(){var t=this,e={description:this.create_storage.description,name:this.create_storage.name,type:this.create_storage.type,param:"{}"};"nfs"===this.create_storage.type?(e.param=JSON.stringify({path:this.create_storage.path,uri:this.create_storage.uri}),(0,u.o6)(e).then((function(e){0===e.code?(t.on_notify_update_scheme(e.data),t.on_back_click()):t.$notify.error({title:"错误",message:"创建存储池失败:".concat(e.message)})}))):this.$notify.error({title:"错误",message:"不支持的存储池:".concat(this.create_storage.type)})}}},Q=X;var K=(0,g.Z)(Q,j,H,!1,null,null,null);const J=K.exports,W={name:"storageView",components:{StorageInfoComponent:L.Z,CreateStorageComponent:J},data:function(){return{data_loading:!1,show_type:-1,show_storage:{},storages:[]}},mixins:[p.Z,c.Z],mounted:function(){this.show_type=0,this.init_view()},created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},methods:{init_view:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.data_loading=!0,e.next=3,(0,u._u)().then((function(e){0==e.code&&(t.storages=e.data)}))["finally"]((function(){t.data_loading=!1}));case 3:case"end":return e.stop()}}),e)})))()},update_storate_info:function(t){var e=this.storages.findIndex((function(e){return e.storageId===t.storageId}));e>=0?this.$set(this.storages,e,t):this.storages.push(t)},dispatch_notify_message:function(t){var e=this;7===t.type&&(0,u.nQ)({storageId:t.id}).then((function(o){if(0==o.code)e.update_storate_info(o.data);else if(3000001==o.code){var s=e.storages.findIndex((function(e){return e.storageId===t.id}));s>=0&&e.storages.splice(s,1)}}))},show_storage_list:function(){this.show_type=0},show_create_storage:function(){this.$refs.CreateStorageComponentRef.init(),this.show_type=2},show_storage_info_click:function(t){this.$refs.StorageInfoComponentRef.init_storage(t),this.show_type=1},pasue_storage:function(t){var e=this;this.$confirm("暂停存储池, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.dZ)({storageId:t.storageId}).then((function(t){0===t.code?e.update_storate_info(t.data):e.$notify.error({title:"错误",message:"暂停存储池失败:".concat(t.message)})}))}))["catch"]((function(){}))},register_storage:function(t){var e=this;this.$confirm("重新注册存储池, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.vA)({storageId:t.storageId}).then((function(o){0===o.code?t.status=0:e.$notify.error({title:"错误",message:"注册存储池失败:".concat(o.message)})}))}))["catch"]((function(){}))},destroy_storage:function(t){var e=this;this.$confirm("删除存储池, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.ye)({storageId:t.storageId}).then((function(t){0===t.code?(e.update_storate_info(t.data),e.show_type=0):e.$notify.error({title:"错误",message:"删除存储池失败:".concat(t.message)})}))}))["catch"]((function(){}))}}},Y=W;var tt=(0,g.Z)(Y,O,A,!1,null,"793a1b64",null);const et=tt.exports;o(82772);var ot=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"}],staticClass:"box-card"},[e("el-row",{staticClass:"clearfix",staticStyle:{height:"20px"},attrs:{slot:"header"},slot:"header"},[e("el-button",{staticStyle:{float:"left",padding:"3px 0"},attrs:{type:"text"},on:{click:t.show_create_template}},[t._v("创建模版")])],1),e("el-row",[e("el-table",{staticStyle:{width:"100%"},attrs:{"v-loading":t.data_loading,data:t.templates}},[e("el-table-column",{attrs:{label:"ID",prop:"templateId",width:"80"}}),e("el-table-column",{attrs:{label:"名称",prop:"name","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"磁盘类型",prop:"volumeType",width:"120"}}),e("el-table-column",{attrs:{label:"类型",prop:"type",width:"100"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",[t._v(t._s(t.get_template_type(o.row)))])]}}])}),e("el-table-column",{attrs:{label:"状态",prop:"status",width:"120"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",{attrs:{type:2===o.row.status?"success":"danger"}},[t._v(t._s(t.get_template_status(o.row)))])]}}])}),e("el-table-column",{attrs:{label:"操作","min-width":"200"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"",size:"mini"},on:{click:function(e){return t.show_template_info(o.row)}}},[t._v("模版详情")]),0===o.row.uri.indexOf("http://")||0===o.row.uri.indexOf("https://")?e("el-button",{attrs:{type:"warning",size:"mini"},on:{click:function(e){return t.download_template(o.row)}}},[t._v("重新下载")]):t._e(),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_template(o.row)}}},[t._v("销毁模版")])]}}])})],1)],1)],1),e("el-card",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{attrs:{content:"模版详情"},on:{back:t.show_template_list}})],1),e("el-row",{staticStyle:{"text-align":"left",margin:"20px 0"}},[!t.show_template.uri||0!==t.show_template.uri.indexOf("http://")&&0!==t.show_template.uri.indexOf("https://")?t._e():e("el-button",{attrs:{type:"warning",size:"mini"},on:{click:function(e){return t.download_template(t.show_template)}}},[t._v("重新下载")]),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_template(t.show_template)}}},[t._v("销毁模版")])],1),e("el-row",[e("el-descriptions",{attrs:{column:2,size:"medium",border:""}},[e("el-descriptions-item",{attrs:{label:"ID"}},[t._v(t._s(t.show_template.templateId))]),e("el-descriptions-item",{attrs:{label:"模版名"}},[t._v(t._s(t.show_template.name))]),t.show_template.uri&&0===t.show_template.uri.indexOf("http")?e("el-descriptions-item",{attrs:{label:"下载地址"}},[t._v(t._s(t.show_template.uri))]):t._e(),e("el-descriptions-item",{attrs:{label:"模版类型"}},[e("el-tag",[t._v(t._s(t.get_template_type(t.show_template)))])],1),e("el-descriptions-item",{attrs:{label:"状态"}},[e("el-tag",{attrs:{type:2===t.show_template.status?"success":"danger"}},[t._v(t._s(t.get_template_status(t.show_template)))])],1)],1)],1)],1),e("el-card",{directives:[{name:"show",rawName:"v-show",value:2===this.show_type,expression:"this.show_type === 2"}],staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"创建模版"},on:{back:function(e){return t.show_template_list()}}})],1),e("el-row",[e("el-form",{ref:"createForm",staticClass:"demo-ruleForm",attrs:{model:t.create_template,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"名称",prop:"name"}},[e("el-input",{model:{value:t.create_template.name,callback:function(e){t.$set(t.create_template,"name",e)},expression:"create_template.name"}})],1),e("el-form-item",{attrs:{label:"模版类型",prop:"templateType"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.create_template.templateType,callback:function(e){t.$set(t.create_template,"templateType",e)},expression:"create_template.templateType"}},[e("el-option",{attrs:{label:"ISO",value:0}}),e("el-option",{attrs:{label:"系统模版",value:1}}),e("el-option",{attrs:{label:"用户模版",value:2}})],1)],1),2===t.create_template.templateType?e("el-form-item",{attrs:{label:"磁盘类型",prop:"volumeType"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.create_template.volumeType,callback:function(e){t.$set(t.create_template,"volumeType",e)},expression:"create_template.volumeType"}},[e("el-option",{attrs:{label:"raw",value:"raw"}}),e("el-option",{attrs:{label:"qcow",value:"qcow"}}),e("el-option",{attrs:{label:"qcow2",value:"qcow2"}}),e("el-option",{attrs:{label:"vdi",value:"vdi"}}),e("el-option",{attrs:{label:"vmdk",value:"vmdk"}}),e("el-option",{attrs:{label:"vpc",value:"vpc"}})],1)],1):t._e(),e("el-form-item",{attrs:{label:" 下载地址",prop:"uri"}},[e("el-input",{model:{value:t.create_template.uri,callback:function(e){t.$set(t.create_template,"uri",e)},expression:"create_template.uri"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.create_template_click}},[t._v("立即创建")]),e("el-button",{on:{click:t.show_template_list}},[t._v("取消")])],1)],1)],1)],1)],1)],1)],1)},st=[];const nt={name:"templateView",components:{},data:function(){return{data_loading:!1,show_type:0,show_template:{},create_template:{name:"",templateType:0,volumeType:"qcow2",uri:""},templates:[]}},mixins:[p.Z,c.Z],mounted:function(){this.init_view()},created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},methods:{init_view:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.data_loading=!0,e.next=3,(0,u.A8)().then((function(e){0==e.code&&(t.templates=e.data)}))["finally"]((function(){t.data_loading=!1}));case 3:case"end":return e.stop()}}),e)})))()},show_template_list:function(){this.show_type=0},show_create_template:function(){this.$refs["createForm"]&&this.$refs["createForm"].resetFields(),this.show_type=2},show_template_info:function(t){this.show_template=t,this.show_type=1},update_template_info:function(t){var e=this.templates.findIndex((function(e){return e.templateId===t.templateId}));e>=0?this.$set(this.templates,e,t):this.templates.push(t),this.show_template&&this.show_template.templateId===t.templateId&&(this.show_template=t)},dispatch_notify_message:function(t){var e=this;5===t.type&&(0,u.BE)({templateId:t.id}).then((function(o){if(0==o.code)e.update_template_info(o.data);else if(5000001==o.code){var s=e.templates.findIndex((function(e){return e.templateId===t.id}));s>=0&&e.templates.splice(s,1)}}))},create_template_click:function(){var t=this,e={name:this.create_template.name,templateType:this.create_template.templateType,uri:this.create_template.uri,volumeType:this.create_template.volumeType};0===this.create_template.templateType?e.volumeType="raw":1===this.create_template.templateType&&(e.volumeType="qcow2"),(0,u.Mn)(e).then((function(e){0===e.code?(t.update_template_info(e.data),t.show_type=0):t.$notify.error({title:"错误",message:"创建模版失败:".concat(e.message)})}))},download_template:function(t){var e=this;this.$confirm("重新下载模版, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.fQ)({templateId:t.templateId}).then((function(t){0===t.code?e.update_template_info(t.data):e.$notify.error({title:"错误",message:"重新下载模版失败:".concat(t.message)})}))}))["catch"]((function(){}))},destroy_template:function(t){var e=this;this.$confirm("删除模版, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.c4)({templateId:t.templateId}).then((function(t){0===t.code?(e.update_template_info(t.data),e.show_type=0):e.$notify.error({title:"错误",message:"删除模版失败:".concat(t.message)})}))}))["catch"]((function(){}))}}},at=nt;var rt=(0,g.Z)(at,ot,st,!1,null,"8deef832",null);const it=rt.exports;var lt=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"}],staticClass:"box-card"},[e("el-row",[e("el-table",{staticStyle:{width:"100%"},attrs:{"v-loading":t.data_loading,data:t.snapshots}},[e("el-table-column",{attrs:{label:"ID",prop:"snapshotVolumeId",width:"80"}}),e("el-table-column",{attrs:{label:"名称",prop:"name","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"磁盘类型",prop:"type",width:"100"}}),e("el-table-column",{attrs:{label:"磁盘空间",prop:"capacity",width:"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(t.get_volume_display_size(e.row.capacity))+" ")]}}])}),e("el-table-column",{attrs:{label:"物理空间",prop:"allocation",width:"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(t.get_volume_display_size(e.row.allocation))+" ")]}}])}),e("el-table-column",{attrs:{label:"状态",prop:"status",width:"100"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",{attrs:{type:1===o.row.status?"success":"danger"}},[t._v(t._s(t.get_snapshot_status(o.row)))])]}}])}),e("el-table-column",{attrs:{label:"操作",width:"300"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"",size:"mini"},on:{click:function(e){return t.show_snapshot_info(o.row)}}},[t._v("快照详情")]),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_snapshot(o.row)}}},[t._v("销毁快照")])]}}])})],1)],1)],1),e("el-card",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{attrs:{content:"快照详情"},on:{back:t.show_snapshot_list}})],1),e("el-row",{staticStyle:{"text-align":"left",margin:"20px 0"}},[e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_snapshot(t.show_snapshot)}}},[t._v("销毁快照")])],1),e("el-row",[e("el-descriptions",{attrs:{column:2,size:"medium",border:""}},[e("el-descriptions-item",{attrs:{label:"ID"}},[t._v(t._s(t.show_snapshot.snapshotVolumeId))]),e("el-descriptions-item",{attrs:{label:"快照名"}},[t._v(t._s(t.show_snapshot.name))]),e("el-descriptions-item",{attrs:{label:"快照路径"}},[t._v(t._s(t.show_snapshot.volumePath))]),e("el-descriptions-item",{attrs:{label:"快照容量"}},[t._v(t._s(t.get_volume_display_size(t.show_snapshot.capacity)))]),e("el-descriptions-item",{attrs:{label:"物理占有"}},[t._v(t._s(t.get_volume_display_size(t.show_snapshot.allocation)))]),e("el-descriptions-item",{attrs:{label:"磁盘类型"}},[t._v(t._s(t.show_snapshot.type))]),e("el-descriptions-item",{attrs:{label:"存储池"}},[t._v(t._s(t.get_storage_name(t.show_snapshot.storageId)))]),e("el-descriptions-item",{attrs:{label:"状态"}},[e("el-tag",{attrs:{type:1===t.show_snapshot.status?"success":"danger"}},[t._v(t._s(t.get_snapshot_status(t.show_snapshot)))])],1)],1)],1)],1)],1)],1)],1)},ct=[];const ut={name:"snapshotView",components:{},data:function(){return{data_loading:!1,show_type:0,show_snapshot:{},snapshots:[],storages:[]}},mixins:[p.Z,c.Z],mounted:function(){this.init_view()},created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},methods:{init_view:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.data_loading=!0,e.next=3,(0,u._u)().then((function(e){0===e.code&&(t.storages=e.data)}));case 3:return e.next=5,(0,u.GQ)().then((function(e){0==e.code&&(t.snapshots=e.data)}))["finally"]((function(){t.data_loading=!1}));case 5:case"end":return e.stop()}}),e)})))()},get_storage_name:function(t){var e=this.storages.find((function(e){return e.storageId===t}))||{name:"-"};return e.name},show_snapshot_list:function(){this.show_type=0},show_snapshot_info:function(t){this.show_snapshot=t,this.show_type=1},update_snapshot_info:function(t){var e=this.snapshots.findIndex((function(e){return e.snapshotVolumeId===t.snapshotVolumeId}));e>=0?this.$set(this.snapshots,e,t):this.snapshots.push(t),this.show_snapshot&&this.show_snapshot.snapshotVolumeId===t.snapshotVolumeId&&(this.show_snapshot=t)},dispatch_notify_message:function(t){var e=this;6===t.type&&(0,u.Tu)({snapshotVolumeId:t.id}).then((function(o){if(0==o.code)e.update_snapshot_info(o.data);else if(6000001==o.code){var s=e.snapshots.findIndex((function(e){return e.snapshotVolumeId===t.id}));s>=0&&e.snapshots.splice(s,1)}}))},destroy_snapshot:function(t){var e=this;this.$confirm("删除快照, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.bv)({snapshotVolumeId:t.snapshotVolumeId}).then((function(o){if(0===o.code){var s=e.snapshots.findIndex((function(e){return e.snapshotVolumeId===t.snapshotVolumeId}));s>=0&&e.snapshots.splice(s,1),e.show_type=0}else e.$notify.error({title:"错误",message:"删除快照失败:".concat(o.message)})}))}))["catch"]((function(){}))}}},dt=ut;var _t=(0,g.Z)(dt,lt,ct,!1,null,"339ee58b",null);const pt=_t.exports;var ht=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"}],staticClass:"box-card"},[e("el-row",{staticClass:"clearfix",staticStyle:{height:"30px"},attrs:{slot:"header"},slot:"header"},[e("div",{staticStyle:{float:"left"}},[e("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0}},[e("el-form-item",[e("el-button",{attrs:{size:"mini",type:"primary"},on:{click:t.show_create_volume}},[t._v("创建磁盘")])],1),e("el-form-item",[e("el-button",{attrs:{size:"mini",disabled:!t.select_volumes.length,type:"danger"},on:{click:t.batch_destroy_volume_click}},[t._v("批量删除")])],1),e("el-form-item",{attrs:{label:"存储池"}},[e("el-select",{staticStyle:{width:"100%"},on:{change:t.update_show_page},model:{value:t.select_storage_id,callback:function(e){t.select_storage_id=e},expression:"select_storage_id"}},[e("el-option",{attrs:{label:"全部",value:0}}),t._l(this.storages,(function(t){return e("el-option",{key:t.storageId,attrs:{label:t.description,value:t.storageId}})}))],2)],1),e("el-form-item",[e("el-input",{staticStyle:{float:"right","max-width":"300px","margin-bottom":"10px"},attrs:{placeholder:"请输入搜索关键字"},on:{input:t.on_key_word_change},model:{value:t.keyword,callback:function(e){t.keyword=e},expression:"keyword"}})],1)],1)],1)]),e("el-row",[e("el-table",{ref:"volumeTable",staticStyle:{width:"100%"},attrs:{"v-loading":!0,data:t.show_table_volumes},on:{"selection-change":t.handleSelectionChange}},[e("el-table-column",{attrs:{type:"selection",width:"55"}}),e("el-table-column",{attrs:{label:"ID",prop:"volumeId",width:"80"}}),e("el-table-column",{attrs:{label:"名称",prop:"description","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"磁盘类型",prop:"type",width:"100"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",[t._v(t._s(o.row.type))])]}}])}),e("el-table-column",{attrs:{label:"磁盘空间",prop:"capacity",width:"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(t.get_volume_display_size(e.row.capacity))+" ")]}}])}),e("el-table-column",{attrs:{label:"物理空间",prop:"allocation",width:"150"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(t.get_volume_display_size(e.row.allocation))+" ")]}}])}),e("el-table-column",{attrs:{label:"挂载机器",prop:"allocation",width:"120","show-overflow-tooltip":""},scopedSlots:t._u([{key:"default",fn:function(o){return[o.row.attach?e("el-button",{attrs:{type:"text",underline:!1},on:{click:function(e){return t.show_guest_info(o.row.attach.guestId)}}},[t._v(t._s(o.row.attach?o.row.attach.description:"-"))]):t._e(),o.row.attach?t._e():e("span",[t._v(t._s(o.row.attach?o.row.attach.description:"-"))])]}}])}),e("el-table-column",{attrs:{label:"状态",prop:"status",width:"100"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",{attrs:{type:1===o.row.status?"success":"danger"}},[t._v(t._s(t.get_volume_status(o.row)))])]}}])}),e("el-table-column",{attrs:{label:"操作",width:"250"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-dropdown",{attrs:{size:"small","split-button":"",placement:"bottom-end",type:"primary"},on:{click:function(e){return t.show_volume_info(o.row)},command:t.menu_command_click}},[t._v(" 磁盘管理 "),e("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},[e("el-dropdown-item",{attrs:{command:{volume:o.row,command:"info"}}},[t._v("磁盘详情")]),e("el-dropdown-item",{attrs:{command:{volume:o.row,command:"resize"},divided:""}},[t._v("扩容磁盘")]),e("el-dropdown-item",{attrs:{command:{volume:o.row,command:"clone"}}},[t._v("克隆磁盘")]),e("el-dropdown-item",{attrs:{command:{volume:o.row,command:"migrate"}}},[t._v("迁移磁盘")]),e("el-dropdown-item",{attrs:{command:{volume:o.row,command:"snapshote"},divided:""}},[t._v("创建快照")]),e("el-dropdown-item",{attrs:{command:{volume:o.row,command:"template"}}},[t._v("创建模版")]),e("el-dropdown-item",{attrs:{command:{volume:o.row,command:"destroy"},divided:""}},[t._v("销毁磁盘")])],1)],1)]}}])})],1),e("el-pagination",{attrs:{"current-page":t.current_page,"page-size":t.page_size,"page-sizes":[5,10,20,50,100,200],total:t.total_size,layout:"total, sizes, prev, pager, next, jumper"},on:{"size-change":t.on_page_size_change,"current-change":t.on_current_page_change}})],1)],1),e("VolumeInfoComponent",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],ref:"VolumeInfoComponentRef",on:{back:function(e){return t.show_volume_list()},onVolumeUpdate:t.update_volume_info}}),e("el-card",{directives:[{name:"show",rawName:"v-show",value:2===this.show_type,expression:"this.show_type === 2"}],staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"创建磁盘"},on:{back:function(e){return t.show_volume_list()}}})],1),e("el-row",[e("el-form",{ref:"createForm",staticClass:"demo-ruleForm",attrs:{model:t.create_volume,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"名称",prop:"description"}},[e("el-input",{model:{value:t.create_volume.description,callback:function(e){t.$set(t.create_volume,"description",e)},expression:"create_volume.description"}})],1),e("el-form-item",{attrs:{label:"存储池",prop:"type"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.create_volume.storageId,callback:function(e){t.$set(t.create_volume,"storageId",e)},expression:"create_volume.storageId"}},[e("el-option",{attrs:{label:"随机",value:0}}),t._l(this.storages,(function(t){return e("el-option",{key:t.storageId,attrs:{label:t.description,value:t.storageId}})}))],2)],1),e("el-form-item",{attrs:{label:"磁盘类型",prop:"volumeType"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.create_volume.volumeType,callback:function(e){t.$set(t.create_volume,"volumeType",e)},expression:"create_volume.volumeType"}},[e("el-option",{attrs:{label:"raw",value:"raw"}}),e("el-option",{attrs:{label:"qcow",value:"qcow"}}),e("el-option",{attrs:{label:"qcow2",value:"qcow2"}}),e("el-option",{attrs:{label:"vdi",value:"vdi"}}),e("el-option",{attrs:{label:"vmdk",value:"vmdk"}}),e("el-option",{attrs:{label:"vpc",value:"vpc"}})],1)],1),e("el-form-item",{attrs:{label:"磁盘大小(GB)",prop:"volumeSize"}},[t._v(" © "),e("el-input",{model:{value:t.create_volume.volumeSize,callback:function(e){t.$set(t.create_volume,"volumeSize",e)},expression:"create_volume.volumeSize"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.create_volume_click}},[t._v("立即创建")]),e("el-button",{on:{click:t.show_volume_list}},[t._v("取消")])],1)],1)],1)],1),e("CloneVolumeComponent",{directives:[{name:"show",rawName:"v-show",value:3===this.show_type,expression:"this.show_type === 3"}],ref:"CloneVolumeComponentRef",on:{back:function(e){return t.show_volume_list()},onVolumeUpdate:t.update_volume_info}}),e("MigrateVolumeComponent",{directives:[{name:"show",rawName:"v-show",value:4===this.show_type,expression:"this.show_type === 4"}],ref:"MigrateVolumeComponentRef",on:{back:function(e){return t.show_volume_list()},onVolumeUpdate:t.update_volume_info}}),e("UploadVolumeComponent",{directives:[{name:"show",rawName:"v-show",value:5===this.show_type,expression:"this.show_type === 5"}],ref:"UploadVolumeComponentRef",on:{back:function(e){return t.show_volume_list()},onVolumeUpdate:t.update_volume_info}}),e("GuestInfoComponent",{directives:[{name:"show",rawName:"v-show",value:6===this.show_type,expression:"this.show_type === 6"}],ref:"GuestInfoComponentRef",on:{back:t.show_volume_list}}),e("DownloadVolumeComponent",{ref:"DownloadVolumeComponentRef"}),e("ResizeVolumeComponent",{ref:"ResizeVolumeComponentRef",on:{onVolumeUpdate:t.update_volume_info}}),e("CreateVolumeTemplateComponent",{ref:"CreateVolumeTemplateComponentRef"}),e("CreateVolumeSnapshotComponent",{ref:"CreateVolumeSnapshotComponentRef"})],1)],1)],1)},mt=[],ft=(o(57327),o(89554),o(54747),o(73210),o(26699),o(32023),o(7488)),gt=o(68501),wt=o(69147),vt=o(52874),yt=o(55050),bt=o(46455),kt=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"上传磁盘"},on:{back:function(e){return t.go_back()}}})],1),e("el-row",[e("el-form",{ref:"uploadForm",staticClass:"demo-ruleForm",attrs:{model:t.upload_volume,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"名称",prop:"description"}},[e("el-input",{model:{value:t.upload_volume.description,callback:function(e){t.$set(t.upload_volume,"description",e)},expression:"upload_volume.description"}})],1),e("el-form-item",{attrs:{label:"存储池",prop:"storageId"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.upload_volume.storageId,callback:function(e){t.$set(t.upload_volume,"storageId",e)},expression:"upload_volume.storageId"}},[e("el-option",{attrs:{label:"随机",value:0}}),t._l(this.storages,(function(t){return e("el-option",{key:t.storageId,attrs:{label:t.description,value:t.storageId}})}))],2)],1),e("el-form-item",{attrs:{label:"目标磁盘类型",prop:"volumeType"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.upload_volume.volumeType,callback:function(e){t.$set(t.upload_volume,"volumeType",e)},expression:"upload_volume.volumeType"}},[e("el-option",{attrs:{label:"raw",value:"raw"}}),e("el-option",{attrs:{label:"qcow",value:"qcow"}}),e("el-option",{attrs:{label:"qcow2",value:"qcow2"}}),e("el-option",{attrs:{label:"vdi",value:"vdi"}}),e("el-option",{attrs:{label:"vmdk",value:"vmdk"}}),e("el-option",{attrs:{label:"vpc",value:"vpc"}})],1)],1),e("el-form-item",[e("el-upload",{ref:"upload",staticClass:"upload-demo",staticStyle:{"max-width":"300px"},attrs:{action:t.get_upload_uri(),limit:1,"on-success":t.on_upload_success,"on-error":t.on_upload_error,name:"volume",data:t.upload_volume,"file-list":t.upload_file_list,"auto-upload":!1,"show-file-list":!0}},[e("el-button",{attrs:{slot:"trigger",size:"small",type:"primary"},slot:"trigger"},[t._v("选择磁盘")])],1)],1),e("el-form-item",[e("el-button",{attrs:{type:"primary",loading:t.uploading},on:{click:t.upload_volume_click}},[t._v("导入")]),e("el-button",{on:{click:t.go_back}},[t._v("取消")])],1)],1)],1)],1)},It=[];const xt={data:function(){return{uploading:!1,storages:[],upload_file_list:[],upload_volume:{description:"",storageId:0,volumeType:"qcow2"}}},methods:{go_back:function(){this.$emit("back")},get_upload_uri:function(){return"./api/volume/upload"},notify_volume_update:function(t){this.$emit("onVolumeUpdate",t)},init:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.$refs["uploadForm"]&&t.$refs["uploadForm"].resetFields(),t.uploading=!1,t.upload_file_list=[],t.uploading=!1,e.next=6,(0,u._u)().then((function(e){0==e.code&&(t.storages=e.data)}));case 6:case"end":return e.stop()}}),e)})))()},upload_volume_click:function(){this.uploading=!0,this.$refs.upload.submit()},on_upload_success:function(t){this.uploading=!1,0===t.code?(this.notify_volume_update(t.data),this.go_back()):(this.upload_file_list=[],this.$notify.error({title:"错误",message:"上传磁盘失败:".concat(t.message)}))},on_upload_error:function(){this.uploading=!1,this.upload_file_list=[],this.$notify.error({title:"错误",message:"磁盘上传失败。"})}}},Ct=xt;var $t=(0,g.Z)(Ct,kt,It,!1,null,null,null);const St=$t.exports;var Zt=o(72541);const Tt={name:"volumeView",components:{GuestInfoComponent:h.Z,DownloadVolumeComponent:ft.Z,ResizeVolumeComponent:gt.Z,CreateVolumeTemplateComponent:wt.Z,CreateVolumeSnapshotComponent:vt.Z,CloneVolumeComponent:yt.Z,MigrateVolumeComponent:bt.Z,UploadVolumeComponent:St,VolumeInfoComponent:Zt.Z},data:function(){return{data_loading:!1,uploading:!1,show_type:-1,select_storage_id:0,create_volume:{description:"",storageId:0,volumeType:"qcow2",volumeSize:100},keyword:"",volumes:[],storages:[],select_volumes:[],current_page:1,page_size:10,total_size:0}},mixins:[p.Z,c.Z],mounted:function(){this.show_type=0,this.init_view()},created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},computed:{show_table_volumes:function(){return this.volumes.filter((function(t){return void 0===t.isShow||t.isShow}))}},methods:{handleSelectionChange:function(t){this.select_volumes=t},init_view:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.data_loading=!0,e.next=3,(0,u._u)().then((function(e){0==e.code&&(t.storages=e.data)}));case 3:return e.next=5,(0,u.Mm)().then((function(e){0==e.code&&(t.volumes=e.data,t.update_show_page())}))["finally"]((function(){t.data_loading=!1}));case 5:case"end":return e.stop()}}),e)})))()},on_current_page_change:function(t){this.current_page=t,this.update_show_page()},on_page_size_change:function(t){this.page_size=t,this.update_show_page()},show_guest_info:function(t){this.$refs.GuestInfoComponentRef.initGuestId(t),this.show_type=6},on_key_word_change:function(){this.current_page=1,this.update_show_page()},update_show_page:function(){var t=this,e=0,o=this.page_size*(this.current_page-1),s=this.page_size*this.current_page;this.volumes.forEach((function(n,a){var r=!0,i=t.keyword.trim().toLowerCase();if(""!==i){var l=n.attach?n.attach.description.toLowerCase():"";r=""+n.volumeId===i||n.description.toLowerCase().indexOf(i)>=0||l.indexOf(i)>=0}var c=!0;t.select_storage_id>0&&(c=n.storageId===t.select_storage_id),r&&c?(e++,n.isShow=!(e<=o||e>s)):n.isShow=!1,t.$set(t.volumes,a,n)})),this.total_size=e},get_storage_name:function(t){var e=this.storages.find((function(e){return e.storageId===t}))||{description:"-"};return e.description},update_volume_info:function(t){var e=this,o=this.select_volumes.map((function(t){return t.volumeId})),s=this.volumes.findIndex((function(e){return e.volumeId===t.volumeId}));if(s>=0)this.$set(this.volumes,s,t);else{var n=this.page_size*(this.current_page-1);this.volumes.splice(n,0,t)}this.update_show_page(),this.$nextTick((function(){e.volumes.forEach((function(t){o.includes(t.volumeId)&&t.isShow&&e.$refs.volumeTable.toggleRowSelection(t)}))})),this.$refs.VolumeInfoComponentRef.refresh_volume(t)},dispatch_notify_message:function(t){var e=this;2===t.type&&(0,u.Rm)({volumeId:t.id}).then((function(o){if(0==o.code)e.update_volume_info(o.data);else if(4000001==o.code){var s=e.select_volumes.map((function(t){return t.volumeId})),n=e.volumes.findIndex((function(e){return e.volumeId===t.id}));n>=0&&e.volumes.splice(n,1),e.$nextTick((function(){e.volumes.forEach((function(t){s.includes(t.volumeId)&&t.isShow&&e.$refs.volumeTable.toggleRowSelection(t)}))}))}}))},show_volume_list:function(){this.show_type=0},show_create_volume:function(){this.$refs["createForm"]&&this.$refs["createForm"].resetFields(),this.show_type=2},show_upload_volume:function(){this.$refs.UploadVolumeComponentRef.init(),this.show_type=5},show_volume_info:function(t){var e=this;return(0,l.Z)((0,i.Z)().mark((function o(){return(0,i.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:e.$refs.VolumeInfoComponentRef.init_volume(t),e.show_type=1;case 2:case"end":return o.stop()}}),o)})))()},create_volume_click:function(){var t=this;(0,u.rL)(this.create_volume).then((function(e){0===e.code?(t.update_volume_info(e.data),t.show_type=0):t.$notify.error({title:"错误",message:"创建磁盘失败:".concat(e.message)})}))},update_volume_status:function(t,e){var o=this.volumes.find((function(e){return e.volumeId===t}));o&&(o.status=e)},menu_command_click:function(t){switch(t.command){case"info":this.show_volume_info(t.volume);break;case"resize":this.show_resize_volume_click(t.volume);break;case"snapshote":this.show_create_volume_snapshot_click(t.volume);break;case"clone":this.show_clone_volume_click(t.volume);break;case"migrate":this.show_migrate_volume_click(t.volume);break;case"template":this.show_create_volume_template_click(t.volume);break;case"destroy":this.destroy_volume(t.volume);break}},show_download_volume_click:function(t){this.$refs.DownloadVolumeComponentRef.init(t)},show_clone_volume_click:function(t){this.$refs.CloneVolumeComponentRef.init(t),this.show_type=3},show_migrate_volume_click:function(t){this.$refs.MigrateVolumeComponentRef.init(t),this.show_type=4},show_create_volume_template_click:function(t){this.$refs.CreateVolumeTemplateComponentRef.init(t)},show_resize_volume_click:function(t){this.$refs.ResizeVolumeComponentRef.init(t)},show_create_volume_snapshot_click:function(t){this.$refs.CreateVolumeSnapshotComponentRef.init(t)},destroy_volume:function(t){var e=this;this.$confirm("删除磁盘, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){console.log(t),(0,u.lp)({volumeId:t.volumeId}).then((function(t){0===t.code?(e.update_volume_info(t.data),e.show_type=0):e.$notify.error({title:"错误",message:"删除磁盘失败:".concat(t.message)})}))}))["catch"]((function(){}))},batch_destroy_volume_click:function(){var t=this;this.$confirm("批量删除所选磁盘, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){var e=t.select_volumes.map((function(t){return t.volumeId})).join(",");(0,u.uT)({volumeIds:e}).then((function(e){0===e.code?e.data.filter((function(e){t.update_volume_info(e)})):t.$notify.error({title:"错误",message:"批量删除磁盘:".concat(e.message)})}))}))["catch"]((function(){}))}}},zt=Tt;var Nt=(0,g.Z)(zt,ht,mt,!1,null,"22f2dc55",null);const Vt=Nt.exports;var Rt=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"}],staticClass:"box-card"},[e("el-row",{staticClass:"clearfix",staticStyle:{height:"20px"},attrs:{slot:"header"},slot:"header"},[e("el-button",{staticStyle:{float:"left",padding:"3px 0"},attrs:{type:"text"},on:{click:t.show_crate_scheme_info_click}},[t._v("创建计算方案")])],1),e("el-row",[e("el-table",{staticStyle:{width:"100%"},attrs:{"v-loading":t.data_loading,data:t.schemes}},[e("el-table-column",{attrs:{label:"ID",prop:"schemeId",width:"80"}}),e("el-table-column",{attrs:{label:"名称",prop:"name","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"CPU",prop:"cpu",width:"120"}}),e("el-table-column",{attrs:{label:"内存",prop:"memory",width:"200"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(t.get_memory_display_size(e.row.memory))+" ")]}}])}),e("el-table-column",{attrs:{label:"操作","min-width":"380"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"",size:"mini"},on:{click:function(e){return t.show_scheme_info_click(o.row)}}},[t._v("详情")]),e("el-button",{attrs:{type:"",size:"mini"},on:{click:function(e){return t.show_modify_scheme(o.row)}}},[t._v("修改")]),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_scheme(o.row)}}},[t._v("删除")])]}}])})],1)],1)],1),e("SchemeInfoComponent",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],ref:"SchemeInfoComponentRef",on:{back:function(e){return t.show_scheme_list()},onSchemeUpdate:t.update_scheme_info}}),e("CreateSchemeComponent",{directives:[{name:"show",rawName:"v-show",value:2===this.show_type,expression:"this.show_type === 2"}],ref:"CreateSchemeComponentRef",on:{back:function(e){return t.show_scheme_list()},onSchemeUpdate:t.update_scheme_info}}),e("ModifySchemeComponent",{directives:[{name:"show",rawName:"v-show",value:3===this.show_type,expression:"this.show_type === 3"}],ref:"ModifySchemeComponentRef",on:{back:function(e){return t.show_scheme_list()},onSchemeUpdate:t.update_scheme_info}})],1)],1)],1)},qt=[],Bt=o(33094),Pt=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"创建计算方案"},on:{back:function(e){return t.on_back_click()}}})],1),e("el-row",[e("el-form",{ref:"createForm",staticClass:"demo-ruleForm",attrs:{model:t.create_scheme,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"名称",prop:"name"}},[e("el-input",{model:{value:t.create_scheme.name,callback:function(e){t.$set(t.create_scheme,"name",e)},expression:"create_scheme.name"}})],1),e("el-form-item",{attrs:{label:"CPU",prop:"cpu"}},[e("el-input",{model:{value:t.create_scheme.cpu,callback:function(e){t.$set(t.create_scheme,"cpu",e)},expression:"create_scheme.cpu"}})],1),e("el-form-item",{attrs:{label:"内存(MB)",prop:"memory"}},[e("el-input",{model:{value:t.create_scheme.memory,callback:function(e){t.$set(t.create_scheme,"memory",e)},expression:"create_scheme.memory"}})],1),e("el-form-item",{attrs:{label:"配额",prop:"speed"}},[e("el-input",{model:{value:t.create_scheme.speed,callback:function(e){t.$set(t.create_scheme,"speed",e)},expression:"create_scheme.speed"}})],1),e("el-form-item",{attrs:{label:"Cores",prop:"cores"}},[e("el-input",{model:{value:t.create_scheme.cores,callback:function(e){t.$set(t.create_scheme,"cores",e)},expression:"create_scheme.cores"}})],1),e("el-form-item",{attrs:{label:"Sockets",prop:"sockets"}},[e("el-input",{model:{value:t.create_scheme.sockets,callback:function(e){t.$set(t.create_scheme,"sockets",e)},expression:"create_scheme.sockets"}})],1),e("el-form-item",{attrs:{label:"Threads",prop:"threads"}},[e("el-input",{model:{value:t.create_scheme.threads,callback:function(e){t.$set(t.create_scheme,"threads",e)},expression:"create_scheme.threads"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.create_scheme_click}},[t._v("立即创建")]),e("el-button",{on:{click:t.on_back_click}},[t._v("取消")])],1)],1)],1)],1)},Gt=[];const Ut={data:function(){return{create_scheme:{name:"",cpu:1,memory:512,speed:0,sockets:0,cores:0,threads:0}}},methods:{on_back_click:function(){this.$emit("back")},on_notify_update_scheme:function(t){this.$emit("onSchemeUpdate",t)},init:function(){this.$refs["createForm"]&&this.$refs["createForm"].resetFields()},create_scheme_click:function(){var t=this;(0,u.ql)(this.create_scheme).then((function(e){0===e.code?(t.on_notify_update_scheme(e.data),t.on_back_click()):t.$notify.error({title:"错误",message:"创建计算方案失败:".concat(e.message)})}))}}},Mt=Ut;var Dt=(0,g.Z)(Mt,Pt,Gt,!1,null,null,null);const Ft=Dt.exports;var Et=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"修改计算方案"},on:{back:function(e){return t.on_back_click()}}})],1),e("el-row",[e("el-form",{staticClass:"demo-ruleForm",attrs:{model:t.modify_scheme,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"名称",prop:"name"}},[e("el-input",{model:{value:t.modify_scheme.name,callback:function(e){t.$set(t.modify_scheme,"name",e)},expression:"modify_scheme.name"}})],1),e("el-form-item",{attrs:{label:"CPU",prop:"cpu"}},[e("el-input",{model:{value:t.modify_scheme.cpu,callback:function(e){t.$set(t.modify_scheme,"cpu",e)},expression:"modify_scheme.cpu"}})],1),e("el-form-item",{attrs:{label:"内存(MB)",prop:"memory"}},[e("el-input",{model:{value:t.modify_scheme.memory,callback:function(e){t.$set(t.modify_scheme,"memory",e)},expression:"modify_scheme.memory"}})],1),e("el-form-item",{attrs:{label:"配额",prop:"speed"}},[e("el-input",{model:{value:t.modify_scheme.speed,callback:function(e){t.$set(t.modify_scheme,"speed",e)},expression:"modify_scheme.speed"}})],1),e("el-form-item",{attrs:{label:"Cores",prop:"cores"}},[e("el-input",{model:{value:t.modify_scheme.cores,callback:function(e){t.$set(t.modify_scheme,"cores",e)},expression:"modify_scheme.cores"}})],1),e("el-form-item",{attrs:{label:"Sockets",prop:"sockets"}},[e("el-input",{model:{value:t.modify_scheme.sockets,callback:function(e){t.$set(t.modify_scheme,"sockets",e)},expression:"modify_scheme.sockets"}})],1),e("el-form-item",{attrs:{label:"Threads",prop:"threads"}},[e("el-input",{model:{value:t.modify_scheme.threads,callback:function(e){t.$set(t.modify_scheme,"threads",e)},expression:"modify_scheme.threads"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.modify_scheme_click}},[t._v("修改")]),e("el-button",{on:{click:t.on_back_click}},[t._v("取消")])],1)],1)],1)],1)},Ot=[];const At={data:function(){return{modify_scheme:{schemeId:0,name:"",cpu:1,memory:512,speed:0,sockets:0,cores:0,threads:0}}},methods:{on_back_click:function(){this.$emit("back")},on_notify_update_scheme:function(t){this.$emit("onSchemeUpdate",t)},init:function(t){this.modify_scheme.schemeId=t.schemeId,this.modify_scheme.name=t.name,this.modify_scheme.cpu=t.cpu,this.modify_scheme.memory=t.memory/1024,this.modify_scheme.speed=t.speed,this.modify_scheme.sockets=t.sockets,this.modify_scheme.cores=t.cores,this.modify_scheme.threads=t.threads},modify_scheme_click:function(){var t=this;this.$confirm("修改计算方案, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.A6)(t.modify_scheme).then((function(e){0===e.code?(t.on_notify_update_scheme(e.data),t.on_back_click()):t.$notify.error({title:"错误",message:"修改计算方案失败:".concat(e.message)})}))}))["catch"]((function(){}))}}},Lt=At;var jt=(0,g.Z)(Lt,Et,Ot,!1,null,null,null);const Ht=jt.exports,Xt={name:"schemeView",components:{SchemeInfoComponent:Bt.Z,CreateSchemeComponent:Ft,ModifySchemeComponent:Ht},data:function(){return{data_loading:!1,current_scheme_id:0,show_type:-1,show_scheme:{},schemes:[]}},mixins:[p.Z,c.Z],mounted:function(){this.show_type=0,this.init_view()},created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},methods:{init_view:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.data_loading=!0,e.next=3,(0,u.Pu)().then((function(e){0==e.code&&(t.schemes=e.data)}))["finally"]((function(){t.data_loading=!1}));case 3:case"end":return e.stop()}}),e)})))()},update_scheme_info:function(t){var e=this.schemes.findIndex((function(e){return e.schemeId===t.schemeId}));e>=0?this.$set(this.schemes,e,t):this.schemes.push(t),this.$refs.SchemeInfoComponentRef.init_scheme(t),this.$forceUpdate()},dispatch_notify_message:function(t){var e=this;8===t.type&&(0,u.TQ)({schemeId:t.id}).then((function(o){if(0==o.code)e.update_scheme_info(o.data);else if(8000001==o.code){var s=e.schemes.findIndex((function(e){return e.schemeId===t.id}));s>=0&&e.schemes.splice(s,1)}e.$forceUpdate()}))},show_scheme_list:function(){this.show_type=0},show_crate_scheme_info_click:function(){this.$refs.CreateSchemeComponentRef.init(),this.show_type=2},show_modify_scheme:function(t){this.$refs.ModifySchemeComponentRef.init(t),this.show_type=3},show_scheme_info_click:function(t){this.show_scheme=t,this.$refs.SchemeInfoComponentRef.init_scheme(t),this.show_type=1},destroy_scheme:function(t){var e=this;this.$confirm("删除计算方案, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.tM)({schemeId:t.schemeId}).then((function(o){if(0===o.code){var s=e.schemes.findIndex((function(e){return e.schemeId===t.schemeId}));s>=0&&e.schemes.splice(s,1),e.show_type=0}else e.$notify.error({title:"错误",message:"删除计算方案失败:".concat(o.message)})}))}))["catch"]((function(){}))}}},Qt=Xt;var Kt=(0,g.Z)(Qt,Rt,qt,!1,null,"3a3543ac",null);const Jt=Kt.exports;var Wt=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"}],staticClass:"box-card"},[e("el-row",{staticClass:"clearfix",staticStyle:{height:"20px"},attrs:{slot:"header"},slot:"header"},[e("el-button",{staticStyle:{float:"left",padding:"3px 0"},attrs:{type:"text"},on:{click:t.show_crate_group_click}},[t._v("创建群组")])],1),e("el-row",[e("el-table",{staticStyle:{width:"100%"},attrs:{"v-loading":t.data_loading,data:t.groups}},[e("el-table-column",{attrs:{label:"ID",prop:"groupId",width:"80"}}),e("el-table-column",{attrs:{label:"名称",prop:"groupName","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"操作","min-width":"380"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"",size:"mini"},on:{click:function(e){return t.show_modify_group(o.row)}}},[t._v("修改")]),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_group(o.row)}}},[t._v("删除")])]}}])})],1)],1)],1),e("CreateGroupComponent",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],ref:"CreateGroupComponentRef",on:{back:function(e){return t.show_group_list()},onGroupUpdate:t.update_group}}),e("ModifyGroupComponent",{directives:[{name:"show",rawName:"v-show",value:2===this.show_type,expression:"this.show_type === 2"}],ref:"ModifyGroupComponentRef",on:{back:function(e){return t.show_group_list()},onGroupUpdate:t.update_group}})],1)],1)],1)},Yt=[],te=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"创建群组"},on:{back:function(e){return t.on_back_click()}}})],1),e("el-row",[e("el-form",{ref:"createForm",staticClass:"demo-ruleForm",attrs:{model:t.create_group,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"名称",prop:"groupName"}},[e("el-input",{model:{value:t.create_group.groupName,callback:function(e){t.$set(t.create_group,"groupName",e)},expression:"create_group.groupName"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.create_group_click}},[t._v("立即创建")]),e("el-button",{on:{click:t.on_back_click}},[t._v("取消")])],1)],1)],1)],1)},ee=[];const oe={data:function(){return{create_group:{groupName:""}}},methods:{on_back_click:function(){this.$emit("back")},on_notify_update_group:function(t){this.$emit("onGroupUpdate",t)},init:function(){this.$refs["createForm"]&&this.$refs["createForm"].resetFields()},create_group_click:function(){var t=this;(0,u.sS)(this.create_group).then((function(e){0===e.code?(t.on_notify_update_group(e.data),t.on_back_click()):t.$notify.error({title:"错误",message:"创建群组失败:".concat(e.message)})}))}}},se=oe;var ne=(0,g.Z)(se,te,ee,!1,null,null,null);const ae=ne.exports;var re=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"修改群组"},on:{back:function(e){return t.on_back_click()}}})],1),e("el-row",[e("el-form",{staticClass:"demo-ruleForm",attrs:{model:t.modify_group,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"名称",prop:"name"}},[e("el-input",{model:{value:t.modify_group.groupName,callback:function(e){t.$set(t.modify_group,"groupName",e)},expression:"modify_group.groupName"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.modify_group_click}},[t._v("修改")]),e("el-button",{on:{click:t.on_back_click}},[t._v("取消")])],1)],1)],1)],1)},ie=[];const le={data:function(){return{modify_group:{groupId:0,groupName:""}}},methods:{on_back_click:function(){this.$emit("back")},on_notify_update_group:function(t){this.$emit("onSchemeUpdate",t)},init:function(t){this.modify_group.groupId=t.groupId,this.modify_group.groupName=t.groupName},modify_group_click:function(){var t=this;this.$confirm("修改群组, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.v_)(t.modify_group).then((function(e){0===e.code?(t.on_notify_update_group(e.data),t.on_back_click()):t.$notify.error({title:"错误",message:"修改群组失败:".concat(e.message)})}))}))["catch"]((function(){}))}}},ce=le;var ue=(0,g.Z)(ce,re,ie,!1,null,null,null);const de=ue.exports,_e={name:"groupView",components:{CreateGroupComponent:ae,ModifyGroupComponent:de},data:function(){return{data_loading:!1,current_group_id:0,show_type:-1,show_group:{},groups:[]}},mixins:[p.Z,c.Z],mounted:function(){this.show_type=0,this.init_view()},created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},methods:{init_view:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.data_loading=!0,e.next=3,(0,u.hI)().then((function(e){0==e.code&&(t.groups=e.data)}))["finally"]((function(){t.data_loading=!1}));case 3:case"end":return e.stop()}}),e)})))()},update_group:function(t){var e=this.groups.findIndex((function(e){return e.groupId===t.groupId}));e>=0?this.$set(this.groups,e,t):this.groups.push(t),this.$refs.GroupInfoComponentRef.init_group(t),this.$forceUpdate()},dispatch_notify_message:function(t){var e=this;9===t.type&&(0,u.yL)({groupId:t.id}).then((function(o){if(0==o.code)e.update_group(o.data);else if(10000001==o.code){var s=e.groups.findIndex((function(e){return e.groupId===t.id}));s>=0&&e.groups.splice(s,1)}e.$forceUpdate()}))},show_group_list:function(){this.show_type=0},show_crate_group_click:function(){this.show_type=1,this.$refs.CreateGroupComponentRef.init()},show_modify_group:function(t){this.$refs.ModifyGroupComponentRef.init(t),this.show_type=2},destroy_group:function(t){var e=this;this.$confirm("删除群组, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.ng)({groupId:t.groupId}).then((function(o){if(0===o.code){var s=e.groups.findIndex((function(e){return e.groupId===t.groupId}));s>=0&&e.groups.splice(s,1),e.show_type=0}else e.$notify.error({title:"错误",message:"删除群组失败:".concat(o.message)})}))}))["catch"]((function(){}))}}},pe=_e;var he=(0,g.Z)(pe,Wt,Yt,!1,null,"63671446",null);const me=he.exports;var fe=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"}],staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-form",{staticClass:"demo-form-inline",attrs:{inline:!0}},[e("el-form-item",[e("el-button",{attrs:{type:"primary",size:"mini"},on:{click:t.show_create_guest_click}},[t._v("创建虚拟机")])],1),e("el-form-item",[e("el-button",{attrs:{disabled:!t.select_guests.length,type:"primary",size:"mini"},on:{click:t.batch_start_guest_click}},[t._v("批量启动")])],1),e("el-form-item",[e("el-button",{attrs:{disabled:!t.select_guests.length,type:"danger",size:"mini"},on:{click:t.batch_stop_guest_click}},[t._v("批量停止")])],1),e("el-form-item",{attrs:{label:"群组"}},[e("el-select",{staticStyle:{width:"100%"},on:{change:t.update_guest_show_page},model:{value:t.select_group_id,callback:function(e){t.select_group_id=e},expression:"select_group_id"}},[e("el-option",{attrs:{label:"全部",value:-1}}),t._l(this.groups,(function(t){return e("el-option",{key:t.groupId,attrs:{label:t.groupName,value:t.groupId}})}))],2)],1),e("el-form-item",{attrs:{label:"运行主机"}},[e("el-select",{staticStyle:{width:"100%"},on:{change:t.update_guest_show_page},model:{value:t.select_host_id,callback:function(e){t.select_host_id=e},expression:"select_host_id"}},[e("el-option",{attrs:{label:"全部",value:0}}),t._l(this.hosts,(function(t){return e("el-option",{key:t.hostId,attrs:{label:t.displayName,value:t.hostId}})}))],2)],1),e("el-form-item",[e("el-input",{staticStyle:{"margin-bottom":"10px"},attrs:{placeholder:"请输入搜索关键字"},on:{input:t.on_key_word_change},model:{value:t.keyword,callback:function(e){t.keyword=e},expression:"keyword"}})],1)],1)],1),e("el-row",[e("el-table",{ref:"guestTable",staticStyle:{width:"100%"},attrs:{"v-loading":t.data_loading,data:t.show_table_guests},on:{"selection-change":t.handleSelectionChange}},[e("el-table-column",{attrs:{type:"selection",width:"55"}}),e("el-table-column",{attrs:{label:"ID",prop:"guestId",width:"80"}}),e("el-table-column",{attrs:{label:"实例名",prop:"name",width:"180","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"标签",prop:"description",width:"180"}}),e("el-table-column",{attrs:{label:"IP地址",prop:"guestIp",width:"150"}}),e("el-table-column",{attrs:{label:"配置",prop:"cpu",width:"150"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(t._s(e.row.cpu)+"核/"+t._s(t.get_memory_display_size(e.row.memory)))]}}])}),e("el-table-column",{attrs:{label:"类型",width:"100"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",[t._v(t._s(0===o.row.type?"系统主机":"用户主机"))])]}}])}),e("el-table-column",{attrs:{label:"状态",prop:"status",width:"100"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",{attrs:{type:2===o.row.status?"success":"danger"}},[t._v(t._s(t.get_guest_status(o.row)))])]}}])}),e("el-table-column",{attrs:{label:"操作","min-width":"150"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-dropdown",{attrs:{size:"small","split-button":"",placement:"bottom-end",type:"primary"},on:{click:function(e){return t.show_guest_info_click(o.row)},command:t.menu_command_click}},[t._v(" 虚拟机管理 "),e("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},[e("el-dropdown-item",{attrs:{command:{guest:o.row,command:"info"}}},[t._v("虚拟机详情")]),e("el-dropdown-item",{attrs:{command:{guest:o.row,command:"start"},divided:"",disabled:4!==o.row.status}},[t._v("启动虚拟机")]),e("el-dropdown-item",{attrs:{command:{guest:o.row,command:"stop"},disabled:2!==o.row.status}},[t._v("停止虚拟机")]),e("el-dropdown-item",{attrs:{command:{guest:o.row,command:"vnc"},disabled:2!==o.row.status}},[t._v("远程桌面")]),e("el-dropdown-item",{attrs:{command:{guest:o.row,command:"reboot"},disabled:2!==o.row.status}},[t._v("重启虚拟机")]),0!==o.row.type?e("el-dropdown-item",{attrs:{command:{guest:o.row,command:"attach_cd"},disabled:0!==o.row.cdRoom}},[t._v("挂载光驱")]):t._e(),0!==o.row.type?e("el-dropdown-item",{attrs:{command:{guest:o.row,command:"detach_cd"},disabled:0===o.row.cdRoom}},[t._v("卸载光驱")]):t._e(),e("el-dropdown-item",{attrs:{command:{guest:o.row,command:"destroy"},divided:""}},[t._v("销毁虚拟机")])],1)],1)]}}])})],1),e("el-pagination",{attrs:{"current-page":t.current_page,"page-size":t.page_size,"page-sizes":[5,10,20,50,100,200],total:t.total_size,layout:"total, sizes, prev, pager, next, jumper"},on:{"size-change":t.on_page_size_change,"current-change":t.on_current_page_change}})],1)],1),e("GuestInfoComponent",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],ref:"GuestInfoComponentRef",on:{back:t.show_guest_list_page,onGuestUpdate:t.update_guest_info}}),e("CreateGuestComponent",{directives:[{name:"show",rawName:"v-show",value:2===this.show_type,expression:"this.show_type === 2"}],ref:"CreateGuestComponentRef",on:{back:t.show_guest_list_page,onGuestUpdate:t.update_guest_info}})],1)],1),e("AttachCdRoomComponent",{ref:"AttachCdRoomComponentRef",on:{onGuestUpdate:t.update_guest_info}}),e("StartGuestComponent",{ref:"StartGuestComponentRef",on:{onGuestUpdate:t.update_guest_info}}),e("StopGuestComponent",{ref:"StopGuestComponentRef",on:{onGuestUpdate:t.update_guest_info}})],1)},ge=[],we=o(23698),ve=(o(92222),o(64148)),ye=o(54165),be=function(){var t=this,e=t._self._c;return e("el-card",{staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"创建虚拟机"},on:{back:t.on_back_click}})],1),e("el-row",[e("el-form",{ref:"createForm",staticClass:"demo-ruleForm",attrs:{model:t.create_guest,"label-width":"100px"}},[e("el-row",[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"标签",prop:"description"}},[e("el-input",{model:{value:t.create_guest.description,callback:function(e){t.$set(t.create_guest,"description",e)},expression:"create_guest.description"}})],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"总线方式"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"总线方式"},model:{value:t.create_guest.busType,callback:function(e){t.$set(t.create_guest,"busType",e)},expression:"create_guest.busType"}},[e("el-option",{attrs:{label:"virtio",value:"virtio"}}),e("el-option",{attrs:{label:"ide",value:"ide"}}),e("el-option",{attrs:{label:"scsi",value:"scsi"}})],1)],1)],1)],1),e("el-row",[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"运行主机"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.create_guest.hostId,callback:function(e){t.$set(t.create_guest,"hostId",e)},expression:"create_guest.hostId"}},[e("el-option",{attrs:{label:"随机",value:0}}),t._l(this.hosts,(function(t){return e("el-option",{key:t.hostId,attrs:{label:t.displayName,value:t.hostId}})}))],2)],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"架构"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择架构"},model:{value:t.create_guest.schemeId,callback:function(e){t.$set(t.create_guest,"schemeId",e)},expression:"create_guest.schemeId"}},t._l(this.schemes,(function(t){return e("el-option",{key:t.schemeId,attrs:{label:t.name,value:t.schemeId}})})),1)],1)],1)],1),e("el-row",[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"网络"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择网络"},model:{value:t.create_guest.networkId,callback:function(e){t.$set(t.create_guest,"networkId",e)},expression:"create_guest.networkId"}},t._l(this.networks,(function(t){return e("el-option",{key:t.networkId,attrs:{label:t.name,value:t.networkId}})})),1)],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"网络驱动"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择网卡驱动"},model:{value:t.create_guest.networkDeviceType,callback:function(e){t.$set(t.create_guest,"networkDeviceType",e)},expression:"create_guest.networkDeviceType"}},[e("el-option",{attrs:{label:"virtio",value:"virtio"}}),e("el-option",{attrs:{label:"rtl8139",value:"rtl8139"}}),e("el-option",{attrs:{label:"e1000",value:"e1000"}})],1)],1)],1)],1),e("el-row",[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"安装方式"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择安装方式"},model:{value:t.create_guest.type,callback:function(e){t.$set(t.create_guest,"type",e)},expression:"create_guest.type"}},[e("el-option",{attrs:{label:"ISO镜像",value:0}}),e("el-option",{attrs:{label:"模版安装",value:1}}),e("el-option",{attrs:{label:"快照安装",value:2}}),e("el-option",{attrs:{label:"现有磁盘",value:3}})],1)],1)],1),e("el-col",{attrs:{span:12}},[3!==t.create_guest.type?e("el-form-item",{attrs:{label:"磁盘类型"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.create_guest.volumeType,callback:function(e){t.$set(t.create_guest,"volumeType",e)},expression:"create_guest.volumeType"}},[e("el-option",{attrs:{label:"raw",value:"raw"}}),e("el-option",{attrs:{label:"qcow",value:"qcow"}}),e("el-option",{attrs:{label:"qcow2",value:"qcow2"}}),e("el-option",{attrs:{label:"vdi",value:"vdi"}}),e("el-option",{attrs:{label:"vmdk",value:"vmdk"}}),e("el-option",{attrs:{label:"vpc",value:"vpc"}})],1)],1):t._e()],1)],1),e("el-row",[e("el-col",{attrs:{span:12}},[0===t.create_guest.type?e("el-form-item",{attrs:{label:"ISO模版"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择光盘镜像"},model:{value:t.create_guest.isoTemplateId,callback:function(e){t.$set(t.create_guest,"isoTemplateId",e)},expression:"create_guest.isoTemplateId"}},t._l(this.iso_template,(function(t){return e("el-option",{key:t.templateId,attrs:{label:t.name,value:t.templateId}})})),1)],1):t._e(),1===t.create_guest.type?e("el-form-item",{attrs:{label:"系统模版"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择模版"},model:{value:t.create_guest.diskTemplateId,callback:function(e){t.$set(t.create_guest,"diskTemplateId",e)},expression:"create_guest.diskTemplateId"}},t._l(this.disk_template,(function(t){return e("el-option",{key:t.templateId,attrs:{label:t.name,value:t.templateId}})})),1)],1):t._e(),2===t.create_guest.type?e("el-form-item",{attrs:{label:"快照模版"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择系统快照"},model:{value:t.create_guest.snapshotVolumeId,callback:function(e){t.$set(t.create_guest,"snapshotVolumeId",e)},expression:"create_guest.snapshotVolumeId"}},t._l(this.snapshot_template,(function(t){return e("el-option",{key:t.snapshotVolumeId,attrs:{label:t.name,value:t.snapshotVolumeId}})})),1)],1):t._e(),3===t.create_guest.type?e("el-form-item",{attrs:{label:"可用磁盘"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择系统磁盘"},model:{value:t.create_guest.volumeId,callback:function(e){t.$set(t.create_guest,"volumeId",e)},expression:"create_guest.volumeId"}},t._l(this.attach_volumes,(function(t){return e("el-option",{key:t.volumeId,attrs:{label:t.description,value:t.volumeId}})})),1)],1):t._e()],1),e("el-col",{attrs:{span:12}},[3!==t.create_guest.type?e("el-form-item",{attrs:{label:"存储池"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.create_guest.storageId,callback:function(e){t.$set(t.create_guest,"storageId",e)},expression:"create_guest.storageId"}},[e("el-option",{attrs:{label:"随机",value:0}}),t._l(this.storages,(function(t){return e("el-option",{key:t.storageId,attrs:{label:t.description,value:t.storageId}})}))],2)],1):t._e()],1)],1),e("el-row",[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"群组"}},[e("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择群组"},model:{value:t.create_guest.groupId,callback:function(e){t.$set(t.create_guest,"groupId",e)},expression:"create_guest.groupId"}},t._l(this.groups,(function(t){return e("el-option",{key:t.groupId,attrs:{label:t.groupName,value:t.groupId}})})),1)],1)],1),e("el-col",{attrs:{span:12}},[1===t.create_guest.type?e("el-form-item",{attrs:{label:"密码"}},[e("el-input",{attrs:{"show-password":!0,type:"password"},model:{value:t.create_guest.password,callback:function(e){t.$set(t.create_guest,"password",e)},expression:"create_guest.password"}})],1):t._e()],1)],1),e("el-row",[e("el-col",{attrs:{span:12}},[0===t.create_guest.type?e("el-form-item",{attrs:{label:"磁盘大小"}},[e("el-input",{model:{value:t.create_guest.size,callback:function(e){t.$set(t.create_guest,"size",e)},expression:"create_guest.size"}})],1):t._e()],1)],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.create_guest_click}},[t._v("立即创建")]),e("el-button",{on:{click:t.on_back_click}},[t._v("取消")])],1)],1)],1)],1)},ke=[];const Ie={data:function(){return{create_guest:{type:0,groupId:0,password:"",description:"",busType:"virtio",hostId:0,schemeId:"",networkId:"",networkDeviceType:"virtio",volumeType:"qcow2",isoTemplateId:"",diskTemplateId:"",snapshotVolumeId:"",volumeId:"",storageId:0,size:100},iso_template:[],attach_volumes:[],disk_template:[],storages:[],snapshot_template:[],schemes:[],hosts:[],networks:[],groups:[]}},methods:{on_back_click:function(){this.$emit("back")},load_all_attach_volumes:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.I2)().then((function(e){0===e.code&&(t.attach_volumes=e.data)}));case 2:case"end":return e.stop()}}),e)})))()},load_all_template:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.A8)().then((function(e){0===e.code&&(t.iso_template=e.data.filter((function(t){return 0==t.templateType&&2===t.status})),t.disk_template=e.data.filter((function(t){return 2==t.templateType&&2===t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},load_all_storage:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u._u)().then((function(e){0==e.code&&(t.storages=e.data.filter((function(t){return 1==t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},load_all_snapshot:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.GQ)().then((function(e){0==e.code&&(t.snapshot_template=e.data.filter((function(t){return 1==t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},load_all_networks:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.jR)().then((function(e){0===e.code&&(t.networks=e.data.filter((function(t){return 2===t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},load_all_host:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.vZ)().then((function(e){0===e.code&&(t.hosts=e.data.filter((function(t){return 1==t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},load_all_schemes:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.Pu)().then((function(e){0===e.code&&(t.schemes=e.data)}));case 2:case"end":return e.stop()}}),e)})))()},load_all_groups:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.hI)().then((function(e){0===e.code&&(t.groups=[{groupId:0,groupName:"默认"}].concat((0,we.Z)(e.data)))}));case 2:case"end":return e.stop()}}),e)})))()},init:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:t.load_all_attach_volumes(),t.load_all_host(),t.load_all_template(),t.load_all_storage(),t.load_all_schemes(),t.load_all_networks(),t.load_all_snapshot(),t.load_all_groups(),t.$refs["createForm"]&&t.$refs["createForm"].resetFields(),t.create_guest.isoTemplateId="",t.create_guest.diskTemplateId="",t.create_guest.snapshotVolumeId="",t.create_guest.password="",t.create_guest.volumeId="",t.create_guest.type=0,t.create_guest.groupId=0;case 16:case"end":return e.stop()}}),e)})))()},create_guest_click:function(){var t=this;switch(this.create_guest.type){case 0:this.create_guest.diskTemplateId=0,this.create_guest.snapshotVolumeId=0,this.create_guest.volumeId=0,this.create_guest.password="";break;case 1:this.create_guest.isoTemplateId=0,this.create_guest.snapshotVolumeId=0,this.create_guest.volumeId=0,this.create_guest.size=0;break;case 2:this.create_guest.isoTemplateId=0,this.create_guest.diskTemplateId=0,this.create_guest.volumeId=0,this.create_guest.size=0;break;case 3:this.create_guest.isoTemplateId=0,this.create_guest.diskTemplateId=0,this.create_guest.snapshotVolumeId=0,this.create_guest.size=0;break}(0,u.Az)(this.create_guest).then((function(e){0===e.code?(t.$emit("onGuestUpdate",e.data),t.$nextTick((function(){t.on_back_click()}))):t.$notify.error({title:"错误",message:"创建虚拟机失败:".concat(e.message)})}))}}},xe=Ie;var Ce=(0,g.Z)(xe,be,ke,!1,null,null,null);const $e=Ce.exports;var Se=o(50053);const Ze={name:"guestView",components:{StartGuestComponent:ve.Z,StopGuestComponent:ye.Z,GuestInfoComponent:h.Z,CreateGuestComponent:$e,AttachCdRoomComponent:Se.Z},data:function(){return{data_loading:!1,select_host_id:0,select_group_id:-1,show_type:-1,keyword:"",guests:[],storages:[],hosts:[],select_guests:[],groups:[],current_page:1,page_size:10,total_size:0}},mixins:[p.Z,c.Z],mounted:function(){this.show_type=0,this.init_view()},created:function(){this.subscribe_notify(this.$options.name,this.dispatch_notify_message),this.init_notify()},beforeDestroy:function(){this.unsubscribe_notify(this.$options.name)},computed:{show_table_guests:function(){return this.guests.filter((function(t){return void 0===t.isShow||t.isShow}))}},methods:{handleSelectionChange:function(t){this.select_guests=t},init_view:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.data_loading=!0,e.next=3,(0,u.jW)().then((function(e){0==e.code&&(t.guests=e.data,t.update_guest_show_page())}))["finally"]((function(){t.data_loading=!1}));case 3:return e.next=5,t.load_all_host();case 5:return e.next=7,t.load_all_groups();case 7:case"end":return e.stop()}}),e)})))()},load_all_host:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.vZ)().then((function(e){0===e.code&&(t.hosts=e.data.filter((function(t){return 1==t.status})))}));case 2:case"end":return e.stop()}}),e)})))()},load_all_groups:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,(0,u.hI)().then((function(e){0===e.code&&(t.groups=[{groupId:0,groupName:"默认"}].concat((0,we.Z)(e.data)))}));case 2:case"end":return e.stop()}}),e)})))()},on_key_word_change:function(){this.current_page=1,this.update_guest_show_page()},on_current_page_change:function(t){this.current_page=t,this.update_guest_show_page()},on_page_size_change:function(t){this.page_size=t,this.update_guest_show_page()},update_guest_show_page:function(){var t=this,e=0,o=this.page_size*(this.current_page-1),s=this.page_size*this.current_page;this.guests.forEach((function(n,a){var r=!0,i=t.keyword.trim().toLowerCase();""!==i&&(r=""+n.guestId===i||n.description.toLowerCase().indexOf(i)>=0||n.name.toLowerCase().indexOf(i)>=0||n.guestIp.toLowerCase().indexOf(i)>=0);var l=!0;t.select_host_id>0&&(l=n.hostId===t.select_host_id);var c=!0;t.select_group_id>-1&&(c=n.groupId===t.select_group_id),r&&l&&c?(e++,n.isShow=!(e<=o||e>s)):n.isShow=!1,t.$set(t.guests,a,n)})),this.total_size=e},update_guest_info:function(t){var e=this;return(0,l.Z)((0,i.Z)().mark((function o(){var s,n,a;return(0,i.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:s=e.select_guests.map((function(t){return t.guestId})),n=e.guests.findIndex((function(e){return e.guestId===t.guestId})),n>=0?e.$set(e.guests,n,t):1===t.type&&(a=e.page_size*(e.current_page-1),e.guests.splice(a,0,t)),e.update_guest_show_page(),e.$nextTick((function(){e.guests.forEach((function(t){s.includes(t.guestId)&&t.isShow&&e.$refs.guestTable.toggleRowSelection(t)}))}));case 5:case"end":return o.stop()}}),o)})))()},dispatch_notify_message:function(t){var e=this;1===t.type&&(0,u.c$)({guestId:t.id}).then((function(o){if(0==o.code)e.update_guest_info(o.data);else if(2000001==o.code){var s=e.select_guests.map((function(t){return t.guestId})),n=e.guests.findIndex((function(e){return e.guestId===t.id}));n>=0&&e.guests.splice(n,1),e.$nextTick((function(){e.guests.forEach((function(t){s.includes(t.guestId)&&t.isShow&&e.$refs.guestTable.toggleRowSelection(t)}))}))}}))},show_guest_list_page:function(){this.show_type=0},show_host_back:function(){this.show_type=1},show_create_guest_click:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:t.$refs.CreateGuestComponentRef.init(),t.show_type=2;case 2:case"end":return e.stop()}}),e)})))()},reboot_guest_click:function(t){var e=this;this.$confirm("重启当前虚拟机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.Qm)({guestId:t.guestId}).then((function(t){0===t.code?e.update_guest_info(t.data):e.$notify.error({title:"错误",message:"重启虚拟机失败:".concat(t.message)})}))}))["catch"]((function(){}))},detach_guest_cd_room_click:function(t){var e=this;(0,u.n4)({guestId:t.guestId}).then((function(t){0===t.code?(e.update_guest_info(t.data),e.stop_dialog_visiable=!1):e.$notify.error({title:"错误",message:"卸载虚拟机光驱失败:".concat(t.message)})}))},menu_command_click:function(t){switch(t.command){case"info":this.show_guest_info_click(t.guest);break;case"start":this.show_start_guest_click(t.guest);break;case"reboot":this.reboot_guest_click(t.guest);break;case"stop":this.show_stop_guest_click(t.guest);break;case"detach_cd":this.detach_guest_cd_room_click(t.guest);break;case"attach_cd":this.show_attach_cd_room_click(t.guest);break;case"vnc":this.vnc_click(t.guest);break;case"destroy":this.destroy_guest(t.guest);break}},show_guest_info_click:function(t){var e=this;return(0,l.Z)((0,i.Z)().mark((function o(){return(0,i.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:e.$refs.GuestInfoComponentRef.init(t),e.show_type=1;case 2:case"end":return o.stop()}}),o)})))()},show_start_guest_click:function(t){var e=this;return(0,l.Z)((0,i.Z)().mark((function o(){return(0,i.Z)().wrap((function(o){while(1)switch(o.prev=o.next){case 0:e.$refs.StartGuestComponentRef.init(t);case 1:case"end":return o.stop()}}),o)})))()},show_stop_guest_click:function(t){this.$refs.StopGuestComponentRef.init(t)},show_attach_cd_room_click:function(t){this.$refs.AttachCdRoomComponentRef.init(t)},vnc_click:function(t){var e=this.$router.resolve({path:"/Vnc",query:{id:t.guestId,description:t.description}}),o=e.href;window.open(o,"_blank")},destroy_guest:function(t){var e=this;this.$confirm("删除当前虚拟机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.yl)({guestId:t.guestId}).then((function(o){if(0===o.code){var s=e.guests.findIndex((function(e){return e.guestId===t.guestId}));s>=0&&e.guests.splice(s,1),e.show_type=0}else e.$notify.error({title:"错误",message:"删除虚拟机失败:".concat(o.message)})}))}))["catch"]((function(){}))},batch_start_guest_click:function(){var t=this;this.$confirm("启动所选虚拟机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){var e=t.select_guests.map((function(t){return t.guestId})).join(",");(0,u.go)({guestIds:e}).then((function(e){0===e.code?e.data.filter((function(e){t.update_guest_info(e)})):t.$notify.error({title:"错误",message:"批量启动虚拟机失败:".concat(e.message)})}))}))["catch"]((function(){}))},batch_stop_guest_click:function(){var t=this;this.$confirm("停止所选虚拟机, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){var e=t.select_guests.map((function(t){return t.guestId})).join(",");(0,u.is)({guestIds:e}).then((function(e){0===e.code?e.data.filter((function(e){t.update_guest_info(e)})):t.$notify.error({title:"错误",message:"批量停止虚拟机失败:".concat(e.message)})}))}))["catch"]((function(){}))}}},Te=Ze;var ze=(0,g.Z)(Te,fe,ge,!1,null,"34f52534",null);const Ne=ze.exports;var Ve=function(){var t=this,e=t._self._c;return e("div",{staticClass:"main"},[e("div",{attrs:{id:"top_bar"}},[e("div",{attrs:{id:"status"}},[t._v(t._s(t.status))]),e("div",{attrs:{id:"sendCtrlAltDelButton"},on:{click:t.on_send_ctrl_alt_del}},[t._v("发送 Ctrl+Alt+Del")])]),e("div",{attrs:{id:"screen"}})])},Re=[],qe=o(78066);const Be={name:"VncView",inject:["check_full_screen"],data:function(){return{id:0,description:"",rfb:null,url:"",status:"连接中..."}},mounted:function(){var t;this.check_full_screen(!0),this.id=this.$route.query.id,this.description=this.$route.query.description,t="https:"===window.location.protocol?"wss":"ws",this.status="正在连接[".concat(this.description,"]..."),this.url="".concat(t,"://").concat(window.location.host,"/api/vnc/").concat(this.id),this.connect()},beforeDestroy:function(){this.check_full_screen(!1)},methods:{connect:function(){var t=this;(0,u.z2)({guestId:this.id}).then((function(e){0===e.code&&(t.rfb=new qe.Z(document.getElementById("screen"),t.url,{credentials:{password:e.data}}),t.rfb.addEventListener("connect",t.on_connect_success),t.rfb.addEventListener("disconnect",t.on_disconnect),t.rfb.addEventListener("credentialsrequired",t.on_required_password),t.rfb.scaleViewport=!1,t.rfb.resizeSession=!1)}))},on_connect_success:function(){this.status="连接成功[".concat(this.description,"]")},on_disconnect:function(t){this.status="远程连接已断开[".concat(this.description,"]"),t.detail.clean&&(this.status="正在重新连接[".concat(this.description,"]..."),this.connect())},on_required_password:function(){var t=this;(0,u.z2)({guestId:this.id}).then((function(e){0===e.code&&e.data&&t.rfb.sendCredentials({password:e.data})}))},on_send_ctrl_alt_del:function(){this.rfb.sendCtrlAltDel(),this.rfb.focus()},sendKey:function(t,e,o){this.rfb.sendKey(t,e,o),this.rfb.focus()}}},Pe=Be;var Ge=(0,g.Z)(Pe,Ve,Re,!1,null,"2e7ccac2",null);const Ue=Ge.exports;var Me=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{staticClass:"box-card"},[e("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[e("span",[t._v("系统汇总")])]),e("el-row",{attrs:{gutter:20}},[e("el-col",{attrs:{span:4}},[e("div",[e("el-statistic",{attrs:{"group-separator":",",value:this.networks.length,title:"网络数量"}})],1)]),e("el-col",{attrs:{span:4}},[e("div",[e("el-statistic",{attrs:{"group-separator":",",value:this.storages.length,title:"存储池数量"}})],1)]),e("el-col",{attrs:{span:4}},[e("div",[e("el-statistic",{attrs:{"group-separator":",",value:this.hosts.length,title:"主机数量"}})],1)]),e("el-col",{attrs:{span:4}},[e("div",[e("el-statistic",{attrs:{"group-separator":",",value:this.guests.length,title:"虚拟机数量"}},[e("template",{slot:"formatter"},[t._v(t._s(t.get_runing_guest_number())+" /"+t._s(this.guests.length))])],2)],1)]),e("el-col",{attrs:{span:4}},[e("div",[e("el-statistic",{attrs:{"group-separator":",",value:this.volumes.length,title:"磁盘数量"}})],1)])],1),e("el-divider"),e("el-card",[e("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[e("span",[t._v("主机信息")])]),e("div",{staticClass:"component"},[e("div",[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"已使用:"+t.get_allocat_cpu()+"核 / 总共:"+t.get_total_cpu()+"核",placement:"top"}},[e("el-progress",{attrs:{format:t.get_cpu_progress_title,type:"circle",percentage:t.totalCpuPercentage,color:"#67C23A"}})],1)],1),e("div",[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"已使用:"+t.get_memory_desplay(t.get_allocat_memory())+" / 总共:"+t.get_memory_desplay(t.get_total_memory()),placement:"top"}},[e("el-progress",{attrs:{format:t.get_memory_progress_title,type:"circle",percentage:t.totalMemoryePercentage,color:"#67C23A"}})],1)],1),e("div",[e("el-table",{staticStyle:{width:"100%"},attrs:{data:t.hosts}},[e("el-table-column",{attrs:{label:"名称",prop:"displayName","max-width":"200","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"主机IP",prop:"hostIp",width:"150","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"CPU","max-width":"150"},scopedSlots:t._u([{key:"default",fn:function(t){return[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"已使用:"+t.row.allocationCpu+"核 / 总共:"+t.row.totalCpu+"核",placement:"top"}},[e("el-progress",{attrs:{color:"#67C23A",percentage:t.row.totalCpu<=0?0:Math.floor(100*t.row.allocationCpu/t.row.totalCpu)}})],1)]}}])}),e("el-table-column",{attrs:{label:"内存","max-width":"150"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"已使用:"+t.get_memory_desplay(o.row.allocationMemory)+" / 总共:"+t.get_memory_desplay(o.row.totalMemory),placement:"top"}},[e("el-progress",{attrs:{color:"#67C23A",percentage:o.row.totalMemory<=0?0:Math.floor(100*o.row.allocationMemory/o.row.totalMemory)}})],1)]}}])}),e("el-table-column")],1)],1)])]),e("el-divider"),e("el-card",[e("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[e("span",[t._v("存储池")])]),e("div",{staticClass:"storage_component"},[e("div",[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"已用:"+t.get_storage_desplay(t.get_allocat_storage())+" / 总共:"+t.get_storage_desplay(t.get_total_capacity()),placement:"top"}},[e("el-progress",{attrs:{type:"circle",format:t.get_storage_progress_title,percentage:t.totalStoragePercentage,color:"#67C23A"}})],1)],1),e("div",[e("el-table",{attrs:{data:t.storages}},[e("el-table-column",{attrs:{label:"名称",prop:"description","max-width":"200","show-overflow-tooltip":""}}),e("el-table-column",{attrs:{label:"类型",prop:"type",width:"120"}}),e("el-table-column",{attrs:{label:"容量",prop:"capacity",width:"150"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"已用:"+t.get_storage_desplay(o.row.allocation)+" / 总共:"+t.get_storage_desplay(o.row.capacity),placement:"top"}},[e("el-progress",{attrs:{color:"#67C23A",percentage:o.row.capacity<=0?0:Math.floor(100*o.row.allocation/o.row.capacity)}})],1)]}}])}),e("el-table-column")],1)],1)])])],1)],1)],1)],1)},De=[];o(91058),o(56977);const Fe={name:"guestView",components:{},data:function(){return{hosts:[],networks:[],storages:[],volumes:[],guests:[],totalStoragePercentage:0,totalCpuPercentage:0,totalMemoryePercentage:0}},mounted:function(){this.init_data()},methods:{init_data:function(){var t=this;(0,u.vZ)().then((function(e){0===e.code&&(t.hosts=e.data,t.totalCpuPercentage=t.get_total_cpu()<=0?0:Math.floor(100*t.get_allocat_cpu()/t.get_total_cpu()),t.totalMemoryePercentage=t.get_total_memory()<=0?0:Math.floor(100*t.get_allocat_memory()/t.get_total_memory()))})),(0,u.jR)().then((function(e){0===e.code&&(t.networks=e.data)})),(0,u._u)().then((function(e){0===e.code&&(t.storages=e.data)})),(0,u.Mm)().then((function(e){0===e.code&&(t.volumes=e.data)})),(0,u.Xj)().then((function(e){0===e.code&&(t.guests=e.data)})),(0,u._u)().then((function(e){0===e.code&&(t.storages=e.data,t.totalStoragePercentage=t.get_total_capacity()<=0?0:parseInt(100*t.get_allocat_storage()/t.get_total_capacity()))}))},get_runing_guest_number:function(){return this.guests.filter((function(t){return 2===t.status})).length},get_storage_desplay:function(t){return t>1099511627776?(t/1099511627776).toFixed(2)+" TB":t>1073741824?(t/1073741824).toFixed(2)+" GB":t>1048576?(t/1048576).toFixed(2)+" MB":t>1024?(t/1024).toFixed(2)+" KB":t+" bytes"},get_memory_desplay:function(t){return t>1048576?(t/1048576).toFixed(2)+" GB":t>1024?(t/1024).toFixed(2)+" MB":void 0},get_total_memory:function(){var t=0;return this.hosts.forEach((function(e){return t+=e.totalMemory})),t},get_allocat_memory:function(){var t=0;return this.hosts.forEach((function(e){return t+=e.allocationMemory})),t},get_total_cpu:function(){var t=0;return this.hosts.forEach((function(e){return t+=e.totalCpu})),t},get_allocat_cpu:function(){var t=0;return this.hosts.forEach((function(e){return t+=e.allocationCpu})),t},locat_cpu:function(){var t=0;return this.hosts.forEach((function(e){return t+=e.allocationCpu})),t},get_total_capacity:function(){var t=0;return this.storages.forEach((function(e){return t+=e.capacity})),t},get_allocat_storage:function(){var t=0;return this.storages.forEach((function(e){return t+=e.allocation})),t},get_cpu_progress_title:function(t){return"总内核:"+t+"%"},get_memory_progress_title:function(t){return"总内存:"+t+"%"},get_storage_progress_title:function(t){return"总存储:"+t+"%"}}},Ee=Fe;var Oe=(0,g.Z)(Ee,Me,De,!1,null,"b397a494",null);const Ae=Oe.exports;var Le=function(){var t=this,e=t._self._c;return e("div",[e("el-container",[e("el-main",[e("el-card",{directives:[{name:"show",rawName:"v-show",value:0===this.show_type,expression:"this.show_type === 0"}],staticClass:"box-card"},[e("el-row",{staticClass:"clearfix",staticStyle:{height:"20px"},attrs:{slot:"header"},slot:"header"},[e("el-button",{staticStyle:{float:"left",padding:"3px 0"},attrs:{type:"text"},on:{click:t.show_create_user_click}},[t._v("注册用户")])],1),e("el-row",[e("el-table",{staticStyle:{width:"100%"},attrs:{"v-loading":t.data_loading,data:t.users}},[e("el-table-column",{attrs:{label:"ID",prop:"userId",width:"80"}}),e("el-table-column",{attrs:{label:"用户名",prop:"loginName",width:"200"}}),e("el-table-column",{attrs:{label:"状态",prop:"state",width:"180"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-tag",{attrs:{type:0===o.row.state?"success":"danger"}},[t._v(t._s(0===o.row.state?"启用":"禁用"))])]}}])}),e("el-table-column",{attrs:{label:"操作"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"",size:"mini"},on:{click:function(e){return t.show_reset_password_click(o.row)}}},[t._v("重置密码")]),1===o.row.state?e("el-button",{attrs:{type:"success",size:"mini"},on:{click:function(e){return t.update_user_state_click(o.row,0)}}},[t._v("启用")]):t._e(),0===o.row.state?e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.update_user_state_click(o.row,1)}}},[t._v("禁用")]):t._e(),e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t.destroy_user_click(o.row)}}},[t._v("删除")])]}}])})],1)],1)],1),e("el-card",{directives:[{name:"show",rawName:"v-show",value:1===this.show_type,expression:"this.show_type === 1"}],staticClass:"box-card"},[e("el-row",{attrs:{slot:"header"},slot:"header"},[e("el-page-header",{staticStyle:{color:"#409eff"},attrs:{content:"注册用户"},on:{back:function(e){return t.show_user_list()}}})],1),e("el-row",[e("el-form",{ref:"createForm",staticClass:"demo-ruleForm",attrs:{model:t.create_user,"label-width":"100px"}},[e("el-form-item",{attrs:{label:"登录名",prop:"loginName"}},[e("el-input",{model:{value:t.create_user.loginName,callback:function(e){t.$set(t.create_user,"loginName",e)},expression:"create_user.loginName"}})],1),e("el-form-item",{attrs:{label:"密码",prop:"password"}},[e("el-input",{attrs:{"show-password":""},model:{value:t.create_user.password,callback:function(e){t.$set(t.create_user,"password",e)},expression:"create_user.password"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.on_create_user_click}},[t._v("注册")]),e("el-button",{on:{click:t.show_user_list}},[t._v("取消")])],1)],1)],1)],1),e("el-dialog",{attrs:{title:"重置密码",visible:t.reset_passwor_dialog_visiable,width:"300px"},on:{"update:visible":function(e){t.reset_passwor_dialog_visiable=e}}},[e("el-form",{ref:"resetPasswordForm",attrs:{model:t.reset_password_user,"label-width":"60px"}},[e("el-form-item",{attrs:{label:"密码"}},[e("el-input",{attrs:{placeholder:"请输入密码","show-password":""},model:{value:t.reset_password_user.password,callback:function(e){t.$set(t.reset_password_user,"password",e)},expression:"reset_password_user.password"}})],1)],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:function(e){t.reset_passwor_dialog_visiable=!1}}},[t._v("取 消")]),e("el-button",{attrs:{type:"primary"},on:{click:t.on_reset_password_click}},[t._v("确 定")])],1)],1)],1)],1)],1)},je=[];const He={name:"userView",components:{},data:function(){return{data_loading:!1,current_loading:!1,reset_passwor_dialog_visiable:!1,show_type:0,create_user:{loginName:"",password:""},reset_password_user:{userId:0,password:""},users:[]}},mounted:function(){this.init_view(),this.show_type=0},methods:{init_view:function(){var t=this;return(0,l.Z)((0,i.Z)().mark((function e(){return(0,i.Z)().wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.data_loading=!0,e.next=3,(0,u.lE)().then((function(e){0==e.code&&(t.users=e.data)}))["finally"]((function(){t.data_loading=!1}));case 3:case"end":return e.stop()}}),e)})))()},show_user_list:function(){this.show_type=0},show_create_user_click:function(){this.$refs["createForm"]&&this.$refs["createForm"].resetFields(),this.show_type=1},show_reset_password_click:function(t){this.$refs["resetPasswordForm"]&&this.$refs["resetPasswordForm"].resetFields(),this.reset_password_user.userId=t.userId,this.reset_password_user.password="",this.reset_passwor_dialog_visiable=!0},update_user_info:function(t){var e=this.users.findIndex((function(e){return e.userId===t.userId}));e>=0?this.$set(this.users,e,t):this.users.push(t),this.show_user&&this.show_user.userId===t.userId&&(this.show_user=t)},on_create_user_click:function(){var t=this;(0,u.a$)(this.create_user).then((function(e){0===e.code?(t.update_user_info(e.data),t.show_type=0):t.$notify.error({title:"错误",message:"注册用户失败:".concat(e.message)})}))},on_reset_password_click:function(){var t=this;this.$confirm("重置密码, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.h8)(t.reset_password_user).then((function(e){0===e.code?(t.update_user_info(e.data),t.reset_passwor_dialog_visiable=!1):t.$notify.error({title:"错误",message:"重置密码失败:".concat(e.message)})}))}))["catch"]((function(){}))},update_user_state_click:function(t,e){var o=this,s=0===e?"启用用户":"禁用用户";this.$confirm("".concat(s,", 是否继续?"),"提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.eV)({userId:t.userId,state:e}).then((function(t){0===t.code?o.update_user_info(t.data):o.$notify.error({title:"错误",message:"".concat(s,"失败:").concat(t.message)})}))}))["catch"]((function(){}))},destroy_user_click:function(t){var e=this;this.$confirm("删除用户, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){(0,u.GE)({userId:t.userId}).then((function(o){if(0===o.code){var s=e.users.findIndex((function(e){return e.userId===t.userId}));s>=0&&e.users.splice(s,1)}else e.$notify.error({title:"错误",message:"删除用户失败:".concat(o.message)})}))}))["catch"]((function(){}))}}},Xe=He;var Qe=(0,g.Z)(Xe,Le,je,!1,null,"3724222a",null);const Ke=Qe.exports;var Je=function(){var t=this,e=t._self._c;return e("div",{staticClass:"login-container",attrs:{id:"main"}},["Login"!==t.show_type||this.oauth.enalbe?t._e():e("el-form",{ref:"ruleForm2",staticClass:"demo-ruleForm login-page",attrs:{"label-position":"left","label-width":"0px","status-icon":""}},[e("h3",{staticClass:"title"},[t._v("KVM Cloud Login")]),e("el-form-item",{attrs:{prop:"username"}},[e("el-input",{attrs:{"auto-complete":"off",autofocus:"true",placeholder:"用户名","prefix-icon":"el-icon-s-custom",type:"text"},model:{value:t.loginData.loginName,callback:function(e){t.$set(t.loginData,"loginName",e)},expression:"loginData.loginName"}})],1),e("el-form-item",{attrs:{prop:"password"}},[e("el-input",{attrs:{"show-password":!0,"auto-complete":"off",placeholder:"密码","prefix-icon":"el-icon-lock",type:"password"},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.login.apply(null,arguments)}},model:{value:t.loginData.password,callback:function(e){t.$set(t.loginData,"password",e)},expression:"loginData.password"}})],1),e("el-form-item",{staticStyle:{width:"100%"}},[e("el-button",{staticStyle:{width:"100%"},attrs:{disabled:""==t.loginData.loginName||""==t.loginData.password,loading:t.loading,type:"primary"},on:{click:t.login}},[t._v("登录")])],1)],1),"Loading"===t.show_type?e("el-form",{staticClass:"login-page",attrs:{"label-position":"left","label-width":"0px","status-icon":""}},[e("div",{staticClass:"title"},[t._v(t._s(this.oauth.title))]),e("div",{directives:[{name:"loading",rawName:"v-loading",value:!0,expression:"true"}],staticStyle:{height:"80px","font-size":"30px","margin-bottom":"10px"},attrs:{"element-loading-spinner":"el-icon-loading","element-loading-text":"正在登录,请稍后..."}})]):t._e(),"Error"===t.show_type?e("el-form",{staticClass:"login-page",attrs:{"label-position":"left","label-width":"0px","status-icon":""}},[e("div",{staticClass:"title"},[t._v(t._s(this.oauth.title))]),e("div",[e("strong",{staticStyle:{color:"red"}},[t._v(t._s(this.errorMessage))])]),e("div",{staticClass:"register"},[e("el-link",{attrs:{type:"primary"},on:{click:function(e){return t.go_login()}}},[t._v("重新登录")])],1)]):t._e()],1)},We=[];const Ye={name:"loginView",inject:["check_full_screen"],data:function(){return{loginData:{loginName:"",password:""},oauth:{enable:!1,title:" Oauth2 登录"},show_type:"",errorMessage:"",loading:!1}},mounted:function(){var t=this;this.check_full_screen(!0),(0,u.kH)().then((function(e){if(0===e.code)if(e.data.oauth&&(t.oauth.title=e.data.oauth.title,t.oauth.enable=e.data.oauth.enable),t.oauth.enable){var o=t.$route.query.code;o&&""!==o?(0,u.rd)({code:o}).then((function(e){if(0!==e.code)t.errorMessage="登录失败,服务器返回如下:\r\n".concat(e.message),t.show_type="Error";else{localStorage.setItem("X-Token",e.data.token);var o=localStorage.getItem("X-Back");localStorage.removeItem("X-Back"),o?window.location.href=o:t.$router.push({path:"/"})}})):t.go_login()}else t.show_type="Login";else t.show_type="Login"}))},beforeDestroy:function(){this.check_full_screen(!1)},methods:{login:function(){var t=this;this.loading=!0,(0,u.kI)({loginName:this.loginData.loginName}).then((function(e){if(0===e.code){var o=window.sha256_digest(window.sha256_digest(t.loginData.password+":"+e.data.signature)+":"+e.data.nonce);(0,u.pH)({loginName:t.loginData.loginName,password:o,nonce:e.data.nonce}).then((function(e){if(0===e.code){localStorage.setItem("X-Token",e.data.token);var o=localStorage.getItem("X-Back");localStorage.removeItem("X-Back"),o?window.location.href=o:t.$router.push({path:"/"})}else t.$notify.error({title:"错误",duration:3e3,message:"登录失败:".concat(e.message)})}))["finally"]((function(){t.loading=!1}))}else t.$notify.error({title:"错误",duration:3e3,message:"登录失败:".concat(e.message)})}))["finally"]((function(){t.loading=!1}))},go_login:function(){window.location.href="/login"},show_login:function(){this.show_type="Login"}}},to=Ye;var eo=(0,g.Z)(to,Je,We,!1,null,"da6fbb2c",null);const oo=eo.exports;s["default"].use(n.ZP);var so=[{path:"/",name:"Home",component:Ae},{path:"/Vnc",name:"Vnc",component:Ue},{path:"/Guest",name:"Guest",component:Ne},{path:"/Network",name:"Network",component:T},{path:"/Host",name:"Host",component:E},{path:"/Storage",name:"Storage",component:et},{path:"/Template",name:"Template",component:it},{path:"/Snapshot",name:"Snapshot",component:pt},{path:"/Volume",name:"Volume",component:Vt},{path:"/Scheme",name:"Scheme",component:Jt},{path:"/Group",name:"Group",component:me},{path:"/User",name:"User",component:Ke},{path:"/Login",name:"Login",component:oo}],no=new n.ZP({routes:so});const ao=no},66949:(t,e,o)=>{"use strict";t.exports=o.p+"img/logo.047618b0.png"},24654:()=>{}},e={};function o(s){var n=e[s];if(void 0!==n)return n.exports;var a=e[s]={id:s,loaded:!1,exports:{}};return t[s].call(a.exports,a,a.exports,o),a.loaded=!0,a.exports}o.m=t,(()=>{o.amdO={}})(),(()=>{var t=[];o.O=(e,s,n,a)=>{if(!s){var r=1/0;for(u=0;u=a)&&Object.keys(o.O).every((t=>o.O[t](s[l])))?s.splice(l--,1):(i=!1,a0&&t[u-1][2]>a;u--)t[u]=t[u-1];t[u]=[s,n,a]}})(),(()=>{o.n=t=>{var e=t&&t.__esModule?()=>t["default"]:()=>t;return o.d(e,{a:e}),e}})(),(()=>{o.d=(t,e)=>{for(var s in e)o.o(e,s)&&!o.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})}})(),(()=>{o.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}()})(),(()=>{o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)})(),(()=>{o.r=t=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}})(),(()=>{o.nmd=t=>(t.paths=[],t.children||(t.children=[]),t)})(),(()=>{o.p="/"})(),(()=>{var t={143:0};o.O.j=e=>0===t[e];var e=(e,s)=>{var n,a,[r,i,l]=s,c=0;if(r.some((e=>0!==t[e]))){for(n in i)o.o(i,n)&&(o.m[n]=i[n]);if(l)var u=l(o)}for(e&&e(s);co(19013)));s=o.O(s)})(); \ No newline at end of file diff --git a/web/src/views/NavView.vue b/web/src/views/NavView.vue index 93486106069ab63713b58f14265180800e2f86b5..5fdf8056102336e774756ee176f9d726ed751728 100644 --- a/web/src/views/NavView.vue +++ b/web/src/views/NavView.vue @@ -21,13 +21,13 @@ export default { nav_menu_data: [ { path: '/', title: '主页', icon: 'el-icon-house' }, { path: '/Guest', title: '虚拟机管理', icon: 'el-icon-s-platform' }, - { path: '/Volume', title: '磁盘管理', icon: 'el-icon-bank-card' }, - { path: '/Snapshot', title: '快照管理', icon: 'el-icon-copy-document' }, - { path: '/Network', title: '网络管理', icon: 'el-icon-platform-eleme' }, { path: '/Host', title: '主机管理', icon: 'el-icon-monitor' }, + { path: '/Network', title: '网络管理', icon: 'el-icon-platform-eleme' }, { path: '/Storage', title: '存储池管理', icon: 'el-icon-coin' }, { path: '/Template', title: '模版管理', icon: 'el-icon-price-tag' }, { path: '/Scheme', title: '计算方案', icon: 'el-icon-cpu' }, + { path: '/Volume', title: '磁盘管理', icon: 'el-icon-bank-card' }, + { path: '/Snapshot', title: '快照管理', icon: 'el-icon-copy-document' }, { path: '/Group', title: '群组管理', icon: 'el-icon-folder' }, { path: '/User', title: '用户管理', icon: 'el-icon-s-custom' } ]