motor-admin 0.4.5 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab0cc50d998434c23dbb9e9722a600b694b9177d7734d2abf347123c97e668cd
4
- data.tar.gz: c6f7837f40d9490d694d1491e691aa4154e8649fa6c9d890683a9bb607fdb1d4
3
+ metadata.gz: 8f591c0e7f8d6230fb49aa0ca7ae5a2f960f2d5a117182d8123e7f86e9e1f102
4
+ data.tar.gz: 8181680a758dc7d7e150036979e22c64df911fd528985b4858a93b86e6f051bc
5
5
  SHA512:
6
- metadata.gz: b11ed6e3233d6e92c95cf2981236f806d91a985544d83872a20a8bcd9cf2f06e17814ca2dfa1dfdb7031e639950afa97822079ba9b68dc36d76426cbfd6065b5
7
- data.tar.gz: dfa730ff66075b589c2a67fb6513fad839a6f60b01335b4eaff67599149822a2071467f1302ec4798235510a3baae77212f75cf02307543fbb3346839f7e0bb0
6
+ metadata.gz: 1659c1b5df414a6b6a0f28a18a734caf8cc0302023f82885c5b8ed0e844e46420512bac822a7baa73efb13b823d9aec29a2261a084191d0aaa67d9172c5e9cb1
7
+ data.tar.gz: 7bb52dad21ef7d941aa8a366ceee190e4ae463cd465fe8a4789e37dea046e30dc88efe9ade3e1f2e5228e523465262ebdfaea6732053af45e01a4f931ca877a6
@@ -4,6 +4,8 @@ module Motor
4
4
  module LoadAndAuthorizeDynamicResource
5
5
  extend ActiveSupport::Concern
6
6
 
7
+ MUTEX = Mutex.new
8
+
7
9
  INSTANCE_VARIABLE_NAME = 'resource'
8
10
  ASSOCIATION_INSTANCE_VARIABLE_NAME = 'associated_resource'
9
11
 
@@ -13,11 +15,12 @@ module Motor
13
15
  end
14
16
 
15
17
  def resource_class
16
- @resource_class ||=
18
+ @resource_class ||= MUTEX.synchronize do
17
19
  Motor::Resources::FetchConfiguredModel.call(
18
20
  Motor::BuildSchema::Utils.classify_slug(resource_name_prefix + params[:resource]),
19
21
  cache_key: Motor::Resource.maximum(:updated_at)
20
22
  )
23
+ end
21
24
  end
22
25
 
23
26
  def resource_name_prefix
@@ -24,3 +24,5 @@ module Motor
24
24
  alias run result
25
25
  end
26
26
  end
27
+
28
+ ActiveSupport.run_load_hooks(:motor_query, Motor::Query)
@@ -29,7 +29,6 @@ el:
29
29
  all: Όλα
30
30
  all_resources: Όλοι οι πόροι
31
31
  and: Και
32
- api: API
33
32
  api_path: Διαδρομή API
34
33
  api_request: Αίτημα API
35
34
  apply: Εφαρμογή
@@ -317,8 +316,6 @@ el:
317
316
  updated: ενημερωμένο
318
317
  created: δημιουργήθηκε
319
318
  deleted: διαγράφηκε
320
- sign_out: Αποσυνδεθείτε
321
- user_dropdown: Χρήστης dropdown
322
319
  add_condition: Προσθήκη συνθήκης
323
320
  remove_condition: Αφαίρεση συνθήκης
324
321
  unable_to_send_alert: Αδυναμία αποστολής ειδοποίησης
@@ -29,7 +29,6 @@ en:
29
29
  all: All
30
30
  all_resources: All Resources
31
31
  and: And
32
- api: API
33
32
  api_path: API path
34
33
  api_request: API request
35
34
  apply: Apply
@@ -266,14 +265,6 @@ en:
266
265
  video: Video
267
266
  display_column: Display column
268
267
  not_authorized_to_perform_action: You are not authorized to perform this action.
269
- download: Download
270
- alert: Alert
271
- downloading: Downloading
272
- display_id: Display ID
273
- display_settings: Display settings
274
- sign_out: Sign out
275
- header: Header
276
- user_dropdown: User dropdown
277
268
  upload: Upload
278
269
  there_is_nothing_here_yet: There is nothing here yet 🤷‍♂️
279
270
  is_null: Is null
@@ -315,20 +315,11 @@ es:
315
315
  updated: updated
316
316
  created: created
317
317
  deleted: deleted
318
- sign_out: Sign out
319
- header: Header
320
- user_dropdown: User dropdown
321
318
  add_condition: Add Condition
322
319
  remove_condition: Remove Condition
323
320
  unable_to_send_alert: Unable to send alert
324
321
  send_via: Send via
325
- download: Descargar
326
- alert: Alerta
327
- downloading: Descargando
328
- display_id: Visualizar ID
329
- display_settings: Configuración de la pantalla
330
322
  sql: SQL
331
- api: API
332
323
  variable_name: Nombre de la variable
333
324
  add_variable: Añadir variable
334
325
  notes: Notes
@@ -311,20 +311,11 @@ pt:
311
311
  updated: updated
312
312
  created: created
313
313
  deleted: deleted
314
- sign_out: Sign out
315
- header: Header
316
- user_dropdown: User dropdown
317
314
  add_condition: Add Condition
318
315
  remove_condition: Remove Condition
319
316
  unable_to_send_alert: Unable to send alert
320
317
  send_via: Send via
321
- download: Descarregar
322
- alert: Alerta
323
- downloading: Descarregamento
324
- display_id: Mostrar ID
325
- display_settings: Definições de visualização
326
318
  sql: SQL
327
- api: API
328
319
  variable_name: Nome da variável
329
320
  add_variable: Adicionar variável
330
321
  notes: Notes
data/lib/motor/admin.rb CHANGED
@@ -4,6 +4,16 @@ module Motor
4
4
  class Admin < ::Rails::Engine
5
5
  config.custom_html = ''
6
6
 
7
+ if !Motor.development? && !Rails.env.production?
8
+ config.eager_load_paths.delete(File.expand_path('../../app/controllers', __dir__))
9
+ config.eager_load_paths.delete(File.expand_path('../../app/controllers/concerns', __dir__))
10
+ config.eager_load_paths.delete(File.expand_path('../../app/models', __dir__))
11
+
12
+ config.autoload_once_paths << File.expand_path('../../app/models', __dir__)
13
+ config.autoload_once_paths << File.expand_path('../../app/controllers', __dir__)
14
+ config.autoload_once_paths << File.expand_path('../../app/controllers/concerns', __dir__)
15
+ end
16
+
7
17
  initializer 'motor.startup_message' do
8
18
  config.after_initialize do
9
19
  next unless Motor.server?
@@ -108,15 +118,13 @@ module Motor
108
118
  end
109
119
 
110
120
  initializer 'motor.upgrade' do
111
- config.after_initialize do
121
+ ActiveSupport.on_load(:motor_query) do
112
122
  next unless Motor.server?
113
123
 
114
124
  unless Motor::Query.table_exists?
115
125
  puts
116
126
  puts ' => Run `rails g motor:install && rake db:migrate` in order to create Motor Admin configuration tables'
117
127
  puts
118
-
119
- raise
120
128
  end
121
129
 
122
130
  if !Motor::ApiConfig.table_exists? || !Motor::Note.table_exists?
@@ -124,8 +132,6 @@ module Motor
124
132
  puts ' => Run `rails g motor:upgrade && rake db:migrate` ' \
125
133
  'to perform data migration and enable the latest features'
126
134
  puts
127
-
128
- raise
129
135
  end
130
136
  end
131
137
  end
@@ -30,7 +30,9 @@ module Motor
30
30
  arel_table = model.arel_table
31
31
 
32
32
  column_names.map do |name|
33
- column_type = model.columns_hash[name].type
33
+ column_type = model.columns_hash[name]&.type
34
+
35
+ next unless column_type
34
36
 
35
37
  if STRING_COLUMN_TYPES.include?(column_type)
36
38
  arel_table[name].matches("%#{keyword}%")
data/lib/motor/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Motor
4
- VERSION = '0.4.5'
4
+ VERSION = '0.4.7'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motor-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Matsyburka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-14 00:00:00.000000000 Z
11
+ date: 2023-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ar_lazy_preload