diff --git a/.github/workflows/brakeman-analysis.yml b/.github/workflows/brakeman-analysis.yml index 6ad197b9b..e00895673 100644 --- a/.github/workflows/brakeman-analysis.yml +++ b/.github/workflows/brakeman-analysis.yml @@ -23,7 +23,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: '2.7' + ruby-version: '3.1' - name: Setup Brakeman env: diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 66b43155f..243944863 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -15,22 +15,24 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 + with: + platforms: linux/amd64,linux/arm64 - name: Log in to Docker Hub - uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Log in to the Container registry - uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} @@ -38,7 +40,7 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: | agroportal/ontoportal_web_ui @@ -50,7 +52,10 @@ jobs: context: . platforms: linux/amd64, linux/arm64 build-args: | - RUBY_VERSION=2.7.8 + RUBY_VERSION=3.1 + BUILDPLATFORM=${{ github.job_name }} push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/tests-real-data-stageportal.yml b/.github/workflows/tests-real-data-stageportal.yml index 53a9d112d..5dff65040 100644 --- a/.github/workflows/tests-real-data-stageportal.yml +++ b/.github/workflows/tests-real-data-stageportal.yml @@ -38,7 +38,7 @@ jobs: - name: Install Ruby and gems uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7.8 + ruby-version: 3.1.0 bundler-cache: true # Add or replace database setup steps here - name: set up config file diff --git a/.github/workflows/tests-system.yml b/.github/workflows/tests-system.yml index 8da36c9e6..4a9b5ec3a 100644 --- a/.github/workflows/tests-system.yml +++ b/.github/workflows/tests-system.yml @@ -45,7 +45,7 @@ jobs: - name: Install Ruby and gems uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7.8 + ruby-version: 3.1.0 bundler-cache: true - name: Run OntoPortal API diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9214bc4de..733210ab0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,7 +39,7 @@ jobs: - name: Install Ruby and gems uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7.8 + ruby-version: 3.1.0 bundler-cache: true - name: Run OntoPortal API diff --git a/Dockerfile b/Dockerfile index af8c454fa..d5da91da5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,70 +1,45 @@ # Make sure it matches the Ruby version in .ruby-version and Gemfile -ARG RUBY_VERSION=2.7.8 -FROM ruby:${RUBY_VERSION}-alpine +ARG RUBY_VERSION=3.1 +FROM ruby:${RUBY_VERSION}-slim-bookworm -RUN apk add --no-cache build-base \ - libxml2-dev \ - libxslt-dev \ - mariadb-dev \ - git \ - tzdata \ - nodejs yarn \ - less \ - bash \ - docker \ - docker-compose \ - cmake \ - g++ \ - make \ - libc6-compat \ - libstdc++ \ - ruby-dev \ - libffi-dev \ - openssl-dev \ - && mkdir /node_modules - - -# Rails app lives here WORKDIR /app -# Set production environment -ARG RAILS_ENV="production" -ARG BUNDLE_WITHOUT="development test" +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential libxml2 libxslt-dev libmariadb-dev \ + git curl libffi-dev pkg-config \ + && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key -o /etc/apt/keyrings/nodesource.asc \ + && echo 'deb [signed-by=/etc/apt/keyrings/nodesource.asc] https://deb.nodesource.com/node_20.x nodistro main' | tee /etc/apt/sources.list.d/nodesource.list \ + && apt-get update && apt-get install -y --no-install-recommends nodejs \ + && corepack enable \ + && apt-get clean && rm -rf /var/lib/apt/lists/* /usr/share/{doc,man} + ENV RAILS_LOG_TO_STDOUT="1" \ RAILS_SERVE_STATIC_FILES="true" \ - RAILS_ENV="${RAILS_ENV}" \ + RAILS_ENV="production" \ + NODE_ENV="production" \ BUNDLE_PATH=/usr/local/bundle \ - BUNDLE_WITHOUT="${BUNDLE_WITHOUT}" + BUNDLE_WITHOUT="development test" \ + SECRET_KEY_BASE_DUMMY=1 -# Update RubyGems and Bundler -RUN gem update --system 3.4.22 && \ - gem install bundler:2.4.22 +COPY Gemfile* . +RUN gem install bundler +RUN bundle install -# Copy Gemfile and Gemfile.lock first -COPY Gemfile Gemfile.lock ./ +COPY package.json *yarn* ./ +RUN mkdir /node_modules +RUN yarn install -# Install gems -RUN bundle config set --local build.nokogiri --use-system-libraries && \ - bundle install --jobs 4 --retry 3 - -# Copy the rest of the application COPY . . -# Install yarn packages and build -RUN yarn install && yarn build - -# Copy configuration files -RUN cp config/bioportal_config_env.rb.sample config/bioportal_config_production.rb && \ - cp config/bioportal_config_env.rb.sample config/bioportal_config_development.rb && \ - cp config/database.yml.sample config/database.yml - -# Precompile bootsnap code for faster boot times -RUN bundle exec bootsnap precompile --gemfile app/ lib/ +RUN cp config/bioportal_config_env.rb.sample config/bioportal_config_production.rb \ + && cp config/bioportal_config_env.rb.sample config/bioportal_config_development.rb \ + && cp config/bioportal_config_env.rb.sample config/bioportal_config_test.rb \ + && cp config/database.yml.sample config/database.yml -# Precompile assets -RUN SECRET_KEY_BASE_DUMMY="1" ./bin/rails assets:precompile +RUN if [ "${RAILS_ENV}" != "development" ]; then \ + bundle exec bootsnap precompile --gemfile app/ lib/ && \ + SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile; fi -ENV BINDING="0.0.0.0" EXPOSE 3000 -CMD ["bash"] +CMD ["rails", "s"] diff --git a/Gemfile b/Gemfile index 9e05e041d..842e392ff 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.4' +gem 'rails', '7.0.8' # JavaScript bundling for Rails gem 'jsbundling-rails' @@ -186,3 +186,7 @@ group :test do end gem 'concurrent-ruby', '1.3.4' + +# pinned gems for Centos 7 to remove when no more needed +gem 'nokogiri', '~> 1.13.10' +gem 'rexml' diff --git a/Gemfile.lock b/Gemfile.lock index 56cb8dcb6..efbe0f373 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,67 +19,67 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (7.0.4) - actionpack (= 7.0.4) - activesupport (= 7.0.4) + actioncable (7.0.8) + actionpack (= 7.0.8) + activesupport (= 7.0.8) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.4) - actionpack (= 7.0.4) - activejob (= 7.0.4) - activerecord (= 7.0.4) - activestorage (= 7.0.4) - activesupport (= 7.0.4) + actionmailbox (7.0.8) + actionpack (= 7.0.8) + activejob (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.4) - actionpack (= 7.0.4) - actionview (= 7.0.4) - activejob (= 7.0.4) - activesupport (= 7.0.4) + actionmailer (7.0.8) + actionpack (= 7.0.8) + actionview (= 7.0.8) + activejob (= 7.0.8) + activesupport (= 7.0.8) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.4) - actionview (= 7.0.4) - activesupport (= 7.0.4) - rack (~> 2.0, >= 2.2.0) + actionpack (7.0.8) + actionview (= 7.0.8) + activesupport (= 7.0.8) + rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.4) - actionpack (= 7.0.4) - activerecord (= 7.0.4) - activestorage (= 7.0.4) - activesupport (= 7.0.4) + actiontext (7.0.8) + actionpack (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.4) - activesupport (= 7.0.4) + actionview (7.0.8) + activesupport (= 7.0.8) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.4) - activesupport (= 7.0.4) + activejob (7.0.8) + activesupport (= 7.0.8) globalid (>= 0.3.6) - 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) + activemodel (7.0.8) + activesupport (= 7.0.8) + activerecord (7.0.8) + activemodel (= 7.0.8) + activesupport (= 7.0.8) + activestorage (7.0.8) + actionpack (= 7.0.8) + activejob (= 7.0.8) + activerecord (= 7.0.8) + activesupport (= 7.0.8) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.4) + activesupport (7.0.8) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -94,6 +94,7 @@ GEM execjs (~> 2) base64 (0.2.0) bcrypt_pbkdf (1.1.1) + bcrypt_pbkdf (1.1.1-arm64-darwin) bigdecimal (3.1.9) bindata (2.5.0) bindex (0.8.1) @@ -103,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) @@ -123,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) @@ -145,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) @@ -154,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) @@ -179,7 +181,7 @@ GEM sass-rails globalid (1.2.1) activesupport (>= 6.1) - graphql (2.4.9) + graphql (2.4.10) base64 fiber-storage logger @@ -196,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) @@ -221,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) @@ -243,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 @@ -254,7 +257,7 @@ GEM jwt (2.10.1) base64 language_server-protocol (3.17.0.4) - launchy (3.1.0) + launchy (3.1.1) addressable (~> 2.8) childprocess (~> 5.0) logger (~> 1.6) @@ -265,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) @@ -297,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.0220) 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) @@ -310,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) @@ -321,13 +325,17 @@ 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) newrelic_rpm (9.17.0) nio4r (2.7.4) - nokogiri (1.15.7-x86_64-linux) + nokogiri (1.13.10-aarch64-linux) + racc (~> 1.4) + nokogiri (1.13.10-arm64-darwin) + racc (~> 1.4) + nokogiri (1.13.10-x86_64-linux) racc (~> 1.4) oauth2 (2.0.9) faraday (>= 0.17.3, < 3.0) @@ -367,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) @@ -380,43 +388,42 @@ 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) rack-test (2.2.0) rack (>= 1.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) + rails (7.0.8) + actioncable (= 7.0.8) + actionmailbox (= 7.0.8) + actionmailer (= 7.0.8) + actionpack (= 7.0.8) + actiontext (= 7.0.8) + actionview (= 7.0.8) + activejob (= 7.0.8) + activemodel (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) bundler (>= 1.15.0) - railties (= 7.0.4) + railties (= 7.0.8) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.2) - loofah (~> 2.21) - nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + rails-html-sanitizer (1.5.0) + loofah (~> 2.19, >= 2.19.1) rails-i18n (7.0.10) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - railties (7.0.4) - actionpack (= 7.0.4) - activesupport (= 7.0.4) + railties (7.0.8) + actionpack (= 7.0.8) + activesupport (= 7.0.8) method_source rake (>= 12.2) thor (~> 1.0) @@ -426,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 @@ -441,9 +448,9 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rexml (3.4.0) + rexml (3.4.1) 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) @@ -451,7 +458,7 @@ GEM 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) @@ -460,9 +467,10 @@ GEM rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.2) - rubocop (1.71.2) + rubocop (1.72.2) 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) @@ -489,7 +497,9 @@ GEM sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (4.9.0) + selenium-webdriver (4.29.1) + base64 (~> 0.2) + logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) @@ -514,8 +524,9 @@ 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) @@ -523,7 +534,7 @@ GEM stimulus-rails (1.3.4) railties (>= 6.0.0) string-similarity (2.1.0) - stringio (3.1.2) + stringio (3.1.5) temple (0.10.3) terminal-table (4.0.0) unicode-display_width (>= 1.1.1, < 4) @@ -544,7 +555,7 @@ GEM unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (4.0.4) uri (1.0.2) - version_gem (1.1.4) + version_gem (1.1.6) view_component (2.83.0) activesupport (>= 5.2.0, < 8.0) concurrent-ruby (~> 1.0) @@ -554,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) @@ -570,7 +581,9 @@ GEM zeitwerk (2.6.18) PLATFORMS + aarch64-linux aarch64-linux-musl + arm64-darwin-24 x86_64-linux x86_64-linux-musl @@ -617,6 +630,7 @@ DEPENDENCIES net-ftp (~> 0.2.0) net-http (~> 0.3.2) newrelic_rpm + nokogiri (~> 1.13.10) oj omniauth omniauth-github @@ -627,10 +641,11 @@ DEPENDENCIES ontologies_api_client! pry puma (~> 5.0) - rails (= 7.0.4) + rails (= 7.0.8) rails-i18n (~> 7.0.0) recaptcha (~> 5.9.0) rest-client + rexml rspec-rails rubocop sassc-rails @@ -649,4 +664,4 @@ DEPENDENCIES will_paginate (~> 3.0) BUNDLED WITH - 2.4.22 + 2.6.5 diff --git a/app/components/display/search_result_component.rb b/app/components/display/search_result_component.rb index 4b112b60f..8b96c2acd 100644 --- a/app/components/display/search_result_component.rb +++ b/app/components/display/search_result_component.rb @@ -52,6 +52,9 @@ def mappings_button t.loader do render LoaderComponent.new(small: true) end + t.error do + "-1" + end end + content_tag(:div, 'mappings', class: 'ml-1') end end diff --git a/app/helpers/internationalisation_helper.rb b/app/helpers/internationalisation_helper.rb index d70fac6d4..4337c0898 100644 --- a/app/helpers/internationalisation_helper.rb +++ b/app/helpers/internationalisation_helper.rb @@ -3,10 +3,15 @@ module InternationalisationHelper # Implement logic to make the term 'ontology' configurable throughout the portal, # allowing it to be replaced with the variable $RESOURCE_TERM def self.t(*args) - return I18n.t(*args) unless $RESOURCE_TERM + key, options = args + options ||= {} + + return I18n.t(key, **options) unless $RESOURCE_TERM begin - original_translation = I18n.t(*args) + key, options = args + options ||= {} + original_translation = I18n.t(key, **options) downcase_translation = original_translation.downcase rescue StandardError => e return e.message @@ -32,7 +37,7 @@ def self.t(*args) replacement = resources if downcase_translation.include?(plural_term) original_translation.gsub(plural_term, replacement) else - I18n.t(*args) + I18n.t(key, **options) end end diff --git a/app/helpers/turbo_helper.rb b/app/helpers/turbo_helper.rb index c1b0303b4..8067b236b 100644 --- a/app/helpers/turbo_helper.rb +++ b/app/helpers/turbo_helper.rb @@ -20,10 +20,13 @@ def alert_success(id: nil, &block) alert(id: id, type:'success', &block) end def prepend(id, options = {}, &block) - turbo_stream.prepend(id, options, &block) + options = { inline: options } if options.is_a?(String) + + turbo_stream.prepend(id, **options, &block) end def replace(id, options = {}, &block) - turbo_stream.replace(id, options, &block) + options = { inline: options } if options.is_a?(String) + turbo_stream.replace(id, **options, &block) end def remove(id) @@ -38,4 +41,4 @@ def render_alerts_container(controller_class = nil) render AlertsContainerComponent.new(id: id) end -end \ No newline at end of file +end diff --git a/app/views/search/index.html.haml b/app/views/search/index.html.haml index a87850f86..1cea34030 100644 --- a/app/views/search/index.html.haml +++ b/app/views/search/index.html.haml @@ -65,12 +65,12 @@ - descendants = result[:descendants] - reuses = result[:reuses] - result[:root][:number] = number - = render Display::SearchResultComponent.new(result[:root]) do |c| - - descendants.each { |d| c.subresult(d.merge(is_sub_component: true))} + = render Display::SearchResultComponent.new(**result[:root]) do |c| + - descendants.each { |d| c.subresult(**d.merge(is_sub_component: true))} - reuses.each do |r| - number = number + 1 - - c.reuse(r[:root].merge(is_sub_component: true, number: number)) do |b| - - r[:descendants].each { |dd| b.subresult(dd.merge(is_sub_component: true))} + - c.reuse(**r[:root].merge(is_sub_component: true, number: number)) do |b| + - r[:descendants].each { |dd| b.subresult(**dd.merge(is_sub_component: true))} - if @search_results.empty? && !@search_query.empty? = empty_state diff --git a/package.json b/package.json index 392e650aa..56cafe45b 100644 --- a/package.json +++ b/package.json @@ -26,5 +26,6 @@ }, "scripts": { "build": "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds" - } + }, + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" } diff --git a/test/controllers/ontologies_controller_test.rb b/test/controllers/ontologies_controller_test.rb index b8afabbcb..6c27680bf 100644 --- a/test/controllers/ontologies_controller_test.rb +++ b/test/controllers/ontologies_controller_test.rb @@ -55,7 +55,11 @@ class OntologiesControllerTest < ActionDispatch::IntegrationTest test 'test get STY in xml format' do get '/ontologies/STY', headers: { 'Accept' => 'application/xml' } - assert_response :success + if $REST_URL == "https://data.stageportal.lirmm.fr/" + assert_response :success + else + assert_equal 500, response.status # STY does not have xml in localhost:9393 + end end test 'test get STY in csv format' do