From 6da2926cbc68a7d69413f9724dec8c8b5a7e6de0 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Sat, 24 Apr 2021 15:18:41 +0200 Subject: [PATCH] ui: CT restore: make privilege level a tri-state radio group Default to keeping the state of the archive, as that has the highest chance to fully work, but allow to enforce either level. It'd be good to add some more feedback of the to be restored guest, i.e., the whole config.. Signed-off-by: Thomas Lamprecht --- www/manager6/window/Restore.js | 52 +++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/www/manager6/window/Restore.js b/www/manager6/window/Restore.js index e30956b0..b63135e9 100644 --- a/www/manager6/window/Restore.js +++ b/www/manager6/window/Restore.js @@ -109,12 +109,48 @@ Ext.define('PVE.window.Restore', { ]; if (me.vmtype === 'lxc') { - items.push({ - xtype: 'proxmoxcheckbox', - name: 'unprivileged', - value: true, - fieldLabel: gettext('Unprivileged container'), - }); + items.push( + { + xtype: 'radiogroup', + fieldLabel: gettext('Privilege Level'), + reference: 'noVNCScalingGroup', + height: '15px', // renders faster with value assigned + layout: { + type: 'hbox', + algin: 'stretch', + }, + autoEl: { + tag: 'div', + 'data-qtip': + gettext('Choose if you want to keep or override the privilege level of the restored Container.'), + }, + items: [ + { + xtype: 'radiofield', + name: 'unprivileged', + inputValue: 'keep', + boxLabel: gettext('From Backup'), + flex: 1, + checked: true, + }, + { + xtype: 'radiofield', + name: 'unprivileged', + inputValue: '1', + boxLabel: gettext('Unprivileged'), + flex: 1, + }, + { + xtype: 'radiofield', + name: 'unprivileged', + inputValue: '0', + boxLabel: gettext('Privileged'), + flex: 1, + //margin: '0 0 0 10', + }, + ], + }, + ); } else if (me.vmtype === 'qemu') { items.push({ xtype: 'proxmoxcheckbox', @@ -194,7 +230,9 @@ Ext.define('PVE.window.Restore', { url = '/nodes/' + me.nodename + '/lxc'; params.ostemplate = me.volid; params.restore = 1; - if (values.unprivileged) { params.unprivileged = 1; } + if (values.unprivileged !== 'keep') { + params.unprivileged = values.unprivileged; + } msg = Proxmox.Utils.format_task_description('vzrestore', params.vmid); } else if (me.vmtype === 'qemu') { url = '/nodes/' + me.nodename + '/qemu';