blazer 3.4.0 → 3.5.0

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 (75) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +23 -27
  4. data/app/assets/javascripts/blazer/Sortable.js +826 -1162
  5. data/app/assets/javascripts/blazer/ace/ace.js +15775 -13360
  6. data/app/assets/javascripts/blazer/ace/ext-language_tools.js +1411 -668
  7. data/app/assets/javascripts/blazer/ace/mode-sql.js +12 -6
  8. data/app/assets/javascripts/blazer/ace/theme-twilight.js +3 -3
  9. data/app/assets/javascripts/blazer/application.js +94 -52
  10. data/app/assets/javascripts/blazer/chart.umd.js +6 -6
  11. data/app/assets/javascripts/blazer/daterangepicker.js +193 -199
  12. data/app/assets/javascripts/blazer/highlight.min.js +235 -373
  13. data/app/assets/javascripts/blazer/moment-timezone-with-data.js +116 -82
  14. data/app/assets/javascripts/blazer/moment.js +368 -365
  15. data/app/assets/javascripts/blazer/queries.js +68 -58
  16. data/app/assets/javascripts/blazer/routes.js +11 -11
  17. data/app/assets/javascripts/blazer/tablesort.js +42 -0
  18. data/app/assets/javascripts/blazer/tom-select.base.js +4175 -0
  19. data/app/assets/stylesheets/blazer/application.css +114 -5
  20. data/app/assets/stylesheets/blazer/tom-select.css +502 -0
  21. data/app/controllers/blazer/base_controller.rb +1 -1
  22. data/app/controllers/blazer/checks_controller.rb +5 -2
  23. data/app/controllers/blazer/queries_controller.rb +3 -1
  24. data/app/helpers/blazer/base_helper.rb +1 -1
  25. data/app/models/blazer/check.rb +35 -57
  26. data/app/views/blazer/_nav.html.erb +1 -1
  27. data/app/views/blazer/_variables.html.erb +57 -42
  28. data/app/views/blazer/checks/_form.html.erb +20 -16
  29. data/app/views/blazer/checks/index.html.erb +17 -20
  30. data/app/views/blazer/dashboards/_form.html.erb +63 -48
  31. data/app/views/blazer/dashboards/show.html.erb +23 -16
  32. data/app/views/blazer/queries/_caching.html.erb +1 -1
  33. data/app/views/blazer/queries/_chart.html.erb +8 -0
  34. data/app/views/blazer/queries/_form.html.erb +153 -180
  35. data/app/views/blazer/queries/_map.html.erb +8 -0
  36. data/app/views/blazer/queries/docs.html.erb +6 -6
  37. data/app/views/blazer/queries/edit.html.erb +1 -0
  38. data/app/views/blazer/queries/home.html.erb +101 -102
  39. data/app/views/blazer/queries/new.html.erb +1 -0
  40. data/app/views/blazer/queries/run.html.erb +23 -34
  41. data/app/views/blazer/queries/schema.html.erb +20 -20
  42. data/app/views/blazer/queries/show.html.erb +19 -12
  43. data/app/views/blazer/uploads/index.html.erb +10 -10
  44. data/app/views/layouts/blazer/application.html.erb +3 -3
  45. data/lib/blazer/adapters/athena_adapter.rb +12 -6
  46. data/lib/blazer/adapters/clickhouse_adapter.rb +136 -0
  47. data/lib/blazer/adapters/druid_adapter.rb +0 -2
  48. data/lib/blazer/adapters/snowflake2_adapter.rb +198 -0
  49. data/lib/blazer/adapters/soda_adapter.rb +0 -2
  50. data/lib/blazer/adapters/sql_adapter.rb +4 -0
  51. data/lib/blazer/adapters.rb +2 -0
  52. data/lib/blazer/check_types.rb +20 -0
  53. data/lib/blazer/email_notifier.rb +49 -0
  54. data/lib/blazer/result.rb +15 -0
  55. data/lib/blazer/slack_notifier.rb +39 -7
  56. data/lib/blazer/version.rb +1 -1
  57. data/lib/blazer.rb +32 -26
  58. data/lib/generators/blazer/templates/config.yml.tt +0 -2
  59. data/licenses/LICENSE-chart.js.txt +1 -1
  60. metadata +12 -31
  61. data/app/assets/javascripts/blazer/bootstrap.js +0 -2580
  62. data/app/assets/javascripts/blazer/jquery.js +0 -10872
  63. data/app/assets/javascripts/blazer/jquery.stickytableheaders.js +0 -325
  64. data/app/assets/javascripts/blazer/rails-ujs.js +0 -746
  65. data/app/assets/javascripts/blazer/selectize.js +0 -3891
  66. data/app/assets/javascripts/blazer/stupidtable-custom-settings.js +0 -13
  67. data/app/assets/javascripts/blazer/stupidtable.js +0 -281
  68. data/app/assets/javascripts/blazer/vue.global.prod.js +0 -1
  69. data/app/assets/stylesheets/blazer/selectize.css +0 -403
  70. data/licenses/LICENSE-jquery.txt +0 -20
  71. data/licenses/LICENSE-rails-ujs.txt +0 -20
  72. data/licenses/LICENSE-stickytableheaders.txt +0 -20
  73. data/licenses/LICENSE-stupidtable.txt +0 -19
  74. data/licenses/LICENSE-vue.txt +0 -21
  75. /data/licenses/{LICENSE-selectize.txt → LICENSE-tom-select.txt} +0 -0
