Skip to content

Commit

Permalink
fix(settings): fix display of capabilities in "About"; add graphing
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Reed committed Apr 20, 2016
1 parent c6c19e4 commit 03ee192
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 15 deletions.
14 changes: 12 additions & 2 deletions src/app/settings/SettingsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'use strict';

var angular = require('angular'),
CapabilityError = require('../misc/CapabilityError'),
Server = require('../servers/models/Server'),
URI = require('urijs');

Expand Down Expand Up @@ -235,7 +236,7 @@
});
$scope.errors = Errors.get();
$scope.info = Info.get();
$scope.canSetLocation = Capabilities.setLocation();
$scope.capabilities = Capabilities.get();
AvailabilityService.supported().then(function(isSupported) {
$scope.hasAvailability = isSupported;
}).finally(function() {
Expand Down Expand Up @@ -277,6 +278,15 @@
Errors.reset();
};

$scope.getErrors = function() {
if (!$scope.errors) {
return [];
}
return $scope.errors.filter(function(error) {
return !(error.message instanceof CapabilityError) && error.message.constructor.name !== 'CapabilityError';
});
};

$scope.isDefaultServer = function(server) {
return server && $scope.defaultServer && server._id === $scope.defaultServer._id;
};
Expand All @@ -295,7 +305,7 @@

util.onInfoUpdated(function() {
$scope.info = Info.get();
$scope.canSetLocation = Capabilities.setLocation();
$scope.capabilities = Capabilities.get();
$scope.$broadcast('scroll.refreshComplete');
});
util.onSettingsUpdated(function() {
Expand Down
56 changes: 43 additions & 13 deletions src/app/settings/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ <h1 class="title">About Compass</h1>
<div class="col">{{username}}</div>
</div>
</ion-item>
<span ng-if="serverName !== undefined">
<span ng-if="defaultServer">
<ion-item class="item-divider item-compass">
OpenNMS Server Information
</ion-item>
Expand All @@ -79,23 +79,53 @@ <h1 class="title">About Compass</h1>
<div class="col">{{info.version === '0.0.0'? 'Unknown':info.version}}</div>
</div>
</ion-item>
<ion-item class="item-text-wrap severity-WARNING" ng-if="info.version === '0.0.0'">Your OpenNMS does not support reporting server version information.</ion-item>
<ion-item class="item-text-wrap" ng-if="hasAvailability">Your OpenNMS server supports the Availability API.</ion-item>
<ion-item class="item-text-wrap severity-WARNING" ng-if="!hasAvailability">Your OpenNMS server does not support the Availability API. Dashboard availability by category requires Meridian 2015 or Horizon 15.0.2.</ion-item>
<ion-item class="item-text-wrap" ng-if="canSetLocation">Your OpenNMS server
supports updating node geolocation information.</ion-item>
<ion-item class="item-text-wrap severity-WARNING" ng-if="!canSetLocation">Your OpenNMS server
does not support updating node geolocation information. Updating node coordinates
requires Meridian 2015 or Horizon 15.0.2.</ion-item>
<ion-item class="item-text-wrap item-icon-left" ng-if="info.version === '0.0.0'">
<i class="icon ion-alert-circled"></i>
Your OpenNMS does not support reporting server version information.
</ion-item>
<ion-item class="item-text-wrap item-icon-left" ng-if="hasAvailability">
<i class="icon ion-checkmark-circled severity severity-NORMAL"></i>
Your OpenNMS server supports displaying category availability.
</ion-item>
<ion-item class="item-text-wrap item-icon-left" ng-if="!hasAvailability">
<i class="icon ion-alert-circled severity severity-WARNING"></i>
Your OpenNMS server does not support displaying category availability. Dashboard availability by category requires Meridian 2015 or Horizon 15.0.2.
</ion-item>
<ion-item class="item-text-wrap item-icon-left" ng-if="capabilities.setLocation">
<i class="icon ion-checkmark-circled severity severity-NORMAL"></i>
Your OpenNMS server supports updating node geolocation information.
</ion-item>
<ion-item class="item-text-wrap item-icon-left" ng-if="!capabilities.setLocation">
<i class="icon ion-alert-circled severity severity-WARNING"></i>
Your OpenNMS server does not support updating node geolocation information. Updating node coordinates requires Meridian 2015 or Horizon 15.0.2.
</ion-item>
<ion-item class="item-text-wrap item-icon-left" ng-if="capabilities.graphs">
<i class="icon ion-checkmark-circled severity severity-NORMAL"></i>
Your OpenNMS server supports the measurements API used for graphing.
</ion-item>
<ion-item class="item-text-wrap item-icon-left" ng-if="!capabilities.graphs">
<i class="icon ion-alert-circled severity severity-WARNING"></i>
Your device or OpenNMS server does not support graphing. The measurements API used for graphing requires Meridian 2016 or Horizon 16 or later. Additionally, Compass only supports graphing on devices with 1GB of memory or higher.
</ion-item>
<ion-item class="item-text-wrap item-icon-left" ng-if="capabilities.ackAlarms">
<i class="icon ion-checkmark-circled severity severity-NORMAL"></i>
Your OpenNMS server supports acknowledging, escalating, and clearing alarms.
</ion-item>
<ion-item class="item-text-wrap item-icon-left" ng-if="!capabilities.ackAlarms">
<i class="icon ion-alert-circled severity severity-WARNING"></i>
Your OpenNMS server does not support acknowledging, escalating, or clearing alarms through the Compass app. The Ack API requires Meridian 2015 or Horizon 14.
</ion-item>
</span>
<span ng-if="errors &amp;&amp; errors.length &gt; 0">
<span ng-if="getErrors().length &gt; 0">
<ion-item class="item-divider item-assertive row">
<div class="col col-50">Errors</div>
<div class="col col-50 pull-right" ng-click="clearErrors()">Clear</div>
</ion-item>
<ion-item ng-repeat="error in errors" class="row item-text-wrap">
<span class="col col-25">{{formatType(error.type)}}</span>
<span class="col col-75">{{getErrorMessage(error)}}</span>
<ion-item ng-repeat="error in getErrors()" class="row item-text-wrap">
<dl>
<dt>{{formatType(error.type)}}</dt>
<dd>{{getErrorMessage(error)}}</dd>
</dl>
</ion-item>
</span>
</ion-list>
Expand Down

0 comments on commit 03ee192

Please sign in to comment.