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

Reply via email to