[pve-devel] [PATCH v2 manager 3/3] ui: hdedit: change nobackup to include in backup

Aaron Lauterer a.lauterer at proxmox.com
Mon Dec 2 10:58:28 CET 2019


Change the behavior from having to activate the `No backup` checkbox to
exclude a disk from backups to having a `Include in backup` checkbox
that is checked by default.

Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---
 www/manager6/qemu/HDEdit.js | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index c810b4b0..fa2fea9e 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -11,6 +11,8 @@ Ext.define('PVE.qemu.HDInputPanel', {
 
     vmconfig: {}, // used to select usused disks
 
+    viewModel: {},
+
     controller: {
 
 	xclass: 'Ext.app.ViewController',
@@ -47,6 +49,13 @@ Ext.define('PVE.qemu.HDInputPanel', {
 		    this.lookupReference('scsiController').setValue(vmScsiType);
 		}
 	    }
+	},
+
+	init: function(view) {
+	    var vm = this.getViewModel();
+	    if (view.isCreate) {
+		vm.set('isIncludedInBackup', true);
+	    }
 	}
     },
 
@@ -68,7 +77,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
 	    me.drive.format = values.diskformat;
 	}
 
-	PVE.Utils.propertyStringSet(me.drive, values.nobackup, 'backup', 'no');
+	PVE.Utils.propertyStringSet(me.drive, values.backup, 'backup');
 	PVE.Utils.propertyStringSet(me.drive, values.noreplicate, 'replicate', 'no');
 	PVE.Utils.propertyStringSet(me.drive, values.discard, 'discard', 'on');
 	PVE.Utils.propertyStringSet(me.drive, values.ssd, 'ssd', 'on');
@@ -121,7 +130,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
 	}
 
 	values.hdimage = drive.file;
-	values.nobackup = !PVE.Parser.parseBoolean(drive.backup, 1);
+	values.backup = PVE.Parser.parseBoolean(drive.backup, 1);
 	values.noreplicate = !PVE.Parser.parseBoolean(drive.replicate, 1);
 	values.diskformat = drive.format || 'raw';
 	values.cache = drive.cache || '__default__';
@@ -282,9 +291,13 @@ Ext.define('PVE.qemu.HDInputPanel', {
 	me.advancedColumn2.push(
 	    {
 		xtype: 'proxmoxcheckbox',
-		fieldLabel: gettext('No backup'),
+		fieldLabel: gettext('Include in backup'),
+		uncheckedValue: 'no',
 		labelWidth: labelWidth,
-		name: 'nobackup'
+		name: 'backup',
+		bind: {
+		    value: '{isIncludedInBackup}',
+		},
 	    },
 	    {
 		xtype: 'proxmoxcheckbox',
-- 
2.20.1





More information about the pve-devel mailing list