sql-jarvis 2.0.9 → 2.1
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/main.js +4 -3
- data/app/helpers/blazer/base_helper.rb +1 -1
- data/app/views/blazer/_nav.html.haml +12 -0
- data/app/views/blazer/{_variables.html.erb → _variables.html.haml} +35 -57
- data/app/views/blazer/check_mailer/failing_checks.html.haml +6 -0
- data/app/views/blazer/check_mailer/state_change.html.haml +31 -0
- data/app/views/blazer/checks/_form.html.haml +51 -0
- data/app/views/blazer/checks/edit.html.haml +2 -0
- data/app/views/blazer/checks/index.html.haml +48 -0
- data/app/views/blazer/checks/new.html.haml +2 -0
- data/app/views/blazer/dashboards/_form.html.haml +64 -0
- data/app/views/blazer/dashboards/edit.html.haml +2 -0
- data/app/views/blazer/dashboards/new.html.haml +2 -0
- data/app/views/blazer/dashboards/show.html.haml +33 -0
- data/app/views/blazer/queries/{_form.html.erb → _form.html.haml} +54 -81
- data/app/views/blazer/queries/_tips.html.haml +92 -0
- data/app/views/blazer/queries/docs.html.haml +115 -0
- data/app/views/blazer/queries/edit.html.haml +2 -0
- data/app/views/blazer/queries/{home.html.erb → home.html.haml} +38 -58
- data/app/views/blazer/queries/new.html.haml +2 -0
- data/app/views/blazer/queries/run.html.haml +153 -0
- data/app/views/blazer/queries/schema.html.haml +43 -0
- data/app/views/blazer/queries/show.html.haml +50 -0
- data/app/views/layouts/blazer/application.html.haml +19 -0
- data/lib/blazer/version.rb +1 -1
- metadata +38 -24
- data/app/views/blazer/_nav.html.erb +0 -15
- data/app/views/blazer/check_mailer/failing_checks.html.erb +0 -6
- data/app/views/blazer/check_mailer/state_change.html.erb +0 -47
- data/app/views/blazer/checks/_form.html.erb +0 -79
- data/app/views/blazer/checks/edit.html.erb +0 -3
- data/app/views/blazer/checks/index.html.erb +0 -69
- data/app/views/blazer/checks/new.html.erb +0 -3
- data/app/views/blazer/dashboards/_form.html.erb +0 -76
- data/app/views/blazer/dashboards/edit.html.erb +0 -3
- data/app/views/blazer/dashboards/new.html.erb +0 -3
- data/app/views/blazer/dashboards/show.html.erb +0 -51
- data/app/views/blazer/queries/_tips.html.erb +0 -69
- data/app/views/blazer/queries/docs.html.erb +0 -131
- data/app/views/blazer/queries/edit.html.erb +0 -2
- data/app/views/blazer/queries/new.html.erb +0 -2
- data/app/views/blazer/queries/run.html.erb +0 -202
- data/app/views/blazer/queries/schema.html.erb +0 -58
- data/app/views/blazer/queries/show.html.erb +0 -76
- data/app/views/layouts/blazer/application.html.erb +0 -25
@@ -0,0 +1,43 @@
|
|
1
|
+
- blazer_title "Schema: #{@data_source.name}"
|
2
|
+
%h1
|
3
|
+
Schema: #{@data_source.name}
|
4
|
+
%hr/
|
5
|
+
#header
|
6
|
+
%input#search.search.form-control{:placeholder => "Start typing a table or column", :style => "width: 300px; display: inline-block;", :type => "text"}/
|
7
|
+
- @schema.each do |table|
|
8
|
+
%table.table.schema-table
|
9
|
+
%thead
|
10
|
+
%tr
|
11
|
+
%th{:colspan => "2"}
|
12
|
+
= table[:table]
|
13
|
+
- if table[:schema] != "public"
|
14
|
+
%span.text-muted{:style => "font-weight: normal;"}= table[:schema]
|
15
|
+
%tbody
|
16
|
+
- table[:columns].each do |column|
|
17
|
+
%tr
|
18
|
+
%td{:style => "width: 60%;"}= column[:name]
|
19
|
+
%td.text-muted= column[:data_type]
|
20
|
+
:javascript
|
21
|
+
$("#search").on("keyup", function() {
|
22
|
+
var value = $(this).val().toLowerCase()
|
23
|
+
$(".schema-table").filter(function() {
|
24
|
+
// if found in table name, show entire table
|
25
|
+
// if just found in rows, show row
|
26
|
+
|
27
|
+
var found = $(this).find("thead").text().toLowerCase().indexOf(value) > -1
|
28
|
+
|
29
|
+
if (found) {
|
30
|
+
$(this).find("tbody tr").toggle(true)
|
31
|
+
} else {
|
32
|
+
$(this).find("tbody tr").filter(function() {
|
33
|
+
var found2 = $(this).text().toLowerCase().indexOf(value) > -1
|
34
|
+
$(this).toggle(found2)
|
35
|
+
if (found2) {
|
36
|
+
found = true
|
37
|
+
}
|
38
|
+
})
|
39
|
+
}
|
40
|
+
|
41
|
+
$(this).toggle(found)
|
42
|
+
})
|
43
|
+
}).focus()
|
@@ -0,0 +1,50 @@
|
|
1
|
+
- blazer_title @query.name
|
2
|
+
.topbar
|
3
|
+
.container
|
4
|
+
.row{:style => "padding-top: 13px;"}
|
5
|
+
.col-sm-8
|
6
|
+
= render partial: "blazer/nav"
|
7
|
+
%h3{:style => "line-height: 34px; display: inline; margin-left: 5px;"}
|
8
|
+
= @query.name
|
9
|
+
.col-sm-4.text-right
|
10
|
+
= link_to "Edit", edit_query_path(@query, variable_params), class: "btn btn-default", disabled: !@query.editable?(blazer_user)
|
11
|
+
= link_to "Fork", new_query_path(variable_params.merge(fork_query_id: @query.id, data_source: @query.data_source, name: @query.name)), class: "btn btn-info"
|
12
|
+
- if !@error && @success
|
13
|
+
= button_to "⤓ .csv", run_queries_path(query_id: @query.id, format: "csv", forecast: params[:forecast]), params: {statement: @statement}, class: "btn btn-primary"
|
14
|
+
= button_to "⤓ .xlsx", run_queries_path(query_id: @query.id, format: "xlsx"), params: {statement: @statement}, class: "btn btn-primary"
|
15
|
+
%div{:style => "margin-bottom: 60px;"}
|
16
|
+
- if @sql_errors.any?
|
17
|
+
.alert.alert-danger
|
18
|
+
%ul
|
19
|
+
- @sql_errors.each do |message|
|
20
|
+
%li= message
|
21
|
+
- if @query.description.present?
|
22
|
+
%p= @query.description
|
23
|
+
= render partial: "blazer/variables", locals: {action: query_path(@query)}
|
24
|
+
%pre#code
|
25
|
+
%code= @statement
|
26
|
+
- if @success
|
27
|
+
#results
|
28
|
+
%p.text-muted Loading...
|
29
|
+
:javascript
|
30
|
+
function showRun(data) {
|
31
|
+
$("#results").html(data);
|
32
|
+
$("#results table").stupidtable().stickyTableHeaders({
|
33
|
+
fixedOffset: 60,
|
34
|
+
});
|
35
|
+
}
|
36
|
+
|
37
|
+
function showError(message) {
|
38
|
+
$("#results").addClass("query-error").html(message);
|
39
|
+
}
|
40
|
+
|
41
|
+
#{blazer_js_var "data", variable_params.merge(statement: @statement, query_id: @query.id, data_source: @query.data_source)}
|
42
|
+
|
43
|
+
runQuery(data, showRun, showError)
|
44
|
+
- unless %w(mongodb).include?(Blazer.data_sources[@query.data_source].adapter)
|
45
|
+
:javascript
|
46
|
+
// do not highlight really long queries
|
47
|
+
// this can lead to performance issues
|
48
|
+
if ($("code").text().length < 10000) {
|
49
|
+
hljs.highlightBlock(document.getElementById("code"));
|
50
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
|
5
|
+
%title= blazer_title ? blazer_title : "Blazer"
|
6
|
+
%meta{:charset => "utf-8"}/
|
7
|
+
= favicon_link_tag "blazer/favicon.png"
|
8
|
+
= stylesheet_link_tag "blazer/application"
|
9
|
+
= javascript_include_tag "blazer/application"
|
10
|
+
:javascript
|
11
|
+
#{blazer_js_var "rootPath", root_path}
|
12
|
+
%script{:crossorigin => "anonymous", :defer => "defer", :integrity => "sha384-DJ25uNYET2XCl5ZF++U8eNxPWqcKohUUBUpKGlNLMchM7q4Wjg2CUpjHLaL8yYPH", :src => "https://use.fontawesome.com/releases/v5.8.2/js/all.js"}
|
13
|
+
- if blazer_maps?
|
14
|
+
= stylesheet_link_tag "https://api.mapbox.com/mapbox.js/v3.1.1/mapbox.css", integrity: "sha384-o8tecBIfqi9yU5yYK2Ne/9A9hlOGFV9MBvCpmemvJH1XxqOe6h8Bl4mLxMi6PgjG", crossorigin: "anonymous"
|
15
|
+
= javascript_include_tag "https://api.mapbox.com/mapbox.js/v3.1.1/mapbox.js", integrity: "sha384-j81LqvtvYigFzGSUgAoFijpvoq4yGoCJSOXI9DFaUEpenR029MBE3E/X5Gr+WdO0", crossorigin: "anonymous"
|
16
|
+
= csrf_meta_tags
|
17
|
+
%body
|
18
|
+
.container
|
19
|
+
= yield
|
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.
|
4
|
+
version: '2.1'
|
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-
|
11
|
+
date: 2019-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '4.2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: haml-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: zip-zip
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -201,28 +215,28 @@ files:
|
|
201
215
|
- app/models/blazer/dashboard_query.rb
|
202
216
|
- app/models/blazer/query.rb
|
203
217
|
- app/models/blazer/record.rb
|
204
|
-
- app/views/blazer/_nav.html.
|
205
|
-
- app/views/blazer/_variables.html.
|
206
|
-
- app/views/blazer/check_mailer/failing_checks.html.
|
207
|
-
- app/views/blazer/check_mailer/state_change.html.
|
208
|
-
- app/views/blazer/checks/_form.html.
|
209
|
-
- app/views/blazer/checks/edit.html.
|
210
|
-
- app/views/blazer/checks/index.html.
|
211
|
-
- app/views/blazer/checks/new.html.
|
212
|
-
- app/views/blazer/dashboards/_form.html.
|
213
|
-
- app/views/blazer/dashboards/edit.html.
|
214
|
-
- app/views/blazer/dashboards/new.html.
|
215
|
-
- app/views/blazer/dashboards/show.html.
|
216
|
-
- app/views/blazer/queries/_form.html.
|
217
|
-
- app/views/blazer/queries/_tips.html.
|
218
|
-
- app/views/blazer/queries/docs.html.
|
219
|
-
- app/views/blazer/queries/edit.html.
|
220
|
-
- app/views/blazer/queries/home.html.
|
221
|
-
- app/views/blazer/queries/new.html.
|
222
|
-
- app/views/blazer/queries/run.html.
|
223
|
-
- app/views/blazer/queries/schema.html.
|
224
|
-
- app/views/blazer/queries/show.html.
|
225
|
-
- app/views/layouts/blazer/application.html.
|
218
|
+
- app/views/blazer/_nav.html.haml
|
219
|
+
- app/views/blazer/_variables.html.haml
|
220
|
+
- app/views/blazer/check_mailer/failing_checks.html.haml
|
221
|
+
- app/views/blazer/check_mailer/state_change.html.haml
|
222
|
+
- app/views/blazer/checks/_form.html.haml
|
223
|
+
- app/views/blazer/checks/edit.html.haml
|
224
|
+
- app/views/blazer/checks/index.html.haml
|
225
|
+
- app/views/blazer/checks/new.html.haml
|
226
|
+
- app/views/blazer/dashboards/_form.html.haml
|
227
|
+
- app/views/blazer/dashboards/edit.html.haml
|
228
|
+
- app/views/blazer/dashboards/new.html.haml
|
229
|
+
- app/views/blazer/dashboards/show.html.haml
|
230
|
+
- app/views/blazer/queries/_form.html.haml
|
231
|
+
- app/views/blazer/queries/_tips.html.haml
|
232
|
+
- app/views/blazer/queries/docs.html.haml
|
233
|
+
- app/views/blazer/queries/edit.html.haml
|
234
|
+
- app/views/blazer/queries/home.html.haml
|
235
|
+
- app/views/blazer/queries/new.html.haml
|
236
|
+
- app/views/blazer/queries/run.html.haml
|
237
|
+
- app/views/blazer/queries/schema.html.haml
|
238
|
+
- app/views/blazer/queries/show.html.haml
|
239
|
+
- app/views/layouts/blazer/application.html.haml
|
226
240
|
- config/routes.rb
|
227
241
|
- lib/blazer.rb
|
228
242
|
- lib/blazer/adapters/athena_adapter.rb
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<div class="btn-group" style="vertical-align: top; margin-right: 5px;">
|
2
|
-
<%= link_to "Home", root_path, class: "btn btn-primary" %>
|
3
|
-
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
4
|
-
<span class="caret"></span>
|
5
|
-
<span class="sr-only">Toggle Dropdown</span>
|
6
|
-
</button>
|
7
|
-
<ul class="dropdown-menu">
|
8
|
-
<li><%= link_to "Checks", checks_path %></li>
|
9
|
-
<li role="separator" class="divider"></li>
|
10
|
-
<li><%= link_to "New Query", new_query_path %></li>
|
11
|
-
<li><%= link_to "New Dashboard", new_dashboard_path %></li>
|
12
|
-
<% check_params = @query ? {query_id: @query.id} : {} %>
|
13
|
-
<li><%= link_to "New Check", new_check_path(check_params) %></li>
|
14
|
-
</ul>
|
15
|
-
</div>
|
@@ -1,47 +0,0 @@
|
|
1
|
-
<html>
|
2
|
-
<head>
|
3
|
-
</head>
|
4
|
-
<body style="font-family: 'Helvetica Neue', Arial, Helvetica; font-size: 14px; color: #333;">
|
5
|
-
<p><%= link_to "View", query_url(@check.query_id, host: Blazer.host) %></p>
|
6
|
-
<% if @error %>
|
7
|
-
<p><%= @error %></p>
|
8
|
-
<% elsif @rows_count > 0 && @check_type == "bad_data" %>
|
9
|
-
<p>
|
10
|
-
<% if @rows_count <= 10 %>
|
11
|
-
<%= pluralize(@rows_count, "row") %>
|
12
|
-
<% else %>
|
13
|
-
Showing 10 of <%= @rows_count %> rows
|
14
|
-
<% end %>
|
15
|
-
</p>
|
16
|
-
<table style="width: 100%; border-spacing: 0; border-collapse: collapse;">
|
17
|
-
<thead>
|
18
|
-
<tr>
|
19
|
-
<% @columns.first(5).each do |column| %>
|
20
|
-
<th style="padding: 8px; line-height: 1.4; text-align: left; vertical-align: bottom; border-bottom: 2px solid #ddd; width: <%= (100 / @columns.size).round(2) %>%;">
|
21
|
-
<%= column %>
|
22
|
-
</th>
|
23
|
-
<% end %>
|
24
|
-
</tr>
|
25
|
-
</thead>
|
26
|
-
<tbody>
|
27
|
-
<% @rows.first(10).each do |row| %>
|
28
|
-
<tr>
|
29
|
-
<% @columns.first(5).each_with_index do |column, i| %>
|
30
|
-
<td style="padding: 8px; line-height: 1.4; vertical-align: top; border-top: 1px solid #ddd;">
|
31
|
-
<% value = row[i] %>
|
32
|
-
<% if @column_types[i] == "time" && value.to_s.length > 10 %>
|
33
|
-
<% value = Time.parse(value).in_time_zone(Blazer.time_zone) rescue value %>
|
34
|
-
<% end %>
|
35
|
-
<%= value %>
|
36
|
-
</td>
|
37
|
-
<% end %>
|
38
|
-
</tr>
|
39
|
-
<% end %>
|
40
|
-
</tbody>
|
41
|
-
</table>
|
42
|
-
<% if @columns.size > 5 %>
|
43
|
-
<p style="color: #999;">Only first 5 columns shown</p>
|
44
|
-
<% end %>
|
45
|
-
<% end %>
|
46
|
-
</body>
|
47
|
-
</html>
|
@@ -1,79 +0,0 @@
|
|
1
|
-
<%= form_for @check, html: {class: "small-form"} do |f| %>
|
2
|
-
<% unless @check.respond_to?(:check_type) || @check.respond_to?(:invert) %>
|
3
|
-
<p class="text-muted">Checks are designed to identify bad data. A check fails if there are any results.</p>
|
4
|
-
<% end %>
|
5
|
-
|
6
|
-
<% if @check.errors.any? %>
|
7
|
-
<div class="alert alert-danger"><%= @check.errors.full_messages.first %></div>
|
8
|
-
<% end %>
|
9
|
-
|
10
|
-
<div class="form-group">
|
11
|
-
<%= f.label :query_id, "Query" %>
|
12
|
-
<div class="hide">
|
13
|
-
<%= f.select :query_id, [], {include_blank: true} %>
|
14
|
-
</div>
|
15
|
-
<script>
|
16
|
-
<%= blazer_js_var "queries", Blazer::Query.named.order(:name).select("id, name").map { |q| {text: q.name, value: q.id} } %>
|
17
|
-
<%= blazer_js_var "items", [@check.query_id].compact %>
|
18
|
-
|
19
|
-
$("#check_query_id").selectize({options: queries, items: items, highlight: false, maxOptions: 100}).parents(".hide").removeClass("hide");
|
20
|
-
</script>
|
21
|
-
</div>
|
22
|
-
|
23
|
-
<% if @check.respond_to?(:check_type) %>
|
24
|
-
<div class="form-group">
|
25
|
-
<%= f.label :check_type, "Alert if" %>
|
26
|
-
<div class="hide">
|
27
|
-
<% check_options = [["Any results (bad data)", "bad_data"], ["No results (missing data)", "missing_data"]] %>
|
28
|
-
<% check_options << ["Anomaly (most recent data point)", "anomaly"] if Blazer.anomaly_checks %>
|
29
|
-
<%= f.select :check_type, check_options %>
|
30
|
-
</div>
|
31
|
-
<script>
|
32
|
-
$("#check_check_type").selectize({}).parent().removeClass("hide");
|
33
|
-
</script>
|
34
|
-
</div>
|
35
|
-
<% elsif @check.respond_to?(:invert) %>
|
36
|
-
<div class="form-group">
|
37
|
-
<%= f.label :invert, "Fails if" %>
|
38
|
-
<div class="hide">
|
39
|
-
<%= f.select :invert, [["Any results (bad data)", false], ["No results (missing data)", true]] %>
|
40
|
-
</div>
|
41
|
-
<script>
|
42
|
-
$("#check_invert").selectize({}).parent().removeClass("hide");
|
43
|
-
</script>
|
44
|
-
</div>
|
45
|
-
<% end %>
|
46
|
-
|
47
|
-
<% if @check.respond_to?(:schedule) && Blazer.check_schedules %>
|
48
|
-
<div class="form-group">
|
49
|
-
<%= f.label :schedule, "Run every" %>
|
50
|
-
<div class="hide">
|
51
|
-
<%= f.select :schedule, Blazer.check_schedules.map { |v| [v, v] } %>
|
52
|
-
</div>
|
53
|
-
<script>
|
54
|
-
$("#check_schedule").selectize({}).parent().removeClass("hide");
|
55
|
-
</script>
|
56
|
-
</div>
|
57
|
-
<% end %>
|
58
|
-
|
59
|
-
<div class="form-group">
|
60
|
-
<%= f.label :emails %>
|
61
|
-
<%= f.text_field :emails, placeholder: "Optional, comma separated", class: "form-control" %>
|
62
|
-
</div>
|
63
|
-
|
64
|
-
<% if Blazer.slack? %>
|
65
|
-
<div class="form-group">
|
66
|
-
<%= f.label :slack_channels %>
|
67
|
-
<%= f.text_field :slack_channels, placeholder: "Optional, comma separated", class: "form-control" %>
|
68
|
-
</div>
|
69
|
-
<% end %>
|
70
|
-
|
71
|
-
<p class="text-muted">Emails <%= Blazer.slack? ? "and Slack notifications " : nil %>are sent when a check starts failing, and when it starts passing again.
|
72
|
-
<p>
|
73
|
-
<% if @check.persisted? %>
|
74
|
-
<%= link_to "Delete", check_path(@check), method: :delete, "data-confirm" => "Are you sure?", class: "btn btn-danger" %>
|
75
|
-
<% end %>
|
76
|
-
<%= f.submit "Save", class: "btn btn-success" %>
|
77
|
-
<%= link_to "Back", :back, class: "btn btn-link" %>
|
78
|
-
</p>
|
79
|
-
<% end %>
|
@@ -1,69 +0,0 @@
|
|
1
|
-
<% blazer_title "Checks" %>
|
2
|
-
|
3
|
-
<div id="header">
|
4
|
-
<div class="pull-right" style="line-height: 34px;">
|
5
|
-
<div class="btn-group">
|
6
|
-
<%= link_to "New Check", new_check_path, class: "btn btn-info" %>
|
7
|
-
<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
8
|
-
<span class="caret"></span>
|
9
|
-
<span class="sr-only">Toggle Dropdown</span>
|
10
|
-
</button>
|
11
|
-
<ul class="dropdown-menu">
|
12
|
-
<li><%= link_to "Home", root_path %></li>
|
13
|
-
<li role="separator" class="divider"></li>
|
14
|
-
<li><%= link_to "New Query", new_query_path %></li>
|
15
|
-
<li><%= link_to "New Dashboard", new_dashboard_path %></li>
|
16
|
-
</ul>
|
17
|
-
</div>
|
18
|
-
</div>
|
19
|
-
|
20
|
-
<input id="search" type="text" placeholder="Start typing a query or state" style="width: 300px; display: inline-block;" class="search form-control" />
|
21
|
-
</div>
|
22
|
-
|
23
|
-
<table id="checks" class="table">
|
24
|
-
<thead>
|
25
|
-
<tr>
|
26
|
-
<th>Query</th>
|
27
|
-
<th style="width: 10%;">State</th>
|
28
|
-
<th style="width: 10%;">Run</th>
|
29
|
-
<th style="width: 20%;">Notify</th>
|
30
|
-
<th style="width: 15%;"></th>
|
31
|
-
</tr>
|
32
|
-
</thead>
|
33
|
-
<tbody>
|
34
|
-
<% @checks.each do |check| %>
|
35
|
-
<tr>
|
36
|
-
<td><%= link_to check.query.name, check.query %> <span class="text-muted"><%= check.try(:check_type).to_s.gsub("_", " ") %></span></td>
|
37
|
-
<td>
|
38
|
-
<% if check.state %>
|
39
|
-
<small class="check-state <%= check.state.parameterize.gsub("-", "_") %>"><%= check.state.upcase %></small>
|
40
|
-
<% end %>
|
41
|
-
</td>
|
42
|
-
<td><%= check.schedule if check.respond_to?(:schedule) %></td>
|
43
|
-
<td>
|
44
|
-
<ul class="list-unstyled" style="margin-bottom: 0; word-break: break-all;">
|
45
|
-
<% check.split_emails.each do |email| %>
|
46
|
-
<li><%= email %></li>
|
47
|
-
<% end %>
|
48
|
-
<% check.split_slack_channels.each do |channel| %>
|
49
|
-
<li><%= channel %></li>
|
50
|
-
<% end %>
|
51
|
-
</ul>
|
52
|
-
</td>
|
53
|
-
<td style="text-align: right; padding: 1px;">
|
54
|
-
<%= link_to "Edit", edit_check_path(check), class: "btn btn-info" %>
|
55
|
-
<%= link_to "Run Now", query_path(check.query), class: "btn btn-primary" %>
|
56
|
-
</td>
|
57
|
-
</tr>
|
58
|
-
<% end %>
|
59
|
-
</tbody>
|
60
|
-
</table>
|
61
|
-
|
62
|
-
<script>
|
63
|
-
$("#search").on("keyup", function() {
|
64
|
-
var value = $(this).val().toLowerCase()
|
65
|
-
$("#checks tbody tr").filter( function() {
|
66
|
-
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
|
67
|
-
})
|
68
|
-
}).focus()
|
69
|
-
</script>
|
@@ -1,76 +0,0 @@
|
|
1
|
-
<%= form_for @dashboard, url: (@dashboard.persisted? ? dashboard_path(@dashboard, variable_params) : dashboards_path(variable_params)), html: {id: "app", class: "small-form"} do |f| %>
|
2
|
-
<% if @dashboard.errors.any? %>
|
3
|
-
<div class="alert alert-danger"><%= @dashboard.errors.full_messages.first %></div>
|
4
|
-
<% end %>
|
5
|
-
|
6
|
-
<div class="form-group">
|
7
|
-
<%= f.label :name %>
|
8
|
-
<%= f.text_field :name, class: "form-control" %>
|
9
|
-
</div>
|
10
|
-
<div class="form-group" v-show="queries.length">
|
11
|
-
<%= f.label :charts %>
|
12
|
-
<ul id="queries" class="list-group">
|
13
|
-
<li class="list-group-item" v-for="(query, index) in queries" :key="query.id" v-cloak>
|
14
|
-
<span class="glyphicon glyphicon-remove" aria-hidden="true" v-on:click="remove(index)"></span>
|
15
|
-
{{ query.name }}
|
16
|
-
<input type="hidden" name="query_ids[]" :value="query.id">
|
17
|
-
</li>
|
18
|
-
</ul>
|
19
|
-
</div>
|
20
|
-
<div class="form-group" v-cloak>
|
21
|
-
<%= f.label :query_id, "Add Chart" %>
|
22
|
-
<%= select_tag :query_id, nil, {include_blank: true, placeholder: "Select chart"} %>
|
23
|
-
</div>
|
24
|
-
<p style="padding-bottom: 140px;" v-cloak>
|
25
|
-
<% if @dashboard.persisted? %>
|
26
|
-
<%= link_to "Delete", dashboard_path(@dashboard), method: :delete, "data-confirm" => "Are you sure?", class: "btn btn-danger"%>
|
27
|
-
<% end %>
|
28
|
-
<%= f.submit "Save", class: "btn btn-success" %>
|
29
|
-
<%= link_to "Back", :back, class: "btn btn-link" %>
|
30
|
-
</p>
|
31
|
-
<% end %>
|
32
|
-
|
33
|
-
<script>
|
34
|
-
<%= blazer_js_var "queries", Blazer::Query.named.order(:name).select("id, name").map { |q| {text: q.name, value: q.id} } %>
|
35
|
-
<%= blazer_js_var "dashboardQueries", @queries || @dashboard.dashboard_queries.order(:position).map(&:query) %>
|
36
|
-
|
37
|
-
var app = new Vue({
|
38
|
-
el: "#app",
|
39
|
-
data: {
|
40
|
-
queries: dashboardQueries
|
41
|
-
},
|
42
|
-
methods: {
|
43
|
-
remove: function(index) {
|
44
|
-
this.queries.splice(index, 1)
|
45
|
-
}
|
46
|
-
},
|
47
|
-
mounted: function() {
|
48
|
-
$("#query_id").selectize({
|
49
|
-
options: queries,
|
50
|
-
highlight: false,
|
51
|
-
maxOptions: 100,
|
52
|
-
onChange: function(val) {
|
53
|
-
if (val) {
|
54
|
-
var item = this.getItem(val)
|
55
|
-
|
56
|
-
// if duplicate query is added, remove the first one
|
57
|
-
for (var i = 0; i < app.queries.length; i++) {
|
58
|
-
if (app.queries[i].id == val) {
|
59
|
-
app.queries.splice(i, 1)
|
60
|
-
break
|
61
|
-
}
|
62
|
-
}
|
63
|
-
|
64
|
-
app.queries.push({id: val, name: item.text()})
|
65
|
-
this.setValue("")
|
66
|
-
}
|
67
|
-
}
|
68
|
-
})
|
69
|
-
}
|
70
|
-
})
|
71
|
-
Sortable.create($("#queries").get(0), {
|
72
|
-
onEnd: function(e) {
|
73
|
-
app.queries.splice(e.newIndex, 0, app.queries.splice(e.oldIndex, 1)[0])
|
74
|
-
}
|
75
|
-
})
|
76
|
-
</script>
|