bnb_blazer 0.4.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/app/overrides/controllers/blazer/base_controller_override.rb +133 -0
  3. data/app/views/{blazer → bnb_blazer}/_variables.html.haml +0 -0
  4. data/app/views/{blazer → bnb_blazer}/checks/_form.html.haml +0 -0
  5. data/app/views/{blazer → bnb_blazer}/checks/edit.html.haml +0 -0
  6. data/app/views/{blazer → bnb_blazer}/checks/index.html.haml +0 -0
  7. data/app/views/{blazer → bnb_blazer}/checks/new.html.haml +0 -0
  8. data/app/views/{blazer → bnb_blazer}/dashboards/_form.html.haml +0 -0
  9. data/app/views/{blazer → bnb_blazer}/dashboards/edit.html.haml +0 -0
  10. data/app/views/{blazer → bnb_blazer}/dashboards/new.html.haml +0 -0
  11. data/app/views/{blazer → bnb_blazer}/dashboards/show.html.haml +2 -2
  12. data/app/views/{blazer → bnb_blazer}/queries/_form.html.haml +0 -0
  13. data/app/views/{blazer → bnb_blazer}/queries/edit.html.haml +0 -0
  14. data/app/views/{blazer → bnb_blazer}/queries/home.html.haml +0 -0
  15. data/app/views/{blazer → bnb_blazer}/queries/new.html.haml +0 -0
  16. data/app/views/{blazer → bnb_blazer}/queries/run.html.haml +0 -0
  17. data/app/views/{blazer → bnb_blazer}/queries/show.html.haml +2 -2
  18. data/app/views/layouts/{blazer → bnb_blazer}/_footer.html.haml +0 -0
  19. data/app/views/layouts/{blazer → bnb_blazer}/_navbar.html.haml +0 -0
  20. data/app/views/layouts/{blazer → bnb_blazer}/application.html.haml +4 -4
  21. data/lib/bnb_blazer.rb +1 -0
  22. data/lib/bnb_blazer/engine.rb +5 -0
  23. data/lib/bnb_blazer/version.rb +1 -1
  24. metadata +22 -94
  25. data/.docker-development-vars +0 -1
  26. data/.gitignore +0 -34
  27. data/.rspec +0 -3
  28. data/.ruby-version +0 -1
  29. data/.travis.yml +0 -6
  30. data/Gemfile +0 -54
  31. data/Gemfile.lock +0 -233
  32. data/LICENSE.txt +0 -21
  33. data/README.md +0 -35
  34. data/app/assets/config/manifest.js +0 -3
  35. data/app/assets/images/.keep +0 -0
  36. data/app/assets/images/bnb_intel_logo.png +0 -0
  37. data/app/assets/stylesheets/application.css +0 -83
  38. data/app/channels/application_cable/channel.rb +0 -4
  39. data/app/channels/application_cable/connection.rb +0 -4
  40. data/app/controllers/application_controller.rb +0 -2
  41. data/app/controllers/concerns/.keep +0 -0
  42. data/app/helpers/application_helper.rb +0 -2
  43. data/app/jobs/application_job.rb +0 -2
  44. data/app/mailers/application_mailer.rb +0 -4
  45. data/app/models/application_record.rb +0 -3
  46. data/app/models/concerns/.keep +0 -0
  47. data/app/models/user.rb +0 -2
  48. data/bin/bundle +0 -3
  49. data/bin/console +0 -14
  50. data/bin/rails +0 -9
  51. data/bin/rake +0 -9
  52. data/bin/setup +0 -36
  53. data/bin/spring +0 -17
  54. data/bin/update +0 -31
  55. data/bin/yarn +0 -11
  56. data/bnb_blazer.gemspec +0 -28
  57. data/config.ru +0 -5
  58. data/config/application.rb +0 -19
  59. data/config/blazer.yml +0 -79
  60. data/config/boot.rb +0 -4
  61. data/config/cable.yml +0 -10
  62. data/config/credentials.yml.enc +0 -1
  63. data/config/database.yml +0 -19
  64. data/config/environment.rb +0 -5
  65. data/config/environments/development.rb +0 -61
  66. data/config/environments/production.rb +0 -94
  67. data/config/environments/test.rb +0 -46
  68. data/config/initializers/application_controller_renderer.rb +0 -8
  69. data/config/initializers/assets.rb +0 -14
  70. data/config/initializers/backtrace_silencers.rb +0 -7
  71. data/config/initializers/content_security_policy.rb +0 -25
  72. data/config/initializers/cookies_serializer.rb +0 -5
  73. data/config/initializers/filter_parameter_logging.rb +0 -4
  74. data/config/initializers/inflections.rb +0 -16
  75. data/config/initializers/mime_types.rb +0 -4
  76. data/config/initializers/wrap_parameters.rb +0 -14
  77. data/config/locales/en.yml +0 -33
  78. data/config/puma.rb +0 -37
  79. data/config/routes.rb +0 -3
  80. data/config/spring.rb +0 -6
  81. data/config/storage.yml +0 -34
  82. data/db/migrate/20210309231658_install_blazer.rb +0 -47
  83. data/db/migrate/20210309231908_create_users.rb +0 -13
  84. data/db/schema.rb +0 -85
  85. data/db/seeds.rb +0 -45
  86. data/docker-compose.yml +0 -22
  87. data/lib/tasks/.keep +0 -0
  88. data/log/.keep +0 -0
  89. data/package.json +0 -5
  90. data/public/404.html +0 -67
  91. data/public/422.html +0 -67
  92. data/public/500.html +0 -66
  93. data/public/apple-touch-icon-precomposed.png +0 -0
  94. data/public/apple-touch-icon.png +0 -0
  95. data/public/favicon.ico +0 -0
  96. data/public/robots.txt +0 -1
  97. data/tmp/.keep +0 -0
  98. data/vendor/.keep +0 -0
