mat_views 0.2.0 → 0.3.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.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -4
  3. data/app/assets/images/mat_views/android-chrome-192x192.png +0 -0
  4. data/app/assets/images/mat_views/android-chrome-512x512.png +0 -0
  5. data/app/assets/images/mat_views/apple-touch-icon.png +0 -0
  6. data/app/assets/images/mat_views/favicon-16x16.png +0 -0
  7. data/app/assets/images/mat_views/favicon-32x32.png +0 -0
  8. data/app/assets/images/mat_views/favicon-48x48.png +0 -0
  9. data/app/assets/images/mat_views/favicon.ico +0 -0
  10. data/app/assets/images/mat_views/favicon.svg +18 -0
  11. data/app/assets/images/mat_views/logo.svg +18 -0
  12. data/app/assets/images/mat_views/mask-icon.svg +5 -0
  13. data/app/assets/stylesheets/mat_views/application.css +323 -12
  14. data/app/controllers/mat_views/admin/application_controller.rb +135 -0
  15. data/app/controllers/mat_views/admin/dashboard_controller.rb +32 -0
  16. data/app/controllers/mat_views/admin/mat_view_definitions_controller.rb +248 -0
  17. data/app/controllers/mat_views/admin/preferences_controller.rb +91 -0
  18. data/app/controllers/mat_views/admin/runs_controller.rb +74 -0
  19. data/app/helpers/mat_views/admin/ui_helper.rb +385 -0
  20. data/app/javascript/mat_views/application.js +8 -0
  21. data/app/javascript/mat_views/controllers/application.js +10 -0
  22. data/app/javascript/mat_views/controllers/details_controller.js +122 -0
  23. data/app/javascript/mat_views/controllers/drawer_controller.js +252 -0
  24. data/app/javascript/mat_views/controllers/filter_controller.js +90 -0
  25. data/app/javascript/mat_views/controllers/flash_controller.js +13 -0
  26. data/app/javascript/mat_views/controllers/index.js +10 -0
  27. data/app/javascript/mat_views/controllers/mv_confirm_controller.js +281 -0
  28. data/app/javascript/mat_views/controllers/submitter_controller.js +15 -0
  29. data/app/javascript/mat_views/controllers/tabs_controller.js +67 -0
  30. data/app/javascript/mat_views/controllers/timezone_controller.js +16 -0
  31. data/app/javascript/mat_views/controllers/tooltip_controller.js +328 -0
  32. data/app/javascript/mat_views/controllers/turbo_frame_lifecycle_controller.js +49 -0
  33. data/app/jobs/mat_views/application_job.rb +2 -2
  34. data/app/jobs/mat_views/create_view_job.rb +9 -8
  35. data/app/jobs/mat_views/delete_view_job.rb +8 -8
  36. data/app/jobs/mat_views/refresh_view_job.rb +8 -9
  37. data/app/models/concerns/mat_views_i18n.rb +139 -0
  38. data/app/models/mat_views/application_record.rb +1 -0
  39. data/app/models/mat_views/mat_view_definition.rb +12 -7
  40. data/app/models/mat_views/mat_view_run.rb +11 -13
  41. data/app/views/layouts/mat_views/_footer.html.erb +41 -0
  42. data/app/views/layouts/mat_views/_header.html.erb +25 -0
  43. data/app/views/layouts/mat_views/admin.html.erb +47 -0
  44. data/app/views/layouts/mat_views/turbo_frame.html.erb +3 -0
  45. data/app/views/mat_views/admin/dashboard/index.html.erb +33 -0
  46. data/app/views/mat_views/admin/mat_view_definitions/_definition_actions.html.erb +94 -0
  47. data/app/views/mat_views/admin/mat_view_definitions/_table.html.erb +48 -0
  48. data/app/views/mat_views/admin/mat_view_definitions/empty.html.erb +1 -0
  49. data/app/views/mat_views/admin/mat_view_definitions/form.html.erb +79 -0
  50. data/app/views/mat_views/admin/mat_view_definitions/index.html.erb +10 -0
  51. data/app/views/mat_views/admin/mat_view_definitions/show.html.erb +40 -0
  52. data/app/views/mat_views/admin/preferences/show.html.erb +50 -0
  53. data/app/views/mat_views/admin/runs/_table.html.erb +61 -0
  54. data/app/views/mat_views/admin/runs/index.html.erb +38 -0
  55. data/app/views/mat_views/admin/runs/show.html.erb +64 -0
  56. data/app/views/mat_views/admin/ui/_card.html.erb +15 -0
  57. data/app/views/mat_views/admin/ui/_details.html.erb +10 -0
  58. data/app/views/mat_views/admin/ui/_flash.html.erb +6 -0
  59. data/app/views/mat_views/admin/ui/_table.html.erb +8 -0
  60. data/config/importmap.rb +9 -0
  61. data/config/locales/en-AU-ocker.yml +187 -0
  62. data/config/locales/en-AU.yml +187 -0
  63. data/config/locales/en-BB.yml +187 -0
  64. data/config/locales/en-BD.yml +187 -0
  65. data/config/locales/en-BE.yml +187 -0
  66. data/config/locales/en-BORK.yml +187 -0
  67. data/config/locales/en-BS.yml +187 -0
  68. data/config/locales/en-BZ.yml +187 -0
  69. data/config/locales/en-CA.yml +187 -0
  70. data/config/locales/en-CM.yml +187 -0
  71. data/config/locales/en-CY.yml +187 -0
  72. data/config/locales/en-EG.yml +187 -0
  73. data/config/locales/en-FJ.yml +187 -0
  74. data/config/locales/en-GB.yml +187 -0
  75. data/config/locales/en-GH.yml +187 -0
  76. data/config/locales/en-GI.yml +187 -0
  77. data/config/locales/en-GM.yml +187 -0
  78. data/config/locales/en-GY.yml +187 -0
  79. data/config/locales/en-HK.yml +187 -0
  80. data/config/locales/en-IE.yml +187 -0
  81. data/config/locales/en-IN.yml +187 -0
  82. data/config/locales/en-JM.yml +187 -0
  83. data/config/locales/en-KE.yml +187 -0
  84. data/config/locales/en-LK.yml +187 -0
  85. data/config/locales/en-LOL.yml +187 -0
  86. data/config/locales/en-LR.yml +187 -0
  87. data/config/locales/en-MS.yml +187 -0
  88. data/config/locales/en-MT.yml +187 -0
  89. data/config/locales/en-MW.yml +187 -0
  90. data/config/locales/en-MY.yml +187 -0
  91. data/config/locales/en-NG.yml +187 -0
  92. data/config/locales/en-NP.yml +187 -0
  93. data/config/locales/en-NZ.yml +187 -0
  94. data/config/locales/en-PG.yml +187 -0
  95. data/config/locales/en-PH.yml +187 -0
  96. data/config/locales/en-PK.yml +187 -0
  97. data/config/locales/en-RW.yml +187 -0
  98. data/config/locales/en-SCOT.yml +187 -0
  99. data/config/locales/en-SG.yml +187 -0
  100. data/config/locales/en-SHAKESPEARE.yml +187 -0
  101. data/config/locales/en-SL.yml +187 -0
  102. data/config/locales/en-SS.yml +187 -0
  103. data/config/locales/en-TH.yml +187 -0
  104. data/config/locales/en-TT.yml +187 -0
  105. data/config/locales/en-TZ.yml +187 -0
  106. data/config/locales/en-UG.yml +187 -0
  107. data/config/locales/en-US-pirate.yml +187 -0
  108. data/config/locales/en-US.yml +187 -0
  109. data/config/locales/en-YODA.yml +187 -0
  110. data/config/locales/en-ZA.yml +187 -0
  111. data/config/locales/en-ZW.yml +187 -0
  112. data/config/locales/en.yml +187 -0
  113. data/config/routes.rb +27 -3
  114. data/lib/generators/mat_views/install/templates/create_mat_view_definitions.rb +7 -7
  115. data/lib/generators/mat_views/install/templates/create_mat_view_runs.rb +5 -5
  116. data/lib/mat_views/admin/auth_bridge.rb +93 -0
  117. data/lib/mat_views/admin/default_auth.rb +61 -0
  118. data/lib/mat_views/configuration.rb +9 -0
  119. data/lib/mat_views/engine.rb +50 -2
  120. data/lib/mat_views/helpers/ui_test_ids.rb +43 -0
  121. data/lib/mat_views/services/base_service.rb +46 -38
  122. data/lib/mat_views/services/check_matview_exists.rb +76 -0
  123. data/lib/mat_views/services/concurrent_refresh.rb +9 -6
  124. data/lib/mat_views/services/create_view.rb +15 -15
  125. data/lib/mat_views/services/delete_view.rb +8 -11
  126. data/lib/mat_views/services/regular_refresh.rb +6 -5
  127. data/lib/mat_views/services/swap_refresh.rb +11 -9
  128. data/lib/mat_views/version.rb +1 -1
  129. data/lib/mat_views.rb +10 -4
  130. data/lib/tasks/helpers.rb +13 -13
  131. data/lib/tasks/mat_views_tasks.rake +15 -15
  132. metadata +130 -5
@@ -8,7 +8,7 @@
8
8
  module MatViews
9
9
  module Services
10
10
  ##
11
- # Service that safely drops a PostgreSQL materialized view.
11
+ # Service that safely drops a PostgreSQL materialised view.
12
12
  #
13
13
  # Options:
14
14
  # - `cascade:` (Boolean, default: false) → drop with CASCADE instead of RESTRICT
@@ -21,10 +21,10 @@ module MatViews
21
21
  #
22
22
  # @example Drop a view if it exists
23
23
  # svc = MatViews::Services::DeleteView.new(defn, **options)
24
- # svc.run
24
+ # svc.call
25
25
  #
26
26
  # @example Force drop with CASCADE
27
- # MatViews::Services::DeleteView.new(defn, cascade: true).run
27
+ # MatViews::Services::DeleteView.new(defn, cascade: true).call
28
28
  #
29
29
  # @example via job, this is the typical usage and will create a run record in the DB
30
30
  # MatViews::Jobs::Adapter.enqueue(MatViews::Services::DeleteViewJob, definition.id, **options)
@@ -77,7 +77,7 @@ module MatViews
77
77
 
78
78
  ##
79
79
  # Assign the request parameters.
80
- # Called by {#run} before {#prepare}.
80
+ # Called by {#call} before {#prepare}.
81
81
  # Sets `concurrent: true` in the request hash.
82
82
  #
83
83
  # @api private
@@ -88,16 +88,13 @@ module MatViews
88
88
  end
89
89
 
90
90
  ##
91
- # Validate name and existence depending on options.
91
+ # Validation step (invoked by BaseService#call before execution).
92
+ # Empty for this service as no other preparation is needed.
92
93
  #
93
94
  # @api private
94
- # @return [MatViews::ServiceResponse, nil]
95
95
  #
96
- def prepare
97
- raise_err "Invalid view name format: #{definition.name.inspect}" unless valid_name?
98
-
99
- nil
100
- end
96
+ # @return [void]
97
+ def prepare; end
101
98
 
102
99
  ##
103
100
  # Build the SQL DROP statement.
@@ -23,7 +23,7 @@ module MatViews
23
23
  #
24
24
  # @example Direct usage
25
25
  # svc = MatViews::Services::RegularRefresh.new(definition, **options)
26
- # response = svc.run
26
+ # response = svc.call
27
27
  # response.success? # => true/false
28
28
  #
29
29
  # @example via job, this is the typical usage and will create a run record in the DB
@@ -62,13 +62,14 @@ module MatViews
62
62
  end
63
63
 
64
64
  ##
65
- # Validate name and existence of the materialized view.
65
+ # Validation step (invoked by BaseService#call before execution).
66
+ # Ensures view exists.
66
67
  #
67
68
  # @api private
68
- # @return [MatViews::ServiceResponse, nil]
69
+ #
70
+ # @return [void]
69
71
  #
70
72
  def prepare
71
- raise_err "Invalid view name format: #{definition.name.inspect}" unless valid_name?
72
73
  raise_err "Materialized view #{schema}.#{rel} does not exist" unless view_exists?
73
74
 
74
75
  nil
@@ -76,7 +77,7 @@ module MatViews
76
77
 
77
78
  ##
78
79
  # Assign the request parameters.
79
- # Called by {#run} before {#prepare}.
80
+ # Called by {#call} before {#prepare}.
80
81
  #
81
82
  # @api private
82
83
  # @return [void]
@@ -10,10 +10,10 @@ require 'securerandom'
10
10
  module MatViews
11
11
  module Services
12
12
  ##
13
- # Service that performs a **swap-style refresh** of a materialized view.
13
+ # Service that performs a **swap-style refresh** of a materialised view.
14
14
  #
15
15
  # Instead of locking the existing view, this strategy builds a new
16
- # temporary materialized view and atomically swaps it in. This approach
16
+ # temporary materialised view and atomically swaps it in. This approach
17
17
  # minimizes downtime and allows for safer rebuilds of large views.
18
18
  #
19
19
  # Steps:
@@ -31,7 +31,7 @@ module MatViews
31
31
  #
32
32
  # @example Direct usage
33
33
  # svc = MatViews::Services::SwapRefresh.new(definition, **options)
34
- # response = svc.run
34
+ # response = svc.call
35
35
  # response.success? # => true/false
36
36
  #
37
37
  # @example via job, this is the typical usage and will create a run record in the DB
@@ -63,12 +63,14 @@ module MatViews
63
63
  end
64
64
 
65
65
  ##
66
- # Ensure name validity and existence of original view.
66
+ # Validation step (invoked by BaseService#call before execution).
67
+ # Ensures view exists.
67
68
  #
68
69
  # @api private
69
- # @return [MatViews::ServiceResponse, nil]
70
+ #
71
+ # @return [void]
72
+ #
70
73
  def prepare
71
- raise_err "Invalid view name format: #{definition.name.inspect}" unless valid_name?
72
74
  raise_err "Materialized view #{schema}.#{rel} does not exist" unless view_exists?
73
75
 
74
76
  nil
@@ -76,7 +78,7 @@ module MatViews
76
78
 
77
79
  ##
78
80
  # Assign the request parameters.
79
- # Called by {#run} before {#prepare}.
81
+ # Called by {#call} before {#prepare}.
80
82
  #
81
83
  # @api private
82
84
  # @return [void]
@@ -124,7 +126,7 @@ module MatViews
124
126
  end
125
127
 
126
128
  ##
127
- # Quote the temporary materialized view name.
129
+ # Quote the temporary materialised view name.
128
130
  #
129
131
  # @api private
130
132
  # @return [String] quoted temporary view name
@@ -133,7 +135,7 @@ module MatViews
133
135
  end
134
136
 
135
137
  ##
136
- # Quote the original materialized view name.
138
+ # Quote the original materialised view name.
137
139
  #
138
140
  # @api private
139
141
  # @return [String] quoted original view name
@@ -17,5 +17,5 @@ module MatViews
17
17
  # - PATCH: Backwards-compatible bug fixes
18
18
  #
19
19
  # @return [String] the current gem version
20
- VERSION = '0.2.0'
20
+ VERSION = '0.3.0'
21
21
  end
data/lib/mat_views.rb CHANGED
@@ -8,6 +8,7 @@
8
8
  require 'ext/exception'
9
9
  require 'mat_views/version'
10
10
  require 'mat_views/engine'
11
+ require 'mat_views/helpers/ui_test_ids'
11
12
  require 'mat_views/configuration'
12
13
  require 'mat_views/jobs/adapter'
13
14
  require 'mat_views/service_response'
@@ -17,13 +18,16 @@ require 'mat_views/services/regular_refresh'
17
18
  require 'mat_views/services/concurrent_refresh'
18
19
  require 'mat_views/services/swap_refresh'
19
20
  require 'mat_views/services/delete_view'
21
+ require 'mat_views/services/check_matview_exists'
22
+ require 'mat_views/admin/auth_bridge'
23
+ require 'mat_views/admin/default_auth'
20
24
 
21
25
  ##
22
26
  # MatViews is a Rails engine that provides first-class support for
23
- # PostgreSQL materialized views in Rails applications.
27
+ # PostgreSQL materialised views in Rails applications.
24
28
  #
25
29
  # Features include:
26
- # - Declarative definitions for materialized views
30
+ # - Declarative definitions for materialised views
27
31
  # - Safe creation, refresh (regular, concurrent, swap), and deletion
28
32
  # - Background job integration (ActiveJob, Sidekiq, Resque)
29
33
  # - Tracking of run history and metrics
@@ -36,7 +40,7 @@ require 'mat_views/services/delete_view'
36
40
  # end
37
41
  #
38
42
  # Once mounted, Rails apps can leverage MatViews services and jobs
39
- # to manage materialized views consistently.
43
+ # to manage materialised views consistently.
40
44
  module MatViews
41
45
  class << self
42
46
  # Global configuration for MatViews
@@ -48,11 +52,13 @@ module MatViews
48
52
  # Example:
49
53
  # MatViews.configure do |config|
50
54
  # config.job_adapter = :sidekiq
51
- # config.job_queue = :materialized
55
+ # config.job_queue = :materialised
52
56
  # end
53
57
  def configure
54
58
  @configuration ||= Configuration.new
55
59
  yield(configuration)
60
+
61
+ configuration.admin_ui[:row_count_strategy] ||= :none
56
62
  end
57
63
  end
58
64
  end
data/lib/tasks/helpers.rb CHANGED
@@ -13,7 +13,7 @@ module MatViews
13
13
  # - Parsing boolean/flag-like arguments
14
14
  # - Confirmation prompts
15
15
  # - Enqueueing background jobs for create, refresh, and delete operations
16
- # - Looking up materialized view definitions
16
+ # - Looking up materialised view definitions
17
17
  #
18
18
  # By extracting this logic, Rake tasks can remain clean and declarative.
19
19
  module Helpers
@@ -59,7 +59,7 @@ module MatViews
59
59
  str.to_sym
60
60
  end
61
61
 
62
- # Check if a materialized view exists in schema.
62
+ # Check if a materialised view exists in schema.
63
63
  # @param rel [String] relation name
64
64
  # @param schema [String] schema name
65
65
  # @return [Boolean]
@@ -110,7 +110,7 @@ module MatViews
110
110
  # Otherwise, prompts user for confirmation and raises if declined.
111
111
  def confirm!(message, skip: false)
112
112
  if skip
113
- logger.info("[mat_views] #{message} confirmation skipped.")
113
+ logger.info("[mat_views] #{message} - confirmation skipped.")
114
114
  return
115
115
  end
116
116
 
@@ -125,31 +125,31 @@ module MatViews
125
125
 
126
126
  # Enqueue a CreateView job for given definition.
127
127
  #
128
- # @param definition_id [Integer] MatViewDefinition ID
128
+ # @param mat_view_definition_id [Integer] MatViewDefinition ID
129
129
  # @param force [Boolean] whether to force creation
130
130
  # @param row_count_strategy [Symbol] :estimated or :exact or :none
131
131
  # @return [void]
132
- def enqueue_create(definition_id, force, row_count_strategy)
132
+ def enqueue_create(mat_view_definition_id, force, row_count_strategy)
133
133
  MatViews::Jobs::Adapter.enqueue(
134
134
  MatViews::CreateViewJob,
135
135
  queue: MatViews.configuration.job_queue || :default,
136
- args: [definition_id, force, row_count_strategy]
136
+ args: [mat_view_definition_id, force, row_count_strategy]
137
137
  )
138
138
  end
139
139
 
140
140
  # Enqueue a RefreshView job for given definition.
141
141
  #
142
- # @param definition_id [Integer] MatViewDefinition ID
142
+ # @param mat_view_definition_id [Integer] MatViewDefinition ID
143
143
  # @param row_count_strategy [Symbol] :estimated or :exact
144
144
  # @return [void]
145
145
  #
146
146
  # This method allows scheduling a refresh operation with the specified row count strategy.
147
147
  # It uses the configured job adapter to enqueue the job.
148
- def enqueue_refresh(definition_id, row_count_strategy)
148
+ def enqueue_refresh(mat_view_definition_id, row_count_strategy)
149
149
  MatViews::Jobs::Adapter.enqueue(
150
150
  MatViews::RefreshViewJob,
151
151
  queue: MatViews.configuration.job_queue || :default,
152
- args: [definition_id, row_count_strategy]
152
+ args: [mat_view_definition_id, row_count_strategy]
153
153
  )
154
154
  end
155
155
 
@@ -166,18 +166,18 @@ module MatViews
166
166
 
167
167
  # Enqueue a DeleteView job for given definition.
168
168
  #
169
- # @param definition_id [Integer] MatViewDefinition ID
169
+ # @param mat_view_definition_id [Integer] MatViewDefinition ID
170
170
  # @param cascade [Boolean] whether to drop with CASCADE
171
171
  # @param row_count_strategy [Symbol] :estimated or :exact or :none
172
172
  # @return [void]
173
173
  #
174
- # This method schedules a job to delete the materialized view, optionally with CASCADE.
174
+ # This method schedules a job to delete the materialised view, optionally with CASCADE.
175
175
  # It uses the configured job adapter to enqueue the job.
176
- def enqueue_delete(definition_id, cascade, row_count_strategy)
176
+ def enqueue_delete(mat_view_definition_id, cascade, row_count_strategy)
177
177
  MatViews::Jobs::Adapter.enqueue(
178
178
  MatViews::DeleteViewJob,
179
179
  queue: MatViews.configuration.job_queue || :default,
180
- args: [definition_id, cascade, row_count_strategy]
180
+ args: [mat_view_definition_id, cascade, row_count_strategy]
181
181
  )
182
182
  end
183
183
  end
@@ -22,22 +22,22 @@ namespace :mat_views do
22
22
  end
23
23
 
24
24
  desc 'Enqueue a CREATE for a specific view by its definition ID'
25
- task :create_by_id, %i[definition_id force row_count_strategy yes] => :environment do |_t, args|
26
- raise 'mat_views:create_by_id requires a definition_id parameter' if args[:definition_id].to_s.strip.empty?
25
+ task :create_by_id, %i[mat_view_definition_id force row_count_strategy yes] => :environment do |_t, args|
26
+ raise 'mat_views:create_by_id requires a mat_view_definition_id parameter' if args[:mat_view_definition_id].to_s.strip.empty?
27
27
 
28
28
  rcs = helpers.parse_row_count_strategy(args[:row_count_strategy])
29
29
  force = helpers.parse_force?(args[:force])
30
30
  skip = helpers.skip_confirm?(args[:yes])
31
31
 
32
- defn = MatViews::MatViewDefinition.find_by(id: args[:definition_id])
33
- raise "No MatViews::MatViewDefinition found for id=#{args[:definition_id]}" unless defn
32
+ defn = MatViews::MatViewDefinition.find_by(id: args[:mat_view_definition_id])
33
+ raise "No MatViews::MatViewDefinition found for id=#{args[:mat_view_definition_id]}" unless defn
34
34
 
35
35
  helpers.confirm!("Enqueue CREATE for id=#{defn.id} (#{defn.name}), force=#{force}, row_count_strategy=#{rcs}", skip: skip)
36
36
  helpers.enqueue_create(defn.id, force, rcs)
37
37
  helpers.logger.info("[mat_views] Enqueued CreateViewJob for definition ##{defn.id} (#{defn.name}), force=#{force}, row_count_strategy=#{rcs}.")
38
38
  end
39
39
 
40
- desc 'Enqueue CREATE jobs for ALL defined materialized views'
40
+ desc 'Enqueue CREATE jobs for ALL defined materialised views'
41
41
  task :create_all, %i[force row_count_strategy yes] => :environment do |_t, args|
42
42
  rcs = helpers.parse_row_count_strategy(args[:row_count_strategy])
43
43
  force = helpers.parse_force?(args[:force])
@@ -69,21 +69,21 @@ namespace :mat_views do
69
69
  end
70
70
 
71
71
  desc 'Enqueue a REFRESH for a specific view by its definition ID'
72
- task :refresh_by_id, %i[definition_id row_count_strategy yes] => :environment do |_t, args|
73
- raise 'mat_views:refresh_by_id requires a definition_id parameter' if args[:definition_id].to_s.strip.empty?
72
+ task :refresh_by_id, %i[mat_view_definition_id row_count_strategy yes] => :environment do |_t, args|
73
+ raise 'mat_views:refresh_by_id requires a mat_view_definition_id parameter' if args[:mat_view_definition_id].to_s.strip.empty?
74
74
 
75
75
  rcs = helpers.parse_row_count_strategy(args[:row_count_strategy])
76
76
  skip = helpers.skip_confirm?(args[:yes])
77
77
 
78
- defn = MatViews::MatViewDefinition.find_by(id: args[:definition_id])
79
- raise "No MatViews::MatViewDefinition found for id=#{args[:definition_id]}" unless defn
78
+ defn = MatViews::MatViewDefinition.find_by(id: args[:mat_view_definition_id])
79
+ raise "No MatViews::MatViewDefinition found for id=#{args[:mat_view_definition_id]}" unless defn
80
80
 
81
81
  helpers.confirm!("Enqueue REFRESH for id=#{defn.id} (#{defn.name}), row_count_strategy=#{rcs}", skip: skip)
82
82
  helpers.enqueue_refresh(defn.id, rcs)
83
83
  helpers.logger.info("[mat_views] Enqueued RefreshViewJob for definition ##{defn.id} (#{defn.name}), row_count_strategy=#{rcs}.")
84
84
  end
85
85
 
86
- desc 'Enqueue REFRESH jobs for ALL defined materialized views'
86
+ desc 'Enqueue REFRESH jobs for ALL defined materialised views'
87
87
  task :refresh_all, %i[row_count_strategy yes] => :environment do |_t, args|
88
88
  rcs = helpers.parse_row_count_strategy(args[:row_count_strategy])
89
89
  skip = helpers.skip_confirm?(args[:yes])
@@ -115,22 +115,22 @@ namespace :mat_views do
115
115
  end
116
116
 
117
117
  desc 'Enqueue a DELETE (DROP MATERIALIZED VIEW) for a specific view by its definition ID'
118
- task :delete_by_id, %i[definition_id cascade row_count_strategy yes] => :environment do |_t, args|
119
- raise 'mat_views:delete_by_id requires a definition_id parameter' if args[:definition_id].to_s.strip.empty?
118
+ task :delete_by_id, %i[mat_view_definition_id cascade row_count_strategy yes] => :environment do |_t, args|
119
+ raise 'mat_views:delete_by_id requires a mat_view_definition_id parameter' if args[:mat_view_definition_id].to_s.strip.empty?
120
120
 
121
121
  rcs = helpers.parse_row_count_strategy(args[:row_count_strategy])
122
122
  cascade = helpers.parse_cascade?(args[:cascade])
123
123
  skip = helpers.skip_confirm?(args[:yes])
124
124
 
125
- defn = MatViews::MatViewDefinition.find_by(id: args[:definition_id])
126
- raise "No MatViews::MatViewDefinition found for id=#{args[:definition_id]}" unless defn
125
+ defn = MatViews::MatViewDefinition.find_by(id: args[:mat_view_definition_id])
126
+ raise "No MatViews::MatViewDefinition found for id=#{args[:mat_view_definition_id]}" unless defn
127
127
 
128
128
  helpers.confirm!("Enqueue DELETE for id=#{defn.id} (#{defn.name}), cascade=#{cascade}, row_count_strategy=#{rcs}", skip: skip)
129
129
  helpers.enqueue_delete(defn.id, cascade, rcs)
130
130
  helpers.logger.info("[mat_views] Enqueued DeleteViewJob for definition ##{defn.id} (#{defn.name}), cascade=#{cascade}, row_count_strategy=#{rcs}.")
131
131
  end
132
132
 
133
- desc 'Enqueue DELETE jobs for ALL defined materialized views'
133
+ desc 'Enqueue DELETE jobs for ALL defined materialised views'
134
134
  task :delete_all, %i[cascade row_count_strategy yes] => :environment do |_t, args|
135
135
  rcs = helpers.parse_row_count_strategy(args[:row_count_strategy])
136
136
  cascade = helpers.parse_cascade?(args[:cascade])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mat_views
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nitesh Purohit
@@ -29,8 +29,22 @@ dependencies:
29
29
  - - "<"
30
30
  - !ruby/object:Gem::Version
31
31
  version: '9.0'
32
+ - !ruby/object:Gem::Dependency
33
+ name: rails-i18n
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '7.0'
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: '7.0'
32
46
  description: A mountable Rails engine to track, define, refresh, and monitor Postgres
33
- materialized views.
47
+ materialised views.
34
48
  email:
35
49
  - nitesh.purohit.it@gmail.com
36
50
  executables: []
@@ -40,14 +54,116 @@ files:
40
54
  - LICENSE
41
55
  - README.md
42
56
  - Rakefile
57
+ - app/assets/images/mat_views/android-chrome-192x192.png
58
+ - app/assets/images/mat_views/android-chrome-512x512.png
59
+ - app/assets/images/mat_views/apple-touch-icon.png
60
+ - app/assets/images/mat_views/favicon-16x16.png
61
+ - app/assets/images/mat_views/favicon-32x32.png
62
+ - app/assets/images/mat_views/favicon-48x48.png
63
+ - app/assets/images/mat_views/favicon.ico
64
+ - app/assets/images/mat_views/favicon.svg
65
+ - app/assets/images/mat_views/logo.svg
66
+ - app/assets/images/mat_views/mask-icon.svg
43
67
  - app/assets/stylesheets/mat_views/application.css
68
+ - app/controllers/mat_views/admin/application_controller.rb
69
+ - app/controllers/mat_views/admin/dashboard_controller.rb
70
+ - app/controllers/mat_views/admin/mat_view_definitions_controller.rb
71
+ - app/controllers/mat_views/admin/preferences_controller.rb
72
+ - app/controllers/mat_views/admin/runs_controller.rb
73
+ - app/helpers/mat_views/admin/ui_helper.rb
74
+ - app/javascript/mat_views/application.js
75
+ - app/javascript/mat_views/controllers/application.js
76
+ - app/javascript/mat_views/controllers/details_controller.js
77
+ - app/javascript/mat_views/controllers/drawer_controller.js
78
+ - app/javascript/mat_views/controllers/filter_controller.js
79
+ - app/javascript/mat_views/controllers/flash_controller.js
80
+ - app/javascript/mat_views/controllers/index.js
81
+ - app/javascript/mat_views/controllers/mv_confirm_controller.js
82
+ - app/javascript/mat_views/controllers/submitter_controller.js
83
+ - app/javascript/mat_views/controllers/tabs_controller.js
84
+ - app/javascript/mat_views/controllers/timezone_controller.js
85
+ - app/javascript/mat_views/controllers/tooltip_controller.js
86
+ - app/javascript/mat_views/controllers/turbo_frame_lifecycle_controller.js
44
87
  - app/jobs/mat_views/application_job.rb
45
88
  - app/jobs/mat_views/create_view_job.rb
46
89
  - app/jobs/mat_views/delete_view_job.rb
47
90
  - app/jobs/mat_views/refresh_view_job.rb
91
+ - app/models/concerns/mat_views_i18n.rb
48
92
  - app/models/mat_views/application_record.rb
49
93
  - app/models/mat_views/mat_view_definition.rb
50
94
  - app/models/mat_views/mat_view_run.rb
95
+ - app/views/layouts/mat_views/_footer.html.erb
96
+ - app/views/layouts/mat_views/_header.html.erb
97
+ - app/views/layouts/mat_views/admin.html.erb
98
+ - app/views/layouts/mat_views/turbo_frame.html.erb
99
+ - app/views/mat_views/admin/dashboard/index.html.erb
100
+ - app/views/mat_views/admin/mat_view_definitions/_definition_actions.html.erb
101
+ - app/views/mat_views/admin/mat_view_definitions/_table.html.erb
102
+ - app/views/mat_views/admin/mat_view_definitions/empty.html.erb
103
+ - app/views/mat_views/admin/mat_view_definitions/form.html.erb
104
+ - app/views/mat_views/admin/mat_view_definitions/index.html.erb
105
+ - app/views/mat_views/admin/mat_view_definitions/show.html.erb
106
+ - app/views/mat_views/admin/preferences/show.html.erb
107
+ - app/views/mat_views/admin/runs/_table.html.erb
108
+ - app/views/mat_views/admin/runs/index.html.erb
109
+ - app/views/mat_views/admin/runs/show.html.erb
110
+ - app/views/mat_views/admin/ui/_card.html.erb
111
+ - app/views/mat_views/admin/ui/_details.html.erb
112
+ - app/views/mat_views/admin/ui/_flash.html.erb
113
+ - app/views/mat_views/admin/ui/_table.html.erb
114
+ - config/importmap.rb
115
+ - config/locales/en-AU-ocker.yml
116
+ - config/locales/en-AU.yml
117
+ - config/locales/en-BB.yml
118
+ - config/locales/en-BD.yml
119
+ - config/locales/en-BE.yml
120
+ - config/locales/en-BORK.yml
121
+ - config/locales/en-BS.yml
122
+ - config/locales/en-BZ.yml
123
+ - config/locales/en-CA.yml
124
+ - config/locales/en-CM.yml
125
+ - config/locales/en-CY.yml
126
+ - config/locales/en-EG.yml
127
+ - config/locales/en-FJ.yml
128
+ - config/locales/en-GB.yml
129
+ - config/locales/en-GH.yml
130
+ - config/locales/en-GI.yml
131
+ - config/locales/en-GM.yml
132
+ - config/locales/en-GY.yml
133
+ - config/locales/en-HK.yml
134
+ - config/locales/en-IE.yml
135
+ - config/locales/en-IN.yml
136
+ - config/locales/en-JM.yml
137
+ - config/locales/en-KE.yml
138
+ - config/locales/en-LK.yml
139
+ - config/locales/en-LOL.yml
140
+ - config/locales/en-LR.yml
141
+ - config/locales/en-MS.yml
142
+ - config/locales/en-MT.yml
143
+ - config/locales/en-MW.yml
144
+ - config/locales/en-MY.yml
145
+ - config/locales/en-NG.yml
146
+ - config/locales/en-NP.yml
147
+ - config/locales/en-NZ.yml
148
+ - config/locales/en-PG.yml
149
+ - config/locales/en-PH.yml
150
+ - config/locales/en-PK.yml
151
+ - config/locales/en-RW.yml
152
+ - config/locales/en-SCOT.yml
153
+ - config/locales/en-SG.yml
154
+ - config/locales/en-SHAKESPEARE.yml
155
+ - config/locales/en-SL.yml
156
+ - config/locales/en-SS.yml
157
+ - config/locales/en-TH.yml
158
+ - config/locales/en-TT.yml
159
+ - config/locales/en-TZ.yml
160
+ - config/locales/en-UG.yml
161
+ - config/locales/en-US-pirate.yml
162
+ - config/locales/en-US.yml
163
+ - config/locales/en-YODA.yml
164
+ - config/locales/en-ZA.yml
165
+ - config/locales/en-ZW.yml
166
+ - config/locales/en.yml
51
167
  - config/routes.rb
52
168
  - lib/ext/exception.rb
53
169
  - lib/generators/mat_views/install/install_generator.rb
@@ -55,11 +171,15 @@ files:
55
171
  - lib/generators/mat_views/install/templates/create_mat_view_runs.rb
56
172
  - lib/generators/mat_views/install/templates/mat_views_initializer.rb
57
173
  - lib/mat_views.rb
174
+ - lib/mat_views/admin/auth_bridge.rb
175
+ - lib/mat_views/admin/default_auth.rb
58
176
  - lib/mat_views/configuration.rb
59
177
  - lib/mat_views/engine.rb
178
+ - lib/mat_views/helpers/ui_test_ids.rb
60
179
  - lib/mat_views/jobs/adapter.rb
61
180
  - lib/mat_views/service_response.rb
62
181
  - lib/mat_views/services/base_service.rb
182
+ - lib/mat_views/services/check_matview_exists.rb
63
183
  - lib/mat_views/services/concurrent_refresh.rb
64
184
  - lib/mat_views/services/create_view.rb
65
185
  - lib/mat_views/services/delete_view.rb
@@ -72,9 +192,14 @@ homepage: https://github.com/Code-Vedas/rails_materialized_views
72
192
  licenses:
73
193
  - MIT
74
194
  metadata:
195
+ bug_tracker_uri: https://github.com/Code-Vedas/rails_materialized_views/issues
196
+ changelog_uri: https://github.com/Code-Vedas/rails_materialized_views/blob/main/CHANGELOG.md
197
+ documentation_uri: https://mat-views.codevedas.com
75
198
  homepage_uri: https://github.com/Code-Vedas/rails_materialized_views
76
199
  source_code_uri: https://github.com/Code-Vedas/rails_materialized_views.git
77
- changelog_uri: https://github.com/Code-Vedas/rails_materialized_views/blob/main/CHANGELOG.md
200
+ funding_uri: https://github.com/sponsors/Code-Vedas
201
+ support_uri: https://mat-views.codevedas.com/support
202
+ rubygems_uri: https://rubygems.org/gems/mat_views
78
203
  rubygems_mfa_required: 'true'
79
204
  rdoc_options: []
80
205
  require_paths:
@@ -90,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
215
  - !ruby/object:Gem::Version
91
216
  version: '0'
92
217
  requirements: []
93
- rubygems_version: 3.6.9
218
+ rubygems_version: 3.6.7
94
219
  specification_version: 4
95
- summary: Manage and refresh PostgreSQL materialized views in Rails
220
+ summary: Manage and refresh PostgreSQL materialised views in Rails
96
221
  test_files: []