adhoq 0.5.0.beta1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/assets/javascripts/adhoq/application.js +0 -1
- data/app/assets/javascripts/adhoq/previewer.js.coffee +0 -8
- data/app/controllers/adhoq/current_tables_controller.rb +1 -22
- data/app/views/adhoq/queries/_current_tables_leftbar.html.slim +1 -1
- data/app/views/adhoq/queries/_form.html.slim +2 -30
- data/lib/adhoq/engine.rb +1 -2
- data/lib/adhoq/version.rb +1 -1
- data/spec/factories/adhoq_queries.rb +9 -9
- data/spec/spec_helper.rb +0 -1
- metadata +14 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d2c0991686730b39d0fbd3c2e9c7f1bda40fb411c901411fd33191c418e15e5a
|
4
|
+
data.tar.gz: 07061445eb7816acd45def397ed4484c3cece656b888a098af3afdf013f0bfd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0014df0080634eb3d843bc89bf676b7536553830bc49be0bd039ff7e9e8e1cb6cf381ffc2b0e213c5be1cdc906a6b73519b4cbdc99b4353411318fddd95a4719
|
7
|
+
data.tar.gz: 62bbafd14f915ce22af6235864a36220137024446440a18e22d077eeab888ef4f18dc6a503c8cb4b1600b9811c3ed80b7ed421019f04e5296d2d5e910567147f
|
@@ -18,14 +18,6 @@ class Previewer
|
|
18
18
|
)
|
19
19
|
|
20
20
|
source: ->
|
21
|
-
# NOTE: Sometimes the textarea is empty even if the monaco editor has some contents.
|
22
|
-
# That's why the editor source is preferred.
|
23
|
-
@editorSource() || @domSource()
|
24
|
-
|
25
|
-
editorSource: ->
|
26
|
-
Adhoq.editor && Adhoq.editor.getValue()
|
27
|
-
|
28
|
-
domSource: ->
|
29
21
|
$(@el.data('source')).val()
|
30
22
|
|
31
23
|
result: ->
|
@@ -11,32 +11,11 @@ module Adhoq
|
|
11
11
|
reject {|klass| klass.abstract_class? || hidden_model_names.include?(klass.name) || klass.name.nil? }.
|
12
12
|
sort_by(&:name)
|
13
13
|
|
14
|
-
|
15
|
-
format.html { render layout: false }
|
16
|
-
format.json { render json: tables_as_json(@ar_classes) }
|
17
|
-
end
|
14
|
+
render layout: false
|
18
15
|
end
|
19
16
|
|
20
17
|
private
|
21
18
|
|
22
|
-
def tables_as_json(ar_classes)
|
23
|
-
ar_classes.map {|ar_class|
|
24
|
-
{
|
25
|
-
table_name: ar_class.table_name,
|
26
|
-
columns: ar_class.columns.map {|column|
|
27
|
-
{
|
28
|
-
name: column.name,
|
29
|
-
type: column.type,
|
30
|
-
primary_key: column.name == ar_class.primary_key,
|
31
|
-
null: column.null,
|
32
|
-
limit: column.limit,
|
33
|
-
default: column.default
|
34
|
-
}
|
35
|
-
}
|
36
|
-
}
|
37
|
-
}
|
38
|
-
end
|
39
|
-
|
40
19
|
def eager_load_models
|
41
20
|
return unless Rails.env.development?
|
42
21
|
[Rails.application, Adhoq::Engine].each(&:eager_load!)
|
@@ -7,20 +7,8 @@
|
|
7
7
|
i.fa.fa-database.fa-pad-r
|
8
8
|
| Show tables
|
9
9
|
|
10
|
-
.clearfix
|
11
|
-
a#disable_code_editor.pull-right(href='#')
|
12
|
-
i.fa.fa-edit
|
13
|
-
| Switch to Plain Editor
|
14
|
-
|
15
10
|
.form-group
|
16
|
-
.form-control
|
17
|
-
#query_field(
|
18
|
-
data-current-tables-path="#{current_tables_path}"
|
19
|
-
data-id="query_query"
|
20
|
-
data-name="query[query]"
|
21
|
-
data-placeholder="#{@query.persisted? ? 'Edit' : 'New'} query"
|
22
|
-
data-query="#{@query.query}"
|
23
|
-
)
|
11
|
+
= f.text_area :query, class: 'form-control', rows: 15, required: true
|
24
12
|
|
25
13
|
.modal.fade#nameAndDesc[role='dialog']
|
26
14
|
.modal-dialog
|
@@ -97,25 +85,9 @@ ul.nav.nav-tabs[role='tablist']
|
|
97
85
|
|
98
86
|
javascript:
|
99
87
|
$(function() {
|
100
|
-
var element = document.getElementById('query_field');
|
101
|
-
|
102
|
-
Adhoq.editor = Adhoq.launchEditor(element);
|
103
|
-
Adhoq.installCompletion(element.dataset.currentTablesPath);
|
104
|
-
|
105
|
-
$('#disable_code_editor').on('click', function(e) {
|
106
|
-
e.preventDefault();
|
107
|
-
|
108
|
-
Adhoq.switchToTextareaEditor({
|
109
|
-
editor: Adhoq.editor,
|
110
|
-
element: element.parentNode,
|
111
|
-
content: Adhoq.editor.getModel().getValue()
|
112
|
-
});
|
113
|
-
|
114
|
-
e.target.remove();
|
115
|
-
});
|
116
|
-
|
117
88
|
Adhoq.enablePreview($('#preview a.js-preview-button'));
|
118
89
|
Adhoq.enablePreview($('#explain a.js-explain-button'));
|
119
90
|
|
120
91
|
Adhoq.enablePreviewKeybordShortCut($('#query_query'), '#previews .tab-pane.active a:has(".fa-refresh")')
|
121
92
|
});
|
93
|
+
|
data/lib/adhoq/engine.rb
CHANGED
@@ -3,6 +3,7 @@ require 'font-awesome-sass'
|
|
3
3
|
require 'jquery-rails'
|
4
4
|
require 'slim-rails'
|
5
5
|
require 'active_decorator'
|
6
|
+
require 'sassc-rails'
|
6
7
|
|
7
8
|
module Adhoq
|
8
9
|
class Engine < ::Rails::Engine
|
@@ -12,7 +13,5 @@ module Adhoq
|
|
12
13
|
g.test_framework :rspec, fixture: false
|
13
14
|
g.fixture_replacement :factory_girl, dir: 'spec/factories'
|
14
15
|
end
|
15
|
-
|
16
|
-
config.assets.paths << "#{__dir__}/../../query_editor/dist"
|
17
16
|
end
|
18
17
|
end
|
data/lib/adhoq/version.rb
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
FactoryBot.define do
|
4
4
|
factory :adhoq_query, class: 'Adhoq::Query' do
|
5
|
-
name 'A query'
|
6
|
-
description 'Simple simple SELECT'
|
7
|
-
query 'SELECT 1'
|
5
|
+
name { 'A query' }
|
6
|
+
description { 'Simple simple SELECT' }
|
7
|
+
query { 'SELECT 1' }
|
8
8
|
|
9
9
|
trait :complex do
|
10
|
-
name 'adhoq current use'
|
11
|
-
description 'Simple analysys: count execution per query'
|
12
|
-
query <<-SQL.strip_heredoc
|
10
|
+
name { 'adhoq current use' }
|
11
|
+
description { 'Simple analysys: count execution per query' }
|
12
|
+
query { <<-SQL.strip_heredoc }
|
13
13
|
SELECT
|
14
14
|
q.id
|
15
15
|
,q.name
|
@@ -27,9 +27,9 @@ FactoryBot.define do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
trait :greeting do
|
30
|
-
name 'greeting'
|
31
|
-
description 'Static query for testing data'
|
32
|
-
query 'SELECT "hello" AS name ,"English greeting message" AS description'
|
30
|
+
name { 'greeting' }
|
31
|
+
description { 'Static query for testing data' }
|
32
|
+
query { 'SELECT "hello" AS name ,"English greeting message" AS description' }
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -13,7 +13,6 @@ Rails.backtrace_cleaner.remove_silencers!
|
|
13
13
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f }
|
14
14
|
|
15
15
|
Capybara.default_driver = :poltergeist
|
16
|
-
Capybara.default_wait_time = 30
|
17
16
|
|
18
17
|
RSpec.configure do |config|
|
19
18
|
config.expect_with :rspec do |expectations|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adhoq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.0
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyosuke MOROHASHI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: font-awesome-sass
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 4.2
|
89
|
+
version: '4.2'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 4.2
|
96
|
+
version: '4.2'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: jquery-rails
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: sassc-rails
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
@@ -280,16 +280,16 @@ dependencies:
|
|
280
280
|
name: sqlite3
|
281
281
|
requirement: !ruby/object:Gem::Requirement
|
282
282
|
requirements:
|
283
|
-
- - "
|
283
|
+
- - "~>"
|
284
284
|
- !ruby/object:Gem::Version
|
285
|
-
version:
|
285
|
+
version: 1.3.6
|
286
286
|
type: :development
|
287
287
|
prerelease: false
|
288
288
|
version_requirements: !ruby/object:Gem::Requirement
|
289
289
|
requirements:
|
290
|
-
- - "
|
290
|
+
- - "~>"
|
291
291
|
- !ruby/object:Gem::Version
|
292
|
-
version:
|
292
|
+
version: 1.3.6
|
293
293
|
- !ruby/object:Gem::Dependency
|
294
294
|
name: tapp
|
295
295
|
requirement: !ruby/object:Gem::Requirement
|
@@ -493,12 +493,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
493
493
|
version: '0'
|
494
494
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
495
495
|
requirements:
|
496
|
-
- - "
|
496
|
+
- - ">="
|
497
497
|
- !ruby/object:Gem::Version
|
498
|
-
version:
|
498
|
+
version: '0'
|
499
499
|
requirements: []
|
500
|
-
|
501
|
-
rubygems_version: 2.5.2.2
|
500
|
+
rubygems_version: 3.0.1
|
502
501
|
signing_key:
|
503
502
|
specification_version: 4
|
504
503
|
summary: DB management console in the wild.
|