kibana-sinatra 3.0.1.0 → 3.1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/lib/kibana/assets/app/components/require.config.js +6 -1
  3. data/lib/kibana/assets/app/controllers/dash.js +3 -0
  4. data/lib/kibana/assets/app/dashboards/default.json +1 -1
  5. data/lib/kibana/assets/app/directives/all.js +2 -1
  6. data/lib/kibana/assets/app/directives/dashUpload.js +7 -2
  7. data/lib/kibana/assets/app/directives/kibanaPanel.js +10 -5
  8. data/lib/kibana/assets/app/directives/resizable.js +34 -0
  9. data/lib/kibana/assets/app/panels/bettermap/module.js +3 -3
  10. data/lib/kibana/assets/app/panels/column/module.html +9 -14
  11. data/lib/kibana/assets/app/panels/goal/module.js +3 -7
  12. data/lib/kibana/assets/app/panels/histogram/module.js +3 -12
  13. data/lib/kibana/assets/app/panels/hits/module.js +1 -6
  14. data/lib/kibana/assets/app/panels/map/module.html +1 -1
  15. data/lib/kibana/assets/app/panels/map/module.js +11 -12
  16. data/lib/kibana/assets/app/panels/sparklines/module.js +0 -5
  17. data/lib/kibana/assets/app/panels/stats/editor.html +9 -7
  18. data/lib/kibana/assets/app/panels/stats/module.html +30 -8
  19. data/lib/kibana/assets/app/panels/stats/module.js +17 -3
  20. data/lib/kibana/assets/app/panels/table/micropanel.html +6 -1
  21. data/lib/kibana/assets/app/panels/table/module.html +105 -87
  22. data/lib/kibana/assets/app/panels/table/module.js +46 -21
  23. data/lib/kibana/assets/app/panels/terms/module.html +76 -51
  24. data/lib/kibana/assets/app/panels/terms/module.js +3 -7
  25. data/lib/kibana/assets/app/panels/trends/editor.html +11 -10
  26. data/lib/kibana/assets/app/panels/trends/module.html +11 -2
  27. data/lib/kibana/assets/app/panels/trends/module.js +4 -0
  28. data/lib/kibana/assets/app/partials/dashboard.html +10 -8
  29. data/lib/kibana/assets/app/services/dashboard.js +5 -2
  30. data/lib/kibana/assets/app/services/esVersion.js +5 -1
  31. data/lib/kibana/assets/app/services/kbnIndex.js +4 -0
  32. data/lib/kibana/assets/app/services/panelMove.js +5 -4
  33. data/lib/kibana/assets/app/services/querySrv.js +1 -1
  34. data/lib/kibana/assets/css/bootstrap.dark.min.css +1 -1
  35. data/lib/kibana/assets/css/bootstrap.light.min.css +1 -1
  36. data/lib/kibana/assets/vendor/LICENSE.json +5 -1
  37. data/lib/kibana/assets/vendor/bootstrap/less/overrides.less +29 -7
  38. data/lib/kibana/assets/vendor/jsonpath.js +87 -0
  39. data/lib/kibana/sinatra/version.rb +1 -1
  40. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a60578b7212ab46b0322991c4c6bdf4248008bb
4
- data.tar.gz: 75631dc7670f9a33295b221bf6b2b97481c7d6d4
3
+ metadata.gz: 8e814d7c44de07824618a49d1ef6f7fd1f65b9da
4
+ data.tar.gz: cd129e565427adc2443cdc2b7678f134f580d6f4
5
5
  SHA512:
