kibana-sinatra 0.0.5 → 0.0.6

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -1
  3. data/lib/kibana/assets/app/app.js +4 -2
  4. data/lib/kibana/assets/app/components/kbn.js +114 -0
  5. data/lib/kibana/assets/app/components/require.config.js +5 -1
  6. data/lib/kibana/assets/app/controllers/dash.js +30 -2
  7. data/lib/kibana/assets/app/controllers/row.js +33 -0
  8. data/lib/kibana/assets/app/dashboards/blank.json +0 -11
  9. data/lib/kibana/assets/app/dashboards/default.json +0 -11
  10. data/lib/kibana/assets/app/dashboards/guided.json +0 -11
  11. data/lib/kibana/assets/app/dashboards/logstash.json +0 -6
  12. data/lib/kibana/assets/app/dashboards/noted.json +0 -11
  13. data/lib/kibana/assets/app/directives/addPanel.js +1 -1
  14. data/lib/kibana/assets/app/directives/kibanaPanel.js +3 -2
  15. data/lib/kibana/assets/app/directives/kibanaSimplePanel.js +3 -3
  16. data/lib/kibana/assets/app/panels/bettermap/module.js +52 -17
  17. data/lib/kibana/assets/app/panels/column/module.js +18 -8
  18. data/lib/kibana/assets/app/panels/histogram/editor.html +3 -0
  19. data/lib/kibana/assets/app/panels/histogram/module.html +1 -1
  20. data/lib/kibana/assets/app/panels/histogram/module.js +179 -49
  21. data/lib/kibana/assets/app/panels/histogram/styleEditor.html +4 -0
  22. data/lib/kibana/assets/app/panels/hits/module.js +46 -18
  23. data/lib/kibana/assets/app/panels/map/module.js +40 -21
  24. data/lib/kibana/assets/app/panels/pie/module.html +3 -0
  25. data/lib/kibana/assets/app/panels/pie/module.js +62 -25
  26. data/lib/kibana/assets/app/panels/sparklines/module.js +42 -35
  27. data/lib/kibana/assets/app/panels/table/editor.html +2 -2
  28. data/lib/kibana/assets/app/panels/table/module.html +24 -19
  29. data/lib/kibana/assets/app/panels/table/module.js +80 -29
  30. data/lib/kibana/assets/app/panels/terms/module.html +3 -0
  31. data/lib/kibana/assets/app/panels/terms/module.js +65 -17
  32. data/lib/kibana/assets/app/panels/text/module.js +21 -9
  33. data/lib/kibana/assets/app/panels/trends/module.js +34 -13
  34. data/lib/kibana/assets/app/partials/dasheditor.html +1 -1
  35. data/lib/kibana/assets/app/services/dashboard.js +14 -14
  36. data/lib/kibana/assets/app/services/fields.js +11 -8
  37. data/lib/kibana/assets/app/services/filterSrv.js +27 -17
  38. data/lib/kibana/assets/app/services/querySrv.js +14 -15
  39. data/lib/kibana/assets/css/bootstrap.dark.min.css +1 -1
  40. data/lib/kibana/assets/css/bootstrap.light.min.css +1 -1
  41. data/lib/kibana/assets/index.html +1 -1
  42. data/lib/kibana/assets/vendor/angular/angular-strap.js +6 -3
  43. data/lib/kibana/assets/vendor/angular/bindonce.js +269 -0
  44. data/lib/kibana/assets/vendor/bootstrap/less/overrides.less +6 -0
  45. data/lib/kibana/assets/vendor/elasticjs/elastic-angular-client.js +37 -24
  46. data/lib/kibana/assets/vendor/elasticjs/elastic.js +4694 -2419
  47. data/lib/kibana/assets/vendor/jquery/jquery.flot.byte.js +107 -0
  48. data/lib/kibana/sinatra/version.rb +1 -1
  49. data/lib/kibana/views/config.erb +19 -16
  50. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 488b10d33481ec09a9be9de778d08b984898b6d8
