[pbs-devel] [PATCH proxmox-backup 1/3] docs: lto barcod generator: disable add button when fields are not valid
Dominik Csapak
d.csapak at proxmox.com
Wed Mar 6 16:10:59 CET 2024
otherwise we end up with entries in the list that won't be
displayed/printed anyway.
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
docs/lto-barcode/label-setup.js | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/docs/lto-barcode/label-setup.js b/docs/lto-barcode/label-setup.js
index e65cc7a4..b42a3080 100644
--- a/docs/lto-barcode/label-setup.js
+++ b/docs/lto-barcode/label-setup.js
@@ -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',
},
],
--
2.39.2
More information about the pbs-devel
mailing list