motor-admin 0.2.75 → 0.2.78
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7103c85ab2173fce73651f6c94df44400326c3a0f6900d02958166334919764
|
4
|
+
data.tar.gz: 2702651e4344a7e11a433e7af54a754413075e6de05fb56a12459f831a6087c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbebc6014289c848ac575afd1c21152e8671c7132af5806a0d550db254110e6b890c948dcdd216ccd54ec1f1849f0295237ad9f715775018b702059cff737e57
|
7
|
+
data.tar.gz: efd8735097f2419c606fafee91bab1543888d5e2d98719a2b6efafb7fe2706e3dbe7d55b0aace3265ff78ddac94056b494980f4d42f2444587136913c95c82f1
|
@@ -67,6 +67,8 @@ module Motor
|
|
67
67
|
|
68
68
|
record.update!(attrs)
|
69
69
|
end
|
70
|
+
|
71
|
+
ActiveRecordUtils.reset_id_sequence!(Motor::Config)
|
70
72
|
end
|
71
73
|
|
72
74
|
def sync_api_configs(configs_hash)
|
@@ -83,6 +85,8 @@ module Motor
|
|
83
85
|
end
|
84
86
|
|
85
87
|
archive_api_configs(configs_index, configs_hash[:api_configs])
|
88
|
+
|
89
|
+
ActiveRecordUtils.reset_id_sequence!(Motor::ApiConfig)
|
86
90
|
end
|
87
91
|
|
88
92
|
def archive_api_configs(configs_index, api_configs)
|
@@ -91,6 +95,7 @@ module Motor
|
|
91
95
|
end
|
92
96
|
end
|
93
97
|
|
98
|
+
# rubocop:disable Metrics/AbcSize
|
94
99
|
def sync_resources(configs_hash)
|
95
100
|
resources_index = Motor::Configs::LoadFromCache.load_resources.index_by(&:name)
|
96
101
|
|
@@ -105,7 +110,10 @@ module Motor
|
|
105
110
|
record.updated_at_will_change!
|
106
111
|
record.update!(attrs)
|
107
112
|
end
|
113
|
+
|
114
|
+
ActiveRecordUtils.reset_id_sequence!(Motor::Resource)
|
108
115
|
end
|
116
|
+
# rubocop:enable Metrics/AbcSize
|
109
117
|
|
110
118
|
def sync_taggable(records, config_items, configs_timestamp, update_proc)
|
111
119
|
processed_records, create_items = update_taggable_items(records, config_items, update_proc)
|
data/lib/motor/configs.rb
CHANGED
@@ -10,6 +10,16 @@ module Motor
|
|
10
10
|
|
11
11
|
module_function
|
12
12
|
|
13
|
+
def clear
|
14
|
+
Motor::Resource.destroy_all
|
15
|
+
Motor::Alert.destroy_all
|
16
|
+
Motor::Query.destroy_all
|
17
|
+
Motor::Dashboard.destroy_all
|
18
|
+
Motor::Form.destroy_all
|
19
|
+
Motor::ApiConfig.destroy_all
|
20
|
+
Motor::Config.destroy_all
|
21
|
+
end
|
22
|
+
|
13
23
|
# @return [String]
|
14
24
|
def file_path
|
15
25
|
if Rails.root.to_s.start_with?(MEMFS_PATH)
|
@@ -145,9 +145,9 @@ module Motor
|
|
145
145
|
# @param filters [Hash]
|
146
146
|
# @return [String]
|
147
147
|
def build_select_sql(connection_class, sql, limit, filters)
|
148
|
-
sql = sql
|
148
|
+
sql = normalize_sql(sql)
|
149
149
|
|
150
|
-
subquery_sql = Arel.sql("(#{sql})
|
150
|
+
subquery_sql = Arel.sql("(#{sql})").as(connection_class.connection.quote_column_name(SUBQUERY_NAME))
|
151
151
|
|
152
152
|
arel_filters = build_filters_arel(filters)
|
153
153
|
|
@@ -198,6 +198,10 @@ module Motor
|
|
198
198
|
[sql, 'SQL', attributes]
|
199
199
|
end
|
200
200
|
|
201
|
+
def normalize_sql(sql)
|
202
|
+
sql.strip.delete_suffix(';').gsub(/\A\)+/, '').gsub(/\z\(+/, '')
|
203
|
+
end
|
204
|
+
|
201
205
|
# @param variable_configs [Array<Hash>]
|
202
206
|
# @param variables_hash [Hash]
|
203
207
|
# @return [Hash]
|
@@ -45,7 +45,8 @@ module Motor
|
|
45
45
|
|
46
46
|
klass.instance_eval do
|
47
47
|
default_scope do
|
48
|
-
from(Arel.sql("(#{self.klass.instance_variable_get(:@__motor_custom_sql)})")
|
48
|
+
from(Arel.sql("(#{self.klass.instance_variable_get(:@__motor_custom_sql)})")
|
49
|
+
.as(connection.quote_column_name(table_name)))
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
data/lib/motor/tasks/motor.rake
CHANGED
@@ -21,6 +21,15 @@ namespace :motor do
|
|
21
21
|
puts '✅ configs have been loaded from configs/motor.yml'
|
22
22
|
end
|
23
23
|
|
24
|
+
task reload: :environment do
|
25
|
+
ActiveRecord::Base.transaction do
|
26
|
+
Motor::Configs.clear
|
27
|
+
Motor::Configs::SyncFromFile.call(with_exception: true)
|
28
|
+
end
|
29
|
+
|
30
|
+
puts '✅ configs have been loaded from configs/motor.yml'
|
31
|
+
end
|
32
|
+
|
24
33
|
desc 'Synchronize configs with remote application'
|
25
34
|
|
26
35
|
task sync: :environment do
|
data/lib/motor/version.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.78
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Matsyburka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord-filter
|