]> git.proxmox.com Git - proxmox-backup.git/commitdiff
docs: lto barcod generator: disable add button when fields are not valid
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 6 Mar 2024 15:10:59 +0000 (16:10 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 7 Mar 2024 08:44:18 +0000 (09:44 +0100)
otherwise we end up with entries in the list that won't be
displayed/printed anyway.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
docs/lto-barcode/label-setup.js

index e65cc7a4143464fe6a0bc7c0ebcc5c07b096e799..b42a308009566289fd47f3a2b8df5dec067dcdd7 100644 (file)
@@ -46,6 +46,23 @@ Ext.define('LabelSetupPanel', {
            let params = view.getValues();
            list.getStore().add(params);
        },
+
+       validitychange: function() {
+           let me = this;
+           let isValid = true;
+           me.getView().query('field').forEach((field) => {
+               if (!field.isValid()) {
+                   isValid = false;
+               }
+           });
+           me.lookup('addButton').setDisabled(!isValid);
+       },
+
+       control: {
+           'field': {
+               validitychange: 'validitychange',
+           },
+       },
     },
 
     items: [
@@ -93,6 +110,7 @@ Ext.define('LabelSetupPanel', {
                {
                    xtype: 'button',
                    text: 'Add',
+                   reference: 'addButton',
                    handler: 'onAdd',
                },
            ],