[pmg-devel] [PATCH pmg-gui v3 3/3] objects: don't reload on match mode change

Dominik Csapak d.csapak at proxmox.com
Thu Feb 22 10:14:20 CET 2024


instead update the record of the object list, and update the visibility
of the 'whatWarning'

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 js/ObjectGroup.js              | 6 +++++-
 js/ObjectGroupConfiguration.js | 7 ++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/js/ObjectGroup.js b/js/ObjectGroup.js
index 214e641..d72d47c 100644
--- a/js/ObjectGroup.js
+++ b/js/ObjectGroup.js
@@ -263,7 +263,11 @@ Ext.define('PMG.ObjectGroup', {
 					    and,
 					    invert,
 					},
-					success: () => me.fireEvent('modeUpdate', me),
+					success: () => {
+					    me.fireEvent('modeUpdate', me, !!and, !!invert);
+					    me.down('#whatWarning')
+						.setHidden(me.objectClass !== 'what' || value === 'any');
+					},
 				    });
 				},
 			    },
diff --git a/js/ObjectGroupConfiguration.js b/js/ObjectGroupConfiguration.js
index eb80032..d22c60d 100644
--- a/js/ObjectGroupConfiguration.js
+++ b/js/ObjectGroupConfiguration.js
@@ -41,7 +41,12 @@ Ext.define('PMG.ObjectGroupConfiguration', {
 			left.run_editor();
 		    }
 		},
-		modeUpdate: () => left.reload(),
+		modeUpdate: (_cmp, and, invert) => {
+		    let rec = left.selModel.getSelection()[0];
+		    rec.set('and', and);
+		    rec.set('invert', invert);
+		    rec.commit();
+		},
 	    },
 	});
 
-- 
2.30.2





More information about the pmg-devel mailing list