kibana-sinatra 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +28 -3
  3. data/lib/kibana/assets/app/app.js +16 -4
  4. data/lib/kibana/assets/app/components/require.config.js +2 -1
  5. data/lib/kibana/assets/app/components/settings.js +4 -3
  6. data/lib/kibana/assets/app/controllers/dash.js +1 -1
  7. data/lib/kibana/assets/app/controllers/dashLoader.js +5 -4
  8. data/lib/kibana/assets/app/dashboards/blank.json +2 -1
  9. data/lib/kibana/assets/app/dashboards/default.json +4 -51
  10. data/lib/kibana/assets/app/dashboards/guided.json +2 -1
  11. data/lib/kibana/assets/app/dashboards/logstash.json +2 -0
  12. data/lib/kibana/assets/app/dashboards/noted.json +2 -1
  13. data/lib/kibana/assets/app/directives/addPanel.js +5 -0
  14. data/lib/kibana/assets/app/directives/all.js +2 -1
  15. data/lib/kibana/assets/app/directives/configModal.js +34 -0
  16. data/lib/kibana/assets/app/directives/kibanaPanel.js +10 -4
  17. data/lib/kibana/assets/app/directives/kibanaSimplePanel.js +10 -8
  18. data/lib/kibana/assets/app/panels/bettermap/editor.html +4 -4
  19. data/lib/kibana/assets/app/panels/bettermap/module.js +1 -1
  20. data/lib/kibana/assets/app/panels/dashcontrol/module.html +1 -4
  21. data/lib/kibana/assets/app/panels/histogram/editor.html +22 -22
  22. data/lib/kibana/assets/app/panels/histogram/module.html +4 -4
  23. data/lib/kibana/assets/app/panels/histogram/module.js +30 -24
  24. data/lib/kibana/assets/app/panels/histogram/timeSeries.js +16 -0
  25. data/lib/kibana/assets/app/panels/hits/editor.html +9 -9
  26. data/lib/kibana/assets/app/panels/map/editor.html +4 -4
  27. data/lib/kibana/assets/app/panels/pie/editor.html +47 -42
  28. data/lib/kibana/assets/app/panels/table/editor.html +39 -38
  29. data/lib/kibana/assets/app/panels/table/module.html +14 -5
  30. data/lib/kibana/assets/app/panels/table/module.js +23 -19
  31. data/lib/kibana/assets/app/panels/table/pagination.html +29 -24
  32. data/lib/kibana/assets/app/panels/terms/editor.html +53 -47
  33. data/lib/kibana/assets/app/panels/terms/module.js +7 -5
  34. data/lib/kibana/assets/app/panels/timepicker/module.html +2 -2
  35. data/lib/kibana/assets/app/partials/dashLoader.html +6 -6
  36. data/lib/kibana/assets/app/partials/dasheditor.html +127 -117
  37. data/lib/kibana/assets/app/partials/paneladd.html +1 -1
  38. data/lib/kibana/assets/app/partials/paneleditor.html +2 -2
  39. data/lib/kibana/assets/app/partials/panelgeneral.html +19 -17
  40. data/lib/kibana/assets/app/partials/roweditor.html +3 -3
  41. data/lib/kibana/assets/app/services/dashboard.js +67 -16
  42. data/lib/kibana/assets/app/services/fields.js +18 -15
  43. data/lib/kibana/assets/css/bootstrap.dark.min.css +1 -1
  44. data/lib/kibana/assets/css/bootstrap.light.min.css +1 -1
  45. data/lib/kibana/assets/vendor/angular/angular.js +17 -0
  46. data/lib/kibana/assets/vendor/bootstrap/less/modals.less +3 -11
  47. data/lib/kibana/assets/vendor/bootstrap/less/overrides.less +2 -3
  48. data/lib/kibana/assets/vendor/jquery/jquery.flot.js +2 -2
  49. data/lib/kibana/sinatra/version.rb +1 -1
  50. data/lib/kibana/views/config.erb +17 -7
  51. metadata +3 -5
  52. data/lib/kibana/assets/app/panels/dashcontrol/load.html +0 -40
  53. data/lib/kibana/assets/app/panels/dashcontrol/save.html +0 -30
  54. data/lib/kibana/assets/app/panels/dashcontrol/share.html +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 21377d439be1057f9413662fee65a2a6bd0328c4
4
- data.tar.gz: 3d3c501f3c505ff9c8408d679e0e8eb6e44a26bf
3
+ metadata.gz: 0ae246456b81df5e196942cf5cc54902c20963cf
4
+ data.tar.gz: d8747df503e6a8317618d611d5d19200abecfc60
5
5
  SHA512:
6
- metadata.gz: 1881dec9046579b356dd06023529ba62b17f491c74d0060a31ae19fdcd271b04658ec2c891ba10181940a01eb7e82813caca46e565ec78115789c9b565d2a94e
7
- data.tar.gz: e00e61cb597a791c5f3c7a383c55300b05166f65b1410dd038fbd02e2e40e70a7ec26763ade25ccfb246f0343095500a8f4bc2ee4ce81d70498b71e787e989a4
6
+ metadata.gz: 7cf30e392b4ce6c72bd8f9d8c28b78d3b4d15142003b91669f1009a601bd96cfa2641f3ebbe6336c150c8c1cdb1b1c38d3987fef762e4866af861ceeda65cdac
7
+ data.tar.gz: 12b2a2c6aa112dad0b28f9c2012177ebbf3a2c8b2ffef6bd0a48014fc2d218eef27420f5ca3d9a44b69cf55b6bce8f947ae36e4fc0e2be10addcfa06834b1066
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  This gem provides [Kibana 3](https://github.com/elasticsearch/kibana) inside a [Sinatra](http://www.sinatrarb.com/) app that you can include in any Rack based system, including Rails.
8
8
 
9
- It is currently based on Kibana 3 commit [f194336277280467f4d27ab8b65c8f69c5c7122e](https://github.com/elasticsearch/kibana/commits/master)
9
+ It is currently based on Kibana 3 commit [0f16e1cc6184ed101e63106b4b386cebc3e92652](https://github.com/elasticsearch/kibana/commits/0f16e1cc6184ed101e63106b4b386cebc3e92652)
10
10
 
11
11
  ## Installation
12
12
 
@@ -36,7 +36,7 @@ module Kibana::Sinatra
36
36
  def elasticsearch_url
37
37
  "http://\"+window.location.hostname+\":9200"
38
38
  end
39
-
39
+
40
40
  def kibana_index
41
41
  "kibana-int"
42
42
  end
@@ -47,11 +47,32 @@ end
47
47
  In your `config/routes.rb` file mount the Kibana::Sinatra::Web class to a route:
48
48
 
49
49
  mount Kibana::Sinatra::Web => '/kibana', :trailing_slash => true
50
-
50
+
51
51
  The trailing slash is important due to the way Kibana links to CSS & JS files.
52
52
 
53
53
  Start your server and you should now be able to load `/kibana/` and Kibana 3 should start up!
54
54
 
55
+ ### Launch as Rack app
56
+
57
+ First you will need to configure Kibana's config.js same as "Inside Rails".
58
+
59
+ And add config.ru on top of your directory.
60
+
61
+ ```ruby
62
+ require 'sinatra'
63
+ require 'kibana/sinatra/web'
64
+
65
+ # If you need to configure elasticsearch_url, put your configuration here just like the Rails example.
66
+
67
+ run Kibana::Sinatra::Web
68
+ ```
69
+
70
+ At last, you need to just run rackup.
71
+
72
+ ```
73
+ rackup
74
+ ```
75
+
55
76
  ## Contributing
56
77
 
57
78
  1. Fork it
@@ -59,3 +80,7 @@ Start your server and you should now be able to load `/kibana/` and Kibana 3 sho
59
80
  3. Commit your changes (`git commit -am 'Add some feature'`)
60
81
  4. Push to the branch (`git push origin my-new-feature`)
61
82
  5. Create new Pull Request
83
+
84
+ ## Contributors
85
+
86
+ Thanks for all the help to our [awesome contributors](https://github.com/ianneub/kibana-sinatra/graphs/contributors)!
@@ -12,9 +12,10 @@ define([
12
12
  'angular-strap',
13
13
  'angular-dragdrop',
14
14
  'extend-jquery',
15
- 'bindonce'
15
+ 'bindonce',
16
16
  ],
17
17
  function (angular, $, _, appLevelRequire) {
18
+
18
19
  "use strict";
19
20
 
20
21
  var app = angular.module('kibana', []),
@@ -25,6 +26,12 @@ function (angular, $, _, appLevelRequire) {
25
26
  // features if we define them after boot time
26
27
  register_fns = {};
27
28
 
29
+ // This stores the Kibana revision number, @REV@ is replaced by grunt.
30
+ app.constant('kbnVersion',"@REV@");
31
+
32
+ // Use this for cache busting partials
33
+ app.constant('cacheBust',"cache-bust="+Date.now());
34
+
28
35
  /**
29
36
  * Tells the application to watch the module, once bootstraping has completed
30
37
  * the modules controller, service, etc. functions will be overwritten to register directly
@@ -59,6 +66,7 @@ function (angular, $, _, appLevelRequire) {
59
66
  };
60
67
 
61
68
  app.config(function ($routeProvider, $controllerProvider, $compileProvider, $filterProvider, $provide) {
69
+
62
70
  $routeProvider
63
71
  .when('/dashboard', {
64
72
  templateUrl: 'app/partials/dashboard.html',
@@ -72,6 +80,7 @@ function (angular, $, _, appLevelRequire) {
72
80
  .otherwise({
73
81
  redirectTo: 'dashboard'
74
82
  });
83
+
75
84
  // this is how the internet told me to dynamically add modules :/
76
85
  register_fns.controller = $controllerProvider.register;
77
86
  register_fns.directive = $compileProvider.directive;
@@ -128,9 +137,12 @@ function (angular, $, _, appLevelRequire) {
128
137
  var $scope = this;
129
138
  $scope.requireContext(deps, function () {
130
139
  var deps = _.toArray(arguments);
131
- $scope.$apply(function () {
132
- fn.apply($scope, deps);
133
- });
140
+ // Check that this is a valid scope.
141
+ if($scope.$id) {
142
+ $scope.$apply(function () {
143
+ fn.apply($scope, deps);
144
+ });
145
+ }
134
146
  });
135
147
  };
136
148
  }]);
@@ -50,7 +50,7 @@ require.config({
50
50
  },
51
51
 
52
52
  angular: {
53
- deps: ['jquery'],
53
+ deps: ['jquery','config'],
54
54
  exports: 'angular'
55
55
  },
56
56
 
@@ -67,6 +67,7 @@ require.config({
67
67
  },
68
68
 
69
69
  // simple dependency declaration
70
+ //
70
71
  'jquery-ui': ['jquery'],
71
72
  'jquery.flot': ['jquery'],
72
73
  'jquery.flot.byte': ['jquery', 'jquery.flot'],
@@ -10,9 +10,10 @@ function (_) {
10
10
  * @type {Object}
11
11
  */
12
12
  var defaults = {
13
- elasticsearch : "http://"+window.location.hostname+":9200",
14
- panel_names : [],
15
- kibana_index : 'kibana-int'
13
+ elasticsearch : "http://"+window.location.hostname+":9200",
14
+ panel_names : [],
15
+ kibana_index : 'kibana-int',
16
+ default_route : '/dashboard/file/default.json'
16
17
  };
17
18
 
18
19
  // This initializes a new hash on purpose, to avoid adding parameters to
@@ -31,7 +31,7 @@ function (angular, config, _) {
31
31
  module.controller('DashCtrl', function(
32
32
  $scope, $route, ejsResource, fields, dashboard, alertSrv, panelMove, esVersion) {
33
33
 
34
- $scope.requiredElasticSearchVersion = ">=0.20.5";
34
+ $scope.requiredElasticSearchVersion = ">=0.90.3";
35
35
 
36
36
  $scope.editor = {
37
37
  index: 0
@@ -7,7 +7,7 @@ function (angular, _) {
7
7
 
8
8
  var module = angular.module('kibana.controllers');
9
9
 
10
- module.controller('dashLoader', function($scope, $http, timer, dashboard, alertSrv) {
10
+ module.controller('dashLoader', function($scope, $http, timer, dashboard, alertSrv, $location) {
11
11
  $scope.loader = dashboard.current.loader;
12
12
 
13
13
  $scope.init = function() {
@@ -35,8 +35,8 @@ function (angular, _) {
35
35
  };
36
36
 
37
37
  $scope.set_default = function() {
38
- if(dashboard.set_default()) {
39
- alertSrv.set('Local Default Set',dashboard.current.title+' has been set as your local default','success',5000);
38
+ if(dashboard.set_default($location.path())) {
39
+ alertSrv.set('Home Set','This page has been set as your default Kibana dashboard','success',5000);
40
40
  } else {
41
41
  alertSrv.set('Incompatible Browser','Sorry, your browser is too old for this feature','error',5000);
42
42
  }
@@ -44,7 +44,8 @@ function (angular, _) {
44
44
 
45
45
  $scope.purge_default = function() {
46
46
  if(dashboard.purge_default()) {
47
- alertSrv.set('Local Default Clear','Your local default dashboard has been cleared','success',5000);
47
+ alertSrv.set('Local Default Clear','Your Kibana default dashboard has been reset to the default',
48
+ 'success',5000);
48
49
  } else {
49
50
  alertSrv.set('Incompatible Browser','Sorry, your browser is too old for this feature','error',5000);
50
51
  }
@@ -26,6 +26,7 @@
26
26
  "index": {
27
27
  "interval": "none",
28
28
  "pattern": "[logstash-]YYYY.MM.DD",
29
- "default": "_all"
29
+ "default": "_all",
30
+ "warm_fields": false
30
31
  }
31
32
  }
@@ -64,61 +64,14 @@
64
64
  "index": {
65
65
  "interval": "none",
66
66
  "pattern": "[logstash-]YYYY.MM.DD",
67
- "default": "_all"
67
+ "default": "_all",
68
+ "warm_fields": false
68
69
  },
69
70
  "style": "dark",
70
71
  "failover": false,
71
72
  "panel_hints": true,
72
- "pulldowns": [
73
- {
74
- "type": "query",
75
- "collapse": true,
76
- "notice": false,
77
- "query": "*",
78
- "pinned": true,
79
- "history": [],
80
- "remember": 10
81
- },
82
- {
83
- "type": "filtering",
84
- "collapse": true,
85
- "notice": false
86
- }
87
- ],
88
- "nav": [
89
- {
90
- "type": "timepicker",
91
- "collapse": false,
92
- "notice": false,
93
- "status": "Stable",
94
- "time_options": [
95
- "5m",
96
- "15m",
97
- "1h",
98
- "6h",
99
- "12h",
100
- "24h",
101
- "2d",
102
- "7d",
103
- "30d"
104
- ],
105
- "refresh_intervals": [
106
- "5s",
107
- "10s",
108
- "30s",
109
- "1m",
110
- "5m",
111
- "15m",
112
- "30m",
113
- "1h",
114
- "2h",
115
- "1d"
116
- ],
117
- "timefield": "@timestamp",
118
- "now": true,
119
- "filter_id": 0
120
- }
121
- ],
73
+ "pulldowns": [],
74
+ "nav": [],
122
75
  "loader": {
123
76
  "save_gist": false,
124
77
  "save_elasticsearch": true,
@@ -200,7 +200,8 @@
200
200
  "index": {
201
201
  "interval": "none",
202
202
  "pattern": "[logstash-]YYYY.MM.DD",
203
- "default": "_all"
203
+ "default": "_all",
204
+ "warm_fields": false
204
205
  },
205
206
  "style": "dark",
206
207
  "failover": false,
@@ -128,6 +128,8 @@
128
128
  },
129
129
  "overflow": "min-height",
130
130
  "fields": [],
131
+ "localTime": true,
132
+ "timeField": "@timestamp",
131
133
  "highlight": [],
132
134
  "sortable": true,
133
135
  "header": true,
@@ -89,7 +89,8 @@
89
89
  "index": {
90
90
  "interval": "none",
91
91
  "pattern": "[logstash-]YYYY.MM.DD",
92
- "default": "_all"
92
+ "default": "_all",
93
+ "warm_fields": false
93
94
  },
94
95
  "style": "dark",
95
96
  "failover": false,
@@ -12,6 +12,11 @@ function (angular, app, _) {
12
12
  return {
13
13
  restrict: 'A',
14
14
  link: function($scope, elem) {
15
+
16
+ $scope.$on("$destroy",function() {
17
+ elem.remove();
18
+ });
19
+
15
20
  $scope.$watch('panel.type', function() {
16
21
  var _type = $scope.panel.type;
17
22
  $scope.reset_panel(_type);
@@ -8,5 +8,6 @@ define([
8
8
  './ngModelOnBlur',
9
9
  './tip',
10
10
  './confirmClick',
11
- './esVersion'
11
+ './esVersion',
12
+ './configModal'
12
13
  ], function () {});
@@ -0,0 +1,34 @@
1
+ define([
2
+ 'angular',
3
+ 'app',
4
+ ],
5
+ function (angular) {
6
+ 'use strict';
7
+
8
+ angular
9
+ .module('kibana.directives')
10
+ .directive('configModal', function($modal,$q) {
11
+ return {
12
+ restrict: 'A',
13
+ link: function(scope, elem) {
14
+ // create a new modal. Can't reuse one modal unforunately as the directive will not
15
+ // re-render on show.
16
+ elem.bind('click',function(){
17
+ var panelModal = $modal({
18
+ template: './app/partials/paneleditor.html',
19
+ persist: true,
20
+ show: false,
21
+ scope: scope,
22
+ keyboard: false
23
+ });
24
+
25
+ // and show it
26
+ $q.when(panelModal).then(function(modalEl) {
27
+ modalEl.modal('show');
28
+ });
29
+ scope.$apply();
30
+ });
31
+ }
32
+ };
33
+ });
34
+ });
@@ -13,7 +13,6 @@ function (angular) {
13
13
 
14
14
  '<div class="row-fluid panel-extra"><div class="panel-extra-container">' +
15
15
 
16
-
17
16
  '<span class="extra row-button" ng-show="panel.editable != false">' +
18
17
  '<span confirm-click="row.panels = _.without(row.panels,panel)" '+
19
18
  'confirmation="Are you sure you want to remove this {{panel.type}} panel?" class="pointer">'+
@@ -37,7 +36,7 @@ function (angular) {
37
36
  '</span>' +
38
37
 
39
38
  '<span class="row-button extra" ng-show="panel.editable != false">' +
40
- '<span bs-modal="\'app/partials/paneleditor.html\'" class="pointer">'+
39
+ '<span config-modal class="pointer">'+
41
40
  '<i class="icon-cog pointer" bs-tooltip="\'Configure\'"></i></span>'+
42
41
  '</span>' +
43
42
 
@@ -62,23 +61,30 @@ function (angular) {
62
61
  link: function($scope, elem, attr) {
63
62
  // once we have the template, scan it for controllers and
64
63
  // load the module.js if we have any
64
+ var newScope = $scope.$new();
65
65
 
66
66
  // compile the module and uncloack. We're done
67
67
  function loadModule($module) {
68
68
  $module.appendTo(elem);
69
69
  elem.wrap(container);
70
70
  /* jshint indent:false */
71
- $compile(elem.contents())($scope);
71
+ $compile(elem.contents())(newScope);
72
72
  elem.removeClass("ng-cloak");
73
73
  }
74
74
 
75
+ newScope.$on('$destroy',function(){
76
+ elem.unbind();
77
+ elem.remove();
78
+ });
79
+
75
80
  $scope.$watch(attr.type, function (name) {
76
81
  elem.addClass("ng-cloak");
77
82
  // load the panels module file, then render it in the dom.
78
83
  var nameAsPath = name.replace(".", "/");
79
84
  $scope.require([
80
85
  'jquery',
81
- 'text!panels/'+nameAsPath+'/module.html'
86
+ 'text!panels/'+nameAsPath+'/module.html',
87
+ 'text!panels/'+nameAsPath+'/editor.html'
82
88
  ], function ($, moduleTemplate) {
83
89
  var $module = $(moduleTemplate);
84
90
  // top level controllers
@@ -60,14 +60,16 @@ function (angular, _) {
60
60
  loadController(name);
61
61
  });
62
62
 
63
- $scope.$watch(attr.panel, function (panel) {
64
- // If the panel attribute is specified, create a new scope. This ruins configuration
65
- // so don't do it with anything that needs to use editor.html
66
- if(!_.isUndefined(panel)) {
67
- $scope = $scope.$new();
68
- $scope.panel = angular.fromJson(panel);
69
- }
70
- });
63
+ if(attr.panel) {
64
+ $scope.$watch(attr.panel, function (panel) {
65
+ // If the panel attribute is specified, create a new scope. This ruins configuration
66
+ // so don't do it with anything that needs to use editor.html
67
+ if(!_.isUndefined(panel)) {
68
+ $scope = $scope.$new();
69
+ $scope.panel = angular.fromJson(panel);
70
+ }
71
+ });
72
+ }
71
73
  }
72
74
  };
73
75
  });
@@ -1,17 +1,17 @@
1
- <div class="row-fluid">
2
- <div class="span4">
1
+ <div class="editor-row">
2
+ <div class="editor-option">
3
3
  <form>
4
4
  <h6>Coordinate Field <tip>geoJSON array! Long,Lat NOT Lat,Long</tip></h6>
5
5
  <input bs-typeahead="fields.list" type="text" class="input-small" ng-model="panel.field">
6
6
  </form>
7
7
  </div>
8
- <div class="span4">
8
+ <div class="editor-option">
9
9
  <form>
10
10
  <h6>Tooltip Field</h6>
11
11
  <input bs-typeahead="fields.list" type="text" class="input-small" ng-model="panel.tooltip">
12
12
  </form>
13
13
  </div>
14
- <div class="span2"><h6>Max Points</h6>
14
+ <div class="editor-option"><h6>Max Points</h6>
15
15
  <input type="number" class="input-small" ng-model="panel.size">
16
16
  </div>
17
17
  </div>