motor-admin 0.4.2 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/app/controllers/motor/data_controller.rb +1 -1
- data/app/controllers/motor/ui_controller.rb +2 -2
- data/app/models/motor/alert.rb +1 -1
- data/app/models/motor/api_config.rb +2 -2
- data/app/models/motor/application_record.rb +1 -1
- data/app/models/motor/dashboard.rb +1 -1
- data/app/models/motor/form.rb +1 -1
- data/app/models/motor/query.rb +1 -1
- data/app/models/motor/resource.rb +1 -1
- data/lib/motor/active_record_utils/defined_scopes_extension.rb +1 -1
- data/lib/motor/admin.rb +2 -2
- data/lib/motor/alerts.rb +1 -1
- data/lib/motor/build_schema/merge_schema_configs.rb +1 -1
- data/lib/motor/configs/build_configs_hash.rb +1 -1
- data/lib/motor/configs/load_from_cache.rb +1 -1
- data/lib/motor/notes/notify_mentions.rb +4 -6
- data/lib/motor/notes/notify_reminder.rb +2 -3
- data/lib/motor/notes/persist.rb +1 -1
- data/lib/motor/resources/fetch_configured_model.rb +2 -2
- data/lib/motor/version.rb +1 -1
- data/ui/dist/{main-94c4b9cbc80e23602ab9.css.gz → main-111931e5606f0c3faafa.css.gz} +0 -0
- data/ui/dist/main-111931e5606f0c3faafa.js.gz +0 -0
- data/ui/dist/manifest.json +5 -5
- metadata +5 -5
- data/ui/dist/main-94c4b9cbc80e23602ab9.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: a6872eec5b5b604ad90658e5cc46f3e6bcef920cf21712fad38400b761a99b70
|
4
|
+
data.tar.gz: 862363ebf4310aa91a434916e37e977ae1f9c27f3887b751f0d7801f3f88f7e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 233119dd49ea625162f191f1d0831f27f21c09ab0fb719c733c17a7bf0ead23a44d45de97a6d21c11b9515c5560a66159625de4b2d2e1be83c94e632bc79b3ea
|
7
|
+
data.tar.gz: 62c6f9104594d35bf9902fb0e58480e6c3bd6fbba15d7aa5e1bb19770b9ca4730e114378d46933aa75398d0ae108b029054004e35466274a3d6e3f4b01e2a83d
|
data/README.md
CHANGED
@@ -6,10 +6,10 @@
|
|
6
6
|
|
7
7
|
Low-code Admin panel and Business intelligence Rails engine **(no DSL - configurable from the UI)**.
|
8
8
|
|
9
|
-
🤓 [Demo App](https://
|
9
|
+
🤓 [Demo App](https://app.getmotoradmin.com/demo/) | 👀 [Features overview](https://www.youtube.com/watch?v=ngVoci8Hll4&list=PLu7llEMh0KcOkR3Uy_RJT0cXPZQKAYVsq&index=1) | ⭐ [Pro](https://www.getmotoradmin.com/ruby-on-rails)
|
10
10
|
</div>
|
11
11
|
|
12
|
-
[![Admin Panel](https://user-images.githubusercontent.com/5418788/119318538-1f30e300-bc82-11eb-94a4-107c31c93b13.png)](https://
|
12
|
+
[![Admin Panel](https://user-images.githubusercontent.com/5418788/119318538-1f30e300-bc82-11eb-94a4-107c31c93b13.png)](https://app.getmotoradmin.com/demo/)
|
13
13
|
|
14
14
|
## Installation
|
15
15
|
Add this line to your application's Gemfile:
|
@@ -109,7 +109,7 @@ Queries can include embedded variables via `{{variable}}` syntax ([mustache](htt
|
|
109
109
|
|
110
110
|
![motor-visualization](https://user-images.githubusercontent.com/5418788/119264625-a2075e80-bbec-11eb-986c-6106dd6e47ce.png)
|
111
111
|
|
112
|
-
Data from the SQL query can be represented as:
|
112
|
+
Data from the SQL query can be represented as: table, number, line chart, bar chart, pie chart, funnel, markdown.
|
113
113
|
|
114
114
|
### Dashboards
|
115
115
|
|
@@ -64,7 +64,7 @@ module Motor
|
|
64
64
|
|
65
65
|
def execute
|
66
66
|
resource_preferences = Motor::Resource.find_by(name: @resource.class.name.underscore).preferences
|
67
|
-
resource_action = resource_preferences[:actions].find { |a| a
|
67
|
+
resource_action = resource_preferences[:actions].find { |a| a.dig(:preferences, :method_name) == params[:method] }
|
68
68
|
|
69
69
|
authorize!(resource_action[:name].to_sym, @resource)
|
70
70
|
|
data/app/models/motor/alert.rb
CHANGED
@@ -11,7 +11,7 @@ module Motor
|
|
11
11
|
has_many :taggable_tags, as: :taggable, dependent: :destroy
|
12
12
|
has_many :tags, through: :taggable_tags, class_name: 'Motor::Tag'
|
13
13
|
|
14
|
-
attribute :preferences, default: -> { HashWithIndifferentAccess.new }
|
14
|
+
attribute :preferences, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
|
15
15
|
serialize :preferences, HashSerializer
|
16
16
|
|
17
17
|
scope :active, -> { where(deleted_at: nil) }
|
@@ -4,8 +4,8 @@ module Motor
|
|
4
4
|
class ApiConfig < ::Motor::ApplicationRecord
|
5
5
|
encrypts :credentials if defined?(::Motor::EncryptedConfig)
|
6
6
|
|
7
|
-
attribute :preferences, default: -> { HashWithIndifferentAccess.new }
|
8
|
-
attribute :credentials, default: -> { HashWithIndifferentAccess.new }
|
7
|
+
attribute :preferences, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
|
8
|
+
attribute :credentials, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
|
9
9
|
|
10
10
|
serialize :credentials, Motor::HashSerializer
|
11
11
|
serialize :preferences, Motor::HashSerializer
|
@@ -9,7 +9,7 @@ module Motor
|
|
9
9
|
has_many :taggable_tags, as: :taggable, dependent: :destroy
|
10
10
|
has_many :tags, through: :taggable_tags, class_name: 'Motor::Tag'
|
11
11
|
|
12
|
-
attribute :preferences, default: -> { HashWithIndifferentAccess.new }
|
12
|
+
attribute :preferences, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
|
13
13
|
serialize :preferences, HashSerializer
|
14
14
|
|
15
15
|
scope :active, -> { where(deleted_at: nil) }
|
data/app/models/motor/form.rb
CHANGED
@@ -10,7 +10,7 @@ module Motor
|
|
10
10
|
has_many :taggable_tags, as: :taggable, dependent: :destroy
|
11
11
|
has_many :tags, through: :taggable_tags, class_name: 'Motor::Tag'
|
12
12
|
|
13
|
-
attribute :preferences, default: -> { HashWithIndifferentAccess.new }
|
13
|
+
attribute :preferences, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
|
14
14
|
serialize :preferences, HashSerializer
|
15
15
|
|
16
16
|
scope :active, -> { where(deleted_at: nil) }
|
data/app/models/motor/query.rb
CHANGED
@@ -10,7 +10,7 @@ module Motor
|
|
10
10
|
has_many :tags, through: :taggable_tags, class_name: 'Motor::Tag'
|
11
11
|
has_many :alerts, dependent: :destroy
|
12
12
|
|
13
|
-
attribute :preferences, default: -> { HashWithIndifferentAccess.new }
|
13
|
+
attribute :preferences, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
|
14
14
|
serialize :preferences, HashSerializer
|
15
15
|
|
16
16
|
scope :active, -> { where(deleted_at: nil) }
|
@@ -4,7 +4,7 @@ module Motor
|
|
4
4
|
class Resource < ::Motor::ApplicationRecord
|
5
5
|
audited
|
6
6
|
|
7
|
-
attribute :preferences, default: -> { HashWithIndifferentAccess.new }
|
7
|
+
attribute :preferences, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
|
8
8
|
serialize :preferences, HashSerializer
|
9
9
|
end
|
10
10
|
end
|
data/lib/motor/admin.rb
CHANGED
@@ -121,8 +121,8 @@ module Motor
|
|
121
121
|
|
122
122
|
if !Motor::ApiConfig.table_exists? || !Motor::Note.table_exists?
|
123
123
|
puts
|
124
|
-
puts ' => Run `rails g motor:upgrade && rake db:migrate`' \
|
125
|
-
'
|
124
|
+
puts ' => Run `rails g motor:upgrade && rake db:migrate` ' \
|
125
|
+
'to perform data migration and enable the latest features'
|
126
126
|
puts
|
127
127
|
|
128
128
|
raise
|
data/lib/motor/alerts.rb
CHANGED
@@ -27,7 +27,7 @@ module Motor
|
|
27
27
|
|
28
28
|
column_index = result.columns.find_index { |c| c[:name] == column_name }
|
29
29
|
|
30
|
-
emails = result.data.
|
30
|
+
emails = result.data.pluck(column_index).uniq
|
31
31
|
|
32
32
|
emails.each do |email|
|
33
33
|
Motor::AlertsMailer.alert_email(alert, email: email).deliver_now!
|
@@ -148,7 +148,7 @@ module Motor
|
|
148
148
|
def load_configs(cache_keys)
|
149
149
|
resources = Motor::Configs::LoadFromCache.load_resources(cache_key: cache_keys[:resources])
|
150
150
|
|
151
|
-
resources.each_with_object(HashWithIndifferentAccess.new) do |resource, acc|
|
151
|
+
resources.each_with_object(ActiveSupport::HashWithIndifferentAccess.new) do |resource, acc|
|
152
152
|
acc[resource.name] = resource.preferences
|
153
153
|
end
|
154
154
|
end
|
@@ -77,7 +77,7 @@ module Motor
|
|
77
77
|
|
78
78
|
def normalize_hash(value)
|
79
79
|
case value
|
80
|
-
when Hash, HashWithIndifferentAccess
|
80
|
+
when Hash, ActiveSupport::HashWithIndifferentAccess
|
81
81
|
value.to_h.stringify_keys.transform_values { |v| normalize_hash(v) }
|
82
82
|
when Array
|
83
83
|
value.map { |e| normalize_hash(e) }
|
@@ -47,17 +47,15 @@ module Motor
|
|
47
47
|
|
48
48
|
display_value = note.record.attributes[configs['display_column']]
|
49
49
|
|
50
|
-
I18n.t('new_mention_for',
|
50
|
+
I18n.t('motor.new_mention_for',
|
51
51
|
resource: ["#{configs['display_name'].singularize} ##{note.record[note.record.class.primary_key]}",
|
52
|
-
display_value].join(' ')
|
53
|
-
scope: :motor)
|
52
|
+
display_value].join(' '))
|
54
53
|
end
|
55
54
|
|
56
55
|
def build_mention_description(note, current_user)
|
57
|
-
I18n.t('user_mentioned_you_with_note',
|
56
|
+
I18n.t('motor.user_mentioned_you_with_note',
|
58
57
|
user: current_user&.email || 'Anonymous',
|
59
|
-
note: note.body.truncate(NOTIFICATION_DESCRIPTION_LIMIT)
|
60
|
-
scope: :motor)
|
58
|
+
note: note.body.truncate(NOTIFICATION_DESCRIPTION_LIMIT))
|
61
59
|
end
|
62
60
|
|
63
61
|
def fetch_users_class(current_user)
|
@@ -39,10 +39,9 @@ module Motor
|
|
39
39
|
|
40
40
|
display_value = note.record.attributes[configs['display_column']]
|
41
41
|
|
42
|
-
I18n.t('new_reminder_for',
|
42
|
+
I18n.t('motor.new_reminder_for',
|
43
43
|
resource: ["#{configs['display_name'].singularize} ##{note.record[note.record.class.primary_key]}",
|
44
|
-
display_value].join(' ')
|
45
|
-
scope: :motor)
|
44
|
+
display_value].join(' '))
|
46
45
|
end
|
47
46
|
end
|
48
47
|
end
|
data/lib/motor/notes/persist.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Motor
|
4
4
|
module Resources
|
5
5
|
module FetchConfiguredModel
|
6
|
-
CACHE_HASH = HashWithIndifferentAccess.new
|
6
|
+
CACHE_HASH = ActiveSupport::HashWithIndifferentAccess.new
|
7
7
|
|
8
8
|
HAS_AND_BELONGS_TO_MANY_JOIN_MODEL_PREFIX = 'HABTM_'
|
9
9
|
|
@@ -56,7 +56,7 @@ module Motor
|
|
56
56
|
def define_audited_class(klass)
|
57
57
|
default_audit_class = Audited.audit_class
|
58
58
|
|
59
|
-
Audited.audit_class = Motor::Audit
|
59
|
+
Audited.audit_class = 'Motor::Audit'
|
60
60
|
|
61
61
|
klass.audited
|
62
62
|
|
data/lib/motor/version.rb
CHANGED
File without changes
|
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-111931e5606f0c3faafa.css.gz": "main-111931e5606f0c3faafa.css.gz",
|
3968
|
+
"main-111931e5606f0c3faafa.js.LICENSE.txt": "main-111931e5606f0c3faafa.js.LICENSE.txt",
|
3969
|
+
"main-111931e5606f0c3faafa.js.gz": "main-111931e5606f0c3faafa.js.gz",
|
3970
|
+
"main.css": "main-111931e5606f0c3faafa.css",
|
3971
|
+
"main.js": "main-111931e5606f0c3faafa.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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Matsyburka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-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-111931e5606f0c3faafa.css.gz
|
2239
|
+
- ui/dist/main-111931e5606f0c3faafa.js.gz
|
2240
2240
|
- ui/dist/manifest.json
|
2241
2241
|
homepage:
|
2242
2242
|
licenses:
|
@@ -2265,7 +2265,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
2265
2265
|
- !ruby/object:Gem::Version
|
2266
2266
|
version: '0'
|
2267
2267
|
requirements: []
|
2268
|
-
rubygems_version: 3.
|
2268
|
+
rubygems_version: 3.4.1
|
2269
2269
|
signing_key:
|
2270
2270
|
specification_version: 4
|
2271
2271
|
summary: Low-code Admin panel and Business intelligence
|
Binary file
|