sql-jarvis 2.0.8 → 2.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/blazer/application.js +2 -61
- data/app/assets/javascripts/blazer/jquery.stickytableheaders.js +320 -320
- data/app/assets/javascripts/blazer/main.js +140 -0
- data/app/assets/javascripts/blazer/position.js +7 -0
- data/app/assets/javascripts/blazer/vue.js +0 -1
- data/app/assets/stylesheets/blazer/application.css +1 -0
- data/app/assets/stylesheets/blazer/main.css +48 -0
- data/app/views/blazer/queries/_form.html.erb +2 -2
- data/app/views/blazer/queries/run.html.erb +62 -55
- data/app/views/blazer/queries/show.html.erb +5 -3
- data/lib/blazer/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95d91e5cd88710c9bcfc4275feefe9adcf44fe0094ee18a1292ade8667c745f9
|
4
|
+
data.tar.gz: ca7ac9b757cf70a255354471daaaae0a38bade6e1d32943ca57bf00af45f62b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 455fa161a14556cef7aac3baba521186c670b0c1469e945cc55201fd9d4635aaecfbad20051fd3e08438bb0b455567e9059f0199c44700f7bba3bc48d9194f09
|
7
|
+
data.tar.gz: e3752620502bcfe904e0320df5f8b51725d41283ab47b496f8a9b60dddf43af722c1cf9be09f38e29ddca1674d9490e07a81299ec01e0ba25a81b60bac10d0c9
|
@@ -17,64 +17,5 @@
|
|
17
17
|
//= require ./queries
|
18
18
|
//= require ./fuzzysearch
|
19
19
|
//= require ./select2
|
20
|
-
|
21
|
-
|
22
|
-
Vue.config.productionTip = false
|
23
|
-
|
24
|
-
$(document).on('mouseenter', '.dropdown-toggle', function () {
|
25
|
-
$(this).parent().addClass('open')
|
26
|
-
})
|
27
|
-
|
28
|
-
$(document).on("change", "#bind input, #bind select", function () {
|
29
|
-
submitIfCompleted($(this).closest("form"))
|
30
|
-
})
|
31
|
-
|
32
|
-
$(document).on("click", "#code", function () {
|
33
|
-
$(this).addClass("expanded")
|
34
|
-
})
|
35
|
-
|
36
|
-
function submitIfCompleted($form) {
|
37
|
-
var completed = true
|
38
|
-
$form.find("input[name], select").each( function () {
|
39
|
-
if ($(this).val() == "") {
|
40
|
-
completed = false
|
41
|
-
}
|
42
|
-
})
|
43
|
-
if (completed) {
|
44
|
-
$form.submit()
|
45
|
-
}
|
46
|
-
}
|
47
|
-
|
48
|
-
// Prevent backspace from navigating backwards.
|
49
|
-
// Adapted from Biff MaGriff: http://stackoverflow.com/a/7895814/1196499
|
50
|
-
function preventBackspaceNav() {
|
51
|
-
$(document).keydown(function (e) {
|
52
|
-
var preventKeyPress
|
53
|
-
if (e.keyCode == 8) {
|
54
|
-
var d = e.srcElement || e.target
|
55
|
-
switch (d.tagName.toUpperCase()) {
|
56
|
-
case 'TEXTAREA':
|
57
|
-
preventKeyPress = d.readOnly || d.disabled
|
58
|
-
break
|
59
|
-
case 'INPUT':
|
60
|
-
preventKeyPress = d.readOnly || d.disabled || (d.attributes["type"] && $.inArray(d.attributes["type"].value.toLowerCase(), ["radio", "reset", "checkbox", "submit", "button"]) >= 0)
|
61
|
-
break
|
62
|
-
case 'DIV':
|
63
|
-
preventKeyPress = d.readOnly || d.disabled || !(d.attributes["contentEditable"] && d.attributes["contentEditable"].value == "true")
|
64
|
-
break
|
65
|
-
default:
|
66
|
-
preventKeyPress = true
|
67
|
-
break
|
68
|
-
}
|
69
|
-
}
|
70
|
-
else {
|
71
|
-
preventKeyPress = false
|
72
|
-
}
|
73
|
-
|
74
|
-
if (preventKeyPress) {
|
75
|
-
e.preventDefault()
|
76
|
-
}
|
77
|
-
})
|
78
|
-
}
|
79
|
-
|
80
|
-
preventBackspaceNav()
|
20
|
+
//= require ./position
|
21
|
+
//= require ./main
|
@@ -1,325 +1,325 @@
|
|
1
1
|
/*! Copyright (c) Jonas Mosbech - https://github.com/jmosbech/StickyTableHeaders
|
2
|
-
|
2
|
+
MIT license info: https://github.com/jmosbech/StickyTableHeaders/blob/master/license.txt */
|
3
3
|
|
4
4
|
;(function ($, window, undefined) {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
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
324
|
|
325
325
|
})(jQuery, window);
|
@@ -0,0 +1,140 @@
|
|
1
|
+
Vue.config.devtools = false
|
2
|
+
Vue.config.productionTip = false
|
3
|
+
|
4
|
+
$(document).on('mouseenter', '.dropdown-toggle', function () {
|
5
|
+
$(this).parent().addClass('open')
|
6
|
+
})
|
7
|
+
|
8
|
+
$(document).on("change", "#bind input, #bind select", function () {
|
9
|
+
submitIfCompleted($(this).closest("form"))
|
10
|
+
})
|
11
|
+
|
12
|
+
$(document).on("click", "#code", function () {
|
13
|
+
$(this).addClass("expanded")
|
14
|
+
})
|
15
|
+
|
16
|
+
$(document).on("click", "a.click2CopyTable", function (event) {
|
17
|
+
event.preventDefault();
|
18
|
+
var selector = $(this).attr('href');
|
19
|
+
copyToClipboard(selector)
|
20
|
+
})
|
21
|
+
|
22
|
+
$(document).on("mouseover", "table th[data-popup='true']", function (event) {
|
23
|
+
var sum = 0, numbers = [];
|
24
|
+
var columns = $(this).parents('thead').find('th');
|
25
|
+
var columnIndex = columns.index(this) + 1;
|
26
|
+
var cells = $(this).parents('table').find('tbody tr td:nth-child('+columnIndex+')');
|
27
|
+
cells.each(function(index, cell) {
|
28
|
+
content = $(cell).text();
|
29
|
+
content = content.split('.').join('').replace(',', '.');
|
30
|
+
float = parseFloat(content);
|
31
|
+
if (isNaN(float)) float = 0;
|
32
|
+
numbers.push(float);
|
33
|
+
sum += float
|
34
|
+
});
|
35
|
+
showTooltip({
|
36
|
+
el: this,
|
37
|
+
min: Math.min.apply(null, numbers),
|
38
|
+
max: Math.max.apply(null, numbers),
|
39
|
+
avg: parseFloat((sum / cells.length).toFixed(2)),
|
40
|
+
sum: sum,
|
41
|
+
count: cells.length
|
42
|
+
})
|
43
|
+
})
|
44
|
+
|
45
|
+
$(document).on("mouseleave", "table th[data-popup='true']", function (event) {
|
46
|
+
$('#summanyPopup').remove();
|
47
|
+
})
|
48
|
+
|
49
|
+
function submitIfCompleted($form) {
|
50
|
+
var completed = true
|
51
|
+
$form.find("input[name], select").each( function () {
|
52
|
+
if ($(this).val() == "") {
|
53
|
+
completed = false
|
54
|
+
}
|
55
|
+
})
|
56
|
+
if (completed) {
|
57
|
+
$form.submit()
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
// Prevent backspace from navigating backwards.
|
62
|
+
// Adapted from Biff MaGriff: http://stackoverflow.com/a/7895814/1196499
|
63
|
+
function preventBackspaceNav() {
|
64
|
+
$(document).keydown(function (e) {
|
65
|
+
var preventKeyPress
|
66
|
+
if (e.keyCode == 8) {
|
67
|
+
var d = e.srcElement || e.target
|
68
|
+
switch (d.tagName.toUpperCase()) {
|
69
|
+
case 'TEXTAREA':
|
70
|
+
preventKeyPress = d.readOnly || d.disabled
|
71
|
+
break
|
72
|
+
case 'INPUT':
|
73
|
+
preventKeyPress = d.readOnly || d.disabled || (d.attributes["type"] && $.inArray(d.attributes["type"].value.toLowerCase(), ["radio", "reset", "checkbox", "submit", "button"]) >= 0)
|
74
|
+
break
|
75
|
+
case 'DIV':
|
76
|
+
preventKeyPress = d.readOnly || d.disabled || !(d.attributes["contentEditable"] && d.attributes["contentEditable"].value == "true")
|
77
|
+
break
|
78
|
+
default:
|
79
|
+
preventKeyPress = true
|
80
|
+
break
|
81
|
+
}
|
82
|
+
}
|
83
|
+
else {
|
84
|
+
preventKeyPress = false
|
85
|
+
}
|
86
|
+
|
87
|
+
if (preventKeyPress) {
|
88
|
+
e.preventDefault()
|
89
|
+
}
|
90
|
+
})
|
91
|
+
}
|
92
|
+
|
93
|
+
function copyToClipboard(selector) {
|
94
|
+
$(selector).find('.text-muted').hide();
|
95
|
+
var el = $(selector)[0];
|
96
|
+
var body = document.body, range, sel;
|
97
|
+
if (document.createRange && window.getSelection) {
|
98
|
+
range = document.createRange();
|
99
|
+
sel = window.getSelection();
|
100
|
+
sel.removeAllRanges();
|
101
|
+
try {
|
102
|
+
range.selectNodeContents(el);
|
103
|
+
sel.addRange(range);
|
104
|
+
} catch (e) {
|
105
|
+
range.selectNode(el);
|
106
|
+
sel.addRange(range);
|
107
|
+
}
|
108
|
+
document.execCommand("copy");
|
109
|
+
sel.removeAllRanges();
|
110
|
+
} else if (body.createTextRange) {
|
111
|
+
range = body.createTextRange();
|
112
|
+
range.moveToElementText(el);
|
113
|
+
range.select();
|
114
|
+
range.execCommand("Copy");
|
115
|
+
sel.removeAllRanges();
|
116
|
+
}
|
117
|
+
$(selector).find('.text-muted').show();
|
118
|
+
}
|
119
|
+
|
120
|
+
function showTooltip(data) {
|
121
|
+
var position = $(data.el).weOffset();
|
122
|
+
var top = position.top + 20 + $(data.el).height();
|
123
|
+
var left = position.left - 100 + $(data.el).width() / 2;
|
124
|
+
var tooltipEl = $('#summanyPopup');
|
125
|
+
if (tooltipEl.length == 0) {
|
126
|
+
tooltipEl = $('<div/>').attr('id', 'summanyPopup').appendTo('body');
|
127
|
+
}
|
128
|
+
tooltipEl.css({ top: top, left: left }).html('');
|
129
|
+
$('<p/>').html('Count: <span>' + formatNumber(data.count) + '</span>').appendTo(tooltipEl);
|
130
|
+
$('<p/>').html('Min: <span>' + formatNumber(data.min) + '</span>').appendTo(tooltipEl);
|
131
|
+
$('<p/>').html('Max: <span>' + formatNumber(data.max) + '</span>').appendTo(tooltipEl);
|
132
|
+
$('<p/>').html('Avg: <span>' + formatNumber(data.avg) + '</span>').appendTo(tooltipEl);
|
133
|
+
$('<p/>').html('Sum: <span>' + formatNumber(data.sum) + '</span>').appendTo(tooltipEl);
|
134
|
+
}
|
135
|
+
|
136
|
+
function formatNumber(num) {
|
137
|
+
return num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,')
|
138
|
+
}
|
139
|
+
|
140
|
+
preventBackspaceNav()
|
@@ -0,0 +1,7 @@
|
|
1
|
+
(function($) {
|
2
|
+
jQuery.fn.weOffset = function () {
|
3
|
+
var top = $(this).offset().top - (window.scrollY || window.pageYOffset || document.body.scrollTop);
|
4
|
+
var left = $(this).offset().left - (window.scrollX || window.pageXOffset || document.body.scrollLeft);
|
5
|
+
return { top: top, left: left };
|
6
|
+
};
|
7
|
+
}(jQuery));
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#summanyPopup {
|
2
|
+
position: fixed;
|
3
|
+
background-color: #FFF;
|
4
|
+
z-index: 100;
|
5
|
+
border-radius: 5px;
|
6
|
+
width: 200px;
|
7
|
+
padding: 15px;
|
8
|
+
box-shadow: inset 0 4px 7px 1px #fff, inset 0 -5px 20px rgba(173,186,204,.25), 0 2px 6px rgba(0,21,64,.14), 0 10px 20px rgba(0,21,64,.05);
|
9
|
+
top: 30px;
|
10
|
+
}
|
11
|
+
|
12
|
+
#summanyPopup p {
|
13
|
+
margin-bottom: 10px;
|
14
|
+
}
|
15
|
+
|
16
|
+
#summanyPopup p span {
|
17
|
+
float: right;
|
18
|
+
}
|
19
|
+
|
20
|
+
#summanyPopup:after {
|
21
|
+
bottom: 100%;
|
22
|
+
left: 50%;
|
23
|
+
border: solid transparent;
|
24
|
+
content: " ";
|
25
|
+
height: 0;
|
26
|
+
width: 0;
|
27
|
+
position: absolute;
|
28
|
+
pointer-events: none;
|
29
|
+
border-color: rgba(0, 0, 0, 0);
|
30
|
+
border-bottom-color: #FFF;
|
31
|
+
border-width: 10px;
|
32
|
+
margin-left: -10px;
|
33
|
+
}
|
34
|
+
|
35
|
+
#summanyPopup:before {
|
36
|
+
bottom: 101%;
|
37
|
+
left: 50%;
|
38
|
+
border: solid transparent;
|
39
|
+
content: " ";
|
40
|
+
height: 0;
|
41
|
+
width: 0;
|
42
|
+
position: absolute;
|
43
|
+
pointer-events: none;
|
44
|
+
border-color: rgba(0, 0, 0, 0);
|
45
|
+
border-bottom-color: #BBB;
|
46
|
+
border-width: 10px;
|
47
|
+
margin-left: -10px;
|
48
|
+
}
|
@@ -25,6 +25,8 @@
|
|
25
25
|
<a v-on:click="run" v-if="!running" class="btn btn-info" style="vertical-align: top; width: 70px;">Run</a>
|
26
26
|
<a v-on:click="cancel" v-if="running" class="btn btn-danger" style="vertical-align: top; width: 70px;">Cancel</a>
|
27
27
|
</div>
|
28
|
+
<hr>
|
29
|
+
<%= render partial: "tips" %>
|
28
30
|
</div>
|
29
31
|
<div class="col-xs-4">
|
30
32
|
<div class="form-group">
|
@@ -61,8 +63,6 @@
|
|
61
63
|
</div>
|
62
64
|
<% end %>
|
63
65
|
<% end %>
|
64
|
-
<hr>
|
65
|
-
<%= render partial: "tips" %>
|
66
66
|
</div>
|
67
67
|
</div>
|
68
68
|
<% end %>
|
@@ -24,21 +24,6 @@
|
|
24
24
|
<% end %>
|
25
25
|
</p>
|
26
26
|
<% end %>
|
27
|
-
<p class="text-muted" style="margin-bottom: 10px;">
|
28
|
-
<%= pluralize(@rows.size, "row") %>
|
29
|
-
|
30
|
-
<% @checks.select(&:state).each do |check| %>
|
31
|
-
· <small class="check-state <%= check.state.parameterize.gsub("-", "_") %>"><%= link_to check.state.upcase, edit_check_path(check) %></small>
|
32
|
-
<% if check.try(:message) %>
|
33
|
-
· <%= check.message %>
|
34
|
-
<% end %>
|
35
|
-
<% end %>
|
36
|
-
|
37
|
-
<% if @query && @result.forecastable? && !params[:forecast] %>
|
38
|
-
·
|
39
|
-
<%= link_to "Forecast", query_path(@query, {forecast: "t"}.merge(variable_params)) %>
|
40
|
-
<% end %>
|
41
|
-
</p>
|
42
27
|
<% end %>
|
43
28
|
<% if @forecast_error %>
|
44
29
|
<div class="alert alert-danger"><%= @forecast_error %></div>
|
@@ -144,52 +129,74 @@
|
|
144
129
|
<% elsif @columns == ["PLAN"] && @data_source.adapter == "druid" %>
|
145
130
|
<pre><code><%= @rows[0][0] %></code></pre>
|
146
131
|
<% else %>
|
147
|
-
<
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
<
|
161
|
-
|
132
|
+
<p class="text-muted" style="margin-bottom: 10px; margin-top: 15px">
|
133
|
+
<%= pluralize(@rows.size, "row") %>
|
134
|
+
<% @checks.select(&:state).each do |check| %>
|
135
|
+
· <small class="check-state <%= check.state.parameterize.gsub("-", "_") %>"><%= link_to check.state.upcase, edit_check_path(check) %></small>
|
136
|
+
<% if check.try(:message) %>
|
137
|
+
· <%= check.message %>
|
138
|
+
<% end %>
|
139
|
+
<% end %>
|
140
|
+
|
141
|
+
<% if @query && @result.forecastable? && !params[:forecast] %>
|
142
|
+
·
|
143
|
+
<%= link_to "Forecast", query_path(@query, {forecast: "t"}.merge(variable_params)) %>
|
144
|
+
<% end %>
|
145
|
+
<span class='pull-right'>
|
146
|
+
<%- if @rows.size > 0 %>
|
147
|
+
<%= link_to 'Copy to clipboard', '#results-table', class: 'click2CopyTable btn btn-xs btn-info' %>
|
148
|
+
<% end %>
|
149
|
+
</span>
|
150
|
+
</p>
|
151
|
+
<div class='scroll-content'>
|
152
|
+
<table class="table results-table" id='results-table'>
|
153
|
+
<thead>
|
162
154
|
<tr>
|
163
|
-
<%
|
164
|
-
<%
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
155
|
+
<% @columns.each_with_index do |key, i| %>
|
156
|
+
<% type = @column_types[i] %>
|
157
|
+
<% summany_popup = type.in?(['float', 'int']) && !key.end_with?('id') %>
|
158
|
+
<th style="width: <%= header_width %>%;" data-sort="<%= type %>" data-popup=<%= summany_popup %>>
|
159
|
+
<div style="min-width: <%= @min_width_types.include?(i) ? 180 : 60 %>px;">
|
160
|
+
<%= key %>
|
161
|
+
</div>
|
162
|
+
</th>
|
163
|
+
<% end %>
|
164
|
+
</tr>
|
165
|
+
</thead>
|
166
|
+
<tbody>
|
167
|
+
<% @rows.each do |row| %>
|
168
|
+
<tr>
|
169
|
+
<% row.each_with_index do |v, i| %>
|
170
|
+
<% k = @columns[i] %>
|
171
|
+
<td>
|
172
|
+
<% if v.is_a?(Time) %>
|
173
|
+
<% v = blazer_time_value(@data_source, k, v) %>
|
174
|
+
<% end %>
|
169
175
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
176
|
+
<% unless v.nil? %>
|
177
|
+
<% if v.is_a?(String) && v == "" %>
|
178
|
+
<div class="text-muted">empty string</div>
|
179
|
+
<% elsif @linked_columns[k] %>
|
180
|
+
<%= link_to blazer_format_value(k, v), @linked_columns[k].gsub("{value}", u(v.to_s)), target: "_blank" %>
|
181
|
+
<% else %>
|
182
|
+
<%= blazer_format_value(k, v) %>
|
183
|
+
<% end %>
|
177
184
|
<% end %>
|
178
|
-
<% end %>
|
179
185
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
186
|
+
<% if v2 = (@boom[k] || {})[v.nil? ? v : v.to_s] %>
|
187
|
+
<div class="text-muted"><%= v2 %></div>
|
188
|
+
<% end %>
|
189
|
+
</td>
|
190
|
+
<% end %>
|
191
|
+
</tr>
|
192
|
+
<% end %>
|
193
|
+
</tbody>
|
194
|
+
</table>
|
195
|
+
</div>
|
189
196
|
<% end %>
|
190
197
|
</div>
|
191
198
|
<% end %>
|
192
|
-
<%
|
193
|
-
<p class="text-muted">No rows</p>
|
199
|
+
<% else %>
|
200
|
+
<p class="text-muted text-center" style='margin-top: 15px'>No rows</p>
|
194
201
|
<% end %>
|
195
202
|
<% end %>
|
@@ -49,12 +49,14 @@
|
|
49
49
|
|
50
50
|
<script>
|
51
51
|
function showRun(data) {
|
52
|
-
$("#results").html(data)
|
53
|
-
$("#results table").stupidtable().stickyTableHeaders({
|
52
|
+
$("#results").html(data);
|
53
|
+
$("#results table").stupidtable().stickyTableHeaders({
|
54
|
+
fixedOffset: 60,
|
55
|
+
});
|
54
56
|
}
|
55
57
|
|
56
58
|
function showError(message) {
|
57
|
-
$("#results").addClass("query-error").html(message)
|
59
|
+
$("#results").addClass("query-error").html(message);
|
58
60
|
}
|
59
61
|
|
60
62
|
<%= blazer_js_var "data", variable_params.merge(statement: @statement, query_id: @query.id, data_source: @query.data_source) %>
|
data/lib/blazer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sql-jarvis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -170,8 +170,10 @@ files:
|
|
170
170
|
- app/assets/javascripts/blazer/jquery-ujs.js
|
171
171
|
- app/assets/javascripts/blazer/jquery.js
|
172
172
|
- app/assets/javascripts/blazer/jquery.stickytableheaders.js
|
173
|
+
- app/assets/javascripts/blazer/main.js
|
173
174
|
- app/assets/javascripts/blazer/moment-timezone-with-data.js
|
174
175
|
- app/assets/javascripts/blazer/moment.js
|
176
|
+
- app/assets/javascripts/blazer/position.js
|
175
177
|
- app/assets/javascripts/blazer/queries.js
|
176
178
|
- app/assets/javascripts/blazer/routes.js
|
177
179
|
- app/assets/javascripts/blazer/select2.js
|
@@ -182,6 +184,7 @@ files:
|
|
182
184
|
- app/assets/stylesheets/blazer/bootstrap.css.erb
|
183
185
|
- app/assets/stylesheets/blazer/daterangepicker.css
|
184
186
|
- app/assets/stylesheets/blazer/github.css
|
187
|
+
- app/assets/stylesheets/blazer/main.css
|
185
188
|
- app/assets/stylesheets/blazer/select2.min.css
|
186
189
|
- app/assets/stylesheets/blazer/selectize.default.css
|
187
190
|
- app/controllers/blazer/base_controller.rb
|
@@ -264,8 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
264
267
|
- !ruby/object:Gem::Version
|
265
268
|
version: '0'
|
266
269
|
requirements: []
|
267
|
-
|
268
|
-
rubygems_version: 2.7.7
|
270
|
+
rubygems_version: 3.0.3
|
269
271
|
signing_key:
|
270
272
|
specification_version: 4
|
271
273
|
summary: Fork from ankane! Explore your data with SQL. Easily create charts and dashboards,
|