[pve-devel] [PATCH manager v2 3/4] ui utils: add renderer for ceph osd addresses

Dominik Csapak d.csapak at proxmox.com
Mon Oct 17 16:29:58 CEST 2022


overall, i'd like the renderer to be a bit more robust.
a small change in output results in nothing showing at all.

i'd try to parse it as good as possible, but fallback to the 'raw' value
in case it fails. that way the user can at least see what ceph returned

On 7/6/22 15:01, Aaron Lauterer wrote:
> Render the OSD listening addresses a bit nicer and one per line.
> 
> Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
> ---
> I tried to keep it as simple as possible to get each address into its
> own line for easier reading.
> 
> changes since v1: none
> 
>   www/manager6/Utils.js | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
> 
> diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
> index 7ca6a271..6499712f 100644
> --- a/www/manager6/Utils.js
> +++ b/www/manager6/Utils.js
> @@ -1278,6 +1278,18 @@ 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.match(/\[(.*)\]/)[1];
> +	value = value.replaceAll(',', '\n');
> +	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;
> +    },
> +
>       windowHostname: function() {
>   	return window.location.hostname.replace(Proxmox.Utils.IP6_bracket_match,
>               function(m, addr, offset, original) { return addr; });






More information about the pve-devel mailing list