mirror of https://github.com/grafana/grafana.git
				
				
				
			removed old mentions of eventBus, still need to refactor fields/table
This commit is contained in:
		
							parent
							
								
									a768c9c1c2
								
							
						
					
					
						commit
						b8bca8baa8
					
				|  | @ -20,7 +20,7 @@ var config = new Settings( | |||
|   elasticsearch:    "http://"+window.location.hostname+":9200",    | ||||
|   // elasticsearch: 'http://localhost:9200',
 | ||||
|   kibana_index:     "kibana-int",  | ||||
|   modules:          ['histogram','map','pie','table','stringquery','sort', | ||||
|   modules:          ['histogram','map','pie','table' | ||||
|                     'timepicker','text','fields','hits','dashcontrol', | ||||
|                     'column','derivequeries','trends','bettermap','query'], | ||||
|   } | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ | |||
| */ | ||||
| 
 | ||||
| angular.module('kibana.bettermap', []) | ||||
| .controller('bettermap', function($scope, eventBus, query, dashboard, filterSrv) { | ||||
| .controller('bettermap', function($scope, query, dashboard, filterSrv) { | ||||
| 
 | ||||
|   // Set and populate defaults
 | ||||
|   var _d = { | ||||
|  |  | |||
|  | @ -27,7 +27,7 @@ | |||
| */ | ||||
| 
 | ||||
| angular.module('kibana.dashcontrol', []) | ||||
| .controller('dashcontrol', function($scope, $routeParams, $http, eventBus, timer, dashboard) { | ||||
| .controller('dashcontrol', function($scope, $routeParams, $http, timer, dashboard) { | ||||
| 
 | ||||
|   $scope.panel = $scope.panel || {}; | ||||
|   // Set and populate defaults
 | ||||
|  | @ -150,7 +150,7 @@ angular.module('kibana.dashcontrol', []) | |||
|     }) | ||||
|   } | ||||
| }) | ||||
| .directive('dashUpload', function(timer, eventBus, dashboard){ | ||||
| .directive('dashUpload', function(timer, dashboard){ | ||||
|   return { | ||||
|     restrict: 'A', | ||||
|     link: function(scope, elem, attrs) { | ||||
|  |  | |||
|  | @ -12,18 +12,10 @@ | |||
|   * fields :: a list of fields known to us | ||||
|   * query_mode :: how to create query | ||||
| 
 | ||||
|   ### Group Events | ||||
|   #### Sends | ||||
|   * query :: Always broadcast as an array, even in multi: false | ||||
|   * get_time :: Request the time object from the timepicker | ||||
|   #### Receives | ||||
|   * query :: An array of queries. This is probably needs to be fixed. | ||||
|   * time :: populate index and time | ||||
|   * fields :: A list of fields known to us | ||||
| */ | ||||
| 
 | ||||
| angular.module('kibana.derivequeries', []) | ||||
| .controller('derivequeries', function($scope, $rootScope, query, eventBus, fields, dashboard, filterSrv) { | ||||
| .controller('derivequeries', function($scope, $rootScope, query, fields, dashboard, filterSrv) { | ||||
| 
 | ||||
|   // Set and populate defaults
 | ||||
|   var _d = { | ||||
|  |  | |||
|  | @ -226,6 +226,7 @@ angular.module('kibana.histogram', []) | |||
|       to:moment.utc(_to), | ||||
|       field:$scope.panel.time_field | ||||
|     }) | ||||
|      | ||||
|     dashboard.refresh(); | ||||
| 
 | ||||
|   } | ||||
|  |  | |||
|  | @ -13,16 +13,10 @@ | |||
|   * donut :: Only applies to 'pie' charts. Punches a hole in the chart for some reason | ||||
|   * tilt :: Only 'pie' charts. Janky 3D effect. Looks terrible 90% of the time.  | ||||
|   * lables :: Only 'pie' charts. Labels on the pie? | ||||
|   ### Group Events | ||||
|   #### Sends | ||||
|   * get_time :: On panel initialization get time range to query | ||||
|   #### Receives | ||||
|   * time :: An object containing the time range to use and the index(es) to query | ||||
|   * query :: An Array of queries, even if its only one | ||||
| 
 | ||||
| */ | ||||
| angular.module('kibana.hits', []) | ||||
| .controller('hits', function($scope, eventBus, query, dashboard, filterSrv) { | ||||
| .controller('hits', function($scope, query, dashboard, filterSrv) { | ||||
| 
 | ||||
|   // Set and populate defaults
 | ||||
|   var _d = { | ||||
|  | @ -142,7 +136,7 @@ angular.module('kibana.hits', []) | |||
|     $scope.get_data(); | ||||
|   } | ||||
| 
 | ||||
| }).directive('hitsChart', function(eventBus, query) { | ||||
| }).directive('hitsChart', function(query) { | ||||
|   return { | ||||
|     restrict: 'A', | ||||
|     link: function(scope, elem, attrs, ctrl) { | ||||
|  |  | |||
|  | @ -19,16 +19,11 @@ | |||
|   * spyable :: Show the 'eye' icon that reveals the last ES query | ||||
|   * index_limit :: This does nothing yet. Eventually will limit the query to the first | ||||
|                    N indices | ||||
|   ### Group Events | ||||
|   #### Sends | ||||
|   * get_time :: On panel initialization get time range to query | ||||
|   #### Receives | ||||
|   * time :: An object containing the time range to use and the index(es) to query | ||||
|   * query :: An Array of queries, this panel uses only the first one | ||||
| 
 | ||||
| */ | ||||
| 
 | ||||
| angular.module('kibana.map', []) | ||||
| .controller('map', function($scope, $rootScope, eventBus, query, dashboard, filterSrv) { | ||||
| .controller('map', function($scope, $rootScope, query, dashboard, filterSrv) { | ||||
| 
 | ||||
|   // Set and populate defaults
 | ||||
|   var _d = { | ||||
|  |  | |||
|  | @ -23,17 +23,10 @@ | |||
|                       doesn't have a field | ||||
|   * spyable :: Show the 'eye' icon that displays the last ES query for this panel | ||||
| 
 | ||||
|   ### Group Events | ||||
|   #### Sends | ||||
|   * get_time :: On panel initialization get time range to query | ||||
|   #### Receives | ||||
|   * time :: An object containing the time range to use and the index(es) to query | ||||
|   * query :: An Array of queries, this panel will use the first in the array | ||||
| 
 | ||||
| */ | ||||
| 
 | ||||
| angular.module('kibana.pie', []) | ||||
| .controller('pie', function($scope, $rootScope, eventBus, query, dashboard, filterSrv) { | ||||
| .controller('pie', function($scope, $rootScope, query, dashboard, filterSrv) { | ||||
| 
 | ||||
|   // Set and populate defaults
 | ||||
|   var _d = { | ||||
|  |  | |||
|  | @ -9,18 +9,10 @@ | |||
|   * query ::  A string or an array of querys. String if multi is off, array if it is on | ||||
|               This should be fixed, it should always be an array even if its only  | ||||
|               one element | ||||
|   * multi :: Allow input of multiple queries? true/false | ||||
|   * multi_arrange :: How to arrange multu query string panels, 'vertical' or 'horizontal' | ||||
|   ### Group Events | ||||
|   #### Sends | ||||
|   * query :: Always broadcast as an array, even in multi: false | ||||
|   #### Receives | ||||
|   * query :: An array of queries. This is probably needs to be fixed. | ||||
| 
 | ||||
| */ | ||||
| 
 | ||||
| angular.module('kibana.query', []) | ||||
| .controller('query', function($scope, eventBus, query, $rootScope) { | ||||
| .controller('query', function($scope, query, $rootScope) { | ||||
| 
 | ||||
|   // Set and populate defaults
 | ||||
|   var _d = { | ||||
|  |  | |||
|  | @ -15,17 +15,10 @@ | |||
|     * enable :: true/false, enable auto refresh by default. Default: false | ||||
|     * interval :: Seconds between auto refresh. Default: 30 | ||||
|     * min :: The lowest interval a user may set | ||||
| 
 | ||||
|   ### Group Events | ||||
|   #### Sends | ||||
|   * time :: Object Includes from, to and index | ||||
|   #### Receives | ||||
|   * get_time :: Receives an object containing a $id, broadcasts back to it. | ||||
| 
 | ||||
| */ | ||||
| 
 | ||||
| angular.module('kibana.timepicker', []) | ||||
| .controller('timepicker', function($scope, $rootScope, eventBus, $timeout, timer, $http, dashboard, filterSrv) { | ||||
| .controller('timepicker', function($scope, $rootScope, $timeout, timer, $http, dashboard, filterSrv) { | ||||
| 
 | ||||
|   // Set and populate defaults
 | ||||
|   var _d = { | ||||
|  | @ -228,7 +221,7 @@ angular.module('kibana.timepicker', []) | |||
|     return $scope.panel.filter_id; | ||||
|   } | ||||
| 
 | ||||
|   // Prefer to pass around Date() objects in the EventBus since interacting with
 | ||||
|   // Prefer to pass around Date() objects since interacting with
 | ||||
|   // moment objects in libraries that are expecting Date()s can be tricky
 | ||||
|   function compile_time(time) { | ||||
|     time = _.clone(time) | ||||
|  |  | |||
|  | @ -19,7 +19,7 @@ | |||
| 
 | ||||
| */ | ||||
| angular.module('kibana.trends', []) | ||||
| .controller('trends', function($scope, eventBus, kbnIndex, query, dashboard, filterSrv) { | ||||
| .controller('trends', function($scope, kbnIndex, query, dashboard, filterSrv) { | ||||
| 
 | ||||
|   // Set and populate defaults
 | ||||
|   var _d = { | ||||
|  | @ -37,11 +37,7 @@ angular.module('kibana.trends', []) | |||
| 
 | ||||
|     $scope.$on('refresh',function(){$scope.get_data()}) | ||||
| 
 | ||||
|     eventBus.register($scope,'time', function(event,time){ | ||||
|       set_time(time) | ||||
|     }); | ||||
|     // Now that we're all setup, request the time from our group
 | ||||
|     eventBus.broadcast($scope.$id,$scope.panel.group,'get_time') | ||||
|     $scope.get_data(); | ||||
|   } | ||||
| 
 | ||||
|   $scope.get_data = function(segment,query_id) { | ||||
|  | @ -173,19 +169,6 @@ angular.module('kibana.trends', []) | |||
|     return x == 0 ? null : 100*(y-x)/x | ||||
|   } | ||||
| 
 | ||||
|   $scope.remove_query = function(q) { | ||||
|     $scope.panel.query = _.without($scope.panel.query,q); | ||||
|     $scope.get_data(); | ||||
|   } | ||||
| 
 | ||||
|   $scope.add_query = function(label,query) { | ||||
|     $scope.panel.query.unshift({ | ||||
|       query: query, | ||||
|       label: label,  | ||||
|     }); | ||||
|     $scope.get_data(); | ||||
|   } | ||||
| 
 | ||||
|   $scope.set_refresh = function (state) {  | ||||
|     $scope.refresh = state;  | ||||
|   } | ||||
|  | @ -197,9 +180,4 @@ angular.module('kibana.trends', []) | |||
|     $scope.$emit('render'); | ||||
|   } | ||||
| 
 | ||||
|   function set_time(time) { | ||||
|     $scope.time = time; | ||||
|     $scope.get_data(); | ||||
|   } | ||||
| 
 | ||||
| }) | ||||
		Loading…
	
		Reference in New Issue