labimotion 1.4.0.rc5 → 1.4.0.rc7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 587b32cc2f374e118a3570bbe34a69a497ec9e6d2134757d9241ad6c90b416ec
4
- data.tar.gz: 4a778699fb7c40c7aa3383cc2cabfb910218a616f122d0b748d092262d2ee370
3
+ metadata.gz: ff15957fc41b34b4b25e4c76e73c1fb9d903a758fa80839ddf3db0c1adaad00c
4
+ data.tar.gz: c8b1b781b8a7d0a53ee988d8d26ca300a3d808f0c7e192c703cfd608b1663d6e
5
5
  SHA512:
6
- metadata.gz: 1c20c57d746b3c6d0f771781fb3bf44eda10062f0ca577cb06e6c4aed1bcceb8f8f0be7556d2cb3e310010aa38c9de14ef791309fe829ef1d591b8782ac5c29a
7
- data.tar.gz: 760ae347f5842287bdf7d04074d55d38cdac15cf61fa540c87295f049c1547fea20fba669997172db08fcbb2f570abd3bf1b4fdbb5774e41d163645e41512e15
6
+ metadata.gz: 423c73182f09f27ce911deb7306325160206da08cfee745a5b9131f8c8e288b291b80fd64c8b81933b9a124a6728be7788de8f04646d2d28bfec0df027ca75be
7
+ data.tar.gz: d6ad47a79590d47766bd931615087d4d7db1083db95999874aff87c35ae94b7c0dcee8ff97ea027de3e01b73871864fcfa5462cdc619458c7711ee27b3f563a5
@@ -41,7 +41,7 @@ module Labimotion
41
41
  end
42
42
  post do
43
43
  msg = create_repo_klass(params, current_user, request.headers['Origin'])
44
- klass = Labimotion::DatasetKlassEntity.represent(DatasetKlass.all)
44
+ klass = Labimotion::DatasetKlassEntity.represent(Labimotion::DatasetKlass.all)
45
45
  { status: msg[:status], message: msg[:message], klass: klass }
46
46
  rescue StandardError => e
47
47
  Labimotion.log_exception(e, current_user)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'labimotion/version'
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
@@ -235,7 +248,7 @@ module Labimotion
235
248
  end
236
249
  post do
237
250
  msg = create_repo_klass(params, current_user, request.headers['Origin'])
238
- klass = Labimotion::ElementKlassEntity.represent(ElementKlass.all)
251
+ klass = Labimotion::ElementKlassEntity.represent(Labimotion::ElementKlass.all)
239
252
  { status: msg[:status], message: msg[:message], klass: klass }
240
253
  rescue StandardError => e
241
254
  Labimotion.log_exception(e, current_user)
@@ -364,6 +377,7 @@ module Labimotion
364
377
  end
365
378
  route_param :id do
366
379
  before do
380
+ byebug
367
381
  @element_policy = ElementPolicy.new(current_user, Element.find(params[:id]))
368
382
  error!('401 Unauthorized', 401) unless current_user.matrix_check_by_name('genericElement') && @element_policy.read?
369
383
  rescue ActiveRecord::RecordNotFound
@@ -125,7 +125,7 @@ module Labimotion
125
125
  end
126
126
  post do
127
127
  msg = create_repo_klass(params, current_user, request.headers['Origin'])
128
- klass = Labimotion::SegmentKlassEntity.represent(SegmentKlass.all)
128
+ klass = Labimotion::SegmentKlassEntity.represent(Labimotion::SegmentKlass.all)
129
129
  { status: msg[:status], message: msg[:message], klass: klass }
130
130
  rescue StandardError => e
131
131
  Labimotion.log_exception(e, current_user)
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ ## Labimotion Configuration
4
+ module Labimotion
5
+ KLASSES_JSON = Rails.root.join('public', 'klasses.json').to_s.freeze # Rails.root.join('app/packs/klasses.json').to_s.freeze
6
+ end
@@ -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
@@ -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
@@ -9,7 +9,7 @@ module Labimotion
9
9
  extend Grape::API::Helpers
10
10
 
11
11
  def klass_list(el_klass, is_active=false)
12
- scope = SegmentKlass.all
12
+ scope = Labimotion::SegmentKlass.all
13
13
  scope = scope.where(is_active: is_active) if is_active.present? && is_active == true
14
14
  scope = scope.joins(:element_klass).where(klass_element: params[:element], is_active: true) if el_klass.present?
15
15
  scope.order('place') || []
@@ -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
@@ -2,5 +2,5 @@
2
2
 
3
3
  ## Labimotion Version
4
4
  module Labimotion
5
- VERSION = '1.4.0.rc5'
5
+ VERSION = '1.4.0.rc7'
6
6
  end
data/lib/labimotion.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # In your_gem_name.rb or main Ruby file
2
2
  module Labimotion
3
3
 
4
+ autoload :CONF, 'labimotion/conf'
4
5
  autoload :VERSION, 'labimotion/version'
5
6
 
6
7
  def self.logger
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.rc5
4
+ version: 1.4.0.rc7
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-07-05 00:00:00.000000000 Z
12
+ date: 2024-07-12 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