From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id ADF6E1FF140 for ; Fri, 08 May 2026 10:41:07 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 165C610B75; Fri, 8 May 2026 10:40:49 +0200 (CEST) From: Dominik Csapak To: pve-devel@lists.proxmox.com, pbs-devel@lists.proxmox.com Subject: [PATCH widget-toolkit 1/2] add window and renderer for locations Date: Fri, 8 May 2026 10:40:13 +0200 Message-ID: <20260508084038.1405206-3-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260508084038.1405206-1-d.csapak@proxmox.com> References: <20260508084038.1405206-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.050 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [location.name] Message-ID-Hash: PVHA3ORFZMDMO5VZPZ26QCBYI2G4YV6U X-Message-ID-Hash: PVHA3ORFZMDMO5VZPZ26QCBYI2G4YV6U X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: PVE and PBS gained a location property (per node and datacenter) which is a propertystring containing of a name and coordinates. Add a window to edit and a renderer for that. Signed-off-by: Dominik Csapak --- src/Makefile | 1 + src/Utils.js | 12 ++++++++ src/window/LocationEdit.js | 57 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 src/window/LocationEdit.js diff --git a/src/Makefile b/src/Makefile index 74ea4ab..9c52339 100644 --- a/src/Makefile +++ b/src/Makefile @@ -110,6 +110,7 @@ JSSRC= \ window/AddYubico.js \ window/TfaEdit.js \ window/NotesEdit.js \ + window/LocationEdit.js \ window/ThemeEdit.js \ window/SyncWindow.js \ node/APT.js \ diff --git a/src/Utils.js b/src/Utils.js index 5457ffa..390a302 100644 --- a/src/Utils.js +++ b/src/Utils.js @@ -1571,6 +1571,18 @@ Ext.define('Proxmox.Utils', { } hiddenElement.click(); }, + + renderLocation: function (value) { + if (!value) { + return Proxmox.Utils.NoneText; + } + let location = Proxmox.Utils.parsePropertyString(value); + let degrees = `${location.latitude} °, ${location.longitude} °`; + if (location.name) { + return `${location.name} (${degrees})`; + } + return degrees; + }, }, singleton: true, diff --git a/src/window/LocationEdit.js b/src/window/LocationEdit.js new file mode 100644 index 0000000..f7b6c6d --- /dev/null +++ b/src/window/LocationEdit.js @@ -0,0 +1,57 @@ +Ext.define('Proxmox.window.LocationEdit', { + extend: 'Proxmox.window.Edit', + alias: 'widget.pmxLocationEditWindow', + + title: gettext('Location'), + + autoLoad: true, + + items: [ + { + xtype: 'inputpanel', + onGetValues: function (values) { + let propertyString = Proxmox.Utils.printPropertyString(values); + if (!propertyString) { + return { delete: 'location' }; + } else { + return { + location: propertyString, + }; + } + }, + + onSetValues: function (value) { + if (value.location) { + return Proxmox.Utils.parsePropertyString(value.location); + } + return {}; + }, + + items: [ + { + xtype: 'proxmoxtextfield', + fieldLabel: gettext('Name'), + allowBlank: true, + emptyText: gettext('Optional'), + name: 'name', + }, + { + xtype: 'numberfield', + minimum: -90.0, + maximum: 90.0, + name: 'latitude', + decimalPrecision: 6, + fieldLabel: gettext('Latitude'), + }, + { + xtype: 'numberfield', + minimum: -180.0, + maximum: 180.0, + name: 'longitude', + decimalPrecision: 6, + fieldLabel: gettext('Longitude'), + }, + ], + }, + ], +}); -- 2.47.3