stash the length separately

This commit is contained in:
Girish Ramakrishnan
2020-09-14 12:12:39 -07:00
parent 5fca372ddf
commit f114a629f3
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -134,7 +134,7 @@
<span class="text-muted">Blocked IPs & Ranges</span>
</div>
<div class="col-xs-6 text-right">
<span>{{ blocklist.currentBlocklist.length }} IP(s) blocked <a href="" ng-click="blocklist.show()"><i class="fa fa-edit text-small"></i></a></span>
<span>{{ blocklist.currentBlocklistLength }} IP(s) blocked <a href="" ng-click="blocklist.show()"><i class="fa fa-edit text-small"></i></a></span>
</div>
</div>
</div>
+2
View File
@@ -61,12 +61,14 @@ angular.module('Application').controller('NetworkController', ['$scope', '$locat
error: {},
blocklist: '',
currentBlocklist: '',
currentBlocklistLength: 0,
refresh: function () {
Client.getBlocklist(function (error, result) {
if (error) return console.error(error);
$scope.blocklist.currentBlocklist = result;
$scope.blocklist.currentBlocklistLength = result.split('\n').filter(function (l) { return l.length !== 0 && l[0] !== '#'; }).length;
});
},