Refactored panel communication to use an angular service, started work on panel editing interface

This commit is contained in:
Rashid Khan
2013-02-07 15:05:55 -07:00
parent 085b688850
commit ee65f81a2b
18 changed files with 178 additions and 75 deletions
+4 -3
View File
@@ -1,5 +1,5 @@
angular.module('kibana.fields', [])
.controller('fields', function($scope, $rootScope) {
.controller('fields', function($scope, eventBus) {
var _id = _.uniqueId();
@@ -12,7 +12,7 @@ angular.module('kibana.fields', [])
$scope.init = function() {
$scope.fields = [];
$scope.$on($scope.panel.group+"-fields", function(event, fields) {
eventBus.register($scope,'fields', function(event, fields) {
$scope.panel.sort = _.clone(fields.sort);
$scope.fields = _.union(fields.all,$scope.fields);
$scope.active = _.clone(fields.active);
@@ -28,7 +28,8 @@ angular.module('kibana.fields', [])
$scope.active = _.without($scope.active,field)
else
$scope.active.push(field)
$rootScope.$broadcast($scope.panel.group+"-selected_fields",$scope.active)
eventBus.broadcast($scope.$id,$scope.panel.group,"selected_fields",$scope.active)
}
$scope.is_active = function(field) {