[pve-devel] [PATCH manager 3/5] gui: ceph: let compare_ceph_versions accept arrays directly

Dominik Csapak d.csapak at proxmox.com
Mon Mar 16 13:56:01 CET 2020


instead of always expecting a '.' separated version string
we will use this for the 'structured' version data

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/Utils.js | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index a42dbf91..1bc6ef03 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -121,11 +121,24 @@ Ext.define('PVE.Utils', { utilities: {
     },
 
     compare_ceph_versions: function(a, b) {
+	let avers = [];
+	let bvers = [];
+
 	if (a === b) {
 	    return 0;
 	}
-	let avers = a.toString().split('.');
-	let bvers = b.toString().split('.');
+
+	if (Ext.isArray(a)) {
+	    avers = a.slice(); // copy array
+	} else {
+	    avers = a.toString().split('.');
+	}
+
+	if (Ext.isArray(b)) {
+	    bvers = b.slice(); // copy array
+	} else {
+	    bvers = b.toString().split('.');
+	}
 
 	while (true) {
 	    let av = avers.shift();
-- 
2.20.1





More information about the pve-devel mailing list