motor-admin-pz 0.4.22 → 0.4.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/motor/auth_tokens_controller.rb +1 -1
- data/app/controllers/motor/data_controller.rb +2 -0
- data/app/controllers/motor/run_api_requests_controller.rb +1 -1
- data/app/controllers/motor/run_graphql_requests_controller.rb +1 -1
- data/app/models/motor/alert.rb +6 -1
- data/app/models/motor/api_config.rb +7 -2
- 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/alerts/scheduled_alerts_cache.rb +5 -1
- data/lib/motor/queries/run_query.rb +6 -15
- data/lib/motor/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93a88182fbcb025e60c5036a8e60ee043a9c86c553fd92ff25d91e83eff1cc94
|
4
|
+
data.tar.gz: 0c704c71d0488b0bfa1ca53392547822496d40b4c2d9912c1454c8ab549b514e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b24ffe23e93d3acf63758e9d4e66b0a6ac555b09b3746a667036289f8971d3d0d26b9913634bcbef77fa8f578168ed8e568556b23c6a68ddd557fd338026684d
|
7
|
+
data.tar.gz: 073bc5aefc3e7dd193cce119c6252cd77da52227519e70d39fb12d351fe9eb4b7287a4f7f1262150cdd3de0d8d5554ebb673220de9da7b883fa886202fa077c1
|
@@ -28,7 +28,7 @@ module Motor
|
|
28
28
|
|
29
29
|
def respond_with_generic_jwt
|
30
30
|
payload = { uid: current_user.id, exp: GENERIC_TOKEN_TTL.from_now.to_i }
|
31
|
-
token = JWT.encode(payload, Rails.application.
|
31
|
+
token = JWT.encode(payload, Rails.application.credentials.secret_key_base)
|
32
32
|
|
33
33
|
render json: { token: token }
|
34
34
|
end
|
@@ -46,7 +46,7 @@ module Motor
|
|
46
46
|
|
47
47
|
payload = { uid: current_user.id, email: current_user.email, exp: JWT_TTL.from_now.to_i }
|
48
48
|
|
49
|
-
JWT.encode(payload, Rails.application.
|
49
|
+
JWT.encode(payload, Rails.application.credentials.secret_key_base)
|
50
50
|
end
|
51
51
|
|
52
52
|
def request_params
|
@@ -38,7 +38,7 @@ module Motor
|
|
38
38
|
|
39
39
|
payload = { uid: current_user.id, email: current_user.email, exp: JWT_TTL.from_now.to_i }
|
40
40
|
|
41
|
-
JWT.encode(payload, Rails.application.
|
41
|
+
JWT.encode(payload, Rails.application.credentials.secret_key_base)
|
42
42
|
end
|
43
43
|
|
44
44
|
def request_params
|
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) }
|
@@ -7,8 +7,13 @@ module Motor
|
|
7
7
|
attribute :preferences, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
|
8
8
|
attribute :credentials, default: -> { ActiveSupport::HashWithIndifferentAccess.new }
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
if Rails.version.to_f >= 7.1
|
11
|
+
serialize :credentials, coder: Motor::HashSerializer
|
12
|
+
serialize :preferences, coder: Motor::HashSerializer
|
13
|
+
else
|
14
|
+
serialize :credentials, Motor::HashSerializer
|
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__))
|
@@ -9,7 +9,11 @@ module Motor
|
|
9
9
|
|
10
10
|
def all
|
11
11
|
ActiveRecord::Base.logger.silence do
|
12
|
-
|
12
|
+
cache_key = Motor::Alert.all.maximum(:updated_at)
|
13
|
+
|
14
|
+
return [] if cache_key.nil?
|
15
|
+
|
16
|
+
CACHE_STORE.fetch(cache_key) do
|
13
17
|
clear
|
14
18
|
|
15
19
|
Motor::Alert.all.active.enabled.to_a
|
@@ -61,27 +61,18 @@ module Motor
|
|
61
61
|
# @param filters [Hash]
|
62
62
|
# @return [ActiveRecord::Result]
|
63
63
|
def execute_query(query, limit, variables_hash, filters)
|
64
|
-
result = nil
|
65
|
-
|
66
64
|
connection_class = fetch_connection_class(query)
|
67
65
|
|
68
66
|
statement = prepare_sql_statement(connection_class, query, limit, variables_hash, filters)
|
69
67
|
|
70
|
-
connection_class.
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
else
|
76
|
-
statement = normalize_statement_for_sql(statement)
|
77
|
-
|
78
|
-
connection_class.connection.exec_query(*statement)
|
79
|
-
end
|
68
|
+
case connection_class.connection.class.name
|
69
|
+
when 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter'
|
70
|
+
PostgresqlExecQuery.call(connection_class.connection, statement)
|
71
|
+
else
|
72
|
+
statement = normalize_statement_for_sql(statement)
|
80
73
|
|
81
|
-
|
74
|
+
connection_class.connection.exec_query(*statement)
|
82
75
|
end
|
83
|
-
|
84
|
-
result
|
85
76
|
end
|
86
77
|
|
87
78
|
def validate_query!(sql)
|
data/lib/motor/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motor-admin-pz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Matsyburka
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-02-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ar_lazy_preload
|
@@ -5109,7 +5109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
5109
5109
|
- !ruby/object:Gem::Version
|
5110
5110
|
version: '0'
|
5111
5111
|
requirements: []
|
5112
|
-
rubygems_version: 3.
|
5112
|
+
rubygems_version: 3.5.6
|
5113
5113
|
signing_key:
|
5114
5114
|
specification_version: 4
|
5115
5115
|
summary: Low-code Admin panel and Business intelligence
|