From: Dominik Csapak <d.csapak@proxmox.com>
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 [thread overview]
Message-ID: <20260526123716.2912640-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20260526123716.2912640-1-d.csapak@proxmox.com>
makes it easier to edit directly from there
Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
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 `<a href='${link}' target="_blank" rel="noreferrer">open on OpenStreetMap</a>`;
+ },
+
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} °, <a href='${link}' target="_blank" rel="noreferrer">open on OpenStreetMap</a>`;
+ 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
next prev parent reply other threads:[~2026-05-26 12:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 12:37 [PATCH widget-toolkit 1/2] location edit: make coordinates pastable Dominik Csapak
2026-05-26 12:37 ` Dominik Csapak [this message]
2026-05-26 14:29 ` Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260526123716.2912640-2-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.