4
- data.tar.gz: 9b115a2965cba2cb58bc0f01e03c745f7c2af59a
3
+ metadata.gz: 21377d439be1057f9413662fee65a2a6bd0328c4
4
+ data.tar.gz: 3d3c501f3c505ff9c8408d679e0e8eb6e44a26bf
5
5
  SHA512:
6
- metadata.gz: 3a31c619687789b0f096ac3e9b86b864df72d6b7c07456cb4aae77a940ca8a3f02e486fe7ad4993c6dc531c4b7a6f81567b920dd7c231c809e880a759f15ae68
7
- data.tar.gz: 8eae148863560503a60ee3685ca805e53304c574835fb646c0c8d46b7b56748587b2949425444cebfdad4537cfe8396c356f476cb340d4ca223ce9d617d1e43e
6
+ metadata.gz: 1881dec9046579b356dd06023529ba62b17f491c74d0060a31ae19fdcd271b04658ec2c891ba10181940a01eb7e82813caca46e565ec78115789c9b565d2a94e
7
+ data.tar.gz: e00e61cb597a791c5f3c7a383c55300b05166f65b1410dd038fbd02e2e40e70a7ec26763ade25ccfb246f0343095500a8f4bc2ee4ce81d70498b71e787e989a4
data/README.md CHANGED
@@ -2,10 +2,11 @@
2
2
 
3
3
  [![Dependency Status](https://gemnasium.com/ianneub/kibana-sinatra.png)](https://gemnasium.com/ianneub/kibana-sinatra)
4
4
  [![Build Status](https://travis-ci.org/ianneub/kibana-sinatra.png)](https://travis-ci.org/ianneub/kibana-sinatra)
5
+ [![Gem Version](https://badge.fury.io/rb/kibana-sinatra.png)](http://badge.fury.io/rb/kibana-sinatra)
5
6
 
6
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.
7
8
 
8
- It is currently based on Kibana 3 commit [90d765d942f194c9561b3d25b3f7c1bc734e9203](https://github.com/elasticsearch/kibana/commits/master)
9
+ It is currently based on Kibana 3 commit [f194336277280467f4d27ab8b65c8f69c5c7122e](https://github.com/elasticsearch/kibana/commits/master)
9
10
 
10
11
  ## Installation
11
12
 
@@ -11,7 +11,8 @@ define([
11
11
  'angular-sanitize',
12
12
  'angular-strap',
13
13
  'angular-dragdrop',
14
- 'extend-jquery'
14
+ 'extend-jquery',
15
+ 'bindonce'
15
16
  ],
16
17
  function (angular, $, _, appLevelRequire) {
17
18
  "use strict";
@@ -84,7 +85,8 @@ function (angular, $, _, appLevelRequire) {
84
85
  '$strap.directives',
85
86
  'ngSanitize',
86
87
  'ngDragDrop',
87
- 'kibana'
88
+ 'kibana',
89
+ 'pasvaz.bindonce'
88
90
  ];
89
91
 
90
92
  _.each('controllers directives factories services filters'.split(' '),
@@ -479,5 +479,119 @@ function($, _, moment) {
479
479
  });
480
480
  };
481
481
 
482
+ // Find the smallest missing number in an array
483
+ kbn.smallestMissing = function(arr,start,end) {
484
+ start = start || 0;
485
+ end = end || arr.length-1;
486
+
487
+ if(start > end) {
488
+ return end + 1;
489
+ }
490
+ if(start !== arr[start]) {
491
+ return start;
492
+ }
493
+ var middle = Math.floor((start + end) / 2);
494
+
495
+ if (arr[middle] > middle) {
496
+ return kbn.smallestMissing(arr, start, middle);
497
+ } else {
498
+ return kbn.smallestMissing(arr, middle + 1, end);
499
+ }
500
+ };
501
+
502
+ kbn.byteFormat = function(size, decimals) {
503
+ var ext, steps = 0;
504
+
505
+ if(_.isUndefined(decimals)) {
506
+ decimals = 2;
507
+ } else if (decimals === 0) {
508
+ decimals = undefined;
509
+ }
510
+
511
+ while (Math.abs(size) >= 1024) {
512
+ steps++;
513
+ size /= 1024;
514
+ }
515
+
516
+ switch (steps) {
517
+ case 0:
518
+ ext = " B";
519
+ break;
520
+ case 1:
521
+ ext = " KB";
522
+ break;
523
+ case 2:
524
+ ext = " MB";
525
+ break;
526
+ case 3:
527
+ ext = " GB";
528
+ break;
529
+ case 4:
530
+ ext = " TB";
531
+ break;
532
+ case 5:
533
+ ext = " PB";
534
+ break;
535
+ case 6:
536
+ ext = " EB";
537
+ break;
538
+ case 7:
539
+ ext = " ZB";
540
+ break;
541
+ case 8:
542
+ ext = " YB";
543
+ break;
544
+ }
545
+
546
+ return (size.toFixed(decimals) + ext);
547
+ };
548
+
549
+ kbn.shortFormat = function(size, decimals) {
550
+ var ext, steps = 0;
551
+
552
+ if(_.isUndefined(decimals)) {
553
+ decimals = 2;
554
+ } else if (decimals === 0) {
555
+ decimals = undefined;
556
+ }
557
+
558
+ while (Math.abs(size) >= 1000) {
559
+ steps++;
560
+ size /= 1000;
561
+ }
562
+
563
+ switch (steps) {
564
+ case 0:
565
+ ext = "";
566
+ break;
567
+ case 1:
568
+ ext = " K";
569
+ break;
570
+ case 2:
571
+ ext = " Mil";
572
+ break;
573
+ case 3:
574
+ ext = " Bil";
575
+ break;
576
+ case 4:
577
+ ext = " Tri";
578
+ break;
579
+ case 5:
580
+ ext = " Quadr";
581
+ break;
582
+ case 6:
583
+ ext = " Quint";
584
+ break;
585
+ case 7:
586
+ ext = " Sext";
587
+ break;
588
+ case 8:
589
+ ext = " Sept";
590
+ break;
591
+ }
592
+
593
+ return (size.toFixed(decimals) + ext);
594
+ };
595
+
482
596
  return kbn;
483
597
  });
@@ -20,6 +20,7 @@ require.config({
20
20
  'angular-sanitize': '../vendor/angular/angular-sanitize',
21
21
  timepicker: '../vendor/angular/timepicker',
22
22
  datepicker: '../vendor/angular/datepicker',
23
+ bindonce: '../vendor/angular/bindonce',
23
24
 
24
25
  underscore: 'components/underscore.extended',
25
26
  'underscore-src': '../vendor/underscore',
@@ -37,6 +38,8 @@ require.config({
37
38
  'jquery.flot.stack': '../vendor/jquery/jquery.flot.stack',
38
39
  'jquery.flot.stackpercent':'../vendor/jquery/jquery.flot.stackpercent',
39
40
  'jquery.flot.time': '../vendor/jquery/jquery.flot.time',
41
+ 'jquery.flot.byte': '../vendor/jquery/jquery.flot.byte',
42
+
40
43
 
41
44
  modernizr: '../vendor/modernizr-2.6.1',
42
45
  elasticjs: '../vendor/elasticjs/elastic-angular-client',
@@ -66,6 +69,7 @@ require.config({
66
69
  // simple dependency declaration
67
70
  'jquery-ui': ['jquery'],
68
71
  'jquery.flot': ['jquery'],
72
+ 'jquery.flot.byte': ['jquery', 'jquery.flot'],
69
73
  'jquery.flot.pie': ['jquery', 'jquery.flot'],
70
74
  'jquery.flot.events': ['jquery', 'jquery.flot'],
71
75
  'jquery.flot.selection':['jquery', 'jquery.flot'],
@@ -81,7 +85,7 @@ require.config({
81
85
  'angular-resource': ['angular'],
82
86
  'angular-route': ['angular'],
83
87
  'angular-touch': ['angular'],
84
-
88
+ 'bindonce': ['angular'],
85
89
  'angular-strap': ['angular', 'bootstrap','timepicker', 'datepicker'],
86
90
 
87
91
  timepicker: ['jquery', 'bootstrap'],
@@ -1,3 +1,22 @@
1
+ /** @scratch /index/0
2
+ * = Kibana
3
+ *
4
+ * // Why can't I have a preamble here?
5
+ *
6
+ * == Introduction
7
+ *
8
+ * Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for
9
+ * ElasticSearch. Kibana is a snap to setup and start using. Written entirely in HTML and Javascript
10
+ * it requires only a plain webserver, Kibana requires no fancy server side components.
11
+ * Kibana strives to be easy to get started with, while also being flexible and powerful, just like
12
+ * Elasticsearch.
13
+ *
14
+ * include::configuration/config.js.asciidoc[]
15
+ *
16
+ * include::panels.asciidoc[]
17
+ *
18
+ */
19
+
1
20
  define([
2
21
  'angular',
3
22
  'config',
@@ -68,9 +87,18 @@ function (angular, config, _) {
68
87
  return { 'min-height': row.collapse ? '5px' : row.height };
69
88
  };
70
89
 
71
- $scope.edit_path = function(type) {
90
+ $scope.panel_path =function(type) {
72
91
  if(type) {
73
- return 'app/panels/'+type+'/editor.html';
92
+ return 'app/panels/'+type.replace(".","/");
93
+ } else {
94
+ return false;
95
+ }
96
+ };
97
+
98
+ $scope.edit_path = function(type) {
99
+ var p = $scope.panel_path(type);
100
+ if(p) {
101
+ return p+'/editor.html';
74
102
  } else {
75
103
  return false;
76
104
  }
@@ -58,6 +58,25 @@ function (angular, app, _) {
58
58
  $scope.row.panels.push(panel);
59
59
  };
60
60
 
61
+ /** @scratch /panels/0
62
+ * [[panels]]
63
+ * = Panels
64
+ *
65
+ * [partintro]
66
+ * --
67
+ * *Kibana* dashboards are made up of blocks called +panels+. Panels are organized into rows
68
+ * and can serve many purposes, though most are designed to provide the results of a query or
69
+ * multiple queries as a visualization. Other panels may show collections of documents or
70
+ * allow you to insert instructions for your users.
71
+ *
72
+ * Panels can be configured easily via the Kibana web interface. For more advanced usage, such
73
+ * as templated or scripted dashboards, documentation of panel properties is available in this
74
+ * section. You may find settings here which are not exposed via the web interface.
75
+ *
76
+ * Each panel type has its own properties, hover there are several that are shared.
77
+ *
78
+ */
79
+
61
80
  $scope.reset_panel = function(type) {
62
81
  var
63
82
  defaultSpan = 4,
@@ -65,12 +84,26 @@ function (angular, app, _) {
65
84
 
66
85
  $scope.panel = {
67
86
  error : false,
87
+ /** @scratch /panels/1
88
+ * span:: A number, 1-12, that describes the width of the panel.
89
+ */
68
90
  span : _as < defaultSpan && _as > 0 ? _as : defaultSpan,
91
+ /** @scratch /panels/1
92
+ * editable:: Enable or disable the edit button the the panel
93
+ */
69
94
  editable: true,
95
+ /** @scratch /panels/1
96
+ * type:: The type of panel this object contains. Each panel type will require additional
97
+ * properties. See the panel types list to the right.
98
+ */
70
99
  type : type
71
100
  };
72
101
  };
73
102
 
103
+ /** @scratch /panels/2
104
+ * --
105
+ */
106
+
74
107
  $scope.init();
75
108
 
76
109
  }
@@ -2,12 +2,6 @@
2
2
  "title": "New Dashboard",
3
3
  "services": {
4
4
  "query": {
5
- "idQueue": [
6
- 1,
7
- 2,
8
- 3,
9
- 4
10
- ],
11
5
  "list": {
12
6
  "0": {
13
7
  "query": "*",
@@ -21,11 +15,6 @@
21
15
  ]
22
16
  },
23
17
  "filter": {
24
- "idQueue": [
25
- 0,
26
- 1,
27
- 2
28
- ],
29
18
  "list": {},
30
19
  "ids": []
31
20
  }
@@ -2,12 +2,6 @@
2
2
  "title": "Introduction",
3
3
  "services": {
4
4
  "query": {
5
- "idQueue": [
6
- 1,
7
- 2,
8
- 3,
9
- 4
10
- ],
11
5
  "list": {
12
6
  "0": {
13
7
  "query": "*",
@@ -23,11 +17,6 @@
23
17
  ]
24
18
  },
25
19
  "filter": {
26
- "idQueue": [
27
- 0,
28
- 1,
29
- 2
30
- ],
31
20
  "list": {},
32
21
  "ids": []
33
22
  }
@@ -2,12 +2,6 @@
2
2
  "title": "Your Basic Dashboard",
3
3
  "services": {
4
4
  "query": {
5
- "idQueue": [
6
- 1,
7
- 2,
8
- 3,
9
- 4
10
- ],
11
5
  "list": {
12
6
  "0": {
13
7
  "query": "*",
@@ -23,11 +17,6 @@
23
17
  ]
24
18
  },
25
19
  "filter": {
26
- "idQueue": [
27
- 0,
28
- 1,
29
- 2
30
- ],
31
20
  "list": {},
32
21
  "ids": []
33
22
  }
@@ -2,9 +2,6 @@
2
2
  "title": "Logstash Search",
3
3
  "services": {
4
4
  "query": {
5
- "idQueue": [
6
- 1
7
- ],
8
5
  "list": {
9
6
  "0": {
10
7
  "query": "{{ARGS.query || '*'}}",
@@ -20,9 +17,6 @@
20
17
  ]
21
18
  },
22
19
  "filter": {
23
- "idQueue": [
24
- 1
25
- ],
26
20
  "list": {
27
21
  "0": {
28
22
  "type": "time",
@@ -2,12 +2,6 @@
2
2
  "title": "A few notes",
3
3
  "services": {
4
4
  "query": {
5
- "idQueue": [
6
- 1,
7
- 2,
8
- 3,
9
- 4
10
- ],
11
5
  "list": {
12
6
  "0": {
13
7
  "query": "*",
@@ -23,11 +17,6 @@
23
17
  ]
24
18
  },
25
19
  "filter": {
26
- "idQueue": [
27
- 0,
28
- 1,
29
- 2
30
- ],
31
20
  "list": {},
32
21
  "ids": []
33
22
  }
@@ -17,7 +17,7 @@ function (angular, app, _) {
17
17
  $scope.reset_panel(_type);
18
18
  if(!_.isUndefined($scope.panel.type)) {
19
19
  $scope.panel.loadingEditor = true;
20
- $scope.require(['panels/'+$scope.panel.type+'/module'], function () {
20
+ $scope.require(['panels/'+$scope.panel.type.replace(".","/") +'/module'], function () {
21
21
  var template = '<div ng-controller="'+$scope.panel.type+'" ng-include="\'app/partials/paneladd.html\'"></div>';
22
22
  elem.html($compile(angular.element(template))($scope));
23
23
  $scope.panel.loadingEditor = false;
@@ -75,9 +75,10 @@ function (angular) {
75
75
  $scope.$watch(attr.type, function (name) {
76
76
  elem.addClass("ng-cloak");
77
77
  // load the panels module file, then render it in the dom.
78
+ var nameAsPath = name.replace(".", "/");
78
79
  $scope.require([
79
80
  'jquery',
80
- 'text!panels/'+name+'/module.html'
81
+ 'text!panels/'+nameAsPath+'/module.html'
81
82
  ], function ($, moduleTemplate) {
82
83
  var $module = $(moduleTemplate);
83
84
  // top level controllers
@@ -88,7 +89,7 @@ function (angular) {
88
89
  if ($controllers.length) {
89
90
  $controllers.first().prepend(editorTemplate);
90
91
  $scope.require([
91
- 'panels/'+name+'/module'
92
+ 'panels/'+nameAsPath+'/module'
92
93
  ], function() {
93
94
  loadModule($module);
94
95
  });