Skip to content

Commit 507a2e9

Browse files
committed
Implemented issue Particular/ServiceControl#40
1 parent eef63e8 commit 507a2e9

File tree

6 files changed

+58
-36
lines changed

6 files changed

+58
-36
lines changed

src/Pulse.Host/PulseBootstrapper.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
namespace Pulse.Host
22
{
3+
using System;
34
using System.IO;
45
using Nancy;
56
using Nancy.Conventions;
@@ -35,9 +36,25 @@ protected override void ConfigureConventions(NancyConventions conventions)
3536
});
3637
}
3738

39+
protected override IRootPathProvider RootPathProvider
40+
{
41+
get { return new CustomRootPathProvider(); }
42+
}
43+
3844
protected override DiagnosticsConfiguration DiagnosticsConfiguration
3945
{
4046
get { return new DiagnosticsConfiguration {Password = @"Welcome1"}; }
4147
}
48+
49+
class CustomRootPathProvider : IRootPathProvider
50+
{
51+
public string GetRootPath()
52+
{
53+
#if DEBUG
54+
return Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\"));
55+
#endif
56+
return AppDomain.CurrentDomain.BaseDirectory;
57+
}
58+
}
4259
}
4360
}

src/Pulse.Host/app/index.html

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html>
2-
<html ng-app="myApp">
2+
<html lang="en" ng-app="myApp">
33
<head>
4-
<title>Bootstrap 101 Template</title>
4+
<title>ServicePulse</title>
55

66
<meta http-equiv="X-UA-Compatible" content="IE=edge">
77
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -15,28 +15,36 @@
1515
<![endif]-->
1616
</head>
1717
<body>
18-
<div class="container">
19-
<div class="header">
20-
<ul class="nav nav-pills pull-right">
21-
<li class="active"><a href="#">Home</a></li>
22-
<li><a href="#">About</a></li>
23-
<li><a href="#">Contact</a></li>
24-
</ul>
25-
<h3 class="text-muted">Project name</h3>
18+
<nav class="navbar navbar-default" role="navigation">
19+
<!-- Brand and toggle get grouped for better mobile display -->
20+
<div class="navbar-header">
21+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
22+
<span class="sr-only">Toggle navigation</span>
23+
<span class="icon-bar"></span>
24+
<span class="icon-bar"></span>
25+
<span class="icon-bar"></span>
26+
</button>
27+
<a class="navbar-brand" href="#">ServicePulse</a>
2628
</div>
2729

28-
<div class="footer">
29-
<p>Copyright 2013 Particular Software Limited. All rights reserved</p>
30+
<!-- Collect the nav links, forms, and other content for toggling -->
31+
<div class="collapse navbar-collapse navbar-ex1-collapse">
32+
<ul class="nav navbar-nav">
33+
<li class="active"><a href="#">Dashboard</a></li>
34+
<li><a href="#">Another Link</a></li>
35+
</ul>
36+
</div>
37+
<!-- /.navbar-collapse -->
38+
</nav>
39+
<div class="row">
40+
<div class="col-md-2">
41+
<ul class="nav nav-pills nav-stacked">
42+
<li><a href="#/view1">Issue 40</a></li>
43+
<li><a href="#/view2">view2</a></li>
44+
</ul>
3045
</div>
46+
<div class="col-md-10" ng-view></div>
3147
</div>
32-
<ul class="menu">
33-
<li><a href="#/view1">view1</a></li>
34-
<li><a href="#/view2">view2</a></li>
35-
</ul>
36-
37-
<div ng-view></div>
38-
39-
<div>Angular seed app: v</div>
4048

4149
<script src="lib/jquery-1.10.2.min.js"></script>
4250
<script src="lib/jquery.signalR-1.1.3.min.js"></script>

src/Pulse.Host/app/js/controllers.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@
55
angular.module('myApp.controllers', [])
66
.controller('MyCtrl1', ['$scope', 'streamService', function ($scope, streamService) {
77

8-
$scope.pings = [];
9-
$scope.callSignalR = function() {
10-
streamService.send('Ping', { name: 'John' });
11-
};
12-
streamService.subscribe($scope, 'Pong', function (message) {
13-
$scope.$apply(function(scope) {
14-
scope.pings.push(message);
8+
$scope.model = {success: 0, fail: 0};
9+
10+
streamService.subscribe($scope, 'HeartbeatSummary', function (message) {
11+
$scope.$apply(function (scope) {
12+
scope.model.success = message.active_endpoints;
13+
scope.model.fail = message.number_of_failing_endpoints;
1514
});
1615
});
1716

18-
1917
}])
2018
.controller('MyCtrl2', ['$scope', 'serviceControlService', function($scope, serviceControlService) {
2119
serviceControlService.getEndpointsWithSla().then(function(endpoints) {

src/Pulse.Host/app/js/services.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ angular.module('myApp.services', [])
1313
connection.received(function(data) {
1414
$log.info('SignalR data received');
1515
$log.info(data);
16-
$rootScope.$broadcast(data.Type, data.Message);
16+
$rootScope.$broadcast(data.type, data.message);
1717
});
1818

1919
connection.start().done(function() {
@@ -22,7 +22,6 @@ angular.module('myApp.services', [])
2222

2323
var onSubscribe = function($scope, messageType, handler) {
2424
$scope.$on(messageType, function(event, message) {
25-
// note that the handler is passed the problem domain parameters
2625
handler(message);
2726
});
2827
};
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div ng-controller="MyCtrl1">
2-
<p>This is the partial for view 1.</p>
3-
<a class="btn btn-default" ng-click="callSignalR()">Click me</a>
4-
<ul ng-repeat="ping in pings">
5-
<li>{{ping.Message}}</li>
6-
</ul>
2+
<h2>Heartbeats indicators</h2>
3+
<div class="well">
4+
<a href="#/view2" class="btn btn-success btn-lg">{{model.success}} active endpoints</a>
5+
<a href="#/view2" class="btn btn-danger btn-lg">{{model.fail}} failing endpoints</a>
6+
</div>
77
</div>

src/Pulse.Host/app/partials/partial2.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div ng-controller="MyCtrl2">
2-
2+
Hello!
33
<ul ng-repeat="e in endpoints">
44
<li>{{e.name}}@{{e.machine}} <strong>{{e.sla}}</strong></li>
55
</ul>

0 commit comments

Comments
 (0)