[pve-devel] [PATCH manager 1/4] node zfs: added check for undefined & new case AVAIL

Tim Marx t.marx at proxmox.com
Wed Oct 31 14:03:15 CET 2018


added a check for a undefined value, because some rows don't have a state e.g.
without this check, there would be a ? followed by undefined.

Signed-off-by: Tim Marx <t.marx at proxmox.com>
---
 www/manager6/Utils.js | 37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 568ceb7b..006ad36e 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -123,24 +123,27 @@ Ext.define('PVE.Utils', { utilities: {
     },
 
     render_zfs_health: function(value) {
-	var iconCls = 'question-circle';
-	switch (value) {
-	    case 'ONLINE':
-		iconCls = 'check-circle good';
-		break;
-	    case 'REMOVED':
-	    case 'DEGRADED':
-		iconCls = 'exclamation-circle warning';
-		break;
-	    case 'UNAVAIL':
-	    case 'FAULTED':
-	    case 'OFFLINE':
-		iconCls = 'times-circle critical';
-		break;
-	    default: //unknown
-	}
+	if (typeof value != 'undefined'){
+	    var iconCls = 'question-circle';
+	    switch (value) {
+		case 'AVAIL':
+		case 'ONLINE':
+		    iconCls = 'check-circle good';
+		    break;
+		case 'REMOVED':
+		case 'DEGRADED':
+		    iconCls = 'exclamation-circle warning';
+		    break;
+		case 'UNAVAIL':
+		case 'FAULTED':
+		case 'OFFLINE':
+		    iconCls = 'times-circle critical';
+		    break;
+		default: //unknown
+	    }
 
-	return '<i class="fa fa-' + iconCls + '"></i> ' + value;
+	    return '<i class="fa fa-' + iconCls + '"></i> ' + value;
+	}
     },
 
     get_kvm_osinfo: function(value) {
-- 
2.11.0




More information about the pve-devel mailing list