labimotion 2.1.0.rc17 → 2.2.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/labimotion/apis/generic_element_api.rb +2 -2
- data/lib/labimotion/collection/import.rb +3 -3
- data/lib/labimotion/entities/properties_entity.rb +1 -3
- data/lib/labimotion/helpers/element_helpers.rb +2 -5
- data/lib/labimotion/helpers/param_helpers.rb +0 -4
- data/lib/labimotion/libs/converter.rb +3 -6
- data/lib/labimotion/libs/dataset_builder.rb +1 -2
- data/lib/labimotion/models/concerns/datasetable.rb +2 -3
- data/lib/labimotion/models/concerns/generic_klass_revisions.rb +3 -2
- data/lib/labimotion/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4397eed28e8f2c6f0e21e022191d842dbb7a42000a2efe72731a89ab8bf9e77b
|
|
4
|
+
data.tar.gz: 3ae429541da0f787d6d0f544307b5acfbf3e922d83c7fc7cd27e47738eb5880e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 12a5d77d600daaf1a45640ab5ff7d253a608cd683fac28a5286019a7990e85cb7c1f0c957240fab625d3dbb703196dcb918b652bcc86457c6ac88cc085990ea0
|
|
7
|
+
data.tar.gz: 28453642570e3e177c0c2684590cdb715016c4043645d9f2e097eca0a4f41e9e3ff30564df8a0b7d5800bfb36a2fd224aa40cb91a107a2bc53adddc1db133070
|
|
@@ -474,7 +474,7 @@ module Labimotion
|
|
|
474
474
|
detail_levels: ElementDetailLevelCalculator.new(user: current_user, element: element).detail_levels,
|
|
475
475
|
policy: @element_policy
|
|
476
476
|
),
|
|
477
|
-
attachments:
|
|
477
|
+
attachments: attach_thumbnail(element&.attachments)
|
|
478
478
|
}
|
|
479
479
|
rescue StandardError => e
|
|
480
480
|
Labimotion.log_exception(e, current_user)
|
|
@@ -517,7 +517,7 @@ module Labimotion
|
|
|
517
517
|
element,
|
|
518
518
|
detail_levels: ElementDetailLevelCalculator.new(user: current_user, element: element).detail_levels,
|
|
519
519
|
),
|
|
520
|
-
attachments:
|
|
520
|
+
attachments: attach_thumbnail(element&.attachments),
|
|
521
521
|
}
|
|
522
522
|
rescue StandardError => e
|
|
523
523
|
Labimotion.log_exception(e, current_user)
|
|
@@ -69,7 +69,7 @@ module Labimotion
|
|
|
69
69
|
|
|
70
70
|
dataset = Labimotion::Dataset.create!(
|
|
71
71
|
fields.slice(
|
|
72
|
-
'properties', 'properties_release'
|
|
72
|
+
'properties', 'properties_release'
|
|
73
73
|
).merge(
|
|
74
74
|
## created_by: current_user_id,
|
|
75
75
|
element: element,
|
|
@@ -112,7 +112,7 @@ module Labimotion
|
|
|
112
112
|
|
|
113
113
|
segment = Labimotion::Segment.create!(
|
|
114
114
|
fields.slice(
|
|
115
|
-
'properties', 'properties_release'
|
|
115
|
+
'properties', 'properties_release'
|
|
116
116
|
).merge(
|
|
117
117
|
created_by: current_user_id,
|
|
118
118
|
element: element,
|
|
@@ -149,7 +149,7 @@ module Labimotion
|
|
|
149
149
|
|
|
150
150
|
element = Labimotion::Element.create!(
|
|
151
151
|
fields.slice(
|
|
152
|
-
'name', 'properties', 'properties_release'
|
|
152
|
+
'name', 'properties', 'properties_release'
|
|
153
153
|
).merge(
|
|
154
154
|
created_by: current_user_id,
|
|
155
155
|
element_klass: element_klass,
|
|
@@ -13,9 +13,7 @@ module Labimotion
|
|
|
13
13
|
private
|
|
14
14
|
|
|
15
15
|
def process_layers
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
(object.properties[Labimotion::Prop::LAYERS]&.keys || []).each do |key|
|
|
16
|
+
(object&.properties.is_a?(Hash) && (object.properties[Labimotion::Prop::LAYERS]&.keys || [])).each do |key|
|
|
19
17
|
yield(key, object.properties[Labimotion::Prop::LAYERS][key])
|
|
20
18
|
end
|
|
21
19
|
end
|
|
@@ -82,8 +82,7 @@ module Labimotion
|
|
|
82
82
|
klass_uuid: klass[:uuid],
|
|
83
83
|
properties: properties,
|
|
84
84
|
properties_release: params[:properties_release],
|
|
85
|
-
|
|
86
|
-
created_by: current_user.id
|
|
85
|
+
created_by: current_user.id,
|
|
87
86
|
}
|
|
88
87
|
element = Labimotion::Element.new(attributes)
|
|
89
88
|
|
|
@@ -117,8 +116,7 @@ module Labimotion
|
|
|
117
116
|
params.delete(:user_labels)
|
|
118
117
|
attributes = declared(params.except(:segments), include_missing: false)
|
|
119
118
|
properties['pkg'] = Labimotion::Utils.pkg(properties['pkg'])
|
|
120
|
-
|
|
121
|
-
if element.klass_uuid != properties['klass_uuid'] || element.properties != properties || element.name != params[:name] || element.metadata != metadata
|
|
119
|
+
if element.klass_uuid != properties['klass_uuid'] || element.properties != properties || element.name != params[:name]
|
|
122
120
|
properties['klass'] = 'Element'
|
|
123
121
|
uuid = SecureRandom.uuid
|
|
124
122
|
properties['uuid'] = uuid
|
|
@@ -130,7 +128,6 @@ module Labimotion
|
|
|
130
128
|
attributes['properties']['uuid'] = uuid
|
|
131
129
|
attributes['uuid'] = uuid
|
|
132
130
|
attributes['klass_uuid'] = properties['klass_uuid']
|
|
133
|
-
attributes['metadata'] = metadata
|
|
134
131
|
attributes['updated_at'] = Time.current
|
|
135
132
|
element.update_columns(attributes)
|
|
136
133
|
end
|
|
@@ -13,7 +13,6 @@ module Labimotion
|
|
|
13
13
|
optional :desc, type: String, desc: 'Klass desc'
|
|
14
14
|
optional :klass_prefix, type: String, desc: 'Klass klass_prefix'
|
|
15
15
|
optional :icon_name, type: String, desc: 'Klass icon_name'
|
|
16
|
-
optional :metadata, type: Hash, desc: 'Klass metadata'
|
|
17
16
|
requires :properties_template, type: Hash, desc: 'Klass template'
|
|
18
17
|
optional :properties_release, type: Hash, desc: 'Klass release'
|
|
19
18
|
optional :released_at, type: DateTime, desc: 'Klass released_at'
|
|
@@ -30,7 +29,6 @@ module Labimotion
|
|
|
30
29
|
requires :klass_prefix, type: String, desc: 'Element Klass Short Label Prefix'
|
|
31
30
|
optional :icon_name, type: String, desc: 'Element Klass Icon Name'
|
|
32
31
|
optional :desc, type: String, desc: 'Element Klass Desc'
|
|
33
|
-
optional :metadata, type: Hash, desc: 'Element Klass metadata'
|
|
34
32
|
optional :properties_template, type: Hash, desc: 'Element Klass properties template'
|
|
35
33
|
end
|
|
36
34
|
|
|
@@ -71,7 +69,6 @@ module Labimotion
|
|
|
71
69
|
params :upload_segment_klass_params do
|
|
72
70
|
requires :label, type: String, desc: 'Klass label'
|
|
73
71
|
optional :desc, type: String, desc: 'Klass desc'
|
|
74
|
-
optional :metadata, type: Hash, desc: 'Klass metadata'
|
|
75
72
|
requires :properties_template, type: Hash, desc: 'Klass template'
|
|
76
73
|
optional :properties_release, type: Hash, desc: 'Klass release'
|
|
77
74
|
optional :released_at, type: DateTime, desc: 'Klass released_at'
|
|
@@ -98,7 +95,6 @@ module Labimotion
|
|
|
98
95
|
requires :element_klass, type: Integer, desc: 'Element Klass Id'
|
|
99
96
|
optional :desc, type: String, desc: 'Segment Klass Desc'
|
|
100
97
|
optional :place, type: String, desc: 'Segment Klass Place', default: '100'
|
|
101
|
-
optional :metadata, type: Hash, desc: 'Klass metadata'
|
|
102
98
|
optional :properties_template, type: Hash, desc: 'Element Klass properties template'
|
|
103
99
|
end
|
|
104
100
|
|
|
@@ -154,13 +154,12 @@ module Labimotion
|
|
|
154
154
|
ofile = Rails.root.join(data[:f], data[:a].filename)
|
|
155
155
|
FileUtils.cp(data[:a].attachment_url, ofile)
|
|
156
156
|
|
|
157
|
-
File.open(ofile, '
|
|
157
|
+
File.open(ofile, 'r') do |f|
|
|
158
158
|
body = { file: f }
|
|
159
159
|
response = HTTParty.post(
|
|
160
160
|
uri('conversions'),
|
|
161
161
|
basic_auth: auth,
|
|
162
162
|
body: body,
|
|
163
|
-
multipart: true,
|
|
164
163
|
timeout: timeout,
|
|
165
164
|
)
|
|
166
165
|
end
|
|
@@ -223,8 +222,7 @@ module Labimotion
|
|
|
223
222
|
element_id: cds.id,
|
|
224
223
|
properties: props,
|
|
225
224
|
properties_release: klass.properties_release,
|
|
226
|
-
klass_uuid: klass.uuid
|
|
227
|
-
metadata: klass.metadata
|
|
225
|
+
klass_uuid: klass.uuid
|
|
228
226
|
)
|
|
229
227
|
end
|
|
230
228
|
|
|
@@ -307,13 +305,12 @@ module Labimotion
|
|
|
307
305
|
|
|
308
306
|
def self.create_tables(tmpfile)
|
|
309
307
|
res = {}
|
|
310
|
-
File.open(tmpfile.path, '
|
|
308
|
+
File.open(tmpfile.path, 'r') do |file|
|
|
311
309
|
body = { file: file }
|
|
312
310
|
response = HTTParty.post(
|
|
313
311
|
uri('tables'),
|
|
314
312
|
basic_auth: auth,
|
|
315
313
|
body: body,
|
|
316
|
-
multipart: true,
|
|
317
314
|
timeout: timeout,
|
|
318
315
|
)
|
|
319
316
|
res = response.parsed_response
|
|
@@ -29,7 +29,6 @@ module Labimotion
|
|
|
29
29
|
properties: ods.properties,
|
|
30
30
|
properties_release: ods.properties_release,
|
|
31
31
|
klass_uuid: ods.klass_uuid,
|
|
32
|
-
metadata: ods.metadata || {}
|
|
33
32
|
)
|
|
34
33
|
end
|
|
35
34
|
|
|
@@ -50,8 +49,8 @@ module Labimotion
|
|
|
50
49
|
props = Labimotion::VocabularyHandler.update_vocabularies(props, dataset_args[:current_user], dataset_args[:element])
|
|
51
50
|
|
|
52
51
|
ds = Labimotion::Dataset.find_by(element_type: self.class.name, element_id: id)
|
|
53
|
-
if ds.present? && (ds.klass_uuid != klass.uuid || ds.properties != props
|
|
54
|
-
ds.update!(properties_release: klass.properties_release, uuid: uuid, dataset_klass_id: dataset_klass_id, properties: props, klass_uuid: klass.uuid
|
|
52
|
+
if ds.present? && (ds.klass_uuid != klass.uuid || ds.properties != props)
|
|
53
|
+
ds.update!(properties_release: klass.properties_release, uuid: uuid, dataset_klass_id: dataset_klass_id, properties: props, klass_uuid: klass.uuid)
|
|
55
54
|
end
|
|
56
55
|
return if ds.present?
|
|
57
56
|
|
|
@@ -9,6 +9,7 @@ module Labimotion
|
|
|
9
9
|
before_save :check_identifier
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
|
|
12
13
|
def check_identifier
|
|
13
14
|
self.identifier = identifier || SecureRandom.uuid if self.has_attribute?(:identifier)
|
|
14
15
|
end
|
|
@@ -33,7 +34,7 @@ module Labimotion
|
|
|
33
34
|
properties_release: properties_release,
|
|
34
35
|
released_at: DateTime.now,
|
|
35
36
|
updated_by: current_user&.id,
|
|
36
|
-
released_by: current_user&.id
|
|
37
|
+
released_by: current_user&.id,
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
self.update!(klass_attributes)
|
|
@@ -45,7 +46,7 @@ module Labimotion
|
|
|
45
46
|
created_by: updated_by,
|
|
46
47
|
properties_release: properties_release,
|
|
47
48
|
released_at: released_at,
|
|
48
|
-
metadata: metadata
|
|
49
|
+
metadata: metadata
|
|
49
50
|
}
|
|
50
51
|
attributes["#{self.class.name.underscore.split('/').last}_id"] = id
|
|
51
52
|
"#{self.class.name}esRevision".constantize.create(attributes)
|
data/lib/labimotion/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: labimotion
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.2.0.rc1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chia-Lin Lin
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2025-12-25 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: caxlsx
|