Skip to content

Commit 6682031

Browse files
committed
Added ability to mute custom checks
1 parent cb2e5e3 commit 6682031

File tree

5 files changed

+29
-12
lines changed

5 files changed

+29
-12
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ angular.module('customChecks', [])
2020
$scope.loadingData = true;
2121
load(page++);
2222
};
23+
24+
$scope.mute = function(row) {
25+
serviceControlService.muteCustomChecks(row);
26+
};
2327

2428
function load(page) {
2529
serviceControlService.getCustomChecks(page).then(function (response) {

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@ <h2><i class="fa-icon-check"></i><span class="break"></span>Showing {{model.tota
1717
<div infinite-scroll="loadMoreResults()" infinite-scroll-distance="0" infinite-scroll-disabled="disableLoadingData">
1818
<div class="scRow" ng-repeat="item in model.data | orderBy: '-reported_at'">
1919
<div class="row-fluid">
20-
<div class="span10 text-info">{{item.failure_reason}}</div>
21-
<div class="span2 text-right"><sp-moment date="{{item.reported_at}}" /></div>
20+
<div class="span4" title="Id: {{item.custom_check_id}}"><strong>{{item.custom_check_id}}</strong></div>
21+
<div class="span4" title="Category: {{item.category}}">{{item.category}}</div>
22+
<div class="span4 text-right"><sp-moment date="{{item.reported_at}}" /></div>
2223
</div>
2324
<div class="row-fluid">
24-
<div class="span2" title="Id: {{item.id}}"><strong>{{item.id}}</strong></div>
25-
<div class="span4" title="Category: {{item.category}}">{{item.category}}</div>
26-
<div class="span6 text-right" title="In: {{item.originating_endpoint.name}} on {{item.originating_endpoint.machine}}">in {{item.originating_endpoint.name}} on {{item.originating_endpoint.machine}}</div>
25+
<div class="span9 text-info"><pre>{{item.failure_reason}}</pre></div>
26+
<div class="span3 text-right" title="In: {{item.originating_endpoint.name}} on {{item.originating_endpoint.machine}}">in {{item.originating_endpoint.name}} on {{item.originating_endpoint.machine}}</div>
27+
</div>
28+
<div class="row-fluid">
29+
<div class="span12 text-right"><a class="btn btn-small btn-link" ng-click="mute(item)"><i class="icon-volume-off"></i> Mute</a></div>
2730
</div>
2831
</div>
2932
<div class="alert alert-success" ng-show='!loadingData && model.total == 0'>No failed custom checks</div>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ angular.module('endpoints', [])
1010

1111
var timeoutId;
1212

13-
$scope.removeEndpoint = function(id) {
14-
serviceControlService.deleteEndpoint(id);
13+
$scope.removeEndpoint = function(endpoint) {
14+
serviceControlService.removeEndpoint(endpoint);
1515
};
1616

1717
$scope.$on('$destroy', function () {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<div style="margin: 5px;" ng-class="{'alert-success': endpoint.reported_status != 'dead', 'alert-danger': endpoint.reported_status == 'dead'}">
1515
<h4>{{endpoint.originating_endpoint.name}}@{{endpoint.originating_endpoint.machine}}</h4>
1616
<p>Latest heartbeat received: <sp-moment date="{{endpoint.last_report_at}}" /></p>
17-
<button class="btn btn-danger" ng-click="removeEndpoint(endpoint.id)">Remove</button>
17+
<button class="btn btn-danger" ng-click="removeEndpoint(endpoint)">Remove</button>
1818
</div>
1919
</div>
2020
</div>

src/ServicePulse.Host/app/js/services/serviceControlService.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ angular.module('services.serviceControlService', [])
4545
});
4646
};
4747

48+
this.muteCustomChecks = function(customCheck) {
49+
$http.delete(scConfig.service_control_url + '/customchecks/' + customCheck.id)
50+
.success(function () {
51+
notifications.pushForCurrentRoute('"{{item.custom_check_id}}" custom check muted', 'info', { item: customCheck });
52+
})
53+
.error(function () {
54+
notifications.pushForCurrentRoute('Failed to mute "{{item.custom_check_id}}" custom check', 'error', { item: customCheck });
55+
});
56+
};
57+
4858
this.retryAllFailedMessages = function () {
4959
$http.post(scConfig.service_control_url + '/errors/retry/all')
5060
.success(function () {
@@ -77,13 +87,13 @@ angular.module('services.serviceControlService', [])
7787
});
7888
};
7989

80-
this.deleteEndpoint = function (id) {
81-
$http.delete(scConfig.service_control_url + '/heartbeats/' + id)
90+
this.removeEndpoint = function (endpoint) {
91+
$http.delete(scConfig.service_control_url + '/heartbeats/' + endpoint.id)
8292
.success(function () {
83-
notifications.pushForCurrentRoute('Endpoint deleted', 'info');
93+
notifications.pushForCurrentRoute('{{item.originating_endpoint.name}}@{{item.originating_endpoint.machine}} endpoint removed', 'info', { item: endpoint });
8494
})
8595
.error(function () {
86-
notifications.pushForCurrentRoute('Endpoint deletion failed', 'error');
96+
notifications.pushForCurrentRoute('Failed to remove {{item.originating_endpoint.name}}@{{item.originating_endpoint.machine}} endpoint', 'error', { item: endpoint });
8797
});
8898
};
8999

0 commit comments

Comments
 (0)