motor-admin 0.4.21 → 0.4.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -0
- data/app/controllers/motor/run_api_requests_controller.rb +6 -1
- data/app/controllers/motor/run_graphql_requests_controller.rb +4 -1
- data/app/models/motor/alert.rb +6 -1
- data/app/models/motor/api_config.rb +6 -1
- data/app/models/motor/audit.rb +5 -1
- data/app/models/motor/config.rb +5 -1
- data/app/models/motor/dashboard.rb +6 -1
- data/app/models/motor/form.rb +6 -1
- data/app/models/motor/query.rb +6 -1
- data/app/models/motor/resource.rb +6 -1
- data/lib/generators/motor/migration.rb +1 -1
- data/lib/motor/admin.rb +2 -0
- data/lib/motor/configs/build_ui_app_tag.rb +3 -0
- data/lib/motor/version.rb +1 -1
- data/ui/dist/{main-3d067b5a5d0ea3475112.css.gz → main-3b866105d1b5846018e0.css.gz} +0 -0
- data/ui/dist/main-3b866105d1b5846018e0.js.gz +0 -0
- data/ui/dist/manifest.json +5 -5
- metadata +4 -4
- data/ui/dist/main-3d067b5a5d0ea3475112.js.gz +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa8f8bf8e08d5de91571f6ccd67b723a0f5fc131f8447de20e71087879f9eb5c
|
4
|
+
data.tar.gz: 80d865f7f20b76f1a15dad48e241de65f174a24bbb35fcd70a0a7c93d8c0bbbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5f9f50c225d0a12840dbbc2f65e0c99ba5f147cdf8cbc9e5f8f1f9c2aaf253eb11562fdc6d23ba04904d22bf51adc857b626b06530330a381e65fb6cbab0d40
|
7
|
+
data.tar.gz: 1b2ffb087aa375a5e57355d2b332b1efbc5dc04e982e3f8bdfd48c9b3ea88282654b8c77590121fa594ddb332b8dca49bf58356d6a3328523ff2426267178193
|
data/README.md
CHANGED
@@ -39,6 +39,7 @@ $ rails motor:install && rake db:migrate
|
|
39
39
|
* [Dashboards](#dashboards)
|
40
40
|
* [Email alerts](#email-alerts)
|
41
41
|
* [Authorization](#authorization)
|
42
|
+
* [Active Storage](#active-storage)
|
42
43
|
* [Intelligence search](#intelligence-search)
|
43
44
|
* [I18n](#i18n)
|
44
45
|
* [Optimized for mobile](#optimized-for-mobile)
|
@@ -134,6 +135,16 @@ Intelligence search can be opened via the top right corner button or using <kbd>
|
|
134
135
|
|
135
136
|
Motor Admin allows to set row-level and column-level permissions via [cancan](https://github.com/CanCanCommunity/cancancan) gem. Admin UI permissions should be defined in `app/models/motor/ability.rb` file in `Motor::Ability` class. See [Motor Admin guide](https://github.com/motor-admin/motor-admin-rails/blob/master/guides/defining_permissions.md) and [CanCan documentation](https://github.com/CanCanCommunity/cancancan/blob/develop/docs/Defining-Abilities.md) to learn how to define user permissions.
|
136
137
|
|
138
|
+
### Active Storage
|
139
|
+
|
140
|
+
Motor Admin is configured by default to perform uploads to the provider you configured in your `storage.yml` file for Active Storage. If you are using large uploads within Motor Admin you will need to enable direct uploads by setting the following ENV variable.
|
141
|
+
|
142
|
+
```sh
|
143
|
+
MOTOR_ACTIVE_STORAGE_DIRECT_UPLOADS_ENABLED=true
|
144
|
+
```
|
145
|
+
|
146
|
+
_Note: At the moment, this will enable direct uploads globally_
|
147
|
+
|
137
148
|
### I18n
|
138
149
|
|
139
150
|
Motor Admin can use Rails ActiveRecord i18n keys to render resource translations:
|
@@ -16,6 +16,7 @@ module Motor
|
|
16
16
|
|
17
17
|
private
|
18
18
|
|
19
|
+
# rubocop:disable Metrics/AbcSize
|
19
20
|
def respond_with_result
|
20
21
|
response = Motor::ApiConfigs.run(find_or_initialize_api_config,
|
21
22
|
method: request_params[:method],
|
@@ -23,12 +24,16 @@ module Motor
|
|
23
24
|
body: request_params[:body],
|
24
25
|
params: request_params[:params],
|
25
26
|
headers: { 'Authorization' => "Bearer #{current_user_jwt}" })
|
27
|
+
response.to_hash.each do |key, (value)|
|
28
|
+
next if key.casecmp('transfer-encoding').zero?
|
26
29
|
|
27
|
-
|
30
|
+
headers[key] = value
|
31
|
+
end
|
28
32
|
|
29
33
|
self.response_body = response.body
|
30
34
|
self.status = response.code.to_i
|
31
35
|
end
|
36
|
+
# rubocop:enable Metrics/AbcSize
|
32
37
|
|
33
38
|
def find_or_initialize_api_config
|
34
39
|
Motor::ApiConfig.find_by(name: request_params[:api_config_name]) ||
|
@@ -17,8 +17,11 @@ module Motor
|
|
17
17
|
query: request_params[:query],
|
18
18
|
variables: request_params[:variables],
|
19
19
|
headers: { 'Authorization' => "Bearer #{current_user_jwt}" })
|
20
|
+
response.to_hash.each do |key, (value)|
|
21
|
+
next if key.casecmp('transfer-encoding').zero?
|
20
22
|
|
21
|
-
|
23
|
+
headers[key] = value
|
24
|
+
end
|
22
25
|
|
23
26
|
self.response_body = response.body
|
24
27
|
self.status = response.code.to_i
|
data/app/models/motor/alert.rb
CHANGED
@@ -12,7 +12,12 @@ module Motor
|
|
12
12
|
has_many :tags, through: :taggable_tags, class_name: 'Motor::Tag'
|
13
13
|
|
14
14
|
attribute :preferences, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
|
15
|
-
|
15
|
+
|
16
|
+
if Rails.version.to_f >= 7.1
|
17
|
+
serialize :preferences, coder: HashSerializer
|
18
|
+
else
|
19
|
+
serialize :preferences, HashSerializer
|
20
|
+
end
|
16
21
|
|
17
22
|
scope :active, -> { where(deleted_at: nil) }
|
18
23
|
scope :enabled, -> { where(is_enabled: true) }
|
@@ -8,7 +8,12 @@ module Motor
|
|
8
8
|
attribute :credentials, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
|
9
9
|
|
10
10
|
serialize :credentials, Motor::HashSerializer
|
11
|
-
|
11
|
+
|
12
|
+
if Rails.version.to_f >= 7.1
|
13
|
+
serialize :preferences, coder: Motor::HashSerializer
|
14
|
+
else
|
15
|
+
serialize :preferences, Motor::HashSerializer
|
16
|
+
end
|
12
17
|
|
13
18
|
has_one :form, dependent: nil, foreign_key: :api_config_name, primary_key: :name, inverse_of: :api_config
|
14
19
|
|
data/app/models/motor/audit.rb
CHANGED
@@ -4,6 +4,10 @@ module Motor
|
|
4
4
|
class Audit < Audited::Audit
|
5
5
|
self.table_name = 'motor_audits'
|
6
6
|
|
7
|
-
|
7
|
+
if Rails.version.to_f >= 7.1
|
8
|
+
serialize :audited_changes, coder: HashSerializer
|
9
|
+
else
|
10
|
+
serialize :audited_changes, HashSerializer
|
11
|
+
end
|
8
12
|
end
|
9
13
|
end
|
data/app/models/motor/config.rb
CHANGED
@@ -10,7 +10,12 @@ module Motor
|
|
10
10
|
has_many :tags, through: :taggable_tags, class_name: 'Motor::Tag'
|
11
11
|
|
12
12
|
attribute :preferences, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
|
13
|
-
|
13
|
+
|
14
|
+
if Rails.version.to_f >= 7.1
|
15
|
+
serialize :preferences, coder: HashSerializer
|
16
|
+
else
|
17
|
+
serialize :preferences, HashSerializer
|
18
|
+
end
|
14
19
|
|
15
20
|
scope :active, -> { where(deleted_at: nil) }
|
16
21
|
|
data/app/models/motor/form.rb
CHANGED
@@ -11,7 +11,12 @@ module Motor
|
|
11
11
|
has_many :tags, through: :taggable_tags, class_name: 'Motor::Tag'
|
12
12
|
|
13
13
|
attribute :preferences, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
|
14
|
-
|
14
|
+
|
15
|
+
if Rails.version.to_f >= 7.1
|
16
|
+
serialize :preferences, coder: HashSerializer
|
17
|
+
else
|
18
|
+
serialize :preferences, HashSerializer
|
19
|
+
end
|
15
20
|
|
16
21
|
scope :active, -> { where(deleted_at: nil) }
|
17
22
|
end
|
data/app/models/motor/query.rb
CHANGED
@@ -11,7 +11,12 @@ module Motor
|
|
11
11
|
has_many :alerts, dependent: :destroy
|
12
12
|
|
13
13
|
attribute :preferences, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
|
14
|
-
|
14
|
+
|
15
|
+
if Rails.version.to_f >= 7.1
|
16
|
+
serialize :preferences, coder: HashSerializer
|
17
|
+
else
|
18
|
+
serialize :preferences, HashSerializer
|
19
|
+
end
|
15
20
|
|
16
21
|
scope :active, -> { where(deleted_at: nil) }
|
17
22
|
|
@@ -5,6 +5,11 @@ module Motor
|
|
5
5
|
audited
|
6
6
|
|
7
7
|
attribute :preferences, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
|
8
|
-
|
8
|
+
|
9
|
+
if Rails.version.to_f >= 7.1
|
10
|
+
serialize :preferences, coder: HashSerializer
|
11
|
+
else
|
12
|
+
serialize :preferences, HashSerializer
|
13
|
+
end
|
9
14
|
end
|
10
15
|
end
|
@@ -6,7 +6,7 @@ module Motor
|
|
6
6
|
def next_migration_number(dirname)
|
7
7
|
next_migration_number = current_migration_number(dirname) + 1
|
8
8
|
|
9
|
-
if ::ActiveRecord::Base.timestamped_migrations
|
9
|
+
if ::ActiveRecord::Base.try(:timestamped_migrations) || ::ActiveRecord.try(:timestamped_migrations)
|
10
10
|
[Time.now.utc.strftime('%Y%m%d%H%M%S'), format('%.14d', next_migration_number)].max
|
11
11
|
else
|
12
12
|
format('%.3d', next_migration_number)
|
data/lib/motor/admin.rb
CHANGED
@@ -4,6 +4,8 @@ module Motor
|
|
4
4
|
class Admin < ::Rails::Engine
|
5
5
|
config.custom_html = ''
|
6
6
|
|
7
|
+
ActiveSupport.cache_format_version = Rails.version.to_f
|
8
|
+
|
7
9
|
if !Motor.development? && Rails.env.development?
|
8
10
|
config.eager_load_paths.delete(File.expand_path('../../app/controllers', __dir__))
|
9
11
|
config.eager_load_paths.delete(File.expand_path('../../app/controllers/concerns', __dir__))
|
@@ -34,6 +34,7 @@ module Motor
|
|
34
34
|
end
|
35
35
|
|
36
36
|
# rubocop:disable Metrics/AbcSize
|
37
|
+
# rubocop:disable Metrics/MethodLength
|
37
38
|
# @return [Hash]
|
38
39
|
def build_data(cache_keys = {}, current_user = nil, current_ability = nil)
|
39
40
|
configs_cache_key = cache_keys[:configs]
|
@@ -46,6 +47,7 @@ module Motor
|
|
46
47
|
base_path: Motor::Admin.routes.url_helpers.motor_path,
|
47
48
|
cable_path: Motor::Admin.routes.url_helpers.try(:motor_cable_path),
|
48
49
|
admin_settings_path: Rails.application.routes.url_helpers.try(:admin_settings_general_path),
|
50
|
+
active_storage_direct_uploads_enabled: ENV['MOTOR_ACTIVE_STORAGE_DIRECT_UPLOADS_ENABLED'].present?,
|
49
51
|
schema: Motor::BuildSchema.call(cache_keys, current_ability),
|
50
52
|
header_links: header_links_data_hash(current_user, current_ability, configs_cache_key),
|
51
53
|
homepage_layout: homepage_layout_data_hash(configs_cache_key),
|
@@ -59,6 +61,7 @@ module Motor
|
|
59
61
|
forms: forms_data_hash(build_cache_key(cache_keys, :forms, current_user, current_ability), current_ability) }
|
60
62
|
end
|
61
63
|
# rubocop:enable Metrics/AbcSize
|
64
|
+
# rubocop:enable Metrics/MethodLength
|
62
65
|
|
63
66
|
def i18n_data
|
64
67
|
I18n.t('motor', default: I18n.t('motor', locale: :en))
|
data/lib/motor/version.rb
CHANGED
Binary file
|
Binary file
|
data/ui/dist/manifest.json
CHANGED
@@ -3964,9 +3964,9 @@
|
|
3964
3964
|
"images/layers-2x.png": "images/layers-2x.png",
|
3965
3965
|
"images/layers.png": "images/layers.png",
|
3966
3966
|
"images/marker-icon.png": "images/marker-icon.png",
|
3967
|
-
"main-
|
3968
|
-
"main-
|
3969
|
-
"main-
|
3970
|
-
"main.css": "main-
|
3971
|
-
"main.js": "main-
|
3967
|
+
"main-3b866105d1b5846018e0.css.gz": "main-3b866105d1b5846018e0.css.gz",
|
3968
|
+
"main-3b866105d1b5846018e0.js.LICENSE.txt": "main-3b866105d1b5846018e0.js.LICENSE.txt",
|
3969
|
+
"main-3b866105d1b5846018e0.js.gz": "main-3b866105d1b5846018e0.js.gz",
|
3970
|
+
"main.css": "main-3b866105d1b5846018e0.css",
|
3971
|
+
"main.js": "main-3b866105d1b5846018e0.js"
|
3972
3972
|
}
|
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.
|
4
|
+
version: 0.4.23
|
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-
|
11
|
+
date: 2023-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ar_lazy_preload
|
@@ -2235,8 +2235,8 @@ files:
|
|
2235
2235
|
- ui/dist/images/layers-2x.png
|
2236
2236
|
- ui/dist/images/layers.png
|
2237
2237
|
- ui/dist/images/marker-icon.png
|
2238
|
-
- ui/dist/main-
|
2239
|
-
- ui/dist/main-
|
2238
|
+
- ui/dist/main-3b866105d1b5846018e0.css.gz
|
2239
|
+
- ui/dist/main-3b866105d1b5846018e0.js.gz
|
2240
2240
|
- ui/dist/manifest.json
|
2241
2241
|
homepage:
|
2242
2242
|
licenses:
|
Binary file
|