On 10/31/18 2:03 PM, Tim Marx wrote:
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 <[email protected]>
---
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) {
instead of a big 'if (a != undefined)' and many indendation changes
i would do something like
if (a === undefined) {
return '';
}
and have the rest of the code continue normally
we do this often in the code already, and it makes it a bit more readable
_______________________________________________
pve-devel mailing list
[email protected]
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel