vertica_history 1.0.2 → 2.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f700cae6a26352a1b40f26efcc69e89f4d6fcf7
4
- data.tar.gz: e8a5d0d5f0c7851af65215e7dc4152adfc2c145d
3
+ metadata.gz: b303df8e623896e367c92d9042e27d58144d2e4b
4
+ data.tar.gz: 7a1c0adcbefa44cc7f5a80077063fe025c3720b6
5
5
  SHA512:
6
- metadata.gz: 622bb7f1eac799aff9b7f8f0aa58dd4358712268ebe5d6209e41c1e55a4e5eabe35fa6338eab07b89393363e36b380846bc5378d37ac1938d7d97fa0088d3489
7
- data.tar.gz: fd9eb13b7464e44c4385a24e74c8807acfd66afe0c2a79bbac3518271308ee9bf248aaf67322952b7bce0465d5e86f8b0f1bb4725b5d626c06a1ca4fa1a08ffa
6
+ metadata.gz: 88c91f059873a8c4f0b672da98053a5008fba4ef3dd6aa74c05ff2368fe5ef283d717797212d434979ca4206f435bab9d51c4d53f80cde5a66657a5658d92168
7
+ data.tar.gz: 7196eb81a544ac39cd1d423df04ebb718fd445b86b5129e94e2525ec538671399f5a0662a6a47b9df9cb55fe22cc9bed38476dd5d2c0dd24da9c1d690b1d22e7
@@ -0,0 +1,5 @@
1
+ function appendNewText(schema) {
2
+ var newText = " " + schema + " ";
3
+ var para = document.getElementById("q");
4
+ para.value = para.value + newText;
5
+ }
@@ -1,12 +1,14 @@
1
1
  module VerticaHistory
2
2
  class VerticaHistoryController < ApplicationController
3
3
  # before_filter { |c| c.authorize_ability :can_edit }
4
- before_filter :fetch_columns
4
+ # before_filter :fetch_columns, only: [:index, :view_history]
5
5
 
6
6
  def index
7
+ fetch_columns
7
8
  end
8
9
 
9
10
  def view_history
