layout: 'fit',
border: false,
-
+
initComponent : function() {
var me = this;
if (!me.vmid && me.consoleType !== 'shell') {
throw "no VM ID specified";
}
-
+
// always use same iframe, to avoid running several noVnc clients
// at same time (to avoid performance problems)
var box = Ext.create('Ext.ux.IFrame', { id : "vncconsole" });
box.load(url);
}
}
- });
+ });
me.callParent();
}
Ext.define('PVE.VNCConsole', {
extend: 'Ext.panel.Panel',
- alias: ['widget.pveVNCConsole'],
+ alias: 'widget.pveVNCConsole',
last_novnc_state: undefined,
last_novnc_msg: undefined,
detectMigratedVM: function() {
var me = this;
-
+
if (!me.vmid) {
return;
}
var novnc_msg = innerDoc.getElementById('noVNC_status_msg').innerHTML;
if (novnc_state !== me.last_novnc_state || novnc_msg !== me.last_novnc_msg) {
- me.last_novnc_state = novnc_state;
- me.last_novnc_msg = novnc_msg;
+ me.last_novnc_state = novnc_state;
+ me.last_novnc_msg = novnc_msg;
if (novnc_state !== 'normal') {
PVE.Utils.setErrorMask(box, novnc_msg || 'unknown');
if (window.innerHeight) {
oh = window.innerHeight;
ow = window.innerWidth;
- } else if (document.documentElement &&
+ } else if (document.documentElement &&
document.documentElement.clientHeight) {
oh = document.documentElement.clientHeight;
ow = document.documentElement.clientWidth;
Ext.define('PVE.KVMConsole', {
extend: 'PVE.VNCConsole',
- alias: ['widget.pveKVMConsole'],
+ alias: 'widget.pveKVMConsole',
initComponent : function() {
var me = this;
-
- if (!me.nodename) {
+
+ if (!me.nodename) {
throw "no node name specified";
}
});
};
- var tbar = [
- {
+ var tbar = [
+ {
text: gettext('Start'),
- handler: function() {
+ handler: function() {
vm_command("start", {}, 1);
}
},
- {
+ {
text: gettext('Shutdown'),
handler: function() {
var msg = Ext.String.format(gettext("Do you really want to shutdown VM {0}?"), me.vmid);
}
vm_command('shutdown');
});
- }
- },
- {
+ }
+ },
+ {
text: gettext('Stop'),
handler: function() {
var msg = Ext.String.format(gettext("Do you really want to stop VM {0}?"), me.vmid);
return;
}
vm_command("stop");
- });
+ });
}
},
- {
+ {
xtype: 'pveQemuSendKeyMenu',
nodename: me.nodename,
vmid: me.vmid
},
- {
+ {
text: gettext('Reset'),
- handler: function() {
+ handler: function() {
var msg = Ext.String.format(gettext("Do you really want to reset VM {0}?"), me.vmid);
Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
if (btn !== 'yes') {
});
}
},
- {
+ {
text: gettext('Suspend'),
handler: function() {
var msg = Ext.String.format(gettext("Do you really want to suspend VM {0}?"), me.vmid);
return;
}
vm_command("suspend");
- });
+ });
}
},
- {
+ {
text: gettext('Resume'),
handler: function() {
- vm_command("resume");
+ vm_command("resume");
}
},
// Note: no migrate here, because we can't display migrate log
- {
+ {
text: gettext('Console'),
handler: function() {
PVE.Utils.openVNCViewer('kvm', me.vmid, me.nodename, me.vmname);
'->',
{
text: gettext('Reload'),
- handler: function () {
- me.reloadApplet();
+ handler: function () {
+ me.reloadApplet();
}
}
];
-
Ext.apply(me, {
tbar: tbar,
url: baseUrl + "/vncproxy",
Ext.define('PVE.LxcConsole', {
extend: 'PVE.VNCConsole',
- alias: ['widget.pveLxcConsole'],
+ alias: 'widget.pveLxcConsole',
initComponent : function() {
var me = this;
-
- if (!me.nodename) {
+
+ if (!me.nodename) {
throw "no node name specified";
}
}
var baseUrl = "/nodes/" + me.nodename + "/lxc/" + me.vmid;
-
+
var vm_command = function(cmd, params, reload_applet) {
PVE.Utils.API2Request({
params: params,
});
};
- var tbar = [
- {
+ var tbar = [
+ {
text: gettext('Start'),
- handler: function() {
+ handler: function() {
vm_command("start");
}
},
- {
+ {
text: gettext('Shutdown'),
handler: function() {
var msg = Ext.String.format(gettext("Do you really want to shutdown VM {0}?"), me.vmid);
return;
}
vm_command("shutdown");
- });
+ });
}
},
- {
+ {
text: gettext('Stop'),
handler: function() {
var msg = Ext.String.format(gettext("Do you really want to stop VM {0}?"), me.vmid);
return;
}
vm_command("stop");
- });
+ });
}
},
// Note: no migrate here, because we can't display migrate log
'->',
{
text: gettext('Reload'),
- handler: function () {
- me.reloadApplet();
+ handler: function () {
+ me.reloadApplet();
}
}
];
Ext.define('PVE.Shell', {
extend: 'PVE.VNCConsole',
- alias: ['widget.pveShell'],
+ alias: 'widget.pveShell',
ugradeSystem: false, // set to true to run "apt-get dist-upgrade"
initComponent : function() {
var me = this;
-
- if (!me.nodename) {
+
+ if (!me.nodename) {
throw "no node name specified";
}
});
}
- tbar.push({
+ tbar.push({
text: gettext('Shell'),
handler: function() {
PVE.Utils.openVNCViewer('shell', undefined, me.nodename, undefined);
});
if (me.ugradeSystem) {
- me.params = { upgrade: 1 };
+ me.params = { upgrade: 1 };
}
me.callParent();