Skip to content

Commit

Permalink
fix(nodes): fix availability display on node detail page (COMPASS-60)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Reed committed Apr 8, 2016
1 parent 5f908f6 commit f249820
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"flot-legend": "https://github.com/RangerRick/flot-legend.git#master",
"urijs": "^1.17.1",
"moment": "^2.12.0",
"ip-address": "^5.7.0",
"ip-address": "^5.8.0",
"angular-highlightjs": "^0.6.1",
"winstore-jscompat": "https://github.com/MSOpenTech/winstore-jscompat.git",
"angular-flot": "~0.0.16",
Expand Down
12 changes: 8 additions & 4 deletions src/app/misc/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@
'opennms.services.Servers',
'opennms.services.Settings'
])
.filter('ip', function() {
.filter('ip', function($log) {
return function(addr) {
if (addr && addr.contains(':')) {
var address = new Address6(addr);
if (address.isValid()) {
return address.correctForm();
try {
var address = new Address6(addr);
if (address.isValid()) {
return address.correctForm();
}
} catch(err) {
$log.warn('error formatting ' + addr + ': ' + err);
}
}
return addr;
Expand Down
4 changes: 2 additions & 2 deletions src/app/nodes/NodeController.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@

$scope.canUpdateGeolocation = Capabilities.setLocation();

var avail = EventService.node($scope.node.id).then(function(results) {
//$log.debug('AvailabilityService got results:',results);
var avail = AvailabilityService.node($scope.node.id).then(function(results) {
$log.debug('AvailabilityService got results:'+angular.toJson(results));
$scope.availability = results;
return results;
}, function(err) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/nodes/node-detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<button class="button button-block button-compass" ng-click="submitCoordinates()" ng-if="canUpdateGeolocation">Set Coordinates to Current Location</button>
</ion-item>
</span>
<span ng-if="availability &amp;&amp; availability.length > 0 &amp;&amp; availability.availability" class="availability">
<span ng-if="availability &amp;&amp; availability.availability &amp;&amp; availability.ipinterfaces.length > 0" class="availability">
<ion-item class="item-divider item-compass">
Availability (Last 24 Hours)
</ion-item>
Expand Down

0 comments on commit f249820

Please sign in to comment.