Commit 7de32878 authored by Dietmar Maurer's avatar Dietmar Maurer

implemement PVE.OpenVZConsole

We now have fully functional openvz vnc console.
parent cfce32a1
...@@ -337,6 +337,107 @@ Ext.define('PVE.KVMConsole', { ...@@ -337,6 +337,107 @@ Ext.define('PVE.KVMConsole', {
} }
}); });
Ext.define('PVE.OpenVZConsole', {
extend: 'PVE.VNCConsole',
alias: ['widget.pveOpenVZConsole'],
initComponent : function() {
var me = this;
if (!me.nodename) {
throw "no node name specified";
}
if (!me.vmid) {
throw "no VM ID specified";
}
var vm_command = function(cmd, params, reload_applet) {
PVE.Utils.API2Request({
params: params,
url: '/nodes/' + me.nodename + '/openvz/' + me.vmid + "/status/" + cmd,
waitMsgTarget: me,
method: 'POST',
failure: function(response, opts) {
Ext.Msg.alert('Error', response.htmlStatus);
},
success: function() {
if (reload_applet) {
Ext.Function.defer(me.reloadApplet, 1000, me);
}
}
});
};
var tbar = [
{
text: 'Start',
handler: function() {
vm_command("start", {}, 1);
}
},
{
text: 'Stop',
handler: function() {
var msg = "Do you really want to stop the VM?";
Ext.Msg.confirm('Confirm', msg, function(btn) {
if (btn !== 'yes') {
return;
}
vm_command("stop", { fast: 1 });
});
}
},
{
text: 'Shutdown',
handler: function() {
var msg = "Do you really want to shutdown the VM?";
Ext.Msg.confirm('Confirm', msg, function(btn) {
if (btn !== 'yes') {
return;
}
vm_command("stop");
});
}
},
'->',
{
text: 'Refresh',
handler: function() {
var applet = Ext.getDom(me.appletID);
applet.sendRefreshRequest();
}
},
{
text: 'Reload',
handler: function () {
me.reloadApplet();
}
},
{
text: 'Console',
handler: function() {
var url = Ext.urlEncode({
console: 'openvz',
vmid: me.vmid,
node: me.nodename
});
var nw = window.open("?" + url, '_blank',
"innerWidth=745,innerheight=427");
nw.focus();
}
}
];
Ext.apply(me, {
tbar: tbar,
url: "/nodes/" + me.nodename + "/openvz/" + me.vmid + "/vncproxy"
});
me.callParent();
}
});
Ext.define('PVE.Shell', { Ext.define('PVE.Shell', {
extend: 'PVE.VNCConsole', extend: 'PVE.VNCConsole',
alias: ['widget.pveShell'], alias: ['widget.pveShell'],
......
...@@ -125,6 +125,14 @@ Ext.define('PVE.ConsoleWorkspace', { ...@@ -125,6 +125,14 @@ Ext.define('PVE.ConsoleWorkspace', {
nodename: param.node, nodename: param.node,
toplevel: true toplevel: true
}; };
} else if (consoleType === 'openvz') {
me.title = "CT " + param.vmid;
content = {
xtype: 'pveOpenVZConsole',
vmid: param.vmid,
nodename: param.node,
toplevel: true
};
} else if (consoleType === 'shell') { } else if (consoleType === 'shell') {
me.title = "node " + param.node + " - Proxmox Shell"; me.title = "node " + param.node + " - Proxmox Shell";
content = { content = {
......
...@@ -33,11 +33,11 @@ Ext.define('PVE.openvz.Config', { ...@@ -33,11 +33,11 @@ Ext.define('PVE.openvz.Config', {
html: 'OpenVZ options - not inplemented!' html: 'OpenVZ options - not inplemented!'
}, },
{ {
xtype: 'pveOpenVZConsole',
title: 'Console', title: 'Console',
itemId: 'console', itemId: 'console',
nodename: nodename, nodename: nodename,
vmid: vmid, vmid: vmid
html: 'OpenVZ console - not inplemented!'
}, },
{ {
title: 'Backup', title: 'Backup',
......
...@@ -102,7 +102,7 @@ Ext.define('PVE.openvz.Summary', { ...@@ -102,7 +102,7 @@ Ext.define('PVE.openvz.Summary', {
text: 'Console', text: 'Console',
handler: function() { handler: function() {
var url = Ext.urlEncode({ var url = Ext.urlEncode({
console: 'kvm', console: 'openvz',
vmid: vmid, vmid: vmid,
node: nodename node: nodename
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment