Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output Master in Machine List #239

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion mod/dashboard/app/browser.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/restangular/dist/restangular.js"></script>
<script src="bower_components/underscore/underscore.js"></script>
<script src="bower_components/moment/moment.js"></script>
<!-- endbuild -->
Expand Down
18 changes: 15 additions & 3 deletions mod/dashboard/app/scripts/controllers/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,22 @@ angular.module('etcdStats', ['ngRoute', 'etcd'])
function readStats() {
EtcdV1.getStat('leader').get().success(function(data) {
$scope.leaderStats = data;
$scope.followers = [];
$scope.leaderName = data.leader;
$scope.machines = [];
//hardcode leader stats
$scope.machines.push({
latency: {
average: 0,
current: 0,
minimum: 0,
maximum: 0,
standardDeviation: 0
},
name: data.leader
});
$.each(data.followers, function(index, value) {
value.name = index;
$scope.followers.push(value);
$scope.machines.push(value);
});
drawGraph();
});
Expand All @@ -46,7 +58,7 @@ angular.module('etcdStats', ['ngRoute', 'etcd'])
chart({
el: $scope.graphContainer,
data: {
'stats': $scope.followers
'stats': $scope.machines
}
}).width(width).height(height).update();
});
Expand Down
1 change: 0 additions & 1 deletion mod/dashboard/app/stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/d3/d3.js"></script>
<script src="bower_components/restangular/dist/restangular.js"></script>
<script src="bower_components/underscore/underscore.js"></script>
<!-- endbuild -->

Expand Down
6 changes: 6 additions & 0 deletions mod/dashboard/app/styles/etcd-widgets.css
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,12 @@ body {
background-color: #00DB24;
}

.etcd-container.etcd-stats .etcd-list .etcd-machine-type {
color: #999;
padding-left: 3px;
font-size: 13px;
}

.etcd-container.etcd-stats .etcd-list .etcd-latency-value {
display: inline-block;
}
Expand Down
19 changes: 11 additions & 8 deletions mod/dashboard/app/views/stats.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="etcd-container etcd-stats {{columns}} {{tableVisibility}}">
<div class="etcd-body">
<div class="etcd-format-selector">
<div class="etcd-selector-item etcd-selector-graph" ng-click="show_graph()">
<div class="etcd-selector-item etcd-selector-graph" ng-click="showGraph()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
preserveAspectRatio="xMinYMin" viewBox="0 0 60 60.007" enable-background="new 0 0 60 60.007" xml:space="preserve">
<path fill="#1D1D1B" d="M30-0.091c-16.621,0-30.094,13.474-30.094,30.094c0,16.621,13.474,30.094,30.094,30.094
Expand All @@ -10,7 +10,7 @@
</svg>

</div>
<div class="etcd-selector-item etcd-selector-table" ng-click="show_table()">
<div class="etcd-selector-item etcd-selector-table" ng-click="showTable()">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
preserveAspectRatio="xMinYMin" viewBox="0 0 59.496 59.503" enable-background="new 0 0 59.496 59.503" xml:space="preserve">
<rect x="0" y="0" fill="#1D1D1B" width="59.496" height="13.111"/>
Expand All @@ -20,23 +20,26 @@
</div>
</div>
<div class="etcd-graph">
<h2>Follower Latency</h2>
<h2>Machine Latency</h2>
<div class="etcd-graph-container" id="latency">
</div>
</div>
<div class="etcd-list">
<h2>Follower List</h2>
<h2>Machine List</h2>
<table cellpadding="0" cellspacing="0">
<thead>
<td class="etcd-name-header">Machine Name</td>
<td class="etcd-latency">Latency</td>
</thead>
<tbody>
<tr ng-repeat="follower in followers">
<td>{{follower.name}}</td>
<tr ng-repeat="machine in machines">
<td ng-switch on="{true:'leader', false: 'follower'}[leaderName == machine.name]">
<div ng-switch-when="leader">{{machine.name}}<span class="etcd-machine-type">(leader)</span></div>
<div ng-switch-default>{{machine.name}}</div>
</td>
<td>
<div class="etcd-square ng-class: {'etcd-square-green': follower.latency.current < 2, 'etcd-square-orange': follower.latency.current < 5, 'etcd-square-red': follower.latency.current >= 10}"></div>
<div class="etcd-latency-value">{{follower.latency.current | number:1 }} ms</div>
<div class="etcd-square ng-class: {'etcd-square-green': machine.latency.current < 2, 'etcd-square-orange': machine.latency.current < 5, 'etcd-square-red': machine.latency.current >= 10}"></div>
<div class="etcd-latency-value">{{machine.latency.current | number:1 }} ms</div>
</td>
</tr>
</tbody>
Expand Down