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 41BD71FF13B for ; Wed, 03 Jun 2026 20:05:35 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4C4E115CEA; Wed, 3 Jun 2026 20:05:33 +0200 (CEST) From: Stoiko Ivanov To: pmg-devel@lists.proxmox.com Subject: [PATCH pmg-gui 11/15] utils: copy pbs helpers from pve-manager Date: Wed, 3 Jun 2026 20:03:13 +0200 Message-ID: <20260603180445.98770-12-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260603180445.98770-1-s.ivanov@proxmox.com> References: <20260603180445.98770-1-s.ivanov@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1780509859925 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.087 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: F5JFPASBARZXSMHWYAET5OI34K7PV4XD X-Message-ID-Hash: F5JFPASBARZXSMHWYAET5OI34K7PV4XD X-MailFrom: s.ivanov@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 Mail Gateway development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: as we'll reuse the widgets from pve-manager for adding pbs encryption support to PMG, copy the helpers from pve-manager. taken from pve-manager commits: fdde857a ("fix #4393: ui: storage backup view: make pbs-specific columns sortable") 957a53bd ("ui: add comment/verification columns to backup/content grid") 3003a59d ("ui: guest backup view: add encrypted column for PBS storages") 14ba33fb ("ui: storage: pbs: improve encryption key handling") Signed-off-by: Stoiko Ivanov --- js/Utils.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/js/Utils.js b/js/Utils.js index 3332f9b..0c3032f 100644 --- a/js/Utils.js +++ b/js/Utils.js @@ -910,6 +910,50 @@ Ext.define('PMG.Utils', { saupdate: ['', gettext('SpamAssassin update')], }); }, + + render_pbs_fingerprint: (fp) => fp.substring(0, 23), + + render_backup_encryption: function (v, meta, record) { + if (!v) { + return gettext('No'); + } + let tip = ''; + if (v.match(/^[a-fA-F0-9]{2}:/)) { + // fingerprint + tip = `Key fingerprint ${PMG.Utils.render_pbs_fingerprint(v)}`; + } + let icon = ``; + return `${icon} ${gettext('Encrypted')}`; + }, + + render_backup_verification: function (v, meta, record) { + let i = (cls, txt) => ` ${txt}`; + if (v === undefined || v === null) { + return i('question-circle-o warning', gettext('None')); + } + let tip = ''; + let txt = gettext('Failed'); + let iconCls = 'times critical'; + if (v.state === 'ok') { + txt = gettext('OK'); + iconCls = 'check good'; + let now = Date.now() / 1000; + let task = Proxmox.Utils.parse_task_upid(v.upid); + let verify_time = Proxmox.Utils.render_timestamp(task.starttime); + tip = `Last verify task started on ${verify_time}`; + if (now - v.starttime > 30 * 24 * 60 * 60) { + tip = `Last verify task over 30 days ago: ${verify_time}`; + iconCls = 'check warning'; + } + } + return ` ${i(iconCls, txt)} `; + }, + verificationStateOrder: { + failed: 0, + none: 1, + ok: 2, + __default__: 3, + }, }); Ext.define('PMG.Async', { -- 2.47.3