application containers often don't have a functional shell (since it runs directly, without init) so try to detect and warn the users in the inline console.
The detection heuristic is: * cmode is 'console' * entrypiont is not '/sbin/init' Those values are not the (lxc) default and should cover most application containers. Since we change the layout a bit, focus the actual iframe component, not the panel. Signed-off-by: Dominik Csapak <[email protected]> --- www/manager6/VNCConsole.js | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/www/manager6/VNCConsole.js b/www/manager6/VNCConsole.js index e4f22cf9..399ed55f 100644 --- a/www/manager6/VNCConsole.js +++ b/www/manager6/VNCConsole.js @@ -29,11 +29,25 @@ Ext.define('PVE.noVncConsole', { // always use same iframe, to avoid running several noVnc clients // at same time (to avoid performance problems) - var box = Ext.create('Ext.ux.IFrame', { itemid: 'vncconsole' }); + var box = Ext.create('Ext.ux.IFrame', { itemid: 'vncconsole', flex: 1 }); + + let warning = Ext.create('Ext.Component', { + userCls: 'pmx-hint', + padding: 5, + hidden: true, + style: { + 'text-align': 'center', + }, + html: gettext('Application Container detected - console might not be functional.'), + }); var type = me.xtermjs ? 'xtermjs' : 'novnc'; Ext.apply(me, { - items: box, + layout: { + type: 'vbox', + align: 'stretch', + }, + items: [warning, box], listeners: { activate: function () { let sp = Ext.state.Manager.getProvider(); @@ -58,8 +72,24 @@ Ext.define('PVE.noVncConsole', { me.callParent(); + // check for app container + if (me.consoleType === 'lxc') { + Proxmox.Utils.API2Request({ + url: `/nodes/${me.nodename}/lxc/${me.vmid}/config`, + success: function (response) { + let consoleMode = response?.result?.data?.cmode; + let entryPoint = response?.result?.data?.entrypoint; + let customEntryPoint = entryPoint !== undefined && entryPoint !== '/sbin/init'; + + if (customEntryPoint && consoleMode === 'console') { + warning.setVisible(true); + } + }, + }); + } + me.on('afterrender', function () { - me.focus(); + box.focus(); }); }, -- 2.47.3 _______________________________________________ pve-devel mailing list [email protected] https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