6
- metadata.gz: 3899211b14c10cf4d02a9157d034eb205a229ef03fe141eba9c907a0be4ffb65f8f01965a9262111c0dc7f2ac097e7f08bdc6018daa6c5a31c444a7835608876
7
- data.tar.gz: 52b59580df2b66f222bb1a8d98963812ef70f9bd198d1e8a7e1c625bd9eb079e1106a94018c1cf80f7832f6688523f384627d8356eb3ab2942f372dd23406cfe
6
+ metadata.gz: 5ebf59a58f1b18902b23f4066da73eb7fcb3b134053e28e0bf17d6b728c9f165b34d91b1bf24197c21470d63eb062d692e418401dfb2103ef06db00f7735306f
7
+ data.tar.gz: 428d2994e538ed095cf9f0babe236e68bb096e87669b2fa427e534712daa784a96da670d578f23797943de3a29df29d547b15b450a32194ce760a0090108510f
@@ -45,7 +45,8 @@ require.config({
45
45
 
46
46
 
47
47
  modernizr: '../vendor/modernizr-2.6.1',
48
- numeral: '../vendor/numeral',
48
+ numeral: '../vendor/numeral',
49
+ jsonpath: '../vendor/jsonpath',
49
50
  elasticjs: '../vendor/elasticjs/elastic-angular-client',
50
51
  },
51
52
  shim: {
@@ -62,6 +63,10 @@ require.config({
62
63
  exports: 'Modernizr'
63
64
  },
64
65
 
66
+ jsonpath: {
67
+ exports: 'jsonPath'
68
+ },
69
+
65
70
  jquery: {
66
71
  exports: 'jQuery'
67
72
  },
@@ -25,6 +25,9 @@ function (angular, config, _) {
25
25
  $scope.panelMoveOver = panelMove.onOver;
26
26
  $scope.panelMoveOut = panelMove.onOut;
27
27
 
28
+ angular.element(window).bind('resize', function(){
29
+ $scope.$broadcast('render');
30
+ });
28
31
 
29
32
  $scope.init = function() {
30
33
  $scope.config = config;
@@ -24,7 +24,7 @@
24
24
  "rows": [
25
25
  {
26
26
  "title": "Intro",
27
- "height": "450px",
27
+ "height": "700px",
28
28
  "editable": false,
29
29
  "collapse": false,
30
30
  "collapsable": false,
@@ -9,5 +9,6 @@ define([
9
9
  './tip',
10
10
  './confirmClick',
11
11
  './esVersion',
12
- './configModal'
12
+ './configModal',
13
+ './resizable'
13
14
  ], function () {});
@@ -13,8 +13,13 @@ function (angular) {
13
13
  function file_selected(evt) {
14
14
  var files = evt.target.files; // FileList object
15
15
  var readerOnload = function() {
16
- return function(e) {
17
- dashboard.dash_load(JSON.parse(e.target.result));
16
+ return function(event) {
17
+ try {
18
+ dashboard.dash_load(JSON.parse(event.target.result));
19
+ }
20
+ catch (err) {
21
+ alertSrv.set('Oops','The dashboard file you want to upload is malformed, please correct it and retry.','error');
22
+ }
18
23
  scope.$apply();
19
24
  };
20
25
  };
@@ -7,9 +7,9 @@ function (angular,$) {
7
7
 
8
8
  angular
9
9
  .module('kibana.directives')
10
- .directive('kibanaPanel', function($compile) {
11
- var container = '<div class="panel-container" ng-style="{\'min-height\':row.height}"></div>';
12
- var content = '<div class="panel-content"></div>';
10
+ .directive('kibanaPanel', function($compile, $rootScope) {
11
+ var container = '<div class="panel-container"></div>';
12
+ var content = '<div class="panel-content" ng-style="{\'min-height\':row.height}"></div>';
13
13
 
14
14
  var panelHeader =
15
15
  '<div class="panel-header">'+
@@ -66,12 +66,17 @@ function (angular,$) {
66
66
  '</div>\n'+
67
67
  '</div>';
68
68
  return {
69
- restrict: 'E',
69
+ restrict: 'A',
70
+ replace: true,
70
71
  link: function($scope, elem, attr) {
71
72
  // once we have the template, scan it for controllers and
72
73
  // load the module.js if we have any
73
74
  var newScope = $scope.$new();
74
75
 
76
+ elem.parent().parent().parent().resize(function() {
77
+ $rootScope.$broadcast('render');
78
+ });
79
+
75
80
  $scope.kbnJqUiDraggableOptions = {
76
81
  revert: 'invalid',
77
82
  helper: function() {
@@ -83,7 +88,7 @@ function (angular,$) {
83
88
  // compile the module and uncloack. We're done
84
89
  function loadModule($module) {
85
90
  $module.appendTo(elem);
86
- elem.wrap(container);
91
+ elem.wrapInner(container);
87
92
  /* jshint indent:false */
88
93
  $compile(elem.contents())(newScope);
89
94
  elem.removeClass("ng-cloak");
@@ -0,0 +1,34 @@
1
+ define([
2
+ 'angular',
3
+ ],
4
+ function (angular) {
5
+ 'use strict';
6
+
7
+ angular
8
+ .module('kibana.directives')
9
+ .directive('resizable', function() {
10
+ return {
11
+ restrict: 'A',
12
+ link: function(scope, elem) {
13
+
14
+ var getOpts = function() {
15
+ return {
16
+ maxWidth: elem.parent().width(),
17
+ grid: elem.parent().width()/12,
18
+ handles: 'e'
19
+ };
20
+ };
21
+
22
+ // Re-render if the window is resized
23
+ angular.element(window).bind('resize', function(){
24
+ elem.resizable(getOpts());
25
+ });
26
+
27
+ elem.resizable(getOpts());
28
+ elem.resize(function (event, ui) {
29
+ scope.panel.span = Math.round(((ui.size.width / elem.parent().width()) * 100) * 1.2 / 10);
30
+ });
31
+ }
32
+ };
33
+ });
34
+ });
@@ -52,11 +52,11 @@ function (angular, app, _, L, localRequire) {
52
52
  }
53
53
  ],
54
54
  status : "Experimental",
55
- description : "Displays geo points in clustered groups on a map. The cavaet for this panel is"+
55
+ description : "Displays geo points in clustered groups on a map. The caveat for this panel is"+
56
56
  " that, for better or worse, it does NOT use the terms facet and it <b>does</b> query "+
57
57
  "sequentially. This however means that it transfers more data and is generally heavier to"+
58
58
  " compute, while showing less actual data. If you have a time filter, it will attempt to"+
59
- " show to most recent points in your search, up to your defined limit"
59
+ " show to most recent points in your search, up to your defined limit."
60
60
  };
61
61
 
62
62
  // Set and populate defaults
@@ -227,7 +227,7 @@ function (angular, app, _, L, localRequire) {
227
227
  var map, layerGroup;
228
228
 
229
229
  function render_panel() {
230
- elem.css({height:scope.row.height});
230
+ elem.css({height:scope.panel.height||scope.row.height});
231
231
 
232
232
  scope.require(['./leaflet/plugins'], function () {
233
233
  scope.panelMeta.loading = false;
@@ -1,16 +1,11 @@
1
1
  <div ng-controller="column" ng-init="init();">
2
- <!-- Panels -->
3
- <div ng-repeat="(name, panel) in panel.panels" ng-hide="panel.height == '0px' || panel.hide" class="row-fluid panel" style="min-height:{{panel.height}}; position:relative">
4
- <!-- Error Panel -->
5
- <div class="row-fluid">
6
- <div class="span12 alert alert-error panel-error" ng-hide="!panel.error">
7
- <a class="close" ng-click="panel.error=false">&times;</a>
8
- <i class="icon-exclamation-sign"></i> <strong>Oops!</strong> {{panel.error}}
9
- </div>
10
- </div>
11
- <!-- Content Panel -->
12
- <div class="row-fluid">
13
- <kibana-panel type="panel.type"></kibana-panel>
14
- </div>
2
+ <!-- All the panels in the column -->
3
+ <div
4
+ ng-repeat="(name, panel) in panel.panels|filter:isPanel"
5
+ ng-cloak ng-hide="panel.height == '0px' || panel.hide"
6
+ kibana-panel type='panel.type'
7
+ class="row-fluid panel"
8
+ style="min-height:{{panel.height}}; position:relative"
9
+ ng-model="row.panels">
15
10
  </div>
16
- </div>
11
+ </div>
@@ -164,15 +164,10 @@ define([
164
164
  render_panel();
165
165
  });
166
166
 
167
- // Or if the window is resized
168
- angular.element(window).bind('resize', function(){
169
- render_panel();
170
- });
171
-
172
167
  // Function for rendering panel
173
168
  function render_panel() {
174
169
  // IE doesn't work without this
175
- elem.css({height:scope.row.height});
170
+ elem.css({height:scope.panel.height||scope.row.height});
176
171
 
177
172
  var label;
178
173
 
@@ -180,7 +175,8 @@ define([
180
175
  show: scope.panel.labels,
181
176
  radius: 0,
182
177
  formatter: function(label, series){
183
- var font = parseInt(scope.row.height.replace('px',''),10)/8 + String('px');
178
+ var font = parseInt(
179
+ (scope.panel.height||scope.row.height).replace('px',''),10)/8 + String('px');
184
180
  if(!(_.isUndefined(label))) {
185
181
  return '<div style="font-size:'+font+';font-weight:bold;text-align:center;padding:2px;color:#fff;">'+
186
182
  Math.round(series.percent)+'%</div>';
@@ -375,8 +375,8 @@ function (angular, app, $, _, kbn, moment, timeSeries, numeral) {
375
375
  // This is a hack proposed by @boaz to work around the fact that we can't get
376
376
  // to field data values directly, and we need timestamps as normalized longs
377
377
  request = request.sort([
378
- $scope.ejs.Sort($scope.panel.annotate.sort[0]).order($scope.panel.annotate.sort[1]),
379
- $scope.ejs.Sort($scope.panel.time_field).desc()
378
+ $scope.ejs.Sort($scope.panel.annotate.sort[0]).order($scope.panel.annotate.sort[1]).ignoreUnmapped(true),
379
+ $scope.ejs.Sort($scope.panel.time_field).desc().ignoreUnmapped(true)
380
380
  ]);
381
381
  }
382
382
 
@@ -579,15 +579,6 @@ function (angular, app, $, _, kbn, moment, timeSeries, numeral) {
579
579
  render_panel(data);
580
580
  });
581
581
 
582
- scope.$watch('panel.span', function(){
583
- render_panel(data);
584
- });
585
-
586
- // Re-render if the window is resized
587
- angular.element(window).bind('resize', function(){
588
- render_panel(data);
589
- });
590
-
591
582
  var scale = function(series,factor) {
592
583
  return _.map(series,function(p) {
593
584
  return [p[0],p[1]*factor];
@@ -616,7 +607,7 @@ function (angular, app, $, _, kbn, moment, timeSeries, numeral) {
616
607
  function render_panel(data) {
617
608
  // IE doesn't work without this
618
609
  try {
619
- elem.css({height:scope.row.height});
610
+ elem.css({height:scope.panel.height||scope.row.height});
620
611
  } catch(e) {return;}
621
612
 
622
613
  // Populate from the query service
@@ -203,15 +203,10 @@ define([
203
203
  render_panel();
204
204
  });
205
205
 
206
- // Re-render if the window is resized
207
- angular.element(window).bind('resize', function(){
208
- render_panel();
209
- });
210
-
211
206
  // Function for rendering panel
212
207
  function render_panel() {
213
208
  // IE doesn't work without this
214
- elem.css({height:scope.row.height});
209
+ elem.css({height:scope.panel.height||scope.row.height});
215
210
 
216
211
  try {
217
212
  _.each(scope.data,function(series) {
@@ -53,7 +53,7 @@
53
53
  background-color: #1f1f1f;
54
54
  border-radius: 5px;
55
55
  position: absolute;
56
- right: 0px;
56
+ left: 0px;
57
57
  top: 15px;
58
58
  display: none;
59
59
  z-index: 99;
@@ -145,8 +145,8 @@ function (angular, app, _, $) {
145
145
  $scope.inspector = angular.toJson(JSON.parse(request.toString()),true);
146
146
  };
147
147
 
148
- $scope.build_search = function(field,value) {
149
- filterSrv.set({type:'terms',field:field,value:value,mandate:"must"});
148
+ $scope.build_search = function(field, value) {
149
+ filterSrv.set({type:'field', field:field, query:value, mandate:"must"});
150
150
  };
151
151
 
152
152
  });
@@ -161,19 +161,16 @@ function (angular, app, _, $) {
161
161
 
162
162
  // Receive render events
163
163
  scope.$on('render',function(){
164
- render_panel();
164
+ slow();
165
165
  });
166
166
 
167
- // Or if the window is resized
168
- angular.element(window).bind('resize', function(){
169
- render_panel();
167
+ elem.closest('.panel').resize(function () {
168
+ elem.empty();
170
169
  });
171
170
 
172
171
  function render_panel() {
173
- elem.css({height:scope.row.height});
174
-
175
- elem.text('');
176
-
172
+ elem.empty();
173
+ elem.css({height:scope.panel.height||scope.row.height});
177
174
  $('.jvectormap-zoomin,.jvectormap-zoomout,.jvectormap-label').remove();
178
175
  require(['./panels/map/lib/map.'+scope.panel.map], function () {
179
176
  elem.vectorMap({
@@ -194,7 +191,7 @@ function (angular, app, _, $) {
194
191
  elem.children('.map-legend').text(label.text() + ": " + count);
195
192
  },
196
193
  onRegionOut: function() {
197
- $('.map-legend').hide();
194
+ elem.children('.map-legend').hide();
198
195
  },
199
196
  onRegionClick: function(event, code) {
200
197
  var count = _.isUndefined(scope.data[code]) ? 0 : scope.data[code];
@@ -205,9 +202,11 @@ function (angular, app, _, $) {
205
202
  });
206
203
  elem.prepend('<span class="map-legend"></span>');
207
204
 
208
- $('.map-legend').hide();
205
+ elem.children('.map-legend').hide();
209
206
  });
210
207
  }
208
+
209
+ var slow = _.debounce(render_panel, 200);
211
210
  }
212
211
  };
213
212
  });
@@ -296,11 +296,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
296
296
  render_panel();
297
297
  });
298
298
 
299
- // Re-render if the window is resized
300
- angular.element(window).bind('resize', function(){
301
- render_panel();
302
- });
303
-
304
299
  var derivative = function(series) {
305
300
  return _.map(series, function(p,i) {
306
301
  var _v;
@@ -1,8 +1,8 @@
1
1
  <div class="row-fluid">
2
2
  <h5>Details</h5>
3
3
  <div class="editor-option">
4
- <label class="small">Function</label>
5
- <select ng-change="set_refresh(true)" class="input-small" ng-model="panel.mode" ng-options="f for f in ['count','min','mean','max','total']"></select>
4
+ <label class="small">Featured Stat</label>
5
+ <select ng-change="set_refresh(true)" class="input-small" ng-model="panel.mode" ng-options="f for f in modes"></select>
6
6
  </div>
7
7
  <div class="editor-option">
8
8
  <label class="small">Field <tip>This field must contain a numeric value</tip></label>
@@ -12,6 +12,12 @@
12
12
  <label class="small">Unit</label>
13
13
  <input type="text" class="input-large" ng-model="panel.unit">
14
14
  </div>
15
+
16
+ <h5>Columns</h5>
17
+ <div class="editor-option" ng-repeat="stat in modes">
18
+ <label class="small">{{stat}}</label><input type="checkbox" ng-model="panel.show[stat]" ng-checked="panel.show[stat]">
19
+ </div>
20
+
15
21
  <h5>Formating</h5>
16
22
  <div class="editor-option">
17
23
  <label class="small">Format</label>
@@ -26,11 +32,7 @@
26
32
  <select class="input-mini" ng-model="panel.display_breakdown" ng-options="f for f in ['yes', 'no']"></select></span>
27
33
  </div>
28
34
  <div class="editor-option">
29
- <label class="small">Label column name</label>
35
+ <label class="small">Query column name</label>
30
36
  <input type="text" class="input-large" ng-model="panel.label_name">
31
37
  </div>
32
- <div class="editor-option">
33
- <label class="small">Value column name</label>
34
- <input type="text" class="input-large" ng-model="panel.value_name">
35
- </div>
36
38
  </div>
@@ -1,14 +1,36 @@
1
1
  <div ng-controller="stats" ng-init="init()">
2
- <h1 ng-style="panel.style" style="text-align: center; line-height: .6em">{{data.value|formatstats:panel.format}} <small style="font-size: .5em; line-height: 0;">{{panel.unit}}</small></h1>
3
- <table ng-show="panel.display_breakdown == 'yes'" cellspacing="0" class="table-hover table table-condensed" style="margin-top: 38px;">
2
+ <style>
3
+ table.stats-table th, table.stats-table td {
4
+ text-align: right;
5
+ }
6
+
7
+ table.stats-table th:first-child, table.stats-table td:first-child {
8
+ text-align: left !important;
9
+ }
10
+
11
+
12
+ </style>
13
+
14
+ <h1 ng-style="panel.style" style="text-align: center; line-height: .6em">{{data.value|formatstats:panel.format}} <small style="font-size: .5em; line-height: 0;">{{panel.unit}} ({{panel.mode}})</small></h1>
15
+ <table ng-show="panel.display_breakdown == 'yes'" cellspacing="0" class="table-hover table table-condensed stats-table" style="margin-top: 38px;">
4
16
  <tbody>
5
- <tr>
6
- <th><a href="" ng-click="set_sort('label')" ng-class="{'icon-chevron-down': panel.sort_field == 'label' && panel.sort_reverse == true, 'icon-chevron-up': panel.sort_field == 'label' && panel.sort_reverse == false}"> {{panel.label_name}} </a></th>
7
- <th style="text-align: right;"><a href="" ng-click="set_sort('value')" ng-class="{'icon-chevron-down': panel.sort_field == 'value' && panel.sort_reverse == true, 'icon-chevron-up': panel.sort_field == 'value' && panel.sort_reverse == false}"> {{panel.value_name}} </a></th>
8
- </tr>
9
- <tr ng-repeat="item in data.rows | orderBy:panel.sort_field:panel.sort_reverse">
17
+ <thead>
18
+ <tr>
19
+ <th><a href="" ng-click="set_sort('label')" ng-class="{'icon-chevron-down': panel.sort_field == 'label' && panel.sort_reverse == true, 'icon-chevron-up': panel.sort_field == 'label' && panel.sort_reverse == false}"> {{panel.label_name}} </a></th>
20
+ <th ng-repeat="stat in modes" ng-show="panel.show[stat]">
21
+ <a href=""
22
+ ng-click="set_sort(stat)"
23
+ ng-class="{'icon-chevron-down': panel.sort_field == stat && panel.sort_reverse == true, 'icon-chevron-up': panel.sort_field == stat && panel.sort_reverse == false}">
24
+ {{stat}}
25
+ </a>
26
+ </th>
27
+ </tr>
28
+ </thead>
29
+ <tr ng-repeat="item in data.rows | orderBy:(panel.sort_field == 'label' ? 'label' : 'value.'+panel.sort_field):panel.sort_reverse">
10
30
  <td><i class="icon-circle" ng-style="{color:item.color}"></i> {{item.label}}</td>
11
- <td style="text-align: right;">{{item.value|formatstats:panel.format}} {{panel.unit}}</td>
31
+ <td ng-repeat="stat in modes" ng-show="panel.show[stat]">{{item.value[stat]|formatstats:panel.format}} {{panel.unit}}</td>
32
+
33
+ <!--<td style="text-align: right;">{{item.value|formatstats:panel.format}} {{panel.unit}}</td>-->
12
34
  </tr>
13
35
  </tbody>
14
36
  </table>