sql-jarvis 1.9.6 → 1.9.7
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.
- checksums.yaml +5 -5
- data/app/assets/javascripts/blazer/application.js +0 -1
- data/app/assets/javascripts/blazer/routes.js +3 -0
- data/app/controllers/blazer/queries_controller.rb +25 -1
- data/app/views/blazer/queries/_form.html.erb +63 -6
- data/config/routes.rb +1 -0
- data/lib/blazer/engine.rb +0 -8
- data/lib/blazer/version.rb +1 -1
- data/sql-jarvis-1.9.6.gem +0 -0
- metadata +4 -5
- data/sql-jarvis-1.9.4.gem +0 -0
- data/sql-jarvis-1.9.5.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d7b78dfb371370a6d7279bdc520f586298e7702fa3b58c5039f55dc03ad08138
|
4
|
+
data.tar.gz: 6f414f547cb3d5fcbb64f40b72d9c3d186c8f167d1ff078413995d5f4498bb34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a059f544d8eb06549069fd9c728b39414cabe2061afdbc33e902ef07064bfbfa0df7094165313ecb8247790f66c5a5a564ba7bdf95f81a77d1290507464b7219
|
7
|
+
data.tar.gz: 624ec5b9428319f1b3b72eef61fccd7ef401f78fb63bd25762a80dc5d649a54e936d6755255d36b0248aed2b8c6861d3296e9e6f8ecf519ab0c4fa6904219f1e
|
@@ -11,6 +11,9 @@ var Routes = {
|
|
11
11
|
tables_queries_path: function(params) {
|
12
12
|
return rootPath + "queries/tables?" + $.param(params)
|
13
13
|
},
|
14
|
+
columns_queries_path: function(params) {
|
15
|
+
return rootPath + "queries/columns?" + $.param(params)
|
16
|
+
},
|
14
17
|
queries_path: function() {
|
15
18
|
return rootPath + "queries"
|
16
19
|
},
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module Blazer
|
2
2
|
class QueriesController < BaseController
|
3
3
|
before_action :set_query, only: [:show, :edit, :update, :destroy, :refresh]
|
4
|
-
before_action :set_data_source, only: [:tables, :schema, :cancel]
|
4
|
+
before_action :set_data_source, only: [:tables, :schema, :cancel, :columns]
|
5
|
+
before_action :set_assignees, only: [:new, :create, :show, :edit, :update, :destroy, :refresh]
|
5
6
|
|
6
7
|
def home
|
7
8
|
if params[:filter] == "dashboards"
|
@@ -183,6 +184,16 @@ module Blazer
|
|
183
184
|
render json: @data_source.tables
|
184
185
|
end
|
185
186
|
|
187
|
+
def columns
|
188
|
+
column_names = []
|
189
|
+
@data_source.schema.map do |t|
|
190
|
+
if params[:tables].include?(t[:table])
|
191
|
+
column_names += t[:columns].map { |c| c[:name] }
|
192
|
+
end
|
193
|
+
end
|
194
|
+
render json: column_names
|
195
|
+
end
|
196
|
+
|
186
197
|
def schema
|
187
198
|
@schema = @data_source.schema
|
188
199
|
end
|
@@ -306,6 +317,19 @@ module Blazer
|
|
306
317
|
end
|
307
318
|
end
|
308
319
|
|
320
|
+
def set_assignees
|
321
|
+
if Blazer.settings.key?('assignees')
|
322
|
+
source = params[:data_source] || 'main'
|
323
|
+
data_source = Blazer.data_sources[source]
|
324
|
+
statement = Blazer.settings['assignees']
|
325
|
+
@assignees = Rails.cache.fetch 'jarvis_assignees' do
|
326
|
+
(Blazer::RunStatement.new.perform(data_source, statement, {}).rows rescue [])
|
327
|
+
end
|
328
|
+
else
|
329
|
+
@assignees = []
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
309
333
|
def render_forbidden
|
310
334
|
render plain: "Access denied", status: :forbidden
|
311
335
|
end
|
@@ -34,10 +34,10 @@
|
|
34
34
|
<%= f.label :description %>
|
35
35
|
<%= f.text_area :description, placeholder: "Optional", style: "height: 80px;", class: "form-control" %>
|
36
36
|
</div>
|
37
|
-
<%- if
|
37
|
+
<%- if @assignees.any? -%>
|
38
38
|
<div class="form-group">
|
39
39
|
<%= f.label :assignees %>
|
40
|
-
<%= f.collection_select :assignee_ids,
|
40
|
+
<%= f.collection_select :assignee_ids, @assignees, :first, :last, {}, { placeholder: "Assignees", style: "height: 80px;", class: "form-control", multiple: true } %>
|
41
41
|
</div>
|
42
42
|
<%- end -%>
|
43
43
|
<div class="text-right">
|
@@ -147,12 +147,12 @@
|
|
147
147
|
editor.setTheme("ace/theme/twilight")
|
148
148
|
editor.getSession().setMode("ace/mode/sql")
|
149
149
|
editor.setOptions({
|
150
|
-
|
150
|
+
fontSize: 12,
|
151
|
+
minLines: 10,
|
151
152
|
enableSnippets: false,
|
152
|
-
enableLiveAutocompletion: false,
|
153
153
|
highlightActiveLine: false,
|
154
|
-
|
155
|
-
|
154
|
+
enableLiveAutocompletion: true,
|
155
|
+
enableBasicAutocompletion: true
|
156
156
|
})
|
157
157
|
editor.renderer.setShowGutter(true)
|
158
158
|
editor.renderer.setPrintMarginColumn(false)
|
@@ -169,6 +169,62 @@
|
|
169
169
|
// fix command+L
|
170
170
|
editor.commands.removeCommands(["gotoline", "find"])
|
171
171
|
|
172
|
+
var langTools = ace.require("ace/ext/language_tools");
|
173
|
+
|
174
|
+
var addSuggestItems = function(callback) {
|
175
|
+
if (window.tableNames === undefined) return;
|
176
|
+
callback(null, window.tableNames.map(function(table) {
|
177
|
+
return { name: table, value: table, score: 100, meta: "table" };
|
178
|
+
}));
|
179
|
+
}
|
180
|
+
|
181
|
+
// Load tables
|
182
|
+
langTools.addCompleter({
|
183
|
+
getCompletions: function(editor, session, pos, prefix, callback) {
|
184
|
+
if (prefix.length === 0) { callback(null, []); return }
|
185
|
+
if (window.tableNames !== undefined) {
|
186
|
+
addSuggestItems(callback);
|
187
|
+
} else {
|
188
|
+
$.getJSON(
|
189
|
+
Routes.tables_queries_path({data_source: this.dataSource})
|
190
|
+
, function(tables) {
|
191
|
+
window.tableNames = tables;
|
192
|
+
// wordList like [{"word":"flow","freq":24,"score":300,"flags":"bc","syllables":"1"}]
|
193
|
+
addSuggestItems(callback);
|
194
|
+
}
|
195
|
+
)
|
196
|
+
}
|
197
|
+
}
|
198
|
+
});
|
199
|
+
|
200
|
+
// Load columns
|
201
|
+
langTools.addCompleter({
|
202
|
+
getCompletions: function(editor, session, pos, prefix, callback) {
|
203
|
+
if (prefix.length === 0) { callback(null, []); return }
|
204
|
+
var sql = $('#query_statement').val();
|
205
|
+
tables = sql.toLowerCase().match(/(join|from) ([a-z_]{2,50})/g);
|
206
|
+
if (tables === null) { callback(null, []); return }
|
207
|
+
tables = tables.map(function(table) { return table.split(' ')[1] });
|
208
|
+
key = tables.join('-');
|
209
|
+
if (window[key]) {
|
210
|
+
callback(null, window[key].map(function(col) {
|
211
|
+
return { name: col, value: col, score: 100, meta: "column" };
|
212
|
+
}));
|
213
|
+
} else {
|
214
|
+
$.getJSON(
|
215
|
+
Routes.columns_queries_path({data_source: this.dataSource, tables: tables})
|
216
|
+
, function(columns) {
|
217
|
+
window[key] = Array.from(new Set(columns));
|
218
|
+
// wordList like [{"word":"flow","freq":24,"score":300,"flags":"bc","syllables":"1"}]
|
219
|
+
callback(null, window[key].map(function(col) {
|
220
|
+
return { name: col, value: col, score: 100, meta: "column" };
|
221
|
+
}));
|
222
|
+
}
|
223
|
+
)
|
224
|
+
}
|
225
|
+
}
|
226
|
+
});
|
227
|
+
|
172
228
|
this.editor = editor
|
173
229
|
|
174
230
|
editor.getSession().on("change", function () {
|
@@ -247,4 +303,5 @@
|
|
247
303
|
$(document).ready(function() {
|
248
304
|
$('#query_assignee_ids').select2();
|
249
305
|
});
|
306
|
+
|
250
307
|
</script>
|
data/config/routes.rb
CHANGED
data/lib/blazer/engine.rb
CHANGED
@@ -20,14 +20,6 @@ module Blazer
|
|
20
20
|
Blazer.mapbox_access_token = ENV["MAPBOX_ACCESS_TOKEN"]
|
21
21
|
end
|
22
22
|
|
23
|
-
if Blazer.settings.key?('assignees')
|
24
|
-
data_source = Blazer.data_sources['main']
|
25
|
-
statement = Blazer.settings['assignees']
|
26
|
-
Blazer.assignees = (Blazer::RunStatement.new.perform(data_source, statement, {}).rows rescue [])
|
27
|
-
else
|
28
|
-
Blazer.assignees = []
|
29
|
-
end
|
30
|
-
|
31
23
|
if Blazer.user_class
|
32
24
|
options = Blazer::BELONGS_TO_OPTIONAL.merge(class_name: Blazer.user_class.to_s)
|
33
25
|
Blazer::Query.belongs_to :creator, options
|
data/lib/blazer/version.rb
CHANGED
Binary file
|
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: 1.9.
|
4
|
+
version: 1.9.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ThanhKhoaIT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -205,8 +205,7 @@ files:
|
|
205
205
|
- lib/generators/blazer/templates/config.yml.tt
|
206
206
|
- lib/generators/blazer/templates/install.rb.tt
|
207
207
|
- lib/tasks/blazer.rake
|
208
|
-
- sql-jarvis-1.9.
|
209
|
-
- sql-jarvis-1.9.5.gem
|
208
|
+
- sql-jarvis-1.9.6.gem
|
210
209
|
homepage: https://github.com/ThanhKhoaIT/blazer
|
211
210
|
licenses:
|
212
211
|
- MIT
|
@@ -227,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
227
226
|
version: '0'
|
228
227
|
requirements: []
|
229
228
|
rubyforge_project:
|
230
|
-
rubygems_version: 2.
|
229
|
+
rubygems_version: 2.7.7
|
231
230
|
signing_key:
|
232
231
|
specification_version: 4
|
233
232
|
summary: Fork from ankane! Explore your data with SQL. Easily create charts and dashboards,
|
data/sql-jarvis-1.9.4.gem
DELETED
Binary file
|
data/sql-jarvis-1.9.5.gem
DELETED
Binary file
|