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
@@ -1,31 +1,21 @@
1
- /*
2
-
3
- ## Table
4
-
5
- ### Parameters
6
- * size :: Number of events per page to show
7
- * pages :: Number of pages to show. size * pages = number of cached events.
8
- Bigger = more memory usage byh the browser
9
- * offset :: Position from which to start in the array of hits
10
- * sort :: An array with 2 elements. sort[0]: field, sort[1]: direction ('asc' or 'desc')
11
- * style :: hash of css properties
12
- * fields :: columns to show in table
13
- * overflow :: 'height' or 'min-height' controls wether the row will expand (min-height) to
14
- to fit the table, or if the table will scroll to fit the row (height)
15
- * trimFactor :: If line is > this many characters, divided by the number of columns, trim it.
16
- * sortable :: Allow sorting?
17
- * spyable :: Show the 'eye' icon that reveals the last ES query for this panel
18
-
19
- */
1
+ /** @scratch /panels/5
2
+ * include::panels/table.asciidoc[]
3
+ */
4
+
5
+ /** @scratch /panels/table/0
6
+ * == table
7
+ * Status: *Stable*
8
+ *
9
+ * The table panel contains a sortable, pagable view of documents that. It can be arranged into
10
+ * defined columns and offers several interactions, such as performing adhoc terms aggregations.
11
+ *
12
+ */
20
13
  define([
21
14
  'angular',
22
15
  'app',
23
16
  'underscore',
24
17
  'kbn',
25
18
  'moment',
26
-
27
- // 'text!./pagination.html',
28
- // 'text!partials/querySelect.html'
29
19
  ],
30
20
  function (angular, app, _, kbn, moment) {
31
21
  'use strict';
@@ -60,31 +50,90 @@ function (angular, app, _, kbn, moment) {
60
50
 
61
51
  // Set and populate defaults
62
52
  var _d = {
63
- queries : {
64
- mode : 'all',
65
- ids : []
66
- },
53
+ /** @scratch /panels/table/5
54
+ * === Parameters
55
+ *
56
+ * size:: The number of hits to show per page
57
+ */
67
58
  size : 100, // Per page
59
+ /** @scratch /panels/table/5
60
+ * pages:: The number of pages available
61
+ */
68
62
  pages : 5, // Pages available
63
+ /** @scratch /panels/table/5
64
+ * offset:: The current page
65
+ */
69
66
  offset : 0,
67
+ /** @scratch /panels/table/5
68
+ * sort:: An array describing the sort order of the table. For example [`@timestamp',`desc']
69
+ */
70
70
  sort : ['_score','desc'],
71
- group : "default",
72
- style : {'font-size': '9pt'},
71
+ /** @scratch /panels/table/5
72
+ * overflow:: The css overflow property. `min-height' (expand) or `auto' (scroll)
73
+ */
73
74
  overflow: 'min-height',
75
+ /** @scratch /panels/table/5
76
+ * fields:: the fields used a columns of the table, in an array.
77
+ */
74
78
  fields : [],
79
+ /** @scratch /panels/table/5
80
+ * highlight:: The fields on which to highlight, in an array
81
+ */
75
82
  highlight : [],
83
+ /** @scratch /panels/table/5
84
+ * sortable:: Set sortable to false to disable sorting
85
+ */
76
86
  sortable: true,
87
+ /** @scratch /panels/table/5
88
+ * header:: Set to false to hide the table column names
89
+ */
77
90
  header : true,
91
+ /** @scratch /panels/table/5
92
+ * paging:: Set to false to hide the paging controls of the table
93
+ */
78
94
  paging : true,
95
+ /** @scratch /panels/table/5
96
+ * field_list:: Set to false to hide the list of fields. The user will be able to expand it,
97
+ * but it will be hidden by default
98
+ */
79
99
  field_list: true,
100
+ /** @scratch /panels/table/5
101
+ * all_fields:: Set to true to show all fields in the mapping, not just the current fields in
102
+ * the table.
103
+ */
80
104
  all_fields: false,
105
+ /** @scratch /panels/table/5
106
+ * trimFactor:: The trim factor is the length at which to truncate fields takinging into
107
+ * consideration the number of columns in the table. For example, a trimFactor of 100, with 5
108
+ * columns in the table, would trim each column at 20 character. The entirety of the field is
109
+ * still available in the expanded view of the event.
110
+ */
81
111
  trimFactor: 300,
112
+ /** @scratch /panels/table/5
113
+ * spyable:: Set to false to disable the inspect icon
114
+ */
115
+ spyable : true,
116
+ /** @scratch /panels/table/5
117
+ * ==== Queries
118
+ * queries object:: This object describes the queries to use on this panel.
119
+ * queries.mode::: Of the queries available, which to use. Options: +all, pinned, unpinned, selected+
120
+ * queries.ids::: In +selected+ mode, which query ids are selected.
121
+ */
122
+ queries : {
123
+ mode : 'all',
124
+ ids : []
125
+ },
126
+ style : {'font-size': '9pt'},
82
127
  normTimes : true,
83
- spyable : true
84
128
  };
85
129
  _.defaults($scope.panel,_d);
86
130
 
87
131
  $scope.init = function () {
132
+ $scope.columns = {};
133
+ _.each($scope.panel.fields,function(field) {
134
+ $scope.columns[field] = true;
135
+ });
136
+
88
137
  $scope.Math = Math;
89
138
  $scope.identity = angular.identity;
90
139
  $scope.$on('refresh',function(){$scope.get_data();});
@@ -159,8 +208,10 @@ function (angular, app, _, kbn, moment) {
159
208
  $scope.toggle_field = function(field) {
160
209
  if (_.indexOf($scope.panel.fields,field) > -1) {
161
210
  $scope.panel.fields = _.without($scope.panel.fields,field);
211
+ delete $scope.columns[field];
162
212
  } else {
163
213
  $scope.panel.fields.push(field);
214
+ $scope.columns[field] = true;
164
215
  }
165
216
  };
166
217
 
@@ -1,4 +1,7 @@
1
1
  <div ng-controller='terms' ng-init="init()">
2
+ <style>
3
+ .pieLabel { pointer-events: none }
4
+ </style>
2
5
  <!-- START Pie or bar chart -->
3
6
  <div ng-show="panel.counter_pos == 'above' && (panel.chart == 'bar' || panel.chart == 'pie')" id='{{$id}}-legend'>
4
7
  <!-- vertical legend above -->
@@ -1,15 +1,14 @@
1
- /*
2
- ## Terms
3
-
4
- ### Parameters
5
- * style :: A hash of css styles
6
- * size :: top N
7
- * arrangement :: How should I arrange the query results? 'horizontal' or 'vertical'
8
- * chart :: Show a chart? 'none', 'bar', 'pie'
9
- * donut :: Only applies to 'pie' charts. Punches a hole in the chart for some reason
10
- * tilt :: Only 'pie' charts. Janky 3D effect. Looks terrible 90% of the time.
11
- * lables :: Only 'pie' charts. Labels on the pie?
12
- */
1
+ /** @scratch /panels/5
2
+ * include::panels/terms.asciidoc[]
3
+ */
4
+
5
+ /** @scratch /panels/terms/0
6
+ * == terms
7
+ * Status: *Stable*
8
+ *
9
+ * A table, bar chart or pie chart based on the results of an Elasticsearch terms facet.
10
+ *
11
+ */
13
12
  define([
14
13
  'angular',
15
14
  'app',
@@ -43,24 +42,73 @@ function (angular, app, _, $, kbn) {
43
42
 
44
43
  // Set and populate defaults
45
44
  var _d = {
46
- queries : {
47
- mode : 'all',
48
- ids : []
49
- },
45
+ /** @scratch /panels/terms/5
46
+ * === Parameters
47
+ *
48
+ * field:: The field on which to computer the facet
49
+ */
50
50
  field : '_type',
51
+ /** @scratch /panels/terms/5
52
+ * exclude:: terms to exclude from the results
53
+ */
51
54
  exclude : [],
55
+ /** @scratch /panels/terms/5
56
+ * missing:: Set to false to disable the display of a counter showing how much results are
57
+ * missing the field
58
+ */
52
59
  missing : true,
60
+ /** @scratch /panels/terms/5
61
+ * other:: Set to false to disable the display of a counter representing the aggregate of all
62
+ * values outside of the scope of your +size+ property
63
+ */
53
64
  other : true,
65
+ /** @scratch /panels/terms/5
66
+ * size:: Show this many terms
67
+ */
54
68
  size : 10,
69
+ /** @scratch /panels/terms/5
70
+ * order:: count, term, reverse_count or reverse_term
71
+ */
55
72
  order : 'count',
56
73
  style : { "font-size": '10pt'},
74
+ /** @scratch /panels/terms/5
75
+ * donut:: In pie chart mode, draw a hole in the middle of the pie to make a tasty donut.
76
+ */
57
77
  donut : false,
78
+ /** @scratch /panels/terms/5
79
+ * tilt:: In pie chart mode, tilt the chart back to appear as more of an oval shape
80
+ */
58
81
  tilt : false,
82
+ /** @scratch /panels/terms/5
83
+ * lables:: In pie chart mode, draw labels in the pie slices
84
+ */
59
85
  labels : true,
86
+ /** @scratch /panels/terms/5
87
+ * arrangement:: In bar or pie mode, arrangement of the legend. horizontal or vertical
88
+ */
60
89
  arrangement : 'horizontal',
90
+ /** @scratch /panels/terms/5
91
+ * chart:: table, bar or pie
92
+ */
61
93
  chart : 'bar',
94
+ /** @scratch /panels/terms/5
95
+ * counter_pos:: The location of the legend in respect to the chart, above or below.
96
+ */
62
97
  counter_pos : 'above',
63
- spyable : true
98
+ /** @scratch /panels/terms/5
99
+ * spyable:: Set spyable to false to disable the inspect button
100
+ */
101
+ spyable : true,
102
+ /** @scratch /panels/terms/5
103
+ * ==== Queries
104
+ * queries object:: This object describes the queries to use on this panel.
105
+ * queries.mode::: Of the queries available, which to use. Options: +all, pinned, unpinned, selected+
106
+ * queries.ids::: In +selected+ mode, which query ids are selected.
107
+ */
108
+ queries : {
109
+ mode : 'all',
110
+ ids : []
111
+ },
64
112
  };
65
113
  _.defaults($scope.panel,_d);
66
114
 
@@ -1,10 +1,15 @@
1
- /*
2
- ## Text
3
- ### Parameters
4
- * mode :: 'text', 'html', 'markdown'
5
- * content :: Content of the panel
6
- * style :: Hash containing css properties
7
- */
1
+ /** @scratch /panels/5
2
+ * include::panels/text.asciidoc[]
3
+ */
4
+
5
+ /** @scratch /panels/text/0
6
+ * == text
7
+ * Status: *Stable*
8
+ *
9
+ * The text panel is used for displaying static text formated as markdown, sanitized html or as plain
10
+ * text.
11
+ *
12
+ */
8
13
  define([
9
14
  'angular',
10
15
  'app',
@@ -25,8 +30,15 @@ function (angular, app, _, require) {
25
30
 
26
31
  // Set and populate defaults
27
32
  var _d = {
28
- status : "Stable",
29
- mode : "markdown",
33
+ /** @scratch /panels/text/5
34
+ * === Parameters
35
+ *
36
+ * mode:: `html', `markdown' or `text'
37
+ */
38
+ mode : "markdown", // 'html','markdown','text'
39
+ /** @scratch /panels/text/5
40
+ * content:: The content of your panel, written in the mark up specified in +mode+
41
+ */
30
42
  content : "",
31
43
  style: {},
32
44
  };
@@ -1,13 +1,16 @@
1
- /*
2
-
3
- ## Trends
4
-
5
- ### Parameters
6
- * style :: A hash of css styles
7
- * arrangement :: How should I arrange the query results? 'horizontal' or 'vertical'
8
- * ago :: Date math formatted time to look back
9
-
10
- */
1
+ /** @scratch /panels/5
2
+ * include::panels/trends.asciidoc[]
3
+ */
4
+
5
+ /** @scratch /panels/trends/0
6
+ * == trends
7
+ * Status: *Beta*
8
+ *
9
+ * A stock-ticker style representation of how queries are moving over time. For example, if the
10
+ * time is 1:10pm, your time picker was set to "Last 10m", and the "Time Ago" parameter was set to
11
+ * "1h", the panel would show how much the query results have changed since 12:00-12:10pm
12
+ *
13
+ */
11
14
  define([
12
15
  'angular',
13
16
  'app',
@@ -43,14 +46,32 @@ function (angular, app, _, kbn) {
43
46
 
44
47
  // Set and populate defaults
45
48
  var _d = {
49
+ /** @scratch /panels/trends/5
50
+ * === Parameters
51
+ *
52
+ * ago:: A date math formatted string describing the relative time period to compare the
53
+ * queries to.
54
+ */
55
+ ago : '1d',
56
+ /** @scratch /panels/trends/5
57
+ * arrangement:: `horizontal' or `vertical'
58
+ */
59
+ arrangement : 'vertical',
60
+ /** @scratch /panels/trends/5
61
+ * spyable:: Set to false to disable the inspect icon
62
+ */
63
+ spyable: true,
64
+ /** @scratch /panels/trends/5
65
+ * ==== Queries
66
+ * queries object:: This object describes the queries to use on this panel.
67
+ * queries.mode::: Of the queries available, which to use. Options: +all, pinned, unpinned, selected+
68
+ * queries.ids::: In +selected+ mode, which query ids are selected.
69
+ */
46
70
  queries : {
47
71
  mode : 'all',
48
72
  ids : []
49
73
  },
50
74
  style : { "font-size": '14pt'},
51
- ago : '1d',
52
- arrangement : 'vertical',
53
- spyable: true
54
75
  };
55
76
  _.defaults($scope.panel,_d);
56
77
 
@@ -159,7 +159,7 @@
159
159
  </div>
160
160
 
161
161
  <div ng-repeat="pulldown in dashboard.current.nav" ng-controller="PulldownCtrl" ng-show="editor.index == 4+$index">
162
- <ng-include ng-show="pulldown.enable" src="'./app/panels/'+pulldown.type+'/editor.html'"></ng-include>
162
+ <ng-include ng-show="pulldown.enable" src="edit_path(pulldown.type)"></ng-include>
163
163
  <button ng-hide="pulldown.enable" class="btn" ng-click="pulldown.enable = true">Enable the {{pulldown.type}}</button>
164
164
  </div>
165
165
 
@@ -184,19 +184,19 @@ function (angular, $, kbn, _, config, moment, Modernizr) {
184
184
  // Set the current dashboard
185
185
  self.current = _.clone(dashboard);
186
186
 
187
- // Ok, now that we've setup the current dashboard, we can inject our services
188
- querySrv = $injector.get('querySrv');
189
- filterSrv = $injector.get('filterSrv');
190
-
191
- // Make sure these re-init
192
- querySrv.init();
193
- filterSrv.init();
194
-
195
- // If there's an interval set, the indices have not been calculated yet,
196
- // so there is no data. Call refresh to calculate the indices and notify the panels.
197
- if(dashboard.index.interval !== 'none') {
187
+ // Delay this until we're sure that querySrv and filterSrv are ready
188
+ $timeout(function() {
189
+ // Ok, now that we've setup the current dashboard, we can inject our services
190
+ querySrv = $injector.get('querySrv');
191
+ filterSrv = $injector.get('filterSrv');
192
+
193
+ // Make sure these re-init
194
+ querySrv.init();
195
+ filterSrv.init();
196
+ },0).then(function() {
197
+ // Call refresh to calculate the indices and notify the panels that we're ready to roll
198
198
  self.refresh();
199
- }
199
+ });
200
200
 
201
201
  if(dashboard.refresh) {
202
202
  self.set_interval(dashboard.refresh);
@@ -274,7 +274,7 @@ function (angular, $, kbn, _, config, moment, Modernizr) {
274
274
 
275
275
  this.file_load = function(file) {
276
276
  return $http({
277
- url: "app/dashboards/"+file+'?' + new Date().getTime(),
277
+ url: "app/dashboards/"+file.replace(/\.(?!json)/,"/")+'?' + new Date().getTime(),
278
278
  method: "GET",
279
279
  transformResponse: function(response) {
280
280
  return renderTemplate(response,$routeParams);
@@ -314,7 +314,7 @@ function (angular, $, kbn, _, config, moment, Modernizr) {
314
314
 
315
315
  this.script_load = function(file) {
316
316
  return $http({
317
- url: "app/dashboards/"+file,
317
+ url: "app/dashboards/"+file.replace(/\.(?!js)/,"/"),
318
318
  method: "GET",
319
319
  transformResponse: function(response) {
320
320
  /*jshint -W054 */
@@ -14,20 +14,22 @@ function (angular, _, config) {
14
14
 
15
15
  this.list = ['_type'];
16
16
  this.mapping = {};
17
+ this.fullMapping = {};
17
18
 
18
19
  $rootScope.$watch(function(){return dashboard.indices;},function(n) {
19
20
  if(!_.isUndefined(n) && n.length) {
20
21
  // Only get the mapping for indices we don't know it for
21
- var indices = _.difference(n,_.keys(self.mapping));
22
+ var indices = _.difference(n,_.keys(self.fullMapping));
22
23
  // Only get the mapping if there are new indices
23
24
  if(indices.length > 0) {
24
25
  self.map(indices).then(function(result) {
25
- self.mapping = _.extend(self.mapping,result);
26
- self.list = mapFields(self.mapping);
26
+ self.fullMapping = _.extend(self.fullMapping,result);
27
+ self.list = mapFields(self.fullMapping);
27
28
  });
28
29
  // Otherwise just use the cached mapping
29
30
  } else {
30
- self.list = mapFields(_.pick(self.mapping,n));
31
+ // This is inefficient, should not need to reprocess?
32
+ self.list = mapFields(_.pick(self.fullMapping,n));
31
33
  }
32
34
  }
33
35
  });
@@ -57,12 +59,13 @@ function (angular, _, config) {
57
59
  }
58
60
  });
59
61
 
62
+ // Flatten the mapping of each index into dot notated keys.
60
63
  return request.then(function(p) {
61
64
  var mapping = {};
62
- _.each(p.data, function(v,k) {
63
- mapping[k] = {};
64
- _.each(v, function (v,f) {
65
- mapping[k][f] = flatten(v);
65
+ _.each(p.data, function(type,index) {
66
+ mapping[index] = {};
67
+ _.each(type, function (fields,typename) {
68
+ mapping[index][typename] = flatten(fields);
66
69
  });
67
70
  });
68
71
  return mapping;