@@ -1,46 +0,0 @@
1
- Rails.application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
6
- # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
8
- config.cache_classes = true
9
-
10
- # Do not eager load code on boot. This avoids loading your whole application
11
- # just for the purpose of running a single test. If you are using a tool that
12
- # preloads Rails for running tests, you may have to set it to true.
13
- config.eager_load = false
14
-
15
- # Configure public file server for tests with Cache-Control for performance.
16
- config.public_file_server.enabled = true
17
- config.public_file_server.headers = {
18
- 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
19
- }
20
-
21
- # Show full error reports and disable caching.
22
- config.consider_all_requests_local = true
23
- config.action_controller.perform_caching = false
24
-
25
- # Raise exceptions instead of rendering exception templates.
26
- config.action_dispatch.show_exceptions = false
27
-
28
- # Disable request forgery protection in test environment.
29
- config.action_controller.allow_forgery_protection = false
30
-
31
- # Store uploaded files on the local file system in a temporary directory
32
- config.active_storage.service = :test
33
-
34
- config.action_mailer.perform_caching = false
35
-
36
- # Tell Action Mailer not to deliver emails to the real world.
37
- # The :test delivery method accumulates sent emails in the
38
- # ActionMailer::Base.deliveries array.
39
- config.action_mailer.delivery_method = :test
40
-
41
- # Print deprecation notices to the stderr.
42
- config.active_support.deprecation = :stderr
43
-
44
- # Raises error for missing translations
45
- # config.action_view.raise_on_missing_translations = true
46
- end
@@ -1,8 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # ActiveSupport::Reloader.to_prepare do
4
- # ApplicationController.renderer.defaults.merge!(
5
- # http_host: 'example.org',
6
- # https: false
7
- # )
8
- # end
@@ -1,14 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Version of your assets, change this if you want to expire all your assets.
4
- Rails.application.config.assets.version = '1.0'
5
-
6
- # Add additional assets to the asset load path.
7
- # Rails.application.config.assets.paths << Emoji.images_path
8
- # Add Yarn node_modules folder to the asset load path.
9
- Rails.application.config.assets.paths << Rails.root.join('node_modules')
10
-
11
- # Precompile additional assets.
12
- # application.js, application.css, and all non-JS/CSS in the app/assets
13
- # folder are already added.
14
- # Rails.application.config.assets.precompile += %w( admin.js admin.css )
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
-
6
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- # Rails.backtrace_cleaner.remove_silencers!
@@ -1,25 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Define an application-wide content security policy
4
- # For further information see the following documentation
5
- # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
6
-
7
- # Rails.application.config.content_security_policy do |policy|
8
- # policy.default_src :self, :https
9
- # policy.font_src :self, :https, :data
10
- # policy.img_src :self, :https, :data
11
- # policy.object_src :none
12
- # policy.script_src :self, :https
13
- # policy.style_src :self, :https
14
-
15
- # # Specify URI for violation reports
16
- # # policy.report_uri "/csp-violation-report-endpoint"
17
- # end
18
-
19
- # If you are using UJS then enable automatic nonce generation
20
- # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
21
-
22
- # Report CSP violations to a specified URI
23
- # For further information see the following documentation:
24
- # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
25
- # Rails.application.config.content_security_policy_report_only = true
@@ -1,5 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Specify a serializer for the signed and encrypted cookie jars.
4
- # Valid options are :json, :marshal, and :hybrid.
5
- Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -1,4 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Configure sensitive parameters which will be filtered from the log file.
4
- Rails.application.config.filter_parameters += [:password]
@@ -1,16 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new inflection rules using the following format. Inflections
4
- # are locale specific, and you may define rules for as many different
5
- # locales as you wish. All of these examples are active by default:
6
- # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
- # inflect.plural /^(ox)$/i, '\1en'
8
- # inflect.singular /^(ox)en/i, '\1'
9
- # inflect.irregular 'person', 'people'
10
- # inflect.uncountable %w( fish sheep )
11
- # end
12
-
13
- # These inflection rules are supported but not enabled by default:
14
- # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
- # inflect.acronym 'RESTful'
16
- # end
@@ -1,4 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
@@ -1,14 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # This file contains settings for ActionController::ParamsWrapper which
4
- # is enabled by default.
5
-
6
- # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
- ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters format: [:json]
9
- end
10
-
11
- # To enable root element in JSON for ActiveRecord objects.
12
- # ActiveSupport.on_load(:active_record) do
13
- # self.include_root_in_json = true
14
- # end
@@ -1,33 +0,0 @@
1
- # Files in the config/locales directory are used for internationalization
2
- # and are automatically loaded by Rails. If you want to use locales other
3
- # than English, add the necessary files in this directory.
4
- #
5
- # To use the locales, use `I18n.t`:
6
- #
7
- # I18n.t 'hello'
8
- #
9
- # In views, this is aliased to just `t`:
10
- #
11
- # <%= t('hello') %>
12
- #
13
- # To use a different locale, set it with `I18n.locale`:
14
- #
15
- # I18n.locale = :es
16
- #
17
- # This would use the information in config/locales/es.yml.
18
- #
19
- # The following keys must be escaped otherwise they will not be retrieved by
20
- # the default I18n backend:
21
- #
22
- # true, false, on, off, yes, no
23
- #
24
- # Instead, surround them with single quotes.
25
- #
26
- # en:
27
- # 'true': 'foo'
28
- #
29
- # To learn more, please read the Rails Internationalization guide
30
- # available at http://guides.rubyonrails.org/i18n.html.
31
-
32
- en:
33
- hello: "Hello world"
data/config/puma.rb DELETED
@@ -1,37 +0,0 @@
1
- # Puma can serve each request in a thread from an internal thread pool.
2
- # The `threads` method setting takes two numbers: a minimum and maximum.
3
- # Any libraries that use thread pools should be configured to match
4
- # the maximum value specified for Puma. Default is set to 5 threads for minimum
5
- # and maximum; this matches the default thread size of Active Record.
6
- #
7
- threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8
- threads threads_count, threads_count
9
-
10
- # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
11
- #
12
- port ENV.fetch("PORT") { 3000 }
13
-
14
- # Specifies the `environment` that Puma will run in.
15
- #
16
- environment ENV.fetch("RAILS_ENV") { "development" }
17
-
18
- # Specifies the `pidfile` that Puma will use.
19
- pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
20
-
21
- # Specifies the number of `workers` to boot in clustered mode.
22
- # Workers are forked webserver processes. If using threads and workers together
23
- # the concurrency of the application would be max `threads` * `workers`.
24
- # Workers do not work on JRuby or Windows (both of which do not support
25
- # processes).
26
- #
27
- # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
28
-
29
- # Use the `preload_app!` method when specifying a `workers` number.
30
- # This directive tells Puma to first boot the application and load code
31
- # before forking the application. This takes advantage of Copy On Write
32
- # process behavior so workers use less memory.
33
- #
34
- # preload_app!
35
-
36
- # Allow puma to be restarted by `rails restart` command.
37
- plugin :tmp_restart
data/config/routes.rb DELETED
@@ -1,3 +0,0 @@
1
- Rails.application.routes.draw do
2
- mount Blazer::Engine, at: "blazer"
3
- end
data/config/spring.rb DELETED
@@ -1,6 +0,0 @@
1
- %w[
2
- .ruby-version
3
- .rbenv-vars
4
- tmp/restart.txt
5
- tmp/caching-dev.txt
6
- ].each { |path| Spring.watch(path) }
data/config/storage.yml DELETED
@@ -1,34 +0,0 @@
1
- test:
2
- service: Disk
3
- root: <%= Rails.root.join("tmp/storage") %>
4
-
5
- local:
6
- service: Disk
7
- root: <%= Rails.root.join("storage") %>
8
-
9
- # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10
- # amazon:
11
- # service: S3
12
- # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13
- # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14
- # region: us-east-1
15
- # bucket: your_own_bucket
16
-
17
- # Remember not to checkin your GCS keyfile to a repository
18
- # google:
19
- # service: GCS
20
- # project: your_project
21
- # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22
- # bucket: your_own_bucket
23
-
24
- # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25
- # microsoft:
26
- # service: AzureStorage
27
- # storage_account_name: your_account_name
28
- # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29
- # container: your_container_name
30
-
31
- # mirror:
32
- # service: Mirror
33
- # primary: local
34
- # mirrors: [ amazon, google, microsoft ]
@@ -1,47 +0,0 @@
1
- class InstallBlazer < ActiveRecord::Migration[5.2]
2
- def change
3
- create_table :blazer_queries do |t|
4
- t.references :creator
5
- t.string :name
6
- t.text :description
7
- t.text :statement
8
- t.string :data_source
9
- t.string :status
10
- t.timestamps null: false
11
- end
12
-
13
- create_table :blazer_audits do |t|
14
- t.references :user
15
- t.references :query
16
- t.text :statement
17
- t.string :data_source
18
- t.datetime :created_at
19
- end
20
-
21
- create_table :blazer_dashboards do |t|
22
- t.references :creator
23
- t.string :name
24
- t.timestamps null: false
25
- end
26
-
27
- create_table :blazer_dashboard_queries do |t|
28
- t.references :dashboard
29
- t.references :query
30
- t.integer :position
31
- t.timestamps null: false
32
- end
33
-
34
- create_table :blazer_checks do |t|
35
- t.references :creator
36
- t.references :query
37
- t.string :state
38
- t.string :schedule
39
- t.text :emails
40
- t.text :slack_channels
41
- t.string :check_type
42
- t.text :message
43
- t.datetime :last_run_at
44
- t.timestamps null: false
45
- end
46
- end
47
- end
@@ -1,13 +0,0 @@
1
- class CreateUsers < ActiveRecord::Migration[5.2]
2
- def change
3
- create_table :users do |t|
4
- t.string :first_name
5
- t.string :last_name
6
- t.boolean :subscriber
7
- t.date :birthday
8
- t.integer :credit_score
9
- t.string :favorite_color
10
- t.timestamps
11
- end
12
- end
13
- end
data/db/schema.rb DELETED
@@ -1,85 +0,0 @@
1
- # This file is auto-generated from the current state of the database. Instead
2
- # of editing this file, please use the migrations feature of Active Record to
3
- # incrementally modify your database, and then regenerate this schema definition.
4
- #
5
- # Note that this schema.rb definition is the authoritative source for your
6
- # database schema. If you need to create the application database on another
7
- # system, you should be using db:schema:load, not running all the migrations
8
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
- # you'll amass, the slower it'll run and the greater likelihood for issues).
10
- #
11
- # It's strongly recommended that you check this file into your version control system.
12
-
13
- ActiveRecord::Schema.define(version: 2021_03_09_231908) do
14
-
15
- # These are extensions that must be enabled in order to support this database
16
- enable_extension "plpgsql"
17
-
18
- create_table "blazer_audits", force: :cascade do |t|
19
- t.bigint "user_id"
20
- t.bigint "query_id"
21
- t.text "statement"
22
- t.string "data_source"
23
- t.datetime "created_at"
24
- t.index ["query_id"], name: "index_blazer_audits_on_query_id"
25
- t.index ["user_id"], name: "index_blazer_audits_on_user_id"
26
- end
27
-
28
- create_table "blazer_checks", force: :cascade do |t|
29
- t.bigint "creator_id"
30
- t.bigint "query_id"
31
- t.string "state"
32
- t.string "schedule"
33
- t.text "emails"
34
- t.text "slack_channels"
35
- t.string "check_type"
36
- t.text "message"
37
- t.datetime "last_run_at"
38
- t.datetime "created_at", null: false
39
- t.datetime "updated_at", null: false
40
- t.index ["creator_id"], name: "index_blazer_checks_on_creator_id"
41
- t.index ["query_id"], name: "index_blazer_checks_on_query_id"
42
- end
43
-
44
- create_table "blazer_dashboard_queries", force: :cascade do |t|
45
- t.bigint "dashboard_id"
46
- t.bigint "query_id"
47
- t.integer "position"
48
- t.datetime "created_at", null: false
49
- t.datetime "updated_at", null: false
50
- t.index ["dashboard_id"], name: "index_blazer_dashboard_queries_on_dashboard_id"
51
- t.index ["query_id"], name: "index_blazer_dashboard_queries_on_query_id"
52
- end
53
-
54
- create_table "blazer_dashboards", force: :cascade do |t|
55
- t.bigint "creator_id"
56
- t.string "name"
57
- t.datetime "created_at", null: false
58
- t.datetime "updated_at", null: false
59
- t.index ["creator_id"], name: "index_blazer_dashboards_on_creator_id"
60
- end
61
-
62
- create_table "blazer_queries", force: :cascade do |t|
63
- t.bigint "creator_id"
64
- t.string "name"
65
- t.text "description"
66
- t.text "statement"
67
- t.string "data_source"
68
- t.string "status"
69
- t.datetime "created_at", null: false
70
- t.datetime "updated_at", null: false
71
- t.index ["creator_id"], name: "index_blazer_queries_on_creator_id"
72
- end
73
-
74
- create_table "users", force: :cascade do |t|
75
- t.string "first_name"
76
- t.string "last_name"
77
- t.boolean "subscriber"
78
- t.date "birthday"
79
- t.integer "credit_score"
80
- t.string "favorite_color"
81
- t.datetime "created_at", null: false
82
- t.datetime "updated_at", null: false
83
- end
84
-
85
- end
data/db/seeds.rb DELETED
@@ -1,45 +0,0 @@
1
- # Small selection of colors so we can make a nice bar chart in Blazer
2
- user_favorite_colors = ["red", "green", "blue", "purple"]
3
-
4
- (1000 - User.count).times do
5
- User.create!(
6
- first_name: Faker::Name.first_name,
7
- last_name: Faker::Name.last_name,
8
- favorite_color: user_favorite_colors.sample,
9
- credit_score: rand(300..850),
10
- subscriber: [true, false].sample,
11
- birthday: Faker::Date.between(from: 30.years.ago, to: 20.years.ago)
12
- )
13
- end
14
-
15
- [
16
- {
17
- name: "Credit Score Scatter Plot",
18
- statement: "SELECT credit_score, COUNT(*) FROM users GROUP BY 1",
19
- status: "active"
20
- },
21
- {
22
- name: "Favorite Color Pie Chart",
23
- statement: "SELECT favorite_color, COUNT(*) AS pie FROM users GROUP BY 1",
24
- status: "active"
25
- },
26
- {
27
- name: "Subscriber Status Bar Chart",
28
- statement: "SELECT subscriber, COUNT(*) FROM users GROUP BY 1",
29
- status: "active"
30
- },
31
- ].each_with_index do |query_params, i|
32
- q = Blazer::Query.find_or_initialize_by(name: query_params[:name])
33
- q.assign_attributes(query_params)
34
- q.data_source = "main"
35
- q.save(validate: false)
36
- end
37
-
38
- dashboard = Blazer::Dashboard.find_or_create_by(name: "Dashboard Demo")
39
- [
40
- "Credit Score Scatter Plot",
41
- "Favorite Color Pie Chart",
42
- "Subscriber Status Bar Chart",
43
- ].each_with_index do |query_name, i|
44
- dashboard.dashboard_queries.create!(query_id: Blazer::Query.find_by(name: query_name).id, position: i)
45
- end