motor-admin 0.1.51 → 0.1.52
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 +4 -4
- data/app/controllers/motor/api_base_controller.rb +5 -3
- data/app/controllers/motor/assets_controller.rb +1 -1
- data/app/controllers/motor/icons_controller.rb +1 -1
- data/lib/motor/active_record_utils/active_storage_blob_patch.rb +4 -0
- data/lib/motor/admin.rb +5 -6
- data/lib/motor/alerts/scheduled_alerts_cache.rb +1 -2
- data/lib/motor/api_query/sort.rb +3 -1
- data/lib/motor/configs/build_ui_app_tag.rb +1 -2
- data/lib/motor/configs/load_from_cache.rb +11 -4
- data/lib/motor/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8798474d7c7dc20d6410dd00f13950997be5e3f5d67e1d2585a57af92cd8db10
|
|
4
|
+
data.tar.gz: 90fcc0b1835fe56b78ecfcc28de03f9d4397b213f6e499afc626c3f4d13b1ef9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c3a34e36e74e5004508e420ba4cdf95e2784d52647dfefccb64fc078b2785cbdd42a7aad84ca41f4c86e2c680b76516f219a41739b7d19601798dda4c9319e06
|
|
7
|
+
data.tar.gz: 727c31fafba431b69e3206d0fb2cff568171760cd43b36b9a42e97a356d5e344c7cacb069c5e9e79899e0fa804f39fd122ae14e30aece4cb77ca64de31620c5f
|
|
@@ -12,10 +12,12 @@ module Motor
|
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
unless Rails.env.test?
|
|
16
|
+
rescue_from StandardError do |e|
|
|
17
|
+
Rails.logger.error(e)
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
render json: { errors: [e.message] }, status: :internal_server_error
|
|
20
|
+
end
|
|
19
21
|
end
|
|
20
22
|
|
|
21
23
|
def current_ability
|
|
@@ -13,6 +13,10 @@ module Motor
|
|
|
13
13
|
super(**hash.with_indifferent_access.slice(*KEYWORD_ARGS).symbolize_keys)
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
+
def create_after_upload!(hash)
|
|
17
|
+
super(**hash.with_indifferent_access.slice(*KEYWORD_ARGS).symbolize_keys)
|
|
18
|
+
end
|
|
19
|
+
|
|
16
20
|
def create_after_unfurling!(hash)
|
|
17
21
|
super(**hash.with_indifferent_access.slice(*KEYWORD_ARGS).symbolize_keys)
|
|
18
22
|
end
|
data/lib/motor/admin.rb
CHANGED
|
@@ -66,13 +66,12 @@ module Motor
|
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
initializer 'motor.active_storage.extensions' do
|
|
69
|
-
|
|
70
|
-
ActiveStorage::Attachment.include(Motor::ActiveRecordUtils::ActiveStorageLinksExtension)
|
|
71
|
-
end
|
|
69
|
+
next unless defined?(ActiveStorage::Engine)
|
|
72
70
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
ActiveStorage::Engine.eager_load!
|
|
72
|
+
|
|
73
|
+
ActiveStorage::Attachment.include(Motor::ActiveRecordUtils::ActiveStorageLinksExtension)
|
|
74
|
+
ActiveStorage::Blob.singleton_class.prepend(Motor::ActiveRecordUtils::ActiveStorageBlobPatch)
|
|
76
75
|
end
|
|
77
76
|
end
|
|
78
77
|
end
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
module Motor
|
|
4
4
|
module Alerts
|
|
5
5
|
module ScheduledAlertsCache
|
|
6
|
-
CACHE_STORE = ActiveSupport::Cache::MemoryStore.new(size: 5.megabytes
|
|
7
|
-
coder: ActiveSupport::Cache::NullCoder)
|
|
6
|
+
CACHE_STORE = ActiveSupport::Cache::MemoryStore.new(size: 5.megabytes)
|
|
8
7
|
|
|
9
8
|
module_function
|
|
10
9
|
|
data/lib/motor/api_query/sort.rb
CHANGED
|
@@ -13,7 +13,9 @@ module Motor
|
|
|
13
13
|
arel_order = build_arel_order(rel.klass, param)
|
|
14
14
|
join_params = build_join_params(rel.klass, param)
|
|
15
15
|
|
|
16
|
-
rel.
|
|
16
|
+
rel = rel.left_joins(join_params) if join_params.present?
|
|
17
|
+
|
|
18
|
+
rel.reorder(arel_order)
|
|
17
19
|
end
|
|
18
20
|
|
|
19
21
|
def build_join_params(_model, param)
|
|
@@ -7,8 +7,7 @@ module Motor
|
|
|
7
7
|
if Motor.development?
|
|
8
8
|
ActiveSupport::Cache::NullStore.new
|
|
9
9
|
else
|
|
10
|
-
ActiveSupport::Cache::MemoryStore.new(size: 5.megabytes
|
|
11
|
-
coder: ActiveSupport::Cache::NullCoder)
|
|
10
|
+
ActiveSupport::Cache::MemoryStore.new(size: 5.megabytes)
|
|
12
11
|
end
|
|
13
12
|
|
|
14
13
|
module_function
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
module Motor
|
|
4
4
|
module Configs
|
|
5
5
|
module LoadFromCache
|
|
6
|
-
|
|
7
|
-
coder: ActiveSupport::Cache::NullCoder)
|
|
6
|
+
CACHE_HASH = HashWithIndifferentAccess.new
|
|
8
7
|
|
|
9
8
|
module_function
|
|
10
9
|
|
|
@@ -57,10 +56,18 @@ module Motor
|
|
|
57
56
|
end
|
|
58
57
|
end
|
|
59
58
|
|
|
60
|
-
def maybe_fetch_from_cache(type, cache_key
|
|
59
|
+
def maybe_fetch_from_cache(type, cache_key)
|
|
61
60
|
return yield unless cache_key
|
|
62
61
|
|
|
63
|
-
|
|
62
|
+
if CACHE_HASH[type] && CACHE_HASH[type][:key] == cache_key
|
|
63
|
+
CACHE_HASH[type][:value]
|
|
64
|
+
else
|
|
65
|
+
result = yield
|
|
66
|
+
|
|
67
|
+
CACHE_HASH[type] = { key: cache_key, value: result }
|
|
68
|
+
|
|
69
|
+
result
|
|
70
|
+
end
|
|
64
71
|
end
|
|
65
72
|
|
|
66
73
|
def load_cache_keys
|
data/lib/motor/version.rb
CHANGED