adhoq 0.4.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +1 -1
- data/app/assets/javascripts/adhoq/current_tables.js +23 -0
- data/app/assets/javascripts/adhoq/previewer.js +52 -0
- data/app/controllers/adhoq/queries_controller.rb +1 -1
- data/app/helpers/adhoq/application_helper.rb +1 -1
- data/app/models/adhoq/execution.rb +2 -2
- data/app/models/adhoq/time_based_orders.rb +1 -1
- data/app/views/adhoq/application/_global_nav.html.erb +18 -0
- data/app/views/adhoq/current_tables/index.html.erb +53 -0
- data/app/views/adhoq/explains/create.html.erb +1 -0
- data/app/views/adhoq/explains/statement_invalid.html.erb +5 -0
- data/app/views/adhoq/previews/create.html.erb +21 -0
- data/app/views/adhoq/previews/statement_invalid.html.erb +4 -0
- data/app/views/adhoq/queries/_current_tables_leftbar.html.erb +14 -0
- data/app/views/adhoq/queries/_execution.html.erb +10 -0
- data/app/views/adhoq/queries/_form.html.erb +124 -0
- data/app/views/adhoq/queries/_queries.html.erb +16 -0
- data/app/views/adhoq/queries/_query.html.erb +67 -0
- data/app/views/adhoq/queries/edit.html.erb +13 -0
- data/app/views/adhoq/queries/index.html.erb +15 -0
- data/app/views/adhoq/queries/new.html.erb +12 -0
- data/app/views/adhoq/queries/show.html.erb +14 -0
- data/app/views/layouts/adhoq/application.html.erb +18 -0
- data/config/database.yml +25 -0
- data/lib/adhoq/engine.rb +1 -1
- data/lib/adhoq/version.rb +1 -1
- data/spec/factories/adhoq_queries.rb +9 -9
- metadata +40 -68
- data/app/assets/javascripts/adhoq/current_tables.js.coffee +0 -18
- data/app/assets/javascripts/adhoq/previewer.js.coffee +0 -34
- data/app/views/adhoq/application/_global_nav.html.slim +0 -12
- data/app/views/adhoq/current_tables/index.html.slim +0 -35
- data/app/views/adhoq/explains/create.html.slim +0 -2
- data/app/views/adhoq/explains/statement_invalid.html.slim +0 -5
- data/app/views/adhoq/previews/create.html.slim +0 -12
- data/app/views/adhoq/previews/statement_invalid.html.slim +0 -5
- data/app/views/adhoq/queries/_current_tables_leftbar.html.slim +0 -9
- data/app/views/adhoq/queries/_execution.html.slim +0 -10
- data/app/views/adhoq/queries/_form.html.slim +0 -93
- data/app/views/adhoq/queries/_queries.html.slim +0 -14
- data/app/views/adhoq/queries/_query.html.slim +0 -48
- data/app/views/adhoq/queries/edit.html.slim +0 -11
- data/app/views/adhoq/queries/index.html.slim +0 -11
- data/app/views/adhoq/queries/new.html.slim +0 -10
- data/app/views/adhoq/queries/show.html.slim +0 -11
- data/app/views/layouts/adhoq/application.html.slim +0 -15
@@ -1,35 +0,0 @@
|
|
1
|
-
h3
|
2
|
-
i.fa.fa-database.fa-pad-r
|
3
|
-
| Current tables
|
4
|
-
small= "Version #{schema_version}"
|
5
|
-
.pull-right
|
6
|
-
button.close[data-trigger="toggleCurrentTables" role='close']
|
7
|
-
span[aria-hidden=true] ×
|
8
|
-
|
9
|
-
ul.list-unstyled.tables
|
10
|
-
- @ar_classes.each do |ar_class|
|
11
|
-
- first_record = ar_class.unscoped.order(table_order_key(ar_class)).first
|
12
|
-
|
13
|
-
li.ar_class data-table-name=ar_class.table_name
|
14
|
-
table.table.table-striped.table-hover.table-bordered
|
15
|
-
caption
|
16
|
-
span.name= ar_class.table_name
|
17
|
-
- unless Adhoq.config.hide_rows_count
|
18
|
-
small.count #{ar_class.unscoped.count} rows
|
19
|
-
thead
|
20
|
-
tr
|
21
|
-
th.col-sm-1.pk PK
|
22
|
-
th.col-sm-3.name Name
|
23
|
-
th.col-sm-2.type Type
|
24
|
-
th.col-sm-1.null Non-Null
|
25
|
-
th.col-sm-2.limit Limit
|
26
|
-
th.col-sm-3.default Default
|
27
|
-
tbody
|
28
|
-
- ar_class.columns.each do |column|
|
29
|
-
tr
|
30
|
-
td.pk.icon= column.name == ar_class.primary_key ? icon_fa('check-circle') : ''
|
31
|
-
td.monospace= column.name
|
32
|
-
td= column.type
|
33
|
-
td.null.icon= column.null ? '' : icon_fa('check')
|
34
|
-
td.limit.number= column.limit
|
35
|
-
td= column.default
|
@@ -1,9 +0,0 @@
|
|
1
|
-
#current-tables
|
2
|
-
a.loading[href=current_tables_path]
|
3
|
-
|
4
|
-
javascript:
|
5
|
-
$(function() {
|
6
|
-
$(document).on('click', '[data-trigger="toggleCurrentTables"]', function($ev) {
|
7
|
-
Adhoq.toggleCurrentTables($($ev.target).attr('role'), {main: '#main', tables: '#current-tables'});
|
8
|
-
})
|
9
|
-
});
|
@@ -1,10 +0,0 @@
|
|
1
|
-
tr[exec]
|
2
|
-
td.wip
|
3
|
-
td.created_at= exec.created_at.localtime.iso8601
|
4
|
-
td.status
|
5
|
-
= exec.status_label
|
6
|
-
td.report
|
7
|
-
- if exec.success?
|
8
|
-
= link_to(query_execution_path(query, exec, format: exec.report_format), class: 'btn btn-sm btn-default') do
|
9
|
-
i.fa.fa-download.fa-pad-r
|
10
|
-
= exec.report_format
|
@@ -1,93 +0,0 @@
|
|
1
|
-
= form_for query, html: {class: 'form query-form', role: 'form'} do |f|
|
2
|
-
.page-header
|
3
|
-
h1
|
4
|
-
= f.label :query, title, class: 'control-label'
|
5
|
-
.pull-right
|
6
|
-
a.btn.btn-default.btn-sm[href='#' data-trigger='toggleCurrentTables' role='show']
|
7
|
-
i.fa.fa-database.fa-pad-r
|
8
|
-
| Show tables
|
9
|
-
|
10
|
-
.form-group
|
11
|
-
= f.text_area :query, class: 'form-control', rows: 15, required: true
|
12
|
-
|
13
|
-
.modal.fade#nameAndDesc[role='dialog']
|
14
|
-
.modal-dialog
|
15
|
-
.modal-content
|
16
|
-
.modal-header
|
17
|
-
button.close[data-dismiss='modal' aria-label='Close']
|
18
|
-
button.close[type='button' data-dismiss='modal' aria-label='Close']
|
19
|
-
span[aria-hidden='true'] ×
|
20
|
-
|
21
|
-
h4 Add name and description to query
|
22
|
-
.modal-body
|
23
|
-
.form-horizontal
|
24
|
-
.form-group
|
25
|
-
= f.label :name, class: 'control-label col-sm-2'
|
26
|
-
.col-sm-8
|
27
|
-
= f.text_field :name, class: 'form-control', required: true
|
28
|
-
|
29
|
-
.form-group
|
30
|
-
= f.label :description, class: 'control-label col-sm-2'
|
31
|
-
.col-sm-8
|
32
|
-
= f.text_area :description, class: 'form-control', required: true
|
33
|
-
.modal-footer
|
34
|
-
button.btn.btn-primary.center-block
|
35
|
-
i.fa.fa-floppy-o.fa-pad-r
|
36
|
-
| Save
|
37
|
-
|
38
|
-
.actions
|
39
|
-
- if query.persisted?
|
40
|
-
= link_to query do
|
41
|
-
i.fa.fa-arrow-left.fa-pad-r
|
42
|
-
| Cancel
|
43
|
-
- else
|
44
|
-
= link_to :queries do
|
45
|
-
i.fa.fa-arrow-left.fa-pad-r
|
46
|
-
| Back to Index
|
47
|
-
|
48
|
-
.pull-right
|
49
|
-
= link_to '#nameAndDesc', class: 'btn btn-default btn-sm', data: {toggle: 'modal', target: '#nameAndDesc'} do
|
50
|
-
i.fa.fa-floppy-o.fa-pad-r
|
51
|
-
| Save as...
|
52
|
-
|
53
|
-
ul.nav.nav-tabs[role='tablist']
|
54
|
-
li.active
|
55
|
-
a[role='tab' data-toggle='tab' href='#preview' ]
|
56
|
-
i.fa.fa-eye.fa-pad-r
|
57
|
-
| Preview
|
58
|
-
li
|
59
|
-
a[role='tab' data-toggle='tab' href='#explain' ]
|
60
|
-
i.fa.fa-info.fa-pad-r
|
61
|
-
| Explain
|
62
|
-
|
63
|
-
#previews.tab-content
|
64
|
-
#preview.tab-pane.active
|
65
|
-
h3
|
66
|
-
| Query preview
|
67
|
-
small
|
68
|
-
= link_to preview_path, class: 'js-preview-button', data: {source: '#query_query', result: '.js-preview-result', remote: true, method: 'POST'} do
|
69
|
-
i.fa.fa-refresh.fa-pad-r[data-title='Refresh preview']
|
70
|
-
| Refresh
|
71
|
-
|
72
|
-
.js-preview-result
|
73
|
-
.alert.alert-info Preview is shown here
|
74
|
-
|
75
|
-
#explain.tab-pane
|
76
|
-
h3
|
77
|
-
| Query explain
|
78
|
-
small
|
79
|
-
= link_to explain_path, class: 'js-explain-button', data: {source: '#query_query', result: '.js-explain-result', remote: true, method: 'POST'} do
|
80
|
-
i.fa.fa-refresh.fa-pad-r[data-title='Refresh explain']
|
81
|
-
| Refresh
|
82
|
-
|
83
|
-
.js-explain-result
|
84
|
-
.alert.alert-info Explain result is shown here
|
85
|
-
|
86
|
-
javascript:
|
87
|
-
$(function() {
|
88
|
-
Adhoq.enablePreview($('#preview a.js-preview-button'));
|
89
|
-
Adhoq.enablePreview($('#explain a.js-explain-button'));
|
90
|
-
|
91
|
-
Adhoq.enablePreviewKeybordShortCut($('#query_query'), '#previews .tab-pane.active a:has(".fa-refresh")')
|
92
|
-
});
|
93
|
-
|
@@ -1,14 +0,0 @@
|
|
1
|
-
- highlight ||= nil
|
2
|
-
section
|
3
|
-
= link_to :root, class: 'btn btn-default new-query btn-sm center-block' do
|
4
|
-
i.fa.fa-plus-square.fa-pad-r
|
5
|
-
| New query
|
6
|
-
|
7
|
-
ol.queries-index.list-unstyled
|
8
|
-
- queries.each do |query|
|
9
|
-
- css = (query == highlight) ? 'panel-success' : 'panel-default'
|
10
|
-
li.panel[query, class= css]
|
11
|
-
.panel-heading
|
12
|
-
h2= link_to query.name, query_path(query)
|
13
|
-
p.panel-body.description= query.description
|
14
|
-
|
@@ -1,48 +0,0 @@
|
|
1
|
-
section.query
|
2
|
-
.page-header
|
3
|
-
h1
|
4
|
-
= query.name
|
5
|
-
.pull-right
|
6
|
-
= link_to [:edit, query], class: 'btn btn-default btn-sm' do
|
7
|
-
i.fa.fa-pencil.fa-pad-r
|
8
|
-
| Edit
|
9
|
-
.pull-right
|
10
|
-
= link_to 'Delete', query, class: 'btn btn-default btn-sm', :method => :delete, data: { confirm: 'Are you sure?' }
|
11
|
-
.clearfix
|
12
|
-
small= "Updated at #{l(query.updated_at, format: :short)}"
|
13
|
-
p.description= query.description
|
14
|
-
|
15
|
-
css:
|
16
|
-
#{Rouge::Themes::Github.render(scope: '.highlight')}
|
17
|
-
|
18
|
-
= raw query.query_with_highlight
|
19
|
-
|
20
|
-
section.new-execution
|
21
|
-
h2 Create report
|
22
|
-
= form_for [query, query.executions.build], html: {role: 'form'} do |f|
|
23
|
-
.form-inline.form-group.report_format
|
24
|
-
= f.label :report_format
|
25
|
-
= f.select :report_format, f.object.supported_formats, {}, class: 'form-control'
|
26
|
-
- if query.parameters.present?
|
27
|
-
h4 Query parameters
|
28
|
-
.form-group.query_parameters
|
29
|
-
- query.parameters.each do |param_name|
|
30
|
-
.form-inline.query_parameter
|
31
|
-
= label_tag "parameters_#{param_name}", "#{param_name}"
|
32
|
-
= query_parameter_field(param_name)
|
33
|
-
.form-group
|
34
|
-
= f.submit 'Create report', class: 'btn btn-default'
|
35
|
-
|
36
|
-
section.past-executions
|
37
|
-
h2 Reports
|
38
|
-
table.executions.table.table-striped.table-hover
|
39
|
-
thead
|
40
|
-
tr
|
41
|
-
th.wip
|
42
|
-
th.created_at= human(Adhoq::Execution, :created_at)
|
43
|
-
th.status= human(Adhoq::Execution, :status)
|
44
|
-
th.report
|
45
|
-
tbody
|
46
|
-
- query.executions.recent_first.preload(:report).each do |exec|
|
47
|
-
- next if exec.report.try(:on_the_fly?)
|
48
|
-
= render 'execution', query: query, exec: exec
|
@@ -1,11 +0,0 @@
|
|
1
|
-
.col-md-12
|
2
|
-
ol.breadcrumb
|
3
|
-
li= link_to 'Index', :queries
|
4
|
-
li= link_to query_friendly_name(@query), @query
|
5
|
-
li.active Edit
|
6
|
-
|
7
|
-
#main.col-md-12
|
8
|
-
section.edit-query
|
9
|
-
= render 'form', query: @query, title: "Edit query > #{query_friendly_name(@query)}"
|
10
|
-
|
11
|
-
= render 'current_tables_leftbar'
|
@@ -1,11 +0,0 @@
|
|
1
|
-
.col-md-12
|
2
|
-
ol.breadcrumb
|
3
|
-
li= link_to 'Index', :queries
|
4
|
-
li.active= query_friendly_name(@query)
|
5
|
-
|
6
|
-
#queries.col-md-3
|
7
|
-
section.queries
|
8
|
-
= render 'queries', queries: Adhoq::Query.recent_first, highlight: @query
|
9
|
-
|
10
|
-
#the-query.col-md-9
|
11
|
-
= render 'query', query: @query
|