diff --git a/Gemfile b/Gemfile index 51dc38ee9..781e6379e 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' # Main Rails gem # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '7.0.3' +gem 'rails', '7.0.4' # JavaScript bundling for Rails gem 'jsbundling-rails' diff --git a/Gemfile.lock b/Gemfile.lock index c302fded1..74919ff34 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GIT remote: https://github.com/ontoportal-lirmm/ontologies_api_ruby_client.git - revision: 1fcf35adcb8955d6b2d48ed08055d31cb00cd3c2 - branch: feature/federate-multiple-apis + revision: 670ce6adfe77aeda97974414ab0ed4b6c5dc9469 + branch: development specs: ontologies_api_client (2.2.0) activesupport (~> 7.0.4) @@ -19,67 +19,67 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (7.0.3) - actionpack (= 7.0.3) - activesupport (= 7.0.3) + actioncable (7.0.4) + actionpack (= 7.0.4) + activesupport (= 7.0.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.3) - actionpack (= 7.0.3) - activejob (= 7.0.3) - activerecord (= 7.0.3) - activestorage (= 7.0.3) - activesupport (= 7.0.3) + actionmailbox (7.0.4) + actionpack (= 7.0.4) + activejob (= 7.0.4) + activerecord (= 7.0.4) + activestorage (= 7.0.4) + activesupport (= 7.0.4) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.3) - actionpack (= 7.0.3) - actionview (= 7.0.3) - activejob (= 7.0.3) - activesupport (= 7.0.3) + actionmailer (7.0.4) + actionpack (= 7.0.4) + actionview (= 7.0.4) + activejob (= 7.0.4) + activesupport (= 7.0.4) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.3) - actionview (= 7.0.3) - activesupport (= 7.0.3) + actionpack (7.0.4) + actionview (= 7.0.4) + activesupport (= 7.0.4) rack (~> 2.0, >= 2.2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.3) - actionpack (= 7.0.3) - activerecord (= 7.0.3) - activestorage (= 7.0.3) - activesupport (= 7.0.3) + actiontext (7.0.4) + actionpack (= 7.0.4) + activerecord (= 7.0.4) + activestorage (= 7.0.4) + activesupport (= 7.0.4) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.3) - activesupport (= 7.0.3) + actionview (7.0.4) + activesupport (= 7.0.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.3) - activesupport (= 7.0.3) + activejob (7.0.4) + activesupport (= 7.0.4) globalid (>= 0.3.6) - activemodel (7.0.3) - activesupport (= 7.0.3) - activerecord (7.0.3) - activemodel (= 7.0.3) - activesupport (= 7.0.3) - activestorage (7.0.3) - actionpack (= 7.0.3) - activejob (= 7.0.3) - activerecord (= 7.0.3) - activesupport (= 7.0.3) + activemodel (7.0.4) + activesupport (= 7.0.4) + activerecord (7.0.4) + activemodel (= 7.0.4) + activesupport (= 7.0.4) + activestorage (7.0.4) + actionpack (= 7.0.4) + activejob (= 7.0.4) + activerecord (= 7.0.4) + activesupport (= 7.0.4) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.3) + activesupport (7.0.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -87,13 +87,13 @@ GEM addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) aes_key_wrap (1.1.0) - airbrussh (1.5.2) + airbrussh (1.5.3) sshkit (>= 1.6.1, != 1.7.0) ast (2.4.2) autoprefixer-rails (10.4.19.0) execjs (~> 2) base64 (0.2.0) - bcrypt_pbkdf (1.1.0) + bcrypt_pbkdf (1.1.1) bigdecimal (3.1.8) bindata (2.5.0) bindex (0.8.1) @@ -104,10 +104,10 @@ GEM popper_js (>= 1.14.3, < 2) sassc-rails (>= 2.0.0) brakeman (5.4.1) - bugsnag (6.26.4) + bugsnag (6.27.1) concurrent-ruby (~> 1.0) - builder (3.2.4) - capistrano (3.18.1) + builder (3.3.0) + capistrano (3.19.1) airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) @@ -134,7 +134,8 @@ GEM xpath (~> 3.2) chart-js-rails (0.1.7) railties (> 3.1) - childprocess (5.0.0) + childprocess (5.1.0) + logger (~> 1.5) coderay (1.1.3) color (1.8) concurrent-ruby (1.3.4) @@ -156,8 +157,7 @@ GEM ed25519 (1.3.0) erubi (1.13.0) erubis (2.7.0) - eventmachine (1.2.7) - excon (0.110.0) + excon (0.111.0) execjs (2.9.1) faraday (2.0.1) faraday-net_http (~> 2.0) @@ -176,9 +176,10 @@ GEM sass-rails globalid (1.2.1) activesupport (>= 6.1) - graphql (2.3.3) + graphql (2.3.14) base64 - graphql-client (0.22.0) + fiber-storage + graphql-client (0.23.0) activesupport (>= 3.0) graphql (>= 1.13.0) haml (5.2.2) @@ -220,11 +221,11 @@ GEM actionpack (>= 6.0.0) activesupport (>= 6.0.0) railties (>= 6.0.0) - inline_svg (1.9.0) + inline_svg (1.10.0) activesupport (>= 3.0) nokogiri (>= 1.6) io-console (0.7.2) - irb (1.13.1) + irb (1.14.0) rdoc (>= 4.0.0) reline (>= 0.4.2) iso-639 (0.3.6) @@ -244,7 +245,7 @@ GEM bindata faraday (~> 2.0) faraday-follow_redirects - jwt (2.8.1) + jwt (2.8.2) base64 language_server-protocol (3.17.0.3) launchy (3.0.1) @@ -260,7 +261,7 @@ GEM listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - logger (1.6.0) + logger (1.6.1) loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -288,21 +289,20 @@ GEM method_source (1.1.0) mime-types (3.5.2) mime-types-data (~> 3.2015) - mime-types-data (3.2024.0507) + mime-types-data (3.2024.0820) mini_mime (1.1.5) - minitest (5.22.3) + minitest (5.25.1) msgpack (1.7.2) multi_json (1.15.0) multi_xml (0.6.0) multipart-post (2.4.1) - mutex_m (0.2.0) mysql2 (0.5.6) net-ftp (0.2.1) net-protocol time net-http (0.3.2) uri - net-imap (0.4.11) + net-imap (0.4.15) date net-protocol net-pop (0.1.2) @@ -317,7 +317,7 @@ GEM net-protocol net-ssh (7.2.3) netrc (0.11.0) - newrelic_rpm (9.9.0) + newrelic_rpm (9.13.0) nio4r (2.7.3) nokogiri (1.15.6-x86_64-linux) racc (~> 1.4) @@ -338,7 +338,7 @@ GEM omniauth-github (2.0.1) omniauth (~> 2.0) omniauth-oauth2 (~> 1.8) - omniauth-google-oauth2 (1.1.2) + omniauth-google-oauth2 (1.1.3) jwt (>= 2.0) oauth2 (~> 2.0) omniauth (~> 2.0) @@ -357,44 +357,41 @@ GEM omniauth-rails_csrf_protection (1.0.2) actionpack (>= 4.2) omniauth (~> 2.0) - open_uri_redirections (0.2.1) - parallel (1.24.0) - parser (3.3.1.0) + ostruct (0.6.0) + parallel (1.26.3) + parser (3.3.4.2) ast (~> 2.4.1) racc popper_js (1.16.1) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - psych (3.3.4) - public_suffix (5.0.5) + psych (5.1.2) + stringio + public_suffix (5.1.1) puma (5.6.8) nio4r (~> 2.0) - racc (1.7.3) + racc (1.8.1) rack (2.2.9) - rack-accept (0.4.5) - rack (>= 0.4) - rack-mini-profiler (3.3.1) - rack (>= 1.2.0) rack-protection (3.2.0) base64 (>= 0.1.0) rack (~> 2.2, >= 2.2.4) rack-test (2.1.0) rack (>= 1.3) - rails (7.0.3) - actioncable (= 7.0.3) - actionmailbox (= 7.0.3) - actionmailer (= 7.0.3) - actionpack (= 7.0.3) - actiontext (= 7.0.3) - actionview (= 7.0.3) - activejob (= 7.0.3) - activemodel (= 7.0.3) - activerecord (= 7.0.3) - activestorage (= 7.0.3) - activesupport (= 7.0.3) + rails (7.0.4) + actioncable (= 7.0.4) + actionmailbox (= 7.0.4) + actionmailer (= 7.0.4) + actionpack (= 7.0.4) + actiontext (= 7.0.4) + actionview (= 7.0.4) + activejob (= 7.0.4) + activemodel (= 7.0.4) + activerecord (= 7.0.4) + activestorage (= 7.0.4) + activesupport (= 7.0.4) bundler (>= 1.15.0) - railties (= 7.0.3) + railties (= 7.0.4) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -405,9 +402,9 @@ GEM rails-i18n (7.0.9) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (7.0.3) - actionpack (= 7.0.3) - activesupport (= 7.0.3) + railties (7.0.4) + actionpack (= 7.0.4) + activesupport (= 7.0.4) method_source rake (>= 12.2) thor (~> 1.0) @@ -417,12 +414,13 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) - rdoc (6.3.4.1) + rdoc (6.7.0) + psych (>= 4.0.0) recaptcha (5.9.0) json redcarpet (3.6.0) - regexp_parser (2.9.0) - reline (0.5.6) + regexp_parser (2.9.2) + reline (0.5.9) io-console (~> 0.5) request_store (1.7.0) rack (>= 1.4) @@ -431,9 +429,10 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rexml (3.2.6) - rouge (4.2.1) - rspec-core (3.13.0) + rexml (3.3.6) + strscan + rouge (4.3.0) + rspec-core (3.13.1) rspec-support (~> 3.13.0) rspec-expectations (3.13.2) diff-lcs (>= 1.2.0, < 2.0) @@ -441,27 +440,26 @@ GEM rspec-mocks (3.13.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-rails (6.1.2) - actionpack (>= 6.1) - activesupport (>= 6.1) - railties (>= 6.1) + rspec-rails (7.0.1) + actionpack (>= 7.0) + activesupport (>= 7.0) + railties (>= 7.0) rspec-core (~> 3.13) rspec-expectations (~> 3.13) rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.1) - rubocop (1.63.5) + rubocop (1.66.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.4, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.31.1, < 2.0) + rubocop-ast (>= 1.32.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.31.3) + rubocop-ast (1.32.2) parser (>= 3.3.1.0) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) @@ -505,9 +503,8 @@ GEM actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - sshkit (1.22.2) + sshkit (1.23.0) base64 - mutex_m net-scp (>= 1.1.2) net-sftp (>= 2.1.2) net-ssh (>= 2.8.0) @@ -518,25 +515,21 @@ GEM temple (0.10.3) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) - terser (1.2.2) + terser (1.2.3) execjs (>= 0.3.0, < 3) - thin (1.8.2) - daemons (~> 1.0, >= 1.0.9) - eventmachine (~> 1.0, >= 1.0.4) - rack (>= 1, < 3) - thor (1.3.1) - tilt (2.3.0) + thor (1.3.2) + tilt (2.4.0) time (0.3.0) date timeout (0.4.1) - turbo-rails (2.0.5) + turbo-rails (2.0.6) actionpack (>= 6.0.0) activejob (>= 6.0.0) railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.5.0) - uri (0.13.0) + uri (0.13.1) version_gem (1.1.4) view_component (2.83.0) activesupport (>= 5.2.0, < 8.0) @@ -559,10 +552,9 @@ GEM xpath (3.2.0) nokogiri (~> 1.8) yard (0.9.36) - zeitwerk (2.6.13) + zeitwerk (2.6.18) PLATFORMS - x86_64-linux x86_64-linux-musl DEPENDENCIES @@ -616,7 +608,7 @@ DEPENDENCIES ontologies_api_client! pry puma (~> 5.0) - rails (= 7.0.3) + rails (= 7.0.4) rails-i18n (~> 7.0.0) recaptcha (~> 5.9.0) rest-client diff --git a/app/assets/stylesheets/components/chip_button.scss b/app/assets/stylesheets/components/chip_button.scss index 1b19a2981..18916b7fe 100644 --- a/app/assets/stylesheets/components/chip_button.scss +++ b/app/assets/stylesheets/components/chip_button.scss @@ -10,6 +10,7 @@ } .chip-button-component-container { display: inline-block; + text-wrap: nowrap !important; } .chip-button-component-container svg path{ fill: var(--primary-color); diff --git a/app/helpers/federation_helper.rb b/app/helpers/federation_helper.rb index fc80e4a2f..afd60dfa0 100644 --- a/app/helpers/federation_helper.rb +++ b/app/helpers/federation_helper.rb @@ -1,11 +1,24 @@ module FederationHelper def federated_portals - $FEDERATED_PORTALS || {} + $FEDERATED_PORTALS ||= LinkedData::Client.settings.federated_portals + end + + def internal_portal_config(id) + return unless internal_ontology?(id) + + { + name: portal_name, + api: rest_url, + apikey: $API_KEY, + ui: $UI_URL, + color: "var(--primary-color)", + 'light-color': 'var(--light-color)', + } end def federated_portal_config(name_key) - $FEDERATED_PORTALS[name_key.to_sym] + federated_portals[name_key.to_sym] end def federated_portal_name(key) @@ -26,7 +39,7 @@ def federated_portal_light_color(key) def ontology_portal_config(id) rest_url = id.split('/')[0..-3].join('/') - $FEDERATED_PORTALS.select{|_, config| config[:api].start_with?(rest_url)}.first + federated_portals.select{|_, config| config[:api].start_with?(rest_url)}.first end def ontology_portal_name(id) @@ -52,7 +65,7 @@ def ontoportal_ui_link(id) end def internal_ontology?(id) - id.start_with?(helpers.rest_url) + id.start_with?(rest_url) end def federated_ontology?(id) diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml index 83fc78158..be0075bfe 100644 --- a/app/views/home/index.html.haml +++ b/app/views/home/index.html.haml @@ -214,10 +214,10 @@ .home-support-items - $PORTALS_INSTANCES&.each do |portal| %div.text-center - = link_to portal[:link], target: '_blank', class: 'home-logo-instances', style: "background-color: #{portal[:color]}" do + = link_to portal[:ui], target: '_blank', class: 'home-logo-instances', style: "background-color: #{portal[:color]}" do = inline_svg 'logo-white.svg', width: "35", height: "26" %p{style: "color: #{portal[:color]}"} - = portal[:portal] + = portal[:name] .home-section .home-section-title diff --git a/config/bioportal_config_env.rb.sample b/config/bioportal_config_env.rb.sample index 1524dc222..352805b19 100644 --- a/config/bioportal_config_env.rb.sample +++ b/config/bioportal_config_env.rb.sample @@ -1,3 +1,6 @@ +$DEBUG_API_CLIENT = false +$API_CLIENT_INVALIDATE_CACHE = false + # Organization info $ORG = ENV['ORG'] $ORG_URL = ENV['ORG_URL'] @@ -37,52 +40,6 @@ $NCBO_API_KEY = ENV['NCBO_API_KEY'] $FAIRNESS_DISABLED = ENV['FAIRNESS_DISABLED'] $FAIRNESS_URL = ENV['FAIRNESS_URL'] - -# Federation configuration -$FEDERATED_PORTALS = { - bioportal: { - name: "BioPortal", - api: 'https://data.bioontology.org/', - ui: 'https://bioportal.bioontology.org/', - apikey: '8b5b7825-538d-40e0-9e9e-5ab9274a9aeb', - color: '#234979', - 'light-color': '#E9F2FA', - }, - agroportal: { - name: "AgroPortal", - api: 'https://data.agroportal.lirmm.fr', - ui: 'https://agroportal.lirmm.fr', - apikey: '1de0a270-29c5-4dda-b043-7c3580628cd5', - color: '#349696', - 'light-color': '#F1F6FA', - }, - ecoportal: { - name: "EcoPortal", - api: 'https://data.ecoportal.lifewatch.eu/', - ui: 'https://ecoportal.lifewatch.eu', - apikey: "43a437ba-a437-4bf0-affd-ab520e584719", - color: '#2076C9', - 'light-color': '#E9F2FA', - }, - # earthportal: { - # name: 'EarthPortal', - # api: 'https://earthportal.eu:8443/', - # ui: 'https://earthportal.eu', - # apikey: "c9147279-954f-41bd-b068-da9b0c441288", - # color: '#404696', - # 'light-color': '#404696' - # }, - biodivportal: { - name: "BioDivPortal", - api: 'https://data.biodivportal.gfbio.org/', - ui: 'https://biodivportal.gfbio.org/', - apikey: "47a57aa3-7b54-4f34-b695-dbb5f5b7363e", - color: '#349696', - 'light-color': '#EBF5F5', - } -} - - # Used to define other bioportal that can be mapped to # Example to map to ncbo bioportal : {"ncbo" => {"api" => "http://data.bioontology.org", "ui" => "http://bioportal.bioontology.org", "apikey" => ""} # Then create the mapping using the following class in JSON : "http://purl.bioontology.org/ontology/MESH/C585345": "ncbo:MESH" @@ -254,53 +211,71 @@ $HOME_PAGE_LOGOS = [ } ] + +# Federation configuration $PORTALS_INSTANCES = [ { - color: '#31b403', - portal: 'AgroPortal', - link: 'https://agroportal.lirmm.fr/' + name: 'AgroPortal', + api: 'https://data.agroportal.lirmm.fr', + ui: 'https://agroportal.lirmm.fr/', + color: '#349696', + apikey: '1de0a270-29c5-4dda-b043-7c3580628cd5', + 'light-color': '#F1F6FA', }, { + name: 'BioPortal', + ui: 'https://bioportal.bioontology.org/', + api: 'https://data.bioontology.org/', + apikey: '8b5b7825-538d-40e0-9e9e-5ab9274a9aeb', color: '#234979', - portal: 'BioPortal', - link: 'https://bioportal.bioontology.org/' + 'light-color': '#E9F2FA', }, { + name: 'SIFR BioPortal', + ui: 'https://bioportal.lirmm.fr/', color: '#74a9cb', - portal: 'SIFR BioPortal', - link: 'https://bioportal.lirmm.fr/' }, { + name: 'EcoPortal', + ui: 'https://ecoportal.lifewatch.eu/', + api: 'https://data.ecoportal.lifewatch.eu/', + apikey: "43a437ba-a437-4bf0-affd-ab520e584719", color: '#0d508a', - portal: 'EcoPortal', - link: 'https://ecoportal.lifewatch.eu/' + 'light-color': '#E9F2FA', }, { + name: 'MedPortal', + ui: 'http://medportal.bmicc.cn/', color: '#234979', - portal: 'MedPortal', - link: 'http://medportal.bmicc.cn/' }, { + name: 'MatPortal', + ui: 'https://matportal.org/', color: '#009574', - portal: 'MatPortal', - link: 'https://matportal.org/' }, { + name: 'IndustryPortal', + ui: 'http://industryportal.enit.fr', color: '#1c0f5d', - portal: 'IndustryPortal', - link: 'http://industryportal.enit.fr' }, { + name: 'EarthPortal', + ui: 'https://earthportal.eu/', + api: 'https://data.earthportal.eu/', + apikey: "c9147279-954f-41bd-b068-da9b0c441288", color: '#1e2251', - portal: 'EarthPortal', - link: 'https://earthportal.eu/' + 'light-color': '#F0F5F6' }, { + name: 'BiodivPortal', + ui: 'https://biodivportal.gfbio.org/', + api: 'https://data.biodivportal.gfbio.org/', + apikey: "47a57aa3-7b54-4f34-b695-dbb5f5b7363e", color: '#33691B', - portal: 'BiodivPortal', - link: 'https://biodivportal.gfbio.org/' + 'light-color': '#EBF5F5', } ] + $ONTOPORTAL_WEBSITE_LINK = "https://ontoportal.org/" $ONTOPORTAL_GITHUB_REPO = "https://github.com/ontoportal" diff --git a/config/initializers/ontologies_api_client.rb b/config/initializers/ontologies_api_client.rb index 880ea9fea..068da5382 100644 --- a/config/initializers/ontologies_api_client.rb +++ b/config/initializers/ontologies_api_client.rb @@ -7,5 +7,5 @@ config.debug_client = $DEBUG_RUBY_CLIENT || false config.debug_client_keys = $DEBUG_RUBY_CLIENT_KEYS || [] config.apikey = $API_KEY - config.federated_portals = $FEDERATED_PORTALS || {} + config.federated_portals = $PORTALS_INSTANCES ? $PORTALS_INSTANCES.map{|x| x[:api] && x[:apikey] ? [x[:name].downcase.to_sym, x] : nil }.compact.to_h : {} end