From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id C21B31FF0DD for ; Thu, 22 Oct 2026 18:44:27 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 67C0921684; Thu, 22 Oct 2026 18:44:27 +0200 (CEST) From: Jonas Theisen To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox-backup v4 9/9] ui: calendar-event: hide clear button if a schedule is required Date: Thu, 22 Oct 2026 18:43:24 +0200 Message-ID: <20261022164343.353831-10-j.theisen@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261022164343.353831-1-j.theisen@proxmox.com> References: <20261022164343.353831-1-j.theisen@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1792687461594 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.116 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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: OIVFSZ5FGI3FL36A6VMZ35ZJJMA5CQR7 X-Message-ID-Hash: OIVFSZ5FGI3FL36A6VMZ35ZJJMA5CQR7 X-MailFrom: j.theisen@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 Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Since the schedule fields of the job edit windows do not allow empty inputs anymore, offering a clear button there is unintuitive. Only show the clear button if the field allows empty values. Fields that may still be left empty, like the GC and prune schedules when creating a datastore or the threshold reset schedule, keep it. Also update the button's visibility when the value is set, not only on change events. Initial values, like the default prune schedule when creating a datastore, do not fire a change event, so the button was previously only shown after the value had been changed manually. Signed-off-by: Jonas Theisen --- www/form/CalendarEvent.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/www/form/CalendarEvent.js b/www/form/CalendarEvent.js index b050da694..1ad0c0a87 100644 --- a/www/form/CalendarEvent.js +++ b/www/form/CalendarEvent.js @@ -59,17 +59,26 @@ Ext.define('PBS.form.CalendarEvent', { weight: -1, hidden: true, handler: function () { - this.triggers.clear.setVisible(false); this.setValue(''); }, }, }, + updateClearTrigger: function (value) { + let me = this; + let empty = Ext.isArray(value) ? !value.length : !value; + me.triggers.clear.setVisible(!empty && me.allowBlank); + }, + + // also called for the initial value, which does not fire a change event + setValue: function (value) { + let me = this; + me.updateClearTrigger(value); + return me.callParent([value]); + }, + listeners: { - change: function (field, value) { - let canClear = (value ?? '') !== ''; - field.triggers.clear.setVisible(canClear); - }, + change: (field, value) => field.updateClearTrigger(value), }, store: { -- 2.47.3