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

Global field list #30

Merged
merged 2 commits into from
Apr 5, 2013
Merged
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
7 changes: 6 additions & 1 deletion common/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,9 @@
background-color: #A60000;
}

.typeahead { z-index: 1051; }
.typeahead { z-index: 1051; }

.navbar-inner {
padding-left: 0px;
padding-right: 0px;
}
6 changes: 5 additions & 1 deletion js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'use strict';

angular.module('kibana.controllers', [])
.controller('DashCtrl', function($scope, $rootScope, $http, $timeout, ejsResource, eventBus) {
.controller('DashCtrl', function($scope, $rootScope, $http, $timeout, ejsResource, eventBus, fields) {

var _d = {
title: "",
Expand All @@ -14,7 +14,11 @@ angular.module('kibana.controllers', [])
$scope.init = function() {

$scope.config = config;
// Make underscore.js available to views
$scope._ = _;

// Provide a global list of all see fields
$scope.fields = fields
$scope.reset_row();
$scope.clear_all_alerts();

Expand Down
15 changes: 15 additions & 0 deletions js/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@ angular.module('kibana.services', [])
});
}

})
/* Service: fields
Provides a global list of all seen fields for use in editor panels
*/
.factory('fields', function($rootScope) {
var fields = {
list : []
}

$rootScope.$on('fields', function(event,f) {
fields.list = _.union(f.data.all,fields.list)
})

return fields;

})
.service('timer', function($timeout) {
// This service really just tracks a list of $timeout promises to give us a
Expand Down
2 changes: 1 addition & 1 deletion panels/map/editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="span3">
<form>
<h6>Field</h6>
<input type="text" class="input-small" ng-model="panel.field">
<input bs-typeahead="fields.list" type="text" class="input-small" ng-model="panel.field">
</form>
</div>
<div class="span6">
Expand Down
2 changes: 1 addition & 1 deletion panels/pie/editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="span4">
<form style="margin-bottom: 0px">
<h6> Field</h6>
<input type="text" style="width:90%" ng-model="panel.query.field">
<input type="text" style="width:90%" bs-typeahead="fields.list" ng-model="panel.query.field">
</form>
</div>
<div class="span8">
Expand Down
2 changes: 1 addition & 1 deletion panels/table/editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h6>Query</h6>
<div class="span4">
<form class="input-append">
<h6>Add field</h6>
<input bs-typeahead="all_fields" type="text" class="input-small" ng-model='newfield'>
<input bs-typeahead="fields.list" type="text" class="input-small" ng-model='newfield'>
<button class="btn" ng-click="toggle_field(newfield);newfield=''"><i class="icon-plus"></i></button>
</form>
</div>
Expand Down
3 changes: 1 addition & 2 deletions panels/table/module.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
angular.module('kibana.table', [])
.controller('table', function($scope, eventBus) {
.controller('table', function($scope, eventBus, fields) {

// Set and populate defaults
var _d = {
Expand Down Expand Up @@ -142,7 +142,6 @@ angular.module('kibana.table', [])

// This breaks, use $scope.data for this
$scope.all_fields = get_all_fields($scope.data);

broadcast_results();

// If we're not sorting in reverse chrono order, query every index for
Expand Down