computer.js:
-modified Computer.prototype.nocasesort: somewhat handle things passed in that are not strings
-modified initPage and refreshcompdata: set vmhost to be sorted using nocasesort
diff --git a/web/js/resources/computer.js b/web/js/resources/computer.js
index dd08e37..ab7d18c 100644
--- a/web/js/resources/computer.js
+++ b/web/js/resources/computer.js
@@ -197,6 +197,12 @@
}
Computer.prototype.nocasesort = function(a, b) {
+ if(typeof a != 'string' && typeof b != 'string')
+ return 0;
+ if(typeof a != 'string')
+ return -1;
+ if(typeof b != 'string')
+ return 1;
var al = a.toLowerCase();
var bl = b.toLowerCase();
if(al.match(/[0-9]/) ||
@@ -319,6 +325,7 @@
resourcestore.comparatorMap['network'] = resource.nocasesort;
resourcestore.comparatorMap['IPaddress'] = resource.ipsort;
resourcestore.comparatorMap['privateIPaddress'] = resource.ipsort;
+ resourcestore.comparatorMap['vmhost'] = resource.nocasesort;
dojo.connect(resourcegrid, '_onFetchComplete', function() {dojo.byId('computercount').innerHTML = 'Computers in table: ' + resourcegrid.rowCount;});
}
@@ -1245,6 +1252,7 @@
procspeed: resource.nocasesort,
network: resource.nocasesort,
ram: resource.nocasesort,
+ vmhost: resource.nocasesort,
IPaddress: resource.ipsort,
privateIPaddress: resource.ipsort};
resourcestore.fetch();