labimotion 1.4.0.rc4 → 1.4.0.rc6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/labimotion/apis/generic_element_api.rb +14 -1
- data/lib/labimotion/collection/import.rb +7 -3
- data/lib/labimotion/conf.rb +6 -0
- data/lib/labimotion/helpers/element_helpers.rb +2 -1
- data/lib/labimotion/helpers/generic_helpers.rb +4 -3
- data/lib/labimotion/models/element_klass.rb +3 -1
- data/lib/labimotion/version.rb +1 -1
- data/lib/labimotion.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f17746bfc2e59e5a5831ba43f167b081e1c9d0f40fbecd6e5d6c780b42b55cea
|
4
|
+
data.tar.gz: 2b87525c3e275df8e80a1c75501a20014f1c5355fd149d76fd509b8819f8bab9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c38733299255e71615703933d0caa2e55594cb73e66b9265ad260dd0ced46b7aea98f903b3d0d0874648c04fcdedbc0c2f8156d69aaa82520816be02a8ec149a
|
7
|
+
data.tar.gz: c676883c9c863a1efbeccf27ba0c22f5b0cb21afae26339c449608a8de7c1c486501a829039a4d379d05b59853696969e5b06f685e9f389d87ccfdae9e3a7dc3
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'labimotion/
|
3
|
+
require 'labimotion/conf'
|
4
4
|
require 'labimotion/libs/export_element'
|
5
5
|
|
6
6
|
module Labimotion
|
@@ -17,6 +17,19 @@ module Labimotion
|
|
17
17
|
helpers Labimotion::ParamHelpers
|
18
18
|
|
19
19
|
resource :generic_elements do
|
20
|
+
# might be removed because the file is moved to public folder
|
21
|
+
namespace :current do
|
22
|
+
desc 'Return serialized elements of current user'
|
23
|
+
get do
|
24
|
+
klasses_json_path = Labimotion::KLASSES_JSON # Rails.root.join('app/packs/klasses.json')
|
25
|
+
klasses = JSON.parse(File.read(klasses_json_path))
|
26
|
+
{ klasses: klasses }
|
27
|
+
rescue StandardError => e
|
28
|
+
Labimotion.log_exception(e, current_user)
|
29
|
+
{ klasses: [] }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
20
33
|
namespace :klass do
|
21
34
|
desc 'get klass info'
|
22
35
|
params do
|
@@ -47,8 +47,12 @@ module Labimotion
|
|
47
47
|
begin
|
48
48
|
data.fetch('Labimotion::Dataset', {}).each do |uuid, fields|
|
49
49
|
klass_id = fields['dataset_klass_id']
|
50
|
-
|
51
|
-
|
50
|
+
next if data.fetch('Labimotion::DatasetKlass', {}).empty?
|
51
|
+
|
52
|
+
dk_obj = data.fetch('Labimotion::DatasetKlass', {}) && data.fetch('Labimotion::DatasetKlass', {})[klass_id]
|
53
|
+
next if dk_obj.nil?
|
54
|
+
|
55
|
+
dk_id = dk_obj && dk_obj['identifier']
|
52
56
|
element_uuid = fields.fetch('element_id')
|
53
57
|
element_type = fields.fetch('element_type')
|
54
58
|
element = instances.fetch(element_type).fetch(element_uuid)
|
@@ -78,7 +82,7 @@ module Labimotion
|
|
78
82
|
end
|
79
83
|
rescue StandardError => e
|
80
84
|
Labimotion.log_exception(e)
|
81
|
-
raise
|
85
|
+
# raise
|
82
86
|
end
|
83
87
|
end
|
84
88
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'grape'
|
4
|
+
require 'labimotion/conf'
|
4
5
|
require 'labimotion/utils/utils'
|
5
6
|
# require 'labimotion/models/element_klass'
|
6
7
|
module Labimotion
|
@@ -33,7 +34,7 @@ module Labimotion
|
|
33
34
|
new_klass = Labimotion::ElementKlass.create!(attributes)
|
34
35
|
new_klass.reload
|
35
36
|
new_klass.create_klasses_revision(current_user)
|
36
|
-
klass_names_file = Rails.root.join('app/packs/klasses.json')
|
37
|
+
klass_names_file = Labimotion::KLASSES_JSON # Rails.root.join('app/packs/klasses.json')
|
37
38
|
klasses = Labimotion::ElementKlass.where(is_active: true)&.pluck(:name) || []
|
38
39
|
File.write(klass_names_file, klasses)
|
39
40
|
klasses
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'grape'
|
3
|
+
require 'labimotion/conf'
|
3
4
|
require 'labimotion/utils/utils'
|
4
5
|
# Helper for associated sample
|
5
6
|
module Labimotion
|
@@ -23,7 +24,7 @@ module Labimotion
|
|
23
24
|
def deactivate_klass(params)
|
24
25
|
klz = fetch_klass(params[:klass], params[:id])
|
25
26
|
klz&.update!(is_active: params[:is_active])
|
26
|
-
generate_klass_file unless klz.class.name != 'ElementKlass'
|
27
|
+
generate_klass_file unless klz.class.name != 'Labimotion::ElementKlass'
|
27
28
|
klz
|
28
29
|
rescue StandardError => e
|
29
30
|
Labimotion.log_exception(e, current_user)
|
@@ -34,7 +35,7 @@ module Labimotion
|
|
34
35
|
authenticate_admin!(params[:klass].gsub(/(Klass)/, 's').downcase)
|
35
36
|
klz = fetch_klass(params[:klass], params[:id])
|
36
37
|
klz&.destroy!
|
37
|
-
generate_klass_file unless klz.class.name != 'ElementKlass'
|
38
|
+
generate_klass_file unless klz.class.name != 'Labimotion::ElementKlass'
|
38
39
|
status 201
|
39
40
|
rescue StandardError => e
|
40
41
|
Labimotion.log_exception(e, current_user)
|
@@ -97,7 +98,7 @@ module Labimotion
|
|
97
98
|
|
98
99
|
###############
|
99
100
|
def generate_klass_file
|
100
|
-
klass_names_file = Rails.root.join('app/packs/klasses.json')
|
101
|
+
klass_names_file = Labimotion::KLASSES_JSON # Rails.root.join('app/packs/klasses.json')
|
101
102
|
klasses = Labimotion::ElementKlass.where(is_active: true)&.pluck(:name) || []
|
102
103
|
File.write(klass_names_file, klasses)
|
103
104
|
rescue StandardError => e
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
require 'labimotion/conf'
|
2
3
|
require 'labimotion/models/concerns/generic_klass_revisions'
|
3
4
|
require 'labimotion/models/concerns/workflow'
|
4
5
|
|
@@ -18,7 +19,8 @@ module Labimotion
|
|
18
19
|
klasses = []
|
19
20
|
ensure
|
20
21
|
File.write(
|
21
|
-
Rails.root.join('app/packs/klasses.json'),
|
22
|
+
# Rails.root.join('app/packs/klasses.json'),
|
23
|
+
Labimotion::KLASSES_JSON,
|
22
24
|
klasses&.to_json || []
|
23
25
|
)
|
24
26
|
end
|
data/lib/labimotion/version.rb
CHANGED
data/lib/labimotion.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: 1.4.0.
|
4
|
+
version: 1.4.0.rc6
|
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: 2024-
|
12
|
+
date: 2024-07-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -42,6 +42,7 @@ files:
|
|
42
42
|
- lib/labimotion/apis/segment_api.rb
|
43
43
|
- lib/labimotion/collection/export.rb
|
44
44
|
- lib/labimotion/collection/import.rb
|
45
|
+
- lib/labimotion/conf.rb
|
45
46
|
- lib/labimotion/entities/application_entity.rb
|
46
47
|
- lib/labimotion/entities/dataset_entity.rb
|
47
48
|
- lib/labimotion/entities/dataset_klass_entity.rb
|