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 2F8441FF146 for ; Tue, 26 May 2026 14:37:30 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9F0A01DB66; Tue, 26 May 2026 14:37:22 +0200 (CEST) From: Dominik Csapak To: pve-devel@lists.proxmox.com Subject: [PATCH widget-toolkit 2/2] location edit: add OpenStreetMap link also in the edit window Date: Tue, 26 May 2026 14:37:09 +0200 Message-ID: <20260526123716.2912640-2-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260526123716.2912640-1-d.csapak@proxmox.com> References: <20260526123716.2912640-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 Message-ID-Hash: XRAPPBUDULZ2TTZ3YFPBLLPEOGQEX7NK X-Message-ID-Hash: XRAPPBUDULZ2TTZ3YFPBLLPEOGQEX7NK 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 VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: makes it easier to edit directly from there Suggested-by: Thomas Lamprecht Signed-off-by: Dominik Csapak --- src/Utils.js | 9 +++++++-- src/window/LocationEdit.js | 22 +++++++++++++++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/Utils.js b/src/Utils.js index 7643316..ed88210 100644 --- a/src/Utils.js +++ b/src/Utils.js @@ -1573,13 +1573,18 @@ Ext.define('Proxmox.Utils', { hiddenElement.click(); }, + renderOpenStreetMapLink: function (lat, long) { + let link = `https://openstreetmap.org?mlat=${lat}&mlon=${long}#map=20/${lat}/${long}`; + return `open on OpenStreetMap`; + }, + renderLocation: function (value) { if (!value) { return Proxmox.Utils.NoneText; } let location = Proxmox.Utils.parsePropertyString(value); - let link = `https://openstreetmap.org?mlat=${location.latitude}&mlon=${location.longitude}#map=20/${location.latitude}/${location.longitude}`; - let degrees = `${location.latitude} °, ${location.longitude} °, open on OpenStreetMap`; + let link = Proxmox.Utils.renderOpenStreetMapLink(location.latitude, location.longitude); + let degrees = `${location.latitude} °, ${location.longitude} °, ${link}`; if (location.name) { return `${location.name} (${degrees})`; } diff --git a/src/window/LocationEdit.js b/src/window/LocationEdit.js index bb92ff2..4ee4eed 100644 --- a/src/window/LocationEdit.js +++ b/src/window/LocationEdit.js @@ -6,7 +6,7 @@ Ext.define('Proxmox.window.LocationEdit', { autoLoad: true, - // make a bit wider for the hint field + // make a bit wider for the hint/link fields width: 400, controller: { @@ -32,9 +32,23 @@ Ext.define('Proxmox.window.LocationEdit', { } }, + onChange: function () { + let me = this; + let lat = me.lookup('latitude').getValue(); + let long = me.lookup('longitude').getValue(); + let openStreetMapLink = me.lookup('openStreetMapLink'); + if (me.isValidCoordinate(lat, long)) { + openStreetMapLink.setValue(Proxmox.Utils.renderOpenStreetMapLink(lat, long)); + openStreetMapLink.setVisible(true); + } else { + openStreetMapLink.setVisible(false); + } + }, + control: { numberfield: { paste: 'onPaste', + change: 'onChange', }, }, }, @@ -97,6 +111,12 @@ Ext.define('Proxmox.window.LocationEdit', { ), userCls: 'pmx-hint', }, + { + xtype: 'displayfield', + reference: 'openStreetMapLink', + hidden: true, + text: '', + }, ], }, ], -- 2.47.3