status: Implement graph switching

This commit is contained in:
Heikki Hannikainen 2016-08-02 10:01:21 +03:00
parent 7eef920b17
commit 2e108cb1ec
3 changed files with 8 additions and 6 deletions

View File

@ -84,12 +84,12 @@ var graph_module = angular.module('graph', [ ]).
});
};
instance.gr_switch = function($scope, id) {
instance.gr_switch = function(id) {
instance.graph_selected = id;
instance.range_selected = false;
$scope.graph_zoomed = false;
instance.scope.graph_zoomed = false;
$('#graph').trigger('plotunselected');
instance.load_graph($scope);
instance.load_graph(instance.scope);
};
instance.graph_zoom = function(zoom_in) {
@ -112,7 +112,7 @@ var graph_module = angular.module('graph', [ ]).
instance.graph_setup = function($scope) {
instance.scope = $scope;
instance.gr_switch($scope, 'totals.tcp_bytes_rx');
instance.gr_switch('totals.tcp_bytes_rx');
$('#graph').bind('plotselected', function(event,ranges) {
var to = parseInt(ranges.xaxis.to.toFixed(0));

View File

@ -1031,7 +1031,9 @@ app.controller('aprscc', [ '$scope', '$http', 'graphs', function($scope, $http,
'cols_clients': cols_clients
};
/* graph zooming and switching */
$scope.graphZoom = graphs.graph_zoom;
$scope.graphSwitch = function(tree, key) { graphs.gr_switch(tree + '.' + key); };
/* set up sorting for client and peer lists */
$scope.clients_sort = {

View File

@ -57,7 +57,7 @@
<div class='table-responsive'>
<table class='table table-hover table-condensed table-striped'>
<tr ng-repeat="k in setup.keys_totals">
<td>{{ setup.key_translate[k] }}</td>
<td ng-click='graphSwitch("totals", k)' class='link'>{{ setup.key_translate[k] }}</td>
<td>{{ status.totals[k] }}</td>
<td ng-show="status_prev">{{ (status.totals[k] - status_prev.totals[k]) / status.tick_dif | ratestr}}/s</td>
</tr>
@ -78,7 +78,7 @@
<div class='table-responsive'>
<table class='table table-hover table-condensed table-striped'>
<tr ng-repeat="k in setup.keys_dupecheck">
<td>{{ setup.key_translate[k] }}</td>
<td ng-click='graphSwitch("dupecheck", k)' class='link'>{{ setup.key_translate[k] }}</td>
<td>{{ status.dupecheck[k] }}</td>
<td ng-show="status_prev">{{ (status.dupecheck[k] - status_prev.dupecheck[k]) / status.tick_dif | ratestr}}/s</td>
</tr>