Re: [PATCH proxmox-backup v7 26/34] ui: utils: add helper to render notification threshold property string

Thomas Lamprecht
2026-04-01T22:32:30Z

Am 01.04.26 um 15:48 schrieb Christian Ebner:
> Show thresholds as comma and space separated list of configured values,
> skipping empty ones.
>
> Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
> Reviewed-by: Hannes Laimer <h.laimer@proxmox.com>
> Tested-by: Hannes Laimer <h.laimer@proxmox.com>
> ---
> www/Utils.js | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/www/Utils.js b/www/Utils.js
> index 25fba16f9..d2f3a3c99 100644
> --- a/www/Utils.js
> +++ b/www/Utils.js
> @@ -933,4 +933,13 @@ Ext.define('PBS.Utils', {
>
> return options.join(', ');
> },
> +
> + render_notification_thresholds: function (notificationThresholds) {
> + let thresholds = [];
> + for (const [k, v] of Object.entries(notificationThresholds)) {
> + thresholds.push(`${k}: ${v}`);
> + }
> +
> + return thresholds.join(', ');
> + },

Could use a map directly:

render_notification_thresholds: (notificationThresholds) =>
Object.entries(notificationThresholds)
.map(([k, v]) => `${k}: ${v}`)
.join(', '),

and potentially add `?? gettext('None')` for the fallback?

And FWIW, should also probably be inline directly, it's simple and only
used once after all.

> });