@@ -1,325 +0,0 @@
1
- /*! Copyright (c) Jonas Mosbech - https://github.com/jmosbech/StickyTableHeaders
2
- MIT license info: https://github.com/jmosbech/StickyTableHeaders/blob/master/license.txt */
3
-
4
- ;(function ($, window, undefined) {
5
- 'use strict';
6
-
7
- var name = 'stickyTableHeaders',
8
- id = 0,
9
- defaults = {
10
- fixedOffset: 0,
11
- leftOffset: 0,
12
- marginTop: 0,
13
- objDocument: document,
14
- objHead: 'head',
15
- objWindow: window,
16
- scrollableArea: window,
17
- cacheHeaderHeight: false,
18
- zIndex: 3
19
- };
20
-
21
- function Plugin (el, options) {
22
- // To avoid scope issues, use 'base' instead of 'this'
23
- // to reference this class from internal events and functions.
24
- var base = this;
25
-
26
- // Access to jQuery and DOM versions of element
27
- base.$el = $(el);
28
- base.el = el;
29
- base.id = id++;
30
-
31
- // Listen for destroyed, call teardown
32
- base.$el.bind('destroyed',
33
- $.proxy(base.teardown, base));
34
-
35
- // Cache DOM refs for performance reasons
36
- base.$clonedHeader = null;
37
- base.$originalHeader = null;
38
-
39
- // Cache header height for performance reasons
40
- base.cachedHeaderHeight = null;
41
-
42
- // Keep track of state
43
- base.isSticky = false;
44
- base.hasBeenSticky = false;
45
- base.leftOffset = null;
46
- base.topOffset = null;
47
-
48
- base.init = function () {
49
- base.setOptions(options);
50
-
51
- base.$el.each(function () {
52
- var $this = $(this);
53
-
54
- // remove padding on <table> to fix issue #7
55
- $this.css('padding', 0);
56
-
57
- base.$originalHeader = $('thead:first', this);
58
- base.$clonedHeader = base.$originalHeader.clone();
59
- $this.trigger('clonedHeader.' + name, [base.$clonedHeader]);
60
-
61
- base.$clonedHeader.addClass('tableFloatingHeader');
62
- base.$clonedHeader.css({display: 'none', opacity: 0.0});
63
-
64
- base.$originalHeader.addClass('tableFloatingHeaderOriginal');
65
-
66
- base.$originalHeader.after(base.$clonedHeader);
67
-
68
- base.$printStyle = $('<style type="text/css" media="print">' +
69
- '.tableFloatingHeader{display:none !important;}' +
70
- '.tableFloatingHeaderOriginal{position:static !important;}' +
71
- '</style>');
72
- base.$head.append(base.$printStyle);
73
- });
74
-
75
- base.$clonedHeader.find("input, select").attr("disabled", true);
76
-
77
- base.updateWidth();
78
- base.toggleHeaders();
79
- base.bind();
80
- };
81
-
82
- base.destroy = function (){
83
- base.$el.unbind('destroyed', base.teardown);
84
- base.teardown();
85
- };
86
-
87
- base.teardown = function(){
88
- if (base.isSticky) {
89
- base.$originalHeader.css('position', 'static');
90
- }
91
- $.removeData(base.el, 'plugin_' + name);
92
- base.unbind();
93
-
94
- base.$clonedHeader.remove();
95
- base.$originalHeader.removeClass('tableFloatingHeaderOriginal');
96
- base.$originalHeader.css('visibility', 'visible');
97
- base.$printStyle.remove();
98
-
99
- base.el = null;
100
- base.$el = null;
101
- };
102
-
103
- base.bind = function(){
104
- base.$scrollableArea.on('scroll.' + name, base.toggleHeaders);
105
- if (!base.isWindowScrolling) {
106
- base.$window.on('scroll.' + name + base.id, base.setPositionValues);
107
- base.$window.on('resize.' + name + base.id, base.toggleHeaders);
108
- }
109
- base.$scrollableArea.on('resize.' + name, base.toggleHeaders);
110
- base.$scrollableArea.on('resize.' + name, base.updateWidth);
111
- };
112
-
113
- base.unbind = function(){
114
- // unbind window events by specifying handle so we don't remove too much
115
- base.$scrollableArea.off('.' + name, base.toggleHeaders);
116
- if (!base.isWindowScrolling) {
117
- base.$window.off('.' + name + base.id, base.setPositionValues);
118
- base.$window.off('.' + name + base.id, base.toggleHeaders);
119
- }
120
- base.$scrollableArea.off('.' + name, base.updateWidth);
121
- };
122
-
123
- // We debounce the functions bound to the scroll and resize events
124
- base.debounce = function (fn, delay) {
125
- var timer = null;
126
- return function () {
127
- var context = this, args = arguments;
128
- clearTimeout(timer);
129
- timer = setTimeout(function () {
130
- fn.apply(context, args);
131
- }, delay);
132
- };
133
- };
134
-
135
- base.toggleHeaders = base.debounce(function () {
136
- if (base.$el) {
137
- base.$el.each(function () {
138
- var $this = $(this),
139
- newLeft,
140
- newTopOffset = base.isWindowScrolling ? (
141
- isNaN(base.options.fixedOffset) ?
142
- base.options.fixedOffset.outerHeight() :
143
- base.options.fixedOffset
144
- ) :
145
- base.$scrollableArea.offset().top + (!isNaN(base.options.fixedOffset) ? base.options.fixedOffset : 0),
146
- offset = $this.offset(),
147
-
148
- scrollTop = base.$scrollableArea.scrollTop() + newTopOffset,
149
- scrollLeft = base.$scrollableArea.scrollLeft(),
150
-
151
- headerHeight,
152
-
153
- scrolledPastTop = base.isWindowScrolling ?
154
- scrollTop > offset.top :
155
- newTopOffset > offset.top,
156
- notScrolledPastBottom;
157
-
158
- if (scrolledPastTop) {
159
- headerHeight = base.options.cacheHeaderHeight ? base.cachedHeaderHeight : base.$clonedHeader.height();
160
- notScrolledPastBottom = (base.isWindowScrolling ? scrollTop : 0) <
161
- (offset.top + $this.height() - headerHeight - (base.isWindowScrolling ? 0 : newTopOffset));
162
- }
163
-
164
- if (scrolledPastTop && notScrolledPastBottom) {
165
- newLeft = offset.left - scrollLeft + base.options.leftOffset;
166
- base.$originalHeader.css({
167
- 'position': 'fixed',
168
- 'margin-top': base.options.marginTop,
169
- 'top': 0,
170
- 'left': newLeft,
171
- 'z-index': base.options.zIndex
172
- });
173
- base.leftOffset = newLeft;
174
- base.topOffset = newTopOffset;
175
- base.$clonedHeader.css('display', '');
176
- if (!base.isSticky) {
177
- base.isSticky = true;
178
- // make sure the width is correct: the user might have resized the browser while in static mode
179
- base.updateWidth();
180
- $this.trigger('enabledStickiness.' + name);
181
- }
182
- base.setPositionValues();
183
- } else if (base.isSticky) {
184
- base.$originalHeader.css('position', 'static');
185
- base.$clonedHeader.css('display', 'none');
186
- base.isSticky = false;
187
- base.resetWidth($('td,th', base.$clonedHeader), $('td,th', base.$originalHeader));
188
- $this.trigger('disabledStickiness.' + name);
189
- }
190
- });
191
- }
192
- }, 0);
193
-
194
- base.setPositionValues = base.debounce(function () {
195
- var winScrollTop = base.$window.scrollTop(),
196
- winScrollLeft = base.$window.scrollLeft();
197
- if (!base.isSticky ||
198
- winScrollTop < 0 || winScrollTop + base.$window.height() > base.$document.height() ||
199
- winScrollLeft < 0 || winScrollLeft + base.$window.width() > base.$document.width()) {
200
- return;
201
- }
202
- base.$originalHeader.css({
203
- 'top': base.topOffset - (base.isWindowScrolling ? 0 : winScrollTop),
204
- 'left': base.leftOffset - (base.isWindowScrolling ? 0 : winScrollLeft)
205
- });
206
- }, 0);
207
-
208
- base.updateWidth = base.debounce(function () {
209
- if (!base.isSticky) {
210
- return;
211
- }
212
- // Copy cell widths from clone
213
- if (!base.$originalHeaderCells) {
214
- base.$originalHeaderCells = $('th,td', base.$originalHeader);
215
- }
216
- if (!base.$clonedHeaderCells) {
217
- base.$clonedHeaderCells = $('th,td', base.$clonedHeader);
218
- }
219
- var cellWidths = base.getWidth(base.$clonedHeaderCells);
220
- base.setWidth(cellWidths, base.$clonedHeaderCells, base.$originalHeaderCells);
221
-
222
- // Copy row width from whole table
223
- base.$originalHeader.css('width', base.$clonedHeader.width());
224
-
225
- // If we're caching the height, we need to update the cached value when the width changes
226
- if (base.options.cacheHeaderHeight) {
227
- base.cachedHeaderHeight = base.$clonedHeader.height();
228
- }
229
- }, 0);
230
-
231
- base.getWidth = function ($clonedHeaders) {
232
- var widths = [];
233
- $clonedHeaders.each(function (index) {
234
- var width, $this = $(this);
235
-
236
- if ($this.css('box-sizing') === 'border-box') {
237
- var boundingClientRect = $this[0].getBoundingClientRect();
238
- if(boundingClientRect.width) {
239
- width = boundingClientRect.width; // #39: border-box bug
240
- } else {
241
- width = boundingClientRect.right - boundingClientRect.left; // ie8 bug: getBoundingClientRect() does not have a width property
242
- }
243
- } else {
244
- var $origTh = $('th', base.$originalHeader);
245
- if ($origTh.css('border-collapse') === 'collapse') {
246
- if (window.getComputedStyle) {
247
- width = parseFloat(window.getComputedStyle(this, null).width);
248
- } else {
249
- // ie8 only
250
- var leftPadding = parseFloat($this.css('padding-left'));
251
- var rightPadding = parseFloat($this.css('padding-right'));
252
- // Needs more investigation - this is assuming constant border around this cell and it's neighbours.
253
- var border = parseFloat($this.css('border-width'));
254
- width = $this.outerWidth() - leftPadding - rightPadding - border;
255
- }
256
- } else {
257
- width = $this.width();
258
- }
259
- }
260
-
261
- widths[index] = width;
262
- });
263
- return widths;
264
- };
265
-
266
- base.setWidth = function (widths, $clonedHeaders, $origHeaders) {
267
- $clonedHeaders.each(function (index) {
268
- var width = widths[index];
269
- $origHeaders.eq(index).css({
270
- 'min-width': width,
271
- 'max-width': width
272
- });
273
- });
274
- };
275
-
276
- base.resetWidth = function ($clonedHeaders, $origHeaders) {
277
- $clonedHeaders.each(function (index) {
278
- var $this = $(this);
279
- $origHeaders.eq(index).css({
280
- 'min-width': $this.css('min-width'),
281
- 'max-width': $this.css('max-width')
282
- });
283
- });
284
- };
285
-
286
- base.setOptions = function (options) {
287
- base.options = $.extend({}, defaults, options);
288
- base.$window = $(base.options.objWindow);
289
- base.$head = $(base.options.objHead);
290
- base.$document = $(base.options.objDocument);
291
- base.$scrollableArea = $(base.options.scrollableArea);
292
- base.isWindowScrolling = base.$scrollableArea[0] === base.$window[0];
293
- };
294
-
295
- base.updateOptions = function (options) {
296
- base.setOptions(options);
297
- // scrollableArea might have changed
298
- base.unbind();
299
- base.bind();
300
- base.updateWidth();
301
- base.toggleHeaders();
302
- };
303
-
304
- // Run initializer
305
- base.init();
306
- }
307
-
308
- // A plugin wrapper around the constructor,
309
- // preventing against multiple instantiations
310
- $.fn[name] = function ( options ) {
311
- return this.each(function () {
312
- var instance = $.data(this, 'plugin_' + name);
313
- if (instance) {
314
- if (typeof options === 'string') {
315
- instance[options].apply(instance);
316
- } else {
317
- instance.updateOptions(options);
318
- }
319
- } else if(options !== 'destroy') {
320
- $.data(this, 'plugin_' + name, new Plugin( this, options ));
321
- }
322
- });
323
- };
324
-
325
- })(jQuery, window);