From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id B4883858C for ; Thu, 27 Jul 2023 12:30:53 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 94D559FBF for ; Thu, 27 Jul 2023 12:30:53 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Thu, 27 Jul 2023 12:30:53 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id D688740E8F for ; Thu, 27 Jul 2023 12:30:52 +0200 (CEST) From: Noel Ullreich To: pve-devel@lists.proxmox.com Date: Thu, 27 Jul 2023 12:30:49 +0200 Message-Id: <20230727103049.38556-3-n.ullreich@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230727103049.38556-1-n.ullreich@proxmox.com> References: <20230727103049.38556-1-n.ullreich@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.057 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH pve-manager 2/2] ui: fix: change units of memory/swap for containers X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Jul 2023 10:30:53 -0000 This patch adds a dropdown-menu (in the web interface) of units, MiB, GiB, and TiB, (although PiB could easily be added in the future) for ram and swapsize of containers. Signed-off-by: Noel Ullreich --- www/manager6/lxc/ResourceEdit.js | 59 +++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/www/manager6/lxc/ResourceEdit.js b/www/manager6/lxc/ResourceEdit.js index 9f4f7e08..8c1f57c3 100644 --- a/www/manager6/lxc/ResourceEdit.js +++ b/www/manager6/lxc/ResourceEdit.js @@ -1,10 +1,10 @@ -var labelWidth = 120; +let labelWidth = 100; Ext.define('PVE.lxc.MemoryEdit', { extend: 'Proxmox.window.Edit', initComponent: function() { - var me = this; + let me = this; Ext.apply(me, { subject: gettext('Memory'), @@ -69,7 +69,7 @@ Ext.define('PVE.lxc.CPUInputPanel', { return values; }, - advancedColumn1: [ + advancedColumn1: [ { xtype: 'numberfield', name: 'cpulimit', @@ -102,7 +102,7 @@ Ext.define('PVE.lxc.CPUInputPanel', { ], initComponent: function() { - var me = this; + let me = this; me.column1 = [ { @@ -130,29 +130,48 @@ Ext.define('PVE.lxc.MemoryInputPanel', { insideWizard: false, + onGetValues: function(values) { + let ret = {}; + + ret.memory = values.memory; + ret.swap = values.swap; + + return ret; + }, + +/* + onSetValues: function(values) { + // TODO: I would have thought that manually setting the combobox here + // might make it possible to set `ok` on the selector when changing the + // unit in the combobox + values.memunit = 'GiB'; + values.swapunit = 'TiB'; + + return values; + }, +*/ + initComponent: function() { - var me = this; + let me = this; - var items = [ + let items = [ { - xtype: 'proxmoxintegerfield', + xtype: 'pmxSizeField', + fieldLabel: gettext('Memory'), name: 'memory', - minValue: 16, - value: '512', - step: 32, - fieldLabel: gettext('Memory') + ' (MiB)', - labelWidth: labelWidth, - allowBlank: false, + unitname: 'memunit', + steparray: [32, 1, 1], + minarray: [16, 1, 1], + datastore: Object.keys(Proxmox.Utils.SizeUnits).slice(2, 5), + backendUnit: 'MiB', }, { - xtype: 'proxmoxintegerfield', + xtype: 'pmxSizeField', + fieldLabel: gettext('Swap'), name: 'swap', - minValue: 0, - value: '512', - step: 32, - fieldLabel: gettext('Swap') + ' (MiB)', - labelWidth: labelWidth, - allowBlank: false, + unitname: 'swapunit', + datastore: Object.keys(Proxmox.Utils.SizeUnits).slice(2, 5), + backendUnit: 'MiB', }, ]; -- 2.39.2