kibana-sinatra 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +28 -3
- data/lib/kibana/assets/app/app.js +16 -4
- data/lib/kibana/assets/app/components/require.config.js +2 -1
- data/lib/kibana/assets/app/components/settings.js +4 -3
- data/lib/kibana/assets/app/controllers/dash.js +1 -1
- data/lib/kibana/assets/app/controllers/dashLoader.js +5 -4
- data/lib/kibana/assets/app/dashboards/blank.json +2 -1
- data/lib/kibana/assets/app/dashboards/default.json +4 -51
- data/lib/kibana/assets/app/dashboards/guided.json +2 -1
- data/lib/kibana/assets/app/dashboards/logstash.json +2 -0
- data/lib/kibana/assets/app/dashboards/noted.json +2 -1
- data/lib/kibana/assets/app/directives/addPanel.js +5 -0
- data/lib/kibana/assets/app/directives/all.js +2 -1
- data/lib/kibana/assets/app/directives/configModal.js +34 -0
- data/lib/kibana/assets/app/directives/kibanaPanel.js +10 -4
- data/lib/kibana/assets/app/directives/kibanaSimplePanel.js +10 -8
- data/lib/kibana/assets/app/panels/bettermap/editor.html +4 -4
- data/lib/kibana/assets/app/panels/bettermap/module.js +1 -1
- data/lib/kibana/assets/app/panels/dashcontrol/module.html +1 -4
- data/lib/kibana/assets/app/panels/histogram/editor.html +22 -22
- data/lib/kibana/assets/app/panels/histogram/module.html +4 -4
- data/lib/kibana/assets/app/panels/histogram/module.js +30 -24
- data/lib/kibana/assets/app/panels/histogram/timeSeries.js +16 -0
- data/lib/kibana/assets/app/panels/hits/editor.html +9 -9
- data/lib/kibana/assets/app/panels/map/editor.html +4 -4
- data/lib/kibana/assets/app/panels/pie/editor.html +47 -42
- data/lib/kibana/assets/app/panels/table/editor.html +39 -38
- data/lib/kibana/assets/app/panels/table/module.html +14 -5
- data/lib/kibana/assets/app/panels/table/module.js +23 -19
- data/lib/kibana/assets/app/panels/table/pagination.html +29 -24
- data/lib/kibana/assets/app/panels/terms/editor.html +53 -47
- data/lib/kibana/assets/app/panels/terms/module.js +7 -5
- data/lib/kibana/assets/app/panels/timepicker/module.html +2 -2
- data/lib/kibana/assets/app/partials/dashLoader.html +6 -6
- data/lib/kibana/assets/app/partials/dasheditor.html +127 -117
- data/lib/kibana/assets/app/partials/paneladd.html +1 -1
- data/lib/kibana/assets/app/partials/paneleditor.html +2 -2
- data/lib/kibana/assets/app/partials/panelgeneral.html +19 -17
- data/lib/kibana/assets/app/partials/roweditor.html +3 -3
- data/lib/kibana/assets/app/services/dashboard.js +67 -16
- data/lib/kibana/assets/app/services/fields.js +18 -15
- data/lib/kibana/assets/css/bootstrap.dark.min.css +1 -1
- data/lib/kibana/assets/css/bootstrap.light.min.css +1 -1
- data/lib/kibana/assets/vendor/angular/angular.js +17 -0
- data/lib/kibana/assets/vendor/bootstrap/less/modals.less +3 -11
- data/lib/kibana/assets/vendor/bootstrap/less/overrides.less +2 -3
- data/lib/kibana/assets/vendor/jquery/jquery.flot.js +2 -2
- data/lib/kibana/sinatra/version.rb +1 -1
- data/lib/kibana/views/config.erb +17 -7
- metadata +3 -5
- data/lib/kibana/assets/app/panels/dashcontrol/load.html +0 -40
- data/lib/kibana/assets/app/panels/dashcontrol/save.html +0 -30
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ae246456b81df5e196942cf5cc54902c20963cf
|
4
|
+
data.tar.gz: d8747df503e6a8317618d611d5d19200abecfc60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 [
|
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
|
-
|
132
|
-
|
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
|
14
|
-
panel_names
|
15
|
-
kibana_index
|
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.
|
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('
|
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
|
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
|
}
|
@@ -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,
|
@@ -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);
|
@@ -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
|
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())(
|
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
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
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
|
2
|
-
<div class="
|
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="
|
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="
|
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>
|