public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] ui: fix usage of findRecord
@ 2020-11-26  8:19 Dominik Csapak
  2020-11-26  9:59 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2020-11-26  8:19 UTC (permalink / raw)
  To: pve-devel

findRecord does not match exactly, but only at the beginning and
case insensitive, by default. Change all calls to be case sensitive
and an exactmatch (we never want the default behaviour afaics).

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/manager6/dc/Backup.js              | 4 ++--
 www/manager6/dc/SecurityGroups.js      | 2 +-
 www/manager6/form/ACMEAPISelector.js   | 2 +-
 www/manager6/form/NodeSelector.js      | 2 +-
 www/manager6/form/VMCPUFlagSelector.js | 2 +-
 www/manager6/form/ViewSelector.js      | 2 +-
 www/manager6/grid/BackupView.js        | 6 ++++--
 www/manager6/grid/FirewallAliases.js   | 2 +-
 www/manager6/panel/IPSet.js            | 2 +-
 www/manager6/window/Backup.js          | 2 +-
 10 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/www/manager6/dc/Backup.js b/www/manager6/dc/Backup.js
index d868dcfc..059d01c7 100644
--- a/www/manager6/dc/Backup.js
+++ b/www/manager6/dc/Backup.js
@@ -65,7 +65,7 @@ Ext.define('PVE.dc.BackupEdit', {
 	    listeners: {
 		change: function(f, v) {
 		    let store = f.getStore();
-		    let rec = store.findRecord('storage', v);
+		    let rec = store.findRecord('storage', v, 0, false, true, true);
 		    let compressionSelector = me.down('pveCompressionSelector');
 
 		    if (rec && rec.data && rec.data.type === 'pbs') {
@@ -278,7 +278,7 @@ Ext.define('PVE.dc.BackupEdit', {
 		sm.deselectAll(true);
 		if (list) {
 		    Ext.Array.each(list.split(','), function(vmid) {
-			var rec = store.findRecord('vmid', vmid);
+			var rec = store.findRecord('vmid', vmid, 0, false, true, true);
 			if (rec) {
 			    sm.select(rec, true);
 			}
diff --git a/www/manager6/dc/SecurityGroups.js b/www/manager6/dc/SecurityGroups.js
index f730721f..90adfa1c 100644
--- a/www/manager6/dc/SecurityGroups.js
+++ b/www/manager6/dc/SecurityGroups.js
@@ -109,7 +109,7 @@ Ext.define('PVE.SecurityGroupList', {
 	    var oldrec = sm.getSelection()[0];
 	    store.load(function(records, operation, success) {
 		if (oldrec) {
-		    var rec = store.findRecord('group', oldrec.data.group);
+		    var rec = store.findRecord('group', oldrec.data.group, 0, false, true, true);
 		    if (rec) {
 			sm.select(rec);
 		    }
diff --git a/www/manager6/form/ACMEAPISelector.js b/www/manager6/form/ACMEAPISelector.js
index 2cf848a1..9989c21c 100644
--- a/www/manager6/form/ACMEAPISelector.js
+++ b/www/manager6/form/ACMEAPISelector.js
@@ -33,7 +33,7 @@ Ext.define('PVE.form.ACMEApiSelector', {
 	let me = this;
 	let val = me.getValue();
 	if (val) {
-	    let record = me.getStore().findRecord('id', val);
+	    let record = me.getStore().findRecord('id', val, 0, false, true, true);
 	    if (record) {
 		return record.data.schema;
 	    }
diff --git a/www/manager6/form/NodeSelector.js b/www/manager6/form/NodeSelector.js
index a00691ed..06286992 100644
--- a/www/manager6/form/NodeSelector.js
+++ b/www/manager6/form/NodeSelector.js
@@ -72,7 +72,7 @@ Ext.define('PVE.form.NodeSelector', {
 	var notAllowed = [];
 
 	Ext.Array.each(value.split(/\s*,\s*/), function(node) {
-	    var rec = me.store.findRecord(me.valueField, node);
+	    var rec = me.store.findRecord(me.valueField, node, 0, false, true, true);
 	    if (!(rec && rec.data) || rec.data.status !== 'online') {
 		offline.push(node);
 	    } else if (me.allowedNodes && !Ext.Array.contains(me.allowedNodes, node)) {
diff --git a/www/manager6/form/VMCPUFlagSelector.js b/www/manager6/form/VMCPUFlagSelector.js
index 7b435d45..71aa7ad7 100644
--- a/www/manager6/form/VMCPUFlagSelector.js
+++ b/www/manager6/form/VMCPUFlagSelector.js
@@ -81,7 +81,7 @@ Ext.define('PVE.form.VMCPUFlagSelector', {
 	    var sign = flag.substr(0, 1);
 	    flag = flag.substr(1);
 
-	    var rec = store.findRecord('flag', flag);
+	    var rec = store.findRecord('flag', flag, 0, false, true, true);
 	    if (rec !== null) {
 		rec.set('state', sign);
 	    } else {
diff --git a/www/manager6/form/ViewSelector.js b/www/manager6/form/ViewSelector.js
index e075be1a..025fcfac 100644
--- a/www/manager6/form/ViewSelector.js
+++ b/www/manager6/form/ViewSelector.js
@@ -74,7 +74,7 @@ Ext.define('PVE.form.ViewSelector', {
 	    applyState : function(state, doSelect) {
 		var view = me.getValue();
 		if (state && state.value && (view != state.value)) {
-		    var record = store.findRecord('key', state.value);
+		    var record = store.findRecord('key', state.value, 0, false, true, true);
 		    if (record) {
 			me.setValue(state.value, true);
 			if (doSelect) {
diff --git a/www/manager6/grid/BackupView.js b/www/manager6/grid/BackupView.js
index d04baeef..9312c59c 100644
--- a/www/manager6/grid/BackupView.js
+++ b/www/manager6/grid/BackupView.js
@@ -99,7 +99,7 @@ Ext.define('PVE.grid.BackupView', {
 	    allowBlank: false,
 	    listeners: {
 		change: function(f, value) {
-		    let storage = f.getStore().findRecord('storage', value);
+		    let storage = f.getStore().findRecord('storage', value, 0, false, true, true);
 		    if (storage) {
 			let isPBS = storage.data.type === 'pbs';
 			me.getColumns().forEach((column) => {
@@ -241,7 +241,9 @@ Ext.define('PVE.grid.BackupView', {
 			disabled: true,
 			enableFn: function() {
 			    let storageVal = storagesel.getValue();
-			    let storage = storagesel.getStore().findRecord('storage', storageVal);
+			    let storage = storagesel
+				.getStore()
+				.findRecord('storage', storageVal, 0, false, true, true);
 			    if (storage) {
 				return storage.data.type !== 'pbs';
 			    }
diff --git a/www/manager6/grid/FirewallAliases.js b/www/manager6/grid/FirewallAliases.js
index 80732726..40bfe357 100644
--- a/www/manager6/grid/FirewallAliases.js
+++ b/www/manager6/grid/FirewallAliases.js
@@ -112,7 +112,7 @@ Ext.define('PVE.FirewallAliases', {
 	    var oldrec = sm.getSelection()[0];
 	    store.load(function(records, operation, success) {
 		if (oldrec) {
-		    var rec = store.findRecord('name', oldrec.data.name);
+		    var rec = store.findRecord('name', oldrec.data.name, 0, false, true, true);
 		    if (rec) {
 			sm.select(rec);
 		    }
diff --git a/www/manager6/panel/IPSet.js b/www/manager6/panel/IPSet.js
index ed99586a..f8f8c1c6 100644
--- a/www/manager6/panel/IPSet.js
+++ b/www/manager6/panel/IPSet.js
@@ -49,7 +49,7 @@ Ext.define('PVE.IPSetList', {
 	    var oldrec = sm.getSelection()[0];
 	    store.load(function(records, operation, success) {
 		if (oldrec) {
-		    var rec = store.findRecord('name', oldrec.data.name);
+		    var rec = store.findRecord('name', oldrec.data.name, 0, false, true, true);
 		    if (rec) {
 			sm.select(rec);
 		    }
diff --git a/www/manager6/window/Backup.js b/www/manager6/window/Backup.js
index 55f52676..f50e4f30 100644
--- a/www/manager6/window/Backup.js
+++ b/www/manager6/window/Backup.js
@@ -33,7 +33,7 @@ Ext.define('PVE.window.Backup', {
 	    listeners: {
 		change: function(f, v) {
 		    let store = f.getStore();
-		    let rec = store.findRecord('storage', v);
+		    let rec = store.findRecord('storage', v, 0, false, true, true);
 
 		    if (rec && rec.data && rec.data.type === 'pbs') {
 			compressionSelector.setValue('zstd');
-- 
2.20.1





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-26 10:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-26  8:19 [pve-devel] [PATCH manager] ui: fix usage of findRecord Dominik Csapak
2020-11-26  9:59 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal