Merge pull request #157 from cubedro/develop
Fixed version class filter
This commit is contained in:
commit
63fc82bcec
2
dist/js/netstats.min.js
vendored
2
dist/js/netstats.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/js/netstats.min.js.map
vendored
2
dist/js/netstats.min.js.map
vendored
File diff suppressed because one or more lines are too long
@ -535,13 +535,32 @@ angular.module('netStatsApp.filters', [])
|
|||||||
if(typeof info === 'undefined' || typeof info.client === 'undefined' || typeof info.client === '')
|
if(typeof info === 'undefined' || typeof info.client === 'undefined' || typeof info.client === '')
|
||||||
return 'text-danger';
|
return 'text-danger';
|
||||||
|
|
||||||
if(current.localeCompare(info.client) > 0)
|
if(compareVersions(info.client, '<', current))
|
||||||
return 'text-warning';
|
return 'text-warning';
|
||||||
|
|
||||||
return 'hidden';
|
return 'hidden';
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function compareVersions(v1, comparator, v2) {
|
||||||
|
"use strict";
|
||||||
|
console.log(v1, comparator, v2);
|
||||||
|
comparator = comparator == '=' ? '==' : comparator;
|
||||||
|
var v1parts = v1.split('.'), v2parts = v2.split('.');
|
||||||
|
var maxLen = Math.max(v1parts.length, v2parts.length);
|
||||||
|
var part1, part2;
|
||||||
|
var cmp = 0;
|
||||||
|
for(var i = 0; i < maxLen && !cmp; i++) {
|
||||||
|
part1 = parseInt(v1parts[i], 10) || 0;
|
||||||
|
part2 = parseInt(v2parts[i], 10) || 0;
|
||||||
|
if(part1 < part2)
|
||||||
|
cmp = 1;
|
||||||
|
if(part1 > part2)
|
||||||
|
cmp = -1;
|
||||||
|
}
|
||||||
|
return eval('0' + comparator + cmp);
|
||||||
|
}
|
||||||
|
|
||||||
function mainClass(node, bestBlock)
|
function mainClass(node, bestBlock)
|
||||||
{
|
{
|
||||||
if( ! node.active)
|
if( ! node.active)
|
||||||
|
Loading…
Reference in New Issue
Block a user