Skip to content

Commit

Permalink
Merge branch 'master' into feature/migrate-ruby-3
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Feb 15, 2025
2 parents e81b24d + 595991d commit db795da
Show file tree
Hide file tree
Showing 11 changed files with 222 additions and 128 deletions.
59 changes: 33 additions & 26 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/ontoportal-lirmm/ontologies_api_ruby_client.git
revision: 23ae179ca9e6aa858b4ceabc454876ff9a65420b
revision: f5b82f304abaf6f0a4ee671729120973084189e5
branch: development
specs:
ontologies_api_client (2.2.0)
Expand Down Expand Up @@ -104,7 +104,8 @@ GEM
autoprefixer-rails (>= 9.1.0)
popper_js (>= 1.14.3, < 2)
sassc-rails (>= 2.0.0)
brakeman (5.4.1)
brakeman (7.0.0)
racc
bugsnag (6.27.1)
concurrent-ruby (~> 1.0)
builder (3.3.0)
Expand All @@ -124,11 +125,11 @@ GEM
capistrano-bundler (>= 1.1, < 3)
capistrano-yarn (2.0.2)
capistrano (~> 3.0)
capybara (3.39.2)
capybara (3.40.0)
addressable
matrix
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
nokogiri (~> 1.11)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
Expand All @@ -146,7 +147,7 @@ GEM
bigdecimal
rexml
crass (1.0.6)
css_parser (1.17.1)
css_parser (1.21.0)
addressable
csv (3.3.2)
dalli (3.2.8)
Expand All @@ -155,7 +156,7 @@ GEM
irb (~> 1.10)
reline (>= 0.3.8)
deepl-rb (3.2.0)
diff-lcs (1.5.1)
diff-lcs (1.6.0)
docile (1.4.1)
domain_name (0.6.20240107)
ed25519 (1.3.0)
Expand Down Expand Up @@ -197,7 +198,8 @@ GEM
railties (>= 5.1)
hashdiff (1.1.2)
hashie (5.0.0)
highline (2.1.0)
highline (3.1.2)
reline
html2haml (2.3.0)
erubis (~> 2.7.0)
haml (>= 4.0)
Expand All @@ -222,7 +224,7 @@ GEM
terminal-table (>= 1.5.1)
i18n-tasks-csv (1.1)
i18n-tasks (~> 0.9)
importmap-rails (2.0.3)
importmap-rails (2.1.0)
actionpack (>= 6.0.0)
activesupport (>= 6.0.0)
railties (>= 6.0.0)
Expand All @@ -244,7 +246,7 @@ GEM
railties (>= 3.2.16)
jsbundling-rails (1.3.1)
railties (>= 6.0.0)
json (2.9.1)
json (2.10.1)
json-jwt (1.16.7)
activesupport (>= 4.2)
aes_key_wrap
Expand All @@ -266,10 +268,11 @@ GEM
letter_opener (~> 1.7)
railties (>= 5.2)
rexml
lint_roller (1.1.0)
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.6.5)
logger (1.6.6)
loofah (2.24.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
Expand Down Expand Up @@ -298,10 +301,10 @@ GEM
mime-types (3.6.0)
logger
mime-types-data (~> 3.2015)
mime-types-data (3.2025.0107)
mime-types-data (3.2025.0204)
mini_mime (1.1.5)
minitest (5.25.4)
msgpack (1.7.5)
msgpack (1.8.0)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.4.1)
Expand All @@ -311,7 +314,7 @@ GEM
time
net-http (0.3.2)
uri
net-imap (0.4.18)
net-imap (0.5.6)
date
net-protocol
net-pop (0.1.2)
Expand All @@ -322,7 +325,7 @@ GEM
net-ssh (>= 2.6.5, < 8.0.0)
net-sftp (4.0.0)
net-ssh (>= 5.0.0, < 8.0.0)
net-smtp (0.5.0)
net-smtp (0.5.1)
net-protocol
net-ssh (7.3.0)
netrc (0.11.0)
Expand Down Expand Up @@ -372,7 +375,7 @@ GEM
omniauth (~> 2.0)
ostruct (0.6.1)
parallel (1.26.3)
parser (3.3.7.0)
parser (3.3.7.1)
ast (~> 2.4.1)
racc
popper_js (1.16.1)
Expand All @@ -385,11 +388,11 @@ GEM
psych (5.2.3)
date
stringio
public_suffix (5.1.1)
public_suffix (6.0.1)
puma (5.6.9)
nio4r (~> 2.0)
racc (1.8.1)
rack (2.2.10)
rack (2.2.11)
rack-protection (3.2.0)
base64 (>= 0.1.0)
rack (~> 2.2, >= 2.2.4)
Expand Down Expand Up @@ -430,7 +433,7 @@ GEM
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
rdoc (6.11.0)
rdoc (6.12.0)
psych (>= 4.0.0)
recaptcha (5.9.0)
json
Expand All @@ -447,15 +450,15 @@ GEM
netrc (~> 0.8)
rexml (3.4.0)
rouge (4.5.1)
rspec-core (3.13.2)
rspec-core (3.13.3)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (7.1.0)
rspec-rails (7.1.1)
actionpack (>= 7.0)
activesupport (>= 7.0)
railties (>= 7.0)
Expand All @@ -464,9 +467,10 @@ GEM
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.2)
rubocop (1.71.1)
rubocop (1.72.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
Expand All @@ -493,7 +497,9 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
selenium-webdriver (4.9.0)
selenium-webdriver (4.28.0)
base64 (~> 0.2)
logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
Expand All @@ -518,16 +524,17 @@ GEM
actionpack (>= 6.1)
activesupport (>= 6.1)
sprockets (>= 3.0.0)
sshkit (1.23.2)
sshkit (1.24.0)
base64
logger
net-scp (>= 1.1.2)
net-sftp (>= 2.1.2)
net-ssh (>= 2.8.0)
ostruct
stimulus-rails (1.3.4)
railties (>= 6.0.0)
string-similarity (2.1.0)
stringio (3.1.2)
stringio (3.1.3)
temple (0.10.3)
terminal-table (4.0.0)
unicode-display_width (>= 1.1.1, < 4)
Expand Down Expand Up @@ -558,7 +565,7 @@ GEM
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webmock (3.24.0)
webmock (3.25.0)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
Expand Down
8 changes: 8 additions & 0 deletions app/assets/stylesheets/concepts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,11 @@ div.synonym-change-request button {
margin-top: -4px;
}

.concept_details_component{
.chip-button-component-container{
word-break: break-word !important;
overflow-wrap: break-word !important;
white-space: normal !important;
}
}

2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def get_class(params)
# TODO_REV: Support views? Replace old view call: @ontology.top_level_classes(view)
@roots = @ontology.explore.roots(concept_schemes: params[:concept_schemes]) rescue nil

if @roots.nil? || response_error?(@roots) || @roots.compact&.empty?
if @roots.blank? || response_error?(@roots) || @roots.compact&.empty?
LOG.add :debug, t('application.missing_roots_for_ontology', acronym: @ontology.acronym)
classes = @ontology.explore.classes.collection
@concept = classes.first.explore.self(full: true) if classes&.first
Expand Down
40 changes: 17 additions & 23 deletions app/controllers/concepts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def show
redirect_to(ontology_path(id: params[:ontology], p: 'classes', conceptid: params[:id], lang: request_lang)) and return unless turbo_frame_request?

@submission = get_ontology_submission_ready(@ontology)
@concept = @ontology.explore.single_class({full: true, language: request_lang}, params[:id])
@concept = @ontology.explore.single_class({ full: true, language: request_lang }, params[:id])
@instances_concept_id = @concept.id

concept_not_found(params[:id]) if @concept.nil?
Expand All @@ -40,22 +40,21 @@ def index
return
end

# Note that find_by_acronym includes views by default
@ontology = LinkedData::Client::Models::Ontology.find_by_acronym(params[:ontology]).first

@submission = @ontology.explore.latest_submission(include:'uriRegexPattern,preferredNamespaceUri')

@concept = @ontology.explore.single_class({dispay: 'prefLabel'}, params[:id])

concept_not_found(params[:id]) if @concept.nil?
@submission = LinkedData::Client::Models::Ontology.explore(params[:ontology])
.latest_submission
.get(include: 'uriRegexPattern,preferredNamespaceUri')
@schemes = params[:concept_schemes].split(',')

@concept.children = @concept.explore.children(pagesize: 750, concept_schemes: Array(@schemes).join(','), language: request_lang, display: 'prefLabel,obsolete,hasChildren').collection || []
@concept = LinkedData::Client::Models::Class.new(values: { id: params[:id] })

@concept.children = LinkedData::Client::Models::Ontology.explore(params[:ontology])
.classes(params[:id])
.children
.get(pagesize: 750, concept_schemes: Array(@schemes).join(','), language: request_lang, display: 'prefLabel,obsolete,hasChildren').collection || []
render turbo_stream: [
replace(helpers.child_id(@concept) + '_open_link') { TreeLinkComponent.tree_close_icon },
replace(helpers.child_id(@concept) + '_childs') do
helpers.concepts_tree_component(@concept, @concept, @ontology.acronym, Array(@schemes), request_lang, sub_tree: true, submission: @submission)
helpers.concepts_tree_component(@concept, @concept, params[:ontology], Array(@schemes), request_lang, sub_tree: true, submission: @submission)
end
]
end
Expand Down Expand Up @@ -84,11 +83,11 @@ def show_definition

def show_tree
@ontology = LinkedData::Client::Models::Ontology.find_by_acronym(params[:ontology]).first
@submission = @ontology.explore.latest_submission(include:'uriRegexPattern,preferredNamespaceUri')
@submission = @ontology.explore.latest_submission(include: 'uriRegexPattern,preferredNamespaceUri')
if @ontology.nil? || @ontology.errors
ontology_not_found(params[:ontology])
else
get_class(params) #application_controller
get_class(params) # application_controller

not_found(t('concepts.missing_roots')) if @root.nil?

Expand All @@ -109,8 +108,8 @@ def show_date_sorted_list
auto_click = page.to_s.eql?('1')
params = {
page: page,
sortby:'modified,created',
order:'desc,desc',
sortby: 'modified,created',
order: 'desc,desc',
display: 'prefLabel,modified,created',
language: request_lang
}
Expand Down Expand Up @@ -142,32 +141,27 @@ def details
@ontology = LinkedData::Client::Models::Ontology.find_by_acronym(params[:ontology]).first
ontology_not_found(params[:ontology]) if @ontology.nil?

@concept = @ontology.explore.single_class({full: true}, CGI.unescape(params[:conceptid]))
@concept = @ontology.explore.single_class({ full: true }, CGI.unescape(params[:conceptid]))
concept_not_found(CGI.unescape(params[:conceptid])) if @concept.nil? || @concept.errors
@container_id = params[:modal] ? 'application_modal_content' : 'concept_details'

render :partial => "details"
end


def biomixer
@ontology = LinkedData::Client::Models::Ontology.find_by_acronym(params[:ontology]).first
ontology_not_found(params[:ontology]) if @ontology.nil?

@concept = @ontology.explore.single_class({full: true}, params[:conceptid])
@concept = @ontology.explore.single_class({ full: true }, params[:conceptid])
concept_not_found(params[:conceptid]) if @concept.nil?

render partial: "biomixer", layout: false
end


private




def filter_concept_with_no_date(concepts)
concepts.filter { |c| !concept_date(c).nil?}
concepts.filter { |c| !concept_date(c).nil? }
end

def concepts_to_years_months(concepts)
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/federation_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def federation_error?(response)
end

def federation_error(response)
federation_errors = response[:errors].map { |e| ontology_portal_name(e.split(' ').last.gsub('search', '')) }
federation_errors = response[:errors].map { |e| e.split(' ').last }
federation_errors.map { |p| "#{p} #{t('federation.not_responding')} " }.join(' ')
end

Expand Down
4 changes: 2 additions & 2 deletions app/helpers/home_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def format_number_abbreviated(number)
end
end

def portal_config_tooltip(portal_name, &block)
portal_id = portal_name&.downcase
def portal_config_tooltip(portal, &block)
portal_id = portal&.downcase
title = if (federation_portal_status(portal_name: portal_id) || portal_id.eql?(portal_name&.downcase))
render(
TurboFrameComponent.new(
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/multi_languages_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def main_language_label(label)
end

# @param label String | Array | OpenStruct
def display_in_multiple_languages(label, show_max: 5, style_as_badge: false)
def display_in_multiple_languages(label, style_as_badge: false, show_max: 5)
if label.blank?
return render Display::AlertComponent.new(message: t('ontology_details.concept.no_preferred_name_for_selected_language'),
type: "warning",
Expand Down
Loading

0 comments on commit db795da

Please sign in to comment.