From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 799271FF56B for ; Mon, 22 Apr 2024 10:53:24 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6C0B0BCCC; Mon, 22 Apr 2024 10:53:26 +0200 (CEST) Message-ID: <4a228548-ca8e-457f-9919-f085bdcc71dc@proxmox.com> Date: Mon, 22 Apr 2024 10:52:52 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Proxmox VE development discussion , Lukas Wagner References: <20240422083116.99809-1-l.wagner@proxmox.com> <20240422083116.99809-11-l.wagner@proxmox.com> Content-Language: en-US From: Fiona Ebner In-Reply-To: <20240422083116.99809-11-l.wagner@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL -0.068 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 Subject: Re: [pve-devel] [PATCH widget-toolkit v6 10/16] notification: matcher: match-field: show known fields/values X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Am 22.04.24 um 10:31 schrieb Lukas Wagner: > @@ -416,10 +416,22 @@ Ext.define('Proxmox.panel.NotificationRulesEditPanel', { > let me = this; > let record = me.get('selectedRecord'); > let currentData = record.get('data'); > + > + let newValue = []; > + > + // Build equivalent regular expression if switching > + // to 'regex' mode > + if (value === 'regex') { > + let regexVal = "^("; > + regexVal += currentData.value.join('|') + ")$"; Can break the UI when you change the match type before there is a value: > Uncaught TypeError: currentData.value.join is not a function > + newValue.push(regexVal); > + } > + and nit: the above could/should be a separate patch > record.set({ > data: { > ...currentData, > type: value, > + value: newValue, > }, > }); > }, ---snip--- > + let valueStore = Ext.create('Ext.data.Store', { > + model: 'proxmox-notification-field-values', > + autoLoad: true, > + proxy: { > + type: 'proxmox', > + > + url: `/api2/json/${me.baseUrl}/matcher-field-values`, > + }, > + listeners: { > + 'load': function() { > + this.each(function(record) { > + if (record.get('field') === 'type') { > + record.set({ > + comment: Nit: while the API does not return a comment for the 'type' field currently, this would override the returned comment should there ever be one in the future. > + Proxmox.Utils.formatNotificationFieldValue( > + record.get('value'), > + ), > + }); > + } > + }, this, true); > + > + // Commit changes so that the description field is not marked > + // as dirty > + this.commitChanges(); > + }, > + }, > + }); > + _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel