motor-admin 0.2.9 → 0.2.13
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/api_base_controller.rb +5 -1
- data/config/locales/en.yml +1 -0
- data/config/locales/es.yml +1 -0
- data/config/locales/pt.yml +1 -0
- data/lib/motor/queries/run_query.rb +37 -3
- data/lib/motor/version.rb +1 -1
- data/ui/dist/{main-440589ed06b181856305.css.gz → main-674256170310c4d08732.css.gz} +0 -0
- data/ui/dist/main-674256170310c4d08732.js.gz +0 -0
- data/ui/dist/manifest.json +5 -5
- metadata +4 -4
- data/ui/dist/main-440589ed06b181856305.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: 697f544810f933295dcac90682261144d4200b664ef0046dd88c4173a4753cbf
|
4
|
+
data.tar.gz: 18279efc9ab7d7ec5aa389eada2b5ad3ac646c613c08c1d08d380215affbbb29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fe13200b02aa8d1b1492de03fe1371b2b60366c9ad8fe87b9c4307dc040a87acb5434a559515162544fb6fba1106153f5a1b0e012f795ef8d7e9085e65f030f
|
7
|
+
data.tar.gz: 75e21f9f22ad5ec5663aa8fd5e7080f56d123cb28865c8a564819cde9d77ef9f4231780f4dbfa01ba3a19ebac0dd2d2ace0929ac09df72d2a41256e130371d15
|
@@ -22,7 +22,11 @@ module Motor
|
|
22
22
|
rescue_from CanCan::AccessDenied do |e|
|
23
23
|
Rails.logger.error(e)
|
24
24
|
|
25
|
-
|
25
|
+
if params[:action].in?(%w[create update destroy])
|
26
|
+
render json: { errors: [I18n.t('motor.not_authorized_to_perform_action')] }, status: :forbidden
|
27
|
+
else
|
28
|
+
render json: { errors: [e.message] }, status: :forbidden
|
29
|
+
end
|
26
30
|
end
|
27
31
|
end
|
28
32
|
end
|
data/config/locales/en.yml
CHANGED
data/config/locales/es.yml
CHANGED
data/config/locales/pt.yml
CHANGED
@@ -83,18 +83,52 @@ module Motor
|
|
83
83
|
# @param result [ActiveRecord::Result]
|
84
84
|
# @return [Hash]
|
85
85
|
def build_columns_hash(result)
|
86
|
-
result.columns.map do |column_name|
|
87
|
-
|
86
|
+
result.columns.map.with_index do |column_name, index|
|
87
|
+
column_type_class = result.column_types[column_name]
|
88
|
+
|
89
|
+
column_type =
|
90
|
+
if column_type_class
|
91
|
+
ActiveRecordUtils::Types.find_name_for_type(column_type_class)
|
92
|
+
else
|
93
|
+
not_nil_value = result.rows.reduce(nil) do |acc, row|
|
94
|
+
column = row[index]
|
95
|
+
|
96
|
+
break column unless column.nil?
|
97
|
+
|
98
|
+
acc
|
99
|
+
end
|
100
|
+
|
101
|
+
fetch_column_type_from_value(not_nil_value)
|
102
|
+
end
|
88
103
|
|
89
104
|
{
|
90
105
|
name: column_name,
|
91
106
|
display_name: column_name.humanize,
|
92
|
-
column_type:
|
107
|
+
column_type: column_type,
|
93
108
|
is_array: column_type.class.to_s == 'ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Array'
|
94
109
|
}
|
95
110
|
end
|
96
111
|
end
|
97
112
|
|
113
|
+
# @param value [Object]
|
114
|
+
# @return [String]
|
115
|
+
def fetch_column_type_from_value(value)
|
116
|
+
case value
|
117
|
+
when Integer
|
118
|
+
'integer'
|
119
|
+
when Float
|
120
|
+
'float'
|
121
|
+
when Time
|
122
|
+
'datetime'
|
123
|
+
when Date
|
124
|
+
'date'
|
125
|
+
when TrueClass, FalseClass
|
126
|
+
'boolean'
|
127
|
+
else
|
128
|
+
'string'
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
98
132
|
# @param query [Motor::Query]
|
99
133
|
# @param limit [Integer]
|
100
134
|
# @param variables_hash [Hash]
|
data/lib/motor/version.rb
CHANGED
Binary file
|
Binary file
|
data/ui/dist/manifest.json
CHANGED
@@ -2601,9 +2601,9 @@
|
|
2601
2601
|
"icons/zoom-out.svg.gz": "icons/zoom-out.svg.gz",
|
2602
2602
|
"icons/zoom-question.svg": "icons/zoom-question.svg",
|
2603
2603
|
"icons/zoom-question.svg.gz": "icons/zoom-question.svg.gz",
|
2604
|
-
"main-
|
2605
|
-
"main-
|
2606
|
-
"main-
|
2607
|
-
"main.css": "main-
|
2608
|
-
"main.js": "main-
|
2604
|
+
"main-674256170310c4d08732.css.gz": "main-674256170310c4d08732.css.gz",
|
2605
|
+
"main-674256170310c4d08732.js.LICENSE.txt": "main-674256170310c4d08732.js.LICENSE.txt",
|
2606
|
+
"main-674256170310c4d08732.js.gz": "main-674256170310c4d08732.js.gz",
|
2607
|
+
"main.css": "main-674256170310c4d08732.css",
|
2608
|
+
"main.js": "main-674256170310c4d08732.js"
|
2609
2609
|
}
|
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.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Matsyburka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord-filter
|
@@ -1524,8 +1524,8 @@ files:
|
|
1524
1524
|
- ui/dist/icons/zoom-money.svg.gz
|
1525
1525
|
- ui/dist/icons/zoom-out.svg.gz
|
1526
1526
|
- ui/dist/icons/zoom-question.svg.gz
|
1527
|
-
- ui/dist/main-
|
1528
|
-
- ui/dist/main-
|
1527
|
+
- ui/dist/main-674256170310c4d08732.css.gz
|
1528
|
+
- ui/dist/main-674256170310c4d08732.js.gz
|
1529
1529
|
- ui/dist/manifest.json
|
1530
1530
|
homepage:
|
1531
1531
|
licenses:
|
Binary file
|