mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-07-27 11:46:44 +00:00
ui utils: add renderer for ceph osd addresses
Render the OSD listening addresses a bit nicer and one per line. Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com> Reviewed-by: Dominik Csapak <d.csapak@proxmox.com> Tested-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
e907f822d7
commit
fe5c4f8156
@ -1280,6 +1280,21 @@ Ext.define('PVE.Utils', {
|
||||
return Ext.htmlEncode(first + " " + last);
|
||||
},
|
||||
|
||||
// expecting the following format:
|
||||
// [v2:10.10.10.1:6802/2008,v1:10.10.10.1:6803/2008]
|
||||
render_ceph_osd_addr: function(value) {
|
||||
value = value.trim();
|
||||
if (value.startsWith('[') && value.endsWith(']')) {
|
||||
value = value.slice(1, -1); // remove []
|
||||
}
|
||||
value = value.replaceAll(',', '\n'); // split IPs in lines
|
||||
let retVal = '';
|
||||
for (const i of value.matchAll(/^(v[0-9]):(.*):([0-9]*)\/([0-9]*)$/gm)) {
|
||||
retVal += `${i[1]}: ${i[2]}:${i[3]}<br>`;
|
||||
}
|
||||
return retVal.length < 1 ? value : retVal;
|
||||
},
|
||||
|
||||
windowHostname: function() {
|
||||
return window.location.hostname.replace(Proxmox.Utils.IP6_bracket_match,
|
||||
function(m, addr, offset, original) { return addr; });
|
||||
|
Loading…
Reference in New Issue
Block a user