[pve-devel] [PATCH manager 2/2] ui: storages: add restore bwlimit field to all storages

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Mar 28 17:40:07 CEST 2018


Can be used to set the per-storage restore bandwidth limit.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 www/manager6/storage/Base.js | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/www/manager6/storage/Base.js b/www/manager6/storage/Base.js
index 71d7b5bb..f82119d9 100644
--- a/www/manager6/storage/Base.js
+++ b/www/manager6/storage/Base.js
@@ -16,9 +16,28 @@ Ext.define('PVE.panel.StorageBase', {
 	values.disable = values.enable ? 0 : 1;
 	delete values.enable;
 
+	if (values.restorebwlimit !== undefined) {
+	    this.bwlimit.restore = values.restorebwlimit * 1024;
+	    delete values.restorebwlimit;
+
+	    values.bwlimit = PVE.Parser.printFormatString(this.bwlimit);
+	}
+
 	return values;
     },
 
+    setValues: function(values) {
+	var me = this;
+
+	if (values.bwlimit) {
+	    me.bwlimit = PVE.Parser.parseBWLimits(values.bwlimit);
+	    me.down('field[name=restorebwlimit]').setValue(me.bwlimit.restore);
+	    me.down('field[name=restorebwlimit]').resetOriginalValue();
+	}
+
+	me.callParent([values]);
+    },
+
     initComponent : function() {
 	var me = this;
 
@@ -31,6 +50,7 @@ Ext.define('PVE.panel.StorageBase', {
 	    allowBlank: false
 	});
 
+	/*jslint confusion:true*/
 	me.column2.unshift(
 	    {
 		xtype: 'pveNodeSelector',
@@ -47,8 +67,20 @@ Ext.define('PVE.panel.StorageBase', {
 		checked: true,
 		uncheckedValue: 0,
 		fieldLabel: gettext('Enable')
+	    },
+	    {
+		xtype: 'proxmoxintegerfield',
+		name: 'restorebwlimit',
+		fieldLabel: gettext('Restore Limit'),
+		minValue: 1,
+		emptyText: gettext('Unlimited'),
+		autoEl: {
+		    tag: 'div',
+		    'data-qtip': gettext('MiB/s')
+		}
 	    }
 	);
+	/*jslint confusion:false*/
 
 	me.callParent();
     }
-- 
2.14.2





More information about the pve-devel mailing list