[pve-devel] [PATCH manager] fix diffstore issue with clusterlog

Dominik Csapak d.csapak at proxmox.com
Fri Mar 10 10:12:25 CET 2017


extjs cannot "convert" and id from other fields, so the ids in the
diffstore and the realstore are different and we re-add every element on
every update

to mitigate this, we generate the id (which is "uid:hostname") in the
backend, and simply use it in the frontend

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/API2/Cluster.pm           |  4 ++++
 www/manager6/data/PVEProxy.js | 15 +--------------
 2 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/PVE/API2/Cluster.pm b/PVE/API2/Cluster.pm
index b6ccd38..6ce86de 100644
--- a/PVE/API2/Cluster.pm
+++ b/PVE/API2/Cluster.pm
@@ -132,6 +132,10 @@ __PACKAGE__->register_method({
 
 	my $res = decode_json(PVE::Cluster::get_cluster_log($loguser, $max));
 
+	foreach my $entry (@{$res->{data}}) {
+	    $entry->{id} = "$entry->{uid}:$entry->{node}";
+	}
+
 	return $res->{data};
     }});
 
diff --git a/www/manager6/data/PVEProxy.js b/www/manager6/data/PVEProxy.js
index b66eeb6..a3b0b72 100644
--- a/www/manager6/data/PVEProxy.js
+++ b/www/manager6/data/PVEProxy.js
@@ -95,20 +95,7 @@ Ext.define('PVE.RestProxy', {
 	    { name: 'time', type : 'date', dateFormat: 'timestamp' }, 
 	    { name: 'pri', type: 'int' },
 	    { name: 'pid', type: 'int' },
-	    'node', 'user', 'tag', 'msg',
-	    {
-		name: 'id',
-		convert: function(value, record) {
-		    var info = record.data;
-		    var text;
-
-		    if (value) {
-			return value;
-		    }
-		    // compute unique ID
-		    return info.uid + ':' + info.node;
-		}
-	    }
+	    'node', 'user', 'tag', 'msg', 'id'
 	],
 	idProperty: 'id'
     });
-- 
2.1.4





More information about the pve-devel mailing list