nquery 0.1.2 → 0.1.4
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 +4 -4
- data/CHANGELOG.md +36 -0
- data/README.md +54 -0
- data/app/assets/builds/nquery/application.css +110 -6
- data/app/assets/builds/nquery/application.js +401 -37
- data/app/controllers/concerns/nquery/breadcrumbs.rb +2 -13
- data/app/controllers/concerns/nquery/chart_actions.rb +5 -5
- data/app/controllers/concerns/nquery/chart_results.rb +70 -9
- data/app/controllers/concerns/nquery/sharing_page.rb +38 -0
- data/app/controllers/nquery/application_controller.rb +2 -0
- data/app/controllers/nquery/dashboard/cards_controller.rb +28 -0
- data/app/controllers/nquery/dashboards_controller.rb +56 -11
- data/app/controllers/nquery/embed/charts_controller.rb +15 -13
- data/app/controllers/nquery/embed/dashboards_controller.rb +34 -8
- data/app/controllers/nquery/public/charts_controller.rb +19 -0
- data/app/controllers/nquery/public/dashboards_controller.rb +33 -0
- data/app/controllers/nquery/public_resources_controller.rb +79 -0
- data/app/controllers/nquery/queries_controller.rb +25 -48
- data/app/controllers/nquery/sharing/base_controller.rb +89 -0
- data/app/controllers/nquery/sharing/embed_tokens_controller.rb +41 -0
- data/app/controllers/nquery/sharing/embeddings_controller.rb +17 -0
- data/app/controllers/nquery/sharing/public_links_controller.rb +21 -0
- data/app/helpers/nquery/charts_helper.rb +13 -0
- data/app/helpers/nquery/sharing_helper.rb +67 -0
- data/app/javascript/nquery/controllers/chart_preview_controller.js +19 -1
- data/app/javascript/nquery/controllers/clipboard_controller.js +23 -0
- data/app/models/concerns/nquery/shareable.rb +43 -0
- data/app/models/nquery/chart.rb +18 -2
- data/app/models/nquery/dashboard.rb +131 -0
- data/app/models/nquery/data_source.rb +1 -1
- data/app/models/nquery/query.rb +72 -0
- data/app/services/nquery/application_service.rb +9 -0
- data/app/services/nquery/dashboards/card_parameters.rb +37 -0
- data/app/services/nquery/dashboards/filters.rb +75 -0
- data/app/services/nquery/dashboards/parameter_charts.rb +31 -0
- data/app/services/nquery/dashboards/parameter_rows.rb +60 -0
- data/app/views/layouts/nquery/application.html.erb +8 -0
- data/app/views/layouts/nquery/embed.html.erb +3 -1
- data/app/views/nquery/charts/_builder_form.html.erb +13 -6
- data/app/views/nquery/charts/_variable_row.html.erb +10 -0
- data/app/views/nquery/charts/_variables.html.erb +28 -0
- data/app/views/nquery/charts/embed.html.erb +5 -11
- data/app/views/nquery/charts/new.html.erb +2 -1
- data/app/views/nquery/charts/update.turbo_stream.erb +3 -0
- data/app/views/nquery/dashboard/charts/new.html.erb +2 -1
- data/app/views/nquery/dashboards/_chart_card.html.erb +27 -1
- data/app/views/nquery/dashboards/_parameter_chart_ids.html.erb +6 -0
- data/app/views/nquery/dashboards/_parameters.html.erb +159 -0
- data/app/views/nquery/dashboards/edit.html.erb +10 -0
- data/app/views/nquery/dashboards/embed.html.erb +9 -0
- data/app/views/nquery/dashboards/show.html.erb +41 -1
- data/app/views/nquery/embed/charts/show.html.erb +7 -8
- data/app/views/nquery/embed/dashboards/show.html.erb +12 -6
- data/app/views/nquery/embed/unavailable.html.erb +1 -0
- data/app/views/nquery/shared/_icon.html.erb +10 -0
- data/app/views/nquery/shared/_shared_chart_card.html.erb +20 -0
- data/app/views/nquery/shared/_sharing_panel.html.erb +94 -0
- data/app/views/nquery/shared/_sidebar.html.erb +1 -1
- data/app/views/nquery/shared/_topbar.html.erb +3 -0
- data/config/routes.rb +24 -1
- data/db/migrate/20260907120000_add_sharing_to_nquery_charts_and_dashboards.rb +19 -0
- data/db/migrate/20260907130000_remove_embedding_params_from_nquery_charts_and_dashboards.rb +8 -0
- data/db/migrate/20261005145000_add_parameters_to_nquery_dashboards.rb +7 -0
- data/db/migrate/20261005190000_add_parameters_to_nquery_queries.rb +7 -0
- data/lib/nquery/boolean.rb +9 -0
- data/lib/nquery/configuration.rb +6 -0
- data/lib/nquery/dashboard_parameters.rb +56 -0
- data/lib/nquery/data_sources/adapter.rb +10 -1
- data/lib/nquery/data_sources/mysql_adapter.rb +2 -2
- data/lib/nquery/data_sources/postgresql_adapter.rb +2 -2
- data/lib/nquery/data_sources/rails_adapter.rb +2 -7
- data/lib/nquery/data_sources/row_limit.rb +211 -0
- data/lib/nquery/embed_token_service.rb +10 -5
- data/lib/nquery/encryption.rb +1 -1
- data/lib/nquery/parameter_value.rb +97 -0
- data/lib/nquery/query_runner.rb +37 -4
- data/lib/nquery/seeder.rb +29 -7
- data/lib/nquery/statement_binds.rb +112 -0
- data/lib/nquery/version.rb +1 -1
- data/lib/nquery.rb +5 -0
- data/nquery.gemspec +2 -2
- metadata +40 -9
- data/app/javascript/nquery/controllers/query_editor_controller.js +0 -41
- data/app/views/nquery/queries/edit.html.erb +0 -40
- data/app/views/nquery/queries/new.html.erb +0 -37
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nquery
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nquery Contributors
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -168,7 +168,7 @@ dependencies:
|
|
|
168
168
|
requirements:
|
|
169
169
|
- - ">="
|
|
170
170
|
- !ruby/object:Gem::Version
|
|
171
|
-
version: 2.
|
|
171
|
+
version: 2.10.2
|
|
172
172
|
- - "<"
|
|
173
173
|
- !ruby/object:Gem::Version
|
|
174
174
|
version: '3'
|
|
@@ -178,7 +178,7 @@ dependencies:
|
|
|
178
178
|
requirements:
|
|
179
179
|
- - ">="
|
|
180
180
|
- !ruby/object:Gem::Version
|
|
181
|
-
version: 2.
|
|
181
|
+
version: 2.10.2
|
|
182
182
|
- - "<"
|
|
183
183
|
- !ruby/object:Gem::Version
|
|
184
184
|
version: '3'
|
|
@@ -202,7 +202,7 @@ dependencies:
|
|
|
202
202
|
requirements:
|
|
203
203
|
- - ">="
|
|
204
204
|
- !ruby/object:Gem::Version
|
|
205
|
-
version: 7.2.
|
|
205
|
+
version: 7.2.2
|
|
206
206
|
- - "<"
|
|
207
207
|
- !ruby/object:Gem::Version
|
|
208
208
|
version: '8'
|
|
@@ -212,7 +212,7 @@ dependencies:
|
|
|
212
212
|
requirements:
|
|
213
213
|
- - ">="
|
|
214
214
|
- !ruby/object:Gem::Version
|
|
215
|
-
version: 7.2.
|
|
215
|
+
version: 7.2.2
|
|
216
216
|
- - "<"
|
|
217
217
|
- !ruby/object:Gem::Version
|
|
218
218
|
version: '8'
|
|
@@ -315,6 +315,7 @@ files:
|
|
|
315
315
|
- app/controllers/concerns/nquery/browsable.rb
|
|
316
316
|
- app/controllers/concerns/nquery/chart_actions.rb
|
|
317
317
|
- app/controllers/concerns/nquery/chart_results.rb
|
|
318
|
+
- app/controllers/concerns/nquery/sharing_page.rb
|
|
318
319
|
- app/controllers/nquery/admin/base_controller.rb
|
|
319
320
|
- app/controllers/nquery/admin/data_sources_controller.rb
|
|
320
321
|
- app/controllers/nquery/admin/groups_controller.rb
|
|
@@ -325,6 +326,7 @@ files:
|
|
|
325
326
|
- app/controllers/nquery/charts_controller.rb
|
|
326
327
|
- app/controllers/nquery/collection/dashboards_controller.rb
|
|
327
328
|
- app/controllers/nquery/collections_controller.rb
|
|
329
|
+
- app/controllers/nquery/dashboard/cards_controller.rb
|
|
328
330
|
- app/controllers/nquery/dashboard/charts_controller.rb
|
|
329
331
|
- app/controllers/nquery/dashboards_controller.rb
|
|
330
332
|
- app/controllers/nquery/embed/charts_controller.rb
|
|
@@ -337,8 +339,15 @@ files:
|
|
|
337
339
|
- app/controllers/nquery/onboarding/companies_controller.rb
|
|
338
340
|
- app/controllers/nquery/onboarding/confirmations_controller.rb
|
|
339
341
|
- app/controllers/nquery/onboarding/congrats_controller.rb
|
|
342
|
+
- app/controllers/nquery/public/charts_controller.rb
|
|
343
|
+
- app/controllers/nquery/public/dashboards_controller.rb
|
|
344
|
+
- app/controllers/nquery/public_resources_controller.rb
|
|
340
345
|
- app/controllers/nquery/queries_controller.rb
|
|
341
346
|
- app/controllers/nquery/sessions_controller.rb
|
|
347
|
+
- app/controllers/nquery/sharing/base_controller.rb
|
|
348
|
+
- app/controllers/nquery/sharing/embed_tokens_controller.rb
|
|
349
|
+
- app/controllers/nquery/sharing/embeddings_controller.rb
|
|
350
|
+
- app/controllers/nquery/sharing/public_links_controller.rb
|
|
342
351
|
- app/helpers/nquery/charts_helper.rb
|
|
343
352
|
- app/helpers/nquery/collections_helper.rb
|
|
344
353
|
- app/helpers/nquery/components_helper.rb
|
|
@@ -347,13 +356,15 @@ files:
|
|
|
347
356
|
- app/helpers/nquery/home_helper.rb
|
|
348
357
|
- app/helpers/nquery/icon_helper.rb
|
|
349
358
|
- app/helpers/nquery/navigation_helper.rb
|
|
359
|
+
- app/helpers/nquery/sharing_helper.rb
|
|
350
360
|
- app/javascript/nquery/controllers/chart_preview_controller.js
|
|
361
|
+
- app/javascript/nquery/controllers/clipboard_controller.js
|
|
351
362
|
- app/javascript/nquery/controllers/csv_mapper_controller.js
|
|
352
363
|
- app/javascript/nquery/controllers/dashboard_grid_controller.js
|
|
353
364
|
- app/javascript/nquery/controllers/data_source_form_controller.js
|
|
354
|
-
- app/javascript/nquery/controllers/query_editor_controller.js
|
|
355
365
|
- app/mailers/nquery/application_mailer.rb
|
|
356
366
|
- app/mailers/nquery/devise_mailer.rb
|
|
367
|
+
- app/models/concerns/nquery/shareable.rb
|
|
357
368
|
- app/models/nquery/application_permission.rb
|
|
358
369
|
- app/models/nquery/application_record.rb
|
|
359
370
|
- app/models/nquery/audit.rb
|
|
@@ -371,6 +382,11 @@ files:
|
|
|
371
382
|
- app/models/nquery/organization.rb
|
|
372
383
|
- app/models/nquery/query.rb
|
|
373
384
|
- app/models/nquery/user.rb
|
|
385
|
+
- app/services/nquery/application_service.rb
|
|
386
|
+
- app/services/nquery/dashboards/card_parameters.rb
|
|
387
|
+
- app/services/nquery/dashboards/filters.rb
|
|
388
|
+
- app/services/nquery/dashboards/parameter_charts.rb
|
|
389
|
+
- app/services/nquery/dashboards/parameter_rows.rb
|
|
374
390
|
- app/views/layouts/nquery/application.html.erb
|
|
375
391
|
- app/views/layouts/nquery/auth.html.erb
|
|
376
392
|
- app/views/layouts/nquery/embed.html.erb
|
|
@@ -397,6 +413,8 @@ files:
|
|
|
397
413
|
- app/views/nquery/charts/_builder_form.html.erb
|
|
398
414
|
- app/views/nquery/charts/_new_header.html.erb
|
|
399
415
|
- app/views/nquery/charts/_schema_tree.html.erb
|
|
416
|
+
- app/views/nquery/charts/_variable_row.html.erb
|
|
417
|
+
- app/views/nquery/charts/_variables.html.erb
|
|
400
418
|
- app/views/nquery/charts/edit.html.erb
|
|
401
419
|
- app/views/nquery/charts/embed.html.erb
|
|
402
420
|
- app/views/nquery/charts/new.html.erb
|
|
@@ -410,7 +428,10 @@ files:
|
|
|
410
428
|
- app/views/nquery/collections/show.html.erb
|
|
411
429
|
- app/views/nquery/dashboard/charts/new.html.erb
|
|
412
430
|
- app/views/nquery/dashboards/_chart_card.html.erb
|
|
431
|
+
- app/views/nquery/dashboards/_parameter_chart_ids.html.erb
|
|
432
|
+
- app/views/nquery/dashboards/_parameters.html.erb
|
|
413
433
|
- app/views/nquery/dashboards/edit.html.erb
|
|
434
|
+
- app/views/nquery/dashboards/embed.html.erb
|
|
414
435
|
- app/views/nquery/dashboards/index.html.erb
|
|
415
436
|
- app/views/nquery/dashboards/new.html.erb
|
|
416
437
|
- app/views/nquery/dashboards/show.html.erb
|
|
@@ -418,6 +439,7 @@ files:
|
|
|
418
439
|
- app/views/nquery/devise_mailer/confirmation_instructions.text.erb
|
|
419
440
|
- app/views/nquery/embed/charts/show.html.erb
|
|
420
441
|
- app/views/nquery/embed/dashboards/show.html.erb
|
|
442
|
+
- app/views/nquery/embed/unavailable.html.erb
|
|
421
443
|
- app/views/nquery/errors/internal_server_error.html.erb
|
|
422
444
|
- app/views/nquery/errors/not_found.html.erb
|
|
423
445
|
- app/views/nquery/home/index.html.erb
|
|
@@ -426,8 +448,6 @@ files:
|
|
|
426
448
|
- app/views/nquery/onboarding/companies/new.html.erb
|
|
427
449
|
- app/views/nquery/onboarding/confirmations/show.html.erb
|
|
428
450
|
- app/views/nquery/onboarding/congrats/show.html.erb
|
|
429
|
-
- app/views/nquery/queries/edit.html.erb
|
|
430
|
-
- app/views/nquery/queries/new.html.erb
|
|
431
451
|
- app/views/nquery/sessions/new.html.erb
|
|
432
452
|
- app/views/nquery/shared/_auth_shell.html.erb
|
|
433
453
|
- app/views/nquery/shared/_breadcrumbs.html.erb
|
|
@@ -435,6 +455,8 @@ files:
|
|
|
435
455
|
- app/views/nquery/shared/_chart_row_actions.html.erb
|
|
436
456
|
- app/views/nquery/shared/_flash.html.erb
|
|
437
457
|
- app/views/nquery/shared/_icon.html.erb
|
|
458
|
+
- app/views/nquery/shared/_shared_chart_card.html.erb
|
|
459
|
+
- app/views/nquery/shared/_sharing_panel.html.erb
|
|
438
460
|
- app/views/nquery/shared/_sidebar.html.erb
|
|
439
461
|
- app/views/nquery/shared/_topbar.html.erb
|
|
440
462
|
- config/importmap.rb
|
|
@@ -447,15 +469,22 @@ files:
|
|
|
447
469
|
- db/migrate/20260722000002_create_nquery_organizations.rb
|
|
448
470
|
- db/migrate/20260722000003_add_devise_to_nquery_users.rb
|
|
449
471
|
- db/migrate/20260722000004_add_onboarding_completed_at_to_nquery_organizations.rb
|
|
472
|
+
- db/migrate/20260907120000_add_sharing_to_nquery_charts_and_dashboards.rb
|
|
473
|
+
- db/migrate/20260907130000_remove_embedding_params_from_nquery_charts_and_dashboards.rb
|
|
474
|
+
- db/migrate/20261005145000_add_parameters_to_nquery_dashboards.rb
|
|
475
|
+
- db/migrate/20261005190000_add_parameters_to_nquery_queries.rb
|
|
450
476
|
- lib/generators/nquery/install_generator.rb
|
|
451
477
|
- lib/nquery.rb
|
|
452
478
|
- lib/nquery/authorizes_collection.rb
|
|
479
|
+
- lib/nquery/boolean.rb
|
|
453
480
|
- lib/nquery/configuration.rb
|
|
454
481
|
- lib/nquery/csv_importer.rb
|
|
482
|
+
- lib/nquery/dashboard_parameters.rb
|
|
455
483
|
- lib/nquery/data_sources/adapter.rb
|
|
456
484
|
- lib/nquery/data_sources/mysql_adapter.rb
|
|
457
485
|
- lib/nquery/data_sources/postgresql_adapter.rb
|
|
458
486
|
- lib/nquery/data_sources/rails_adapter.rb
|
|
487
|
+
- lib/nquery/data_sources/row_limit.rb
|
|
459
488
|
- lib/nquery/data_sources/sqlite_adapter.rb
|
|
460
489
|
- lib/nquery/data_sources/syncer.rb
|
|
461
490
|
- lib/nquery/embed_token_service.rb
|
|
@@ -464,6 +493,7 @@ files:
|
|
|
464
493
|
- lib/nquery/onboarding.rb
|
|
465
494
|
- lib/nquery/onboarding/admin_provisioner.rb
|
|
466
495
|
- lib/nquery/onboarding/password_confirmation.rb
|
|
496
|
+
- lib/nquery/parameter_value.rb
|
|
467
497
|
- lib/nquery/permissions/resolver.rb
|
|
468
498
|
- lib/nquery/query_runner.rb
|
|
469
499
|
- lib/nquery/readonly_sql.rb
|
|
@@ -471,6 +501,7 @@ files:
|
|
|
471
501
|
- lib/nquery/schema_explorer.rb
|
|
472
502
|
- lib/nquery/seeder.rb
|
|
473
503
|
- lib/nquery/setup.rb
|
|
504
|
+
- lib/nquery/statement_binds.rb
|
|
474
505
|
- lib/nquery/version.rb
|
|
475
506
|
- lib/tasks/nquery.rake
|
|
476
507
|
- nquery.gemspec
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Controller } from "@hotwired/stimulus"
|
|
2
|
-
|
|
3
|
-
export default class extends Controller {
|
|
4
|
-
static targets = ["statement", "results", "dataSource", "schema"]
|
|
5
|
-
|
|
6
|
-
insertTable(event) {
|
|
7
|
-
const table = event.currentTarget.dataset.table
|
|
8
|
-
const textarea = this.statementTarget
|
|
9
|
-
const insert = `SELECT * FROM ${table} LIMIT 100`
|
|
10
|
-
textarea.value = insert
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
async run() {
|
|
14
|
-
const statement = this.statementTarget.value
|
|
15
|
-
const dataSourceId = this.dataSourceTarget?.value
|
|
16
|
-
const csrf = document.querySelector('meta[name="csrf-token"]')?.content
|
|
17
|
-
|
|
18
|
-
try {
|
|
19
|
-
const response = await fetch("/queries/run", {
|
|
20
|
-
method: "POST",
|
|
21
|
-
headers: { "Content-Type": "application/json", "X-CSRF-Token": csrf },
|
|
22
|
-
body: JSON.stringify({ statement, data_source_id: dataSourceId })
|
|
23
|
-
})
|
|
24
|
-
const data = await response.json()
|
|
25
|
-
this.resultsTarget.textContent = JSON.stringify(data, null, 2)
|
|
26
|
-
} catch (e) {
|
|
27
|
-
this.resultsTarget.textContent = e.message
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
async loadSchema() {
|
|
32
|
-
if (!this.hasSchemaTarget) return
|
|
33
|
-
const dataSourceId = this.dataSourceTarget.value
|
|
34
|
-
const response = await fetch(`/queries/schema?data_source_id=${dataSourceId}`)
|
|
35
|
-
const data = await response.json()
|
|
36
|
-
this.schemaTarget.innerHTML = data.tables.map(t => {
|
|
37
|
-
const name = typeof t === "string" ? t : t.name
|
|
38
|
-
return `<li class="nq-tree-item" data-action="click->query-editor#insertTable" data-table="${name}">${name}</li>`
|
|
39
|
-
}).join("")
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<div class="nq-page-header">
|
|
2
|
-
<h1>Edit query: <%= @query.name || "Untitled" %></h1>
|
|
3
|
-
</div>
|
|
4
|
-
|
|
5
|
-
<%= form_with model: @query, url: query_path(@query), method: :patch, class: "nq-form" do |f| %>
|
|
6
|
-
<div class="nq-grid nq-grid-editor" data-controller="query-editor">
|
|
7
|
-
<aside class="nq-card nq-schema-panel">
|
|
8
|
-
<h3>Schema</h3>
|
|
9
|
-
<ul class="nq-tree" data-query-editor-target="schema">
|
|
10
|
-
<% @schema_tables.each do |table| %>
|
|
11
|
-
<li class="nq-tree-item" data-action="click->query-editor#insertTable" data-table="<%= table %>"><%= table %></li>
|
|
12
|
-
<% end %>
|
|
13
|
-
</ul>
|
|
14
|
-
</aside>
|
|
15
|
-
|
|
16
|
-
<div class="nq-editor-panel">
|
|
17
|
-
<div class="nq-form-row">
|
|
18
|
-
<%= f.label :name %>
|
|
19
|
-
<%= f.text_field :name, class: "nq-input" %>
|
|
20
|
-
</div>
|
|
21
|
-
<div class="nq-form-row">
|
|
22
|
-
<%= f.label :data_source_id, "Data source" %>
|
|
23
|
-
<%= f.collection_select :data_source_id, @data_sources, :id, :name, {}, class: "nq-input",
|
|
24
|
-
data: { query_editor_target: "dataSource" } %>
|
|
25
|
-
</div>
|
|
26
|
-
<div class="nq-form-row">
|
|
27
|
-
<%= f.label :statement, "SQL" %>
|
|
28
|
-
<%= f.text_area :statement, rows: 12, class: "nq-textarea", data: { query_editor_target: "statement" } %>
|
|
29
|
-
</div>
|
|
30
|
-
<div class="nq-actions">
|
|
31
|
-
<button type="button" class="nq-btn" data-action="click->query-editor#run">Run query</button>
|
|
32
|
-
<%= f.submit "Save", class: "nq-btn nq-btn-primary" %>
|
|
33
|
-
<% if @query.chart %>
|
|
34
|
-
<%= link_to "View chart", chart_path(@query.chart), class: "nq-btn" %>
|
|
35
|
-
<% end %>
|
|
36
|
-
</div>
|
|
37
|
-
<pre class="nq-results" data-query-editor-target="results"></pre>
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
<% end %>
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
<div class="nq-page-header">
|
|
2
|
-
<h1>New SQL query</h1>
|
|
3
|
-
</div>
|
|
4
|
-
|
|
5
|
-
<%= form_with model: @query, url: queries_path, class: "nq-form" do |f| %>
|
|
6
|
-
<div class="nq-grid nq-grid-editor" data-controller="query-editor">
|
|
7
|
-
<aside class="nq-card nq-schema-panel">
|
|
8
|
-
<h3>Schema</h3>
|
|
9
|
-
<ul class="nq-tree">
|
|
10
|
-
<% @schema_tables.each do |table| %>
|
|
11
|
-
<li class="nq-tree-item" data-action="click->query-editor#insertTable" data-table="<%= table %>"><%= table %></li>
|
|
12
|
-
<% end %>
|
|
13
|
-
</ul>
|
|
14
|
-
</aside>
|
|
15
|
-
|
|
16
|
-
<div class="nq-editor-panel">
|
|
17
|
-
<div class="nq-form-row">
|
|
18
|
-
<%= f.label :name, "Query name" %>
|
|
19
|
-
<%= f.text_field :name, class: "nq-input" %>
|
|
20
|
-
</div>
|
|
21
|
-
<div class="nq-form-row">
|
|
22
|
-
<%= f.label :data_source_id, "Data source" %>
|
|
23
|
-
<%= f.collection_select :data_source_id, @data_sources, :id, :name, {}, class: "nq-input",
|
|
24
|
-
data: { query_editor_target: "dataSource", action: "change->query-editor#loadSchema" } %>
|
|
25
|
-
</div>
|
|
26
|
-
<div class="nq-form-row">
|
|
27
|
-
<%= f.label :statement, "SQL" %>
|
|
28
|
-
<%= f.text_area :statement, rows: 12, class: "nq-textarea", data: { query_editor_target: "statement" } %>
|
|
29
|
-
</div>
|
|
30
|
-
<div class="nq-actions">
|
|
31
|
-
<button type="button" class="nq-btn" data-action="click->query-editor#run">Run query</button>
|
|
32
|
-
<%= f.submit "Save", class: "nq-btn nq-btn-primary" %>
|
|
33
|
-
</div>
|
|
34
|
-
<pre class="nq-results" data-query-editor-target="results"></pre>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
<% end %>
|