11
+ fetch_columns
10
12
  connection_configurations = {
11
13
  host: Rails.configuration.vertica_host,
12
14
  user: Rails.configuration.vertica_user,
@@ -111,6 +113,32 @@ module VerticaHistory
111
113
  redirect_to "/rails_admin/#{@model}/#{id}"
112
114
  end
113
115
 
116
+
117
+ def make_query
118
+ @other_schemas = Rails.configuration.other_vertica_schemas || nil
119
+ end
120
+
121
+ def query_results
122
+ connection_configurations = {
123
+ host: Rails.configuration.vertica_host,
124
+ user: Rails.configuration.vertica_user,
125
+ password: Rails.configuration.vertica_password,
126
+ ssl: Rails.configuration.vertica_ssl || true,
127
+ port: Rails.configuration.vertica_port || 5433,
128
+ database: Rails.configuration.vertica_database,
129
+ role: Rails.configuration.vertica_role,
130
+ search_path: Rails.configuration.vertica_search_path || nil,
131
+ row_style: Rails.configuration.vertica_row_style || :hash
132
+ }
133
+
134
+ connection = Vertica.connect(connection_configurations)
135
+ result = connection.query("#{params[:q]}")
136
+ @q = params[:q]
137
+ @columns = result.columns.map { |x| x.name }
138
+ @rows = result.rows
139
+ connection.close
140
+ end
141
+
114
142
  def fetch_columns
115
143
  @id = params['id']
116
144
  @model ||= params['class_name'].camelize.constantize
@@ -16,7 +16,11 @@
16
16
  <% end %>
17
17
 
18
18
  <br /><br />
19
- <%= f.submit(action_button, class: 'btn btn-primary') %>
19
+ <div class="pull-left btn-group">
20
+ <%= f.submit(action_button, class: 'btn btn-primary') %>
21
+ <%= link_to "Cancel", "/rails_admin/#{@model}/#{@id}", { class: 'btn btn-default' } %>
22
+ <%= link_to "Write Vertica Query", "/vertica_history/vertica_history_query", { class: 'btn btn-default' } %>
23
+ </div>
20
24
  <br /><br />
21
25
  <% end %>
22
26
 
@@ -1,7 +1,4 @@
1
1
  <h1>Select Attributes for Vertica History for <%= @model %> <%= @id %></h1>
2
2
  <div>Select Attributes you want to see in the table for the history of the records in vertica</div>
3
3
 
4
- <%= render partial: 'select_attributes', locals: { action_button: 'View History' } %>
5
-
6
- <div class="pull-left"><%= link_to "Cancel", "/rails_admin/#{@model}/#{@id}" %></div>
7
- </div>
4
+ <%= render partial: 'select_attributes', locals: { action_button: 'View History' } %>
@@ -0,0 +1,16 @@
1
+ <h1>Create a query that you want to submit to vertica for this stack</h1>
2
+
3
+ <%= form_tag({ :controller => '/vertica_history/vertica_history', :action => 'query_results' }, method: 'post', html: { class: 'form-inline attributes-select-form' }) do %>
4
+ <%= label_tag(:q, "Search for:") %>
5
+ <%= text_area_tag(:q, nil, {rows:'10', class: 'form-control'}) %>
6
+ <br>Click schema below to append it to your query</br>
7
+ <p>
8
+ <% @other_schemas.each do |schema| %>
9
+ <button type="button" onclick="appendNewText('<%=schema%>')" class="btn btn-info"><%=schema%></button>
10
+ <% end %>
11
+ <br>
12
+ <div class="btn-group">
13
+ <%= submit_tag("Search", {class: 'btn btn-primary'}) %>
14
+ <%= link_to "Cancel", "/rails_admin/", { class: 'btn btn-default' } %>
15
+ </div>
16
+ <% end %>
@@ -0,0 +1,27 @@
1
+ <h1>Submit another query that you want to submit to vertica for this stack</h1>
2
+
3
+ <%= form_tag({ :controller => '/vertica_history/vertica_history', :action => 'query_results' }, method: 'post', html: { class: 'form-inline attributes-select-form' }) do %>
4
+ <%= label_tag(:q, "Search for:") %>
5
+ <%= text_area_tag(:q, @q, {rows:'10', class: 'form-control'}) %>
6
+ <br>
7
+ <div class="btn-group">
8
+ <%= submit_tag("Search", {class: 'btn btn-primary'}) %>
9
+ <%= link_to "Cancel", "/rails_admin/", { class: 'btn btn-default' } %>
10
+ </div>
11
+ <% end %>
12
+ <br>
13
+ <table class="table table-striped table-bordered table-condensed text-center">
14
+ <tr>
15
+ <% @columns.each do |title| %>
16
+ <th class="text-center"><%= title %></th>
17
+ <% end %>
18
+ </tr>
19
+
20
+ <% @rows.each do |row| %>
21
+ <tr>
22
+ <% @columns.each do |column| %>
23
+ <td><%= row[column.to_sym] %></td>
24
+ <% end %>
25
+ </tr>
26
+ <% end %>
27
+ </table>
data/config/routes.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  VerticaHistory::Engine.routes.draw do
2
- get ':class_name/:id' => 'vertica_history#index', as: 'vertica_history_index'
2
+ get 'vertica_history_query' => 'vertica_history#make_query'
3
+ post 'vertica_history_query/query_results' => 'vertica_history#query_results'
4
+ get ':class_name/:id' => 'vertica_history#index'
3
5
  get ':class_name/:id/history' => 'vertica_history#view_history', as: 'vertica_history_view_history'
4
6
  end
@@ -1,3 +1,3 @@
1
1
  module VerticaHistory
2
- VERSION = "1.0.2"
2
+ VERSION = "2.0.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vertica_history
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Taylor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-03 00:00:00.000000000 Z
11
+ date: 2016-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -62,6 +62,7 @@ files:
62
62
  - Rakefile
63
63
  - app/assets/javascripts/application.js
64
64
  - app/assets/javascripts/vertica_history/application.js
65
+ - app/assets/javascripts/vertica_history/schema_buttons.js
65
66
  - app/assets/javascripts/vertica_history/select_all.js
66
67
  - app/assets/stylesheets/vertica_history/application.css.scss
67
68
  - app/assets/stylesheets/vertica_history/bootstrap-overrides.css.scss
@@ -74,6 +75,8 @@ files:
74
75
  - app/views/vertica_history/vertica_history/_filters.html.erb
75
76
  - app/views/vertica_history/vertica_history/_select_attributes.html.erb
76
77
  - app/views/vertica_history/vertica_history/index.html.erb
78
+ - app/views/vertica_history/vertica_history/make_query.html.erb
79
+ - app/views/vertica_history/vertica_history/query_results.html.erb
77
80
  - app/views/vertica_history/vertica_history/view_history.html.erb
78
81
  - config/routes.rb
79
82
  - lib/rails_admin/config/actions/vertica_history.rb
@@ -144,41 +147,41 @@ specification_version: 4
144
147
  summary: Gem to connect rails admin to Vertica to see history of any record
145
148
  test_files:
146
149
  - test/test_helper.rb
147
- - test/integration/navigation_test.rb
150
+ - test/dummy/public/422.html
151
+ - test/dummy/public/favicon.ico
152
+ - test/dummy/public/404.html
153
+ - test/dummy/public/500.html
154
+ - test/dummy/config.ru
155
+ - test/dummy/bin/bundle
156
+ - test/dummy/bin/rake
157
+ - test/dummy/bin/rails
158
+ - test/dummy/bin/setup
159
+ - test/dummy/Rakefile
160
+ - test/dummy/app/helpers/application_helper.rb
148
161
  - test/dummy/app/controllers/application_controller.rb
149
162
  - test/dummy/app/views/layouts/application.html.erb
150
163
  - test/dummy/app/assets/javascripts/application.js
151
164
  - test/dummy/app/assets/stylesheets/application.css
152
- - test/dummy/app/helpers/application_helper.rb
153
- - test/dummy/config/environments/production.rb
154
- - test/dummy/config/environments/development.rb
155
- - test/dummy/config/environments/test.rb
156
- - test/dummy/config/application.rb
157
- - test/dummy/config/database.yml
158
- - test/dummy/config/secrets.yml
165
+ - test/dummy/db/schema.rb
159
166
  - test/dummy/config/boot.rb
160
- - test/dummy/config/routes.rb
161
- - test/dummy/config/environment.rb
162
- - test/dummy/config/initializers/mime_types.rb
163
- - test/dummy/config/initializers/session_store.rb
167
+ - test/dummy/config/initializers/inflections.rb
168
+ - test/dummy/config/initializers/wrap_parameters.rb
164
169
  - test/dummy/config/initializers/backtrace_silencers.rb
170
+ - test/dummy/config/initializers/filter_parameter_logging.rb
165
171
  - test/dummy/config/initializers/cookies_serializer.rb
166
172
  - test/dummy/config/initializers/assets.rb
167
- - test/dummy/config/initializers/filter_parameter_logging.rb
168
- - test/dummy/config/initializers/wrap_parameters.rb
169
- - test/dummy/config/initializers/inflections.rb
173
+ - test/dummy/config/initializers/mime_types.rb
174
+ - test/dummy/config/initializers/session_store.rb
175
+ - test/dummy/config/application.rb
176
+ - test/dummy/config/database.yml
177
+ - test/dummy/config/routes.rb
178
+ - test/dummy/config/secrets.yml
170
179
  - test/dummy/config/locales/en.yml
171
- - test/dummy/bin/bundle
172
- - test/dummy/bin/rake
173
- - test/dummy/bin/setup
174
- - test/dummy/bin/rails
180
+ - test/dummy/config/environments/test.rb
181
+ - test/dummy/config/environments/development.rb
182
+ - test/dummy/config/environments/production.rb
183
+ - test/dummy/config/environment.rb
175
184
  - test/dummy/README.rdoc
176
- - test/dummy/Rakefile
177
- - test/dummy/db/schema.rb
178
- - test/dummy/public/500.html
179
- - test/dummy/public/422.html
180
- - test/dummy/public/404.html
181
- - test/dummy/public/favicon.ico
182
- - test/dummy/config.ru
185
+ - test/integration/navigation_test.rb
183
186
  - test/vertica_history_test.rb
184
187
  has_rdoc: