Skip to content

Commit 61b40d3

Browse files
committed
Number of endpoints zero'd on SC restart, fixes #20
1 parent bdc9801 commit 61b40d3

File tree

4 files changed

+9
-19
lines changed

4 files changed

+9
-19
lines changed

src/ServicePulse.Host/app/js/custom_checks/customChecks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ angular.module('customChecks', [])
44
.config(['$routeProvider', function ($routeProvider) {
55
$routeProvider.when('/customChecks', { templateUrl: 'js/custom_checks/customChecks.tpl.html', controller: 'CustomChecksCtrl' });
66
}])
7-
.controller('CustomChecksCtrl', ['$scope', 'serviceControlService', 'streamService', function ($scope, serviceControlService, streamService) {
7+
.controller('CustomChecksCtrl', ['$scope', 'serviceControlService', function ($scope, serviceControlService) {
88

99
$scope.model = { data: [], total: 0};
1010
$scope.loadingData = false;

src/ServicePulse.Host/app/js/dashboard/dashboard.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,14 @@ angular.module('dashboard', [])
2929
$scope.model.number_of_failed_messages = message.total;
3030
});
3131

32-
streamService.subscribe($scope, 'EndpointFailedToHeartbeat', function() {
33-
$scope.model.failing_endpoints++;
34-
$scope.model.active_endpoints--;
32+
streamService.subscribe($scope, 'TotalEndpointsUpdated', function (message) {
33+
$scope.model.failing_endpoints = message.failing;
34+
$scope.model.active_endpoints = message.active;
3535
});
3636

37-
streamService.subscribe($scope, 'EndpointHeartbeatRestored', function() {
38-
$scope.model.failing_endpoints--;
39-
$scope.model.active_endpoints++;
40-
});
41-
42-
streamService.subscribe($scope, 'HeartbeatingEndpointDetected', function() {
43-
$scope.model.active_endpoints++;
44-
});
4537

4638
$scope.$on('$destroy', function () {
47-
streamService.unsubscribe($scope, 'EndpointHeartbeatRestored');
48-
streamService.unsubscribe($scope, 'HeartbeatingEndpointDetected');
49-
streamService.unsubscribe($scope, 'EndpointFailedToHeartbeat');
39+
streamService.unsubscribe($scope, 'TotalEndpointsUpdated');
5040
streamService.unsubscribe($scope, 'TotalErrorMessagesUpdated');
5141
streamService.unsubscribe($scope, 'TotalCustomCheckUpdated');
5242
});

src/ServicePulse.Host/app/js/endpoints/endpoints.tpl.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111

1212
<div class="row" ng-repeat="endpoint in model">
1313
<div class="span5">
14-
<div style="margin: 5px;" ng-class="{'alert-success': endpoint.active, 'alert-danger': endpoint.active == false}">
15-
<h4>{{endpoint.endpoint}}@{{endpoint.machine}}</h4>
16-
<p>Latest heartbeat received: <sp-moment date="{{endpoint.last_sent_at}}" /></p>
14+
<div style="margin: 5px;" ng-class="{'alert-success': endpoint.reported_status != 'dead', 'alert-danger': endpoint.reported_status == 'dead'}">
15+
<h4>{{endpoint.originating_endpoint.name}}@{{endpoint.originating_endpoint.machine}}</h4>
16+
<p>Latest heartbeat received: <sp-moment date="{{endpoint.last_report_at}}" /></p>
1717
</div>
1818
</div>
1919
</div>

src/ServicePulse.Host/app/js/failed_messages/failedMessages.tpl.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ <h2><i class="fa-icon-envelope"></i><span class="break"></span>Showing {{model.f
5252
<div class="box-content">
5353
<div class="btn-toolbar">
5454
<button class="btn" ng-click="retrySelected()" ng-disabled="model.selectedIds.length == 0"><i class="icon-repeat"></i> Retry {{model.selectedIds.length}} selected</button>
55-
<button class="btn" ng-click="retryAll()" ng-disabled="model.total == 0"><i class="icon-asterisk"></i> Retry all ({{model.total}} messages)</button>
55+
<button class="btn" ng-click="retryAll()" ng-disabled="model.total == 0"><i class="icon-asterisk"></i> Retry all messages)</button>
5656
<div class="btn-group pull-right">
5757
<a class="btn btn-link dropdown-toggle"
5858
data-toggle="dropdown"

0 commit comments

Comments
 (0)