From 1bc246e89c8da437c904d36fcbafb1a2f12ed234 Mon Sep 17 00:00:00 2001 From: Syphax bouazzouni Date: Fri, 10 May 2024 18:25:15 +0200 Subject: [PATCH] add an error message if one of the external portal is down --- Gemfile.lock | 4 ++-- app/controllers/concerns/submission_filter.rb | 4 +++- app/views/ontologies/browser/_ontologies.html.haml | 7 ++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b60c6db9a..c302fded1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/ontoportal-lirmm/ontologies_api_ruby_client.git - revision: 0db56d748a1574450ebeb5f67429cd0b766cf932 + revision: 1fcf35adcb8955d6b2d48ed08055d31cb00cd3c2 branch: feature/federate-multiple-apis specs: ontologies_api_client (2.2.0) @@ -176,7 +176,7 @@ GEM sass-rails globalid (1.2.1) activesupport (>= 6.1) - graphql (2.3.2) + graphql (2.3.3) base64 graphql-client (0.22.0) activesupport (>= 3.0) diff --git a/app/controllers/concerns/submission_filter.rb b/app/controllers/concerns/submission_filter.rb index d92ec2d6c..e090ea81f 100644 --- a/app/controllers/concerns/submission_filter.rb +++ b/app/controllers/concerns/submission_filter.rb @@ -25,6 +25,8 @@ def submissions_paginate_filter(params) @ontologies = LinkedData::Client::Models::Ontology.all(include: 'all', also_include_views: true, display_links: false, display_context: false) + @ontologies, @errors = @ontologies.partition { |x| !x.errors } + # get fair scores of all ontologies @fair_scores = fairness_service_enabled? ? get_fair_score('all') : nil @@ -61,7 +63,7 @@ def ontologies_filter_url(filters, page: 1, count: false) def filter_using_data(ontologies, query:, status:, show_views:, private_only:, languages:, page_size:, formality_level:, is_of_type:, groups:, categories:, formats:) submissions = LinkedData::Client::Models::OntologySubmission.all(include: BROWSE_ATTRIBUTES.join(','), also_include_views: true, display_links: false, display_context: false) - submissions = submissions.map { |x| [x[:ontology][:id], x] }.to_h + submissions = submissions.map { |x| x[:ontology] ? [x[:ontology][:id], x] : nil}.compact.to_h submissions = ontologies.map { |ont| ontology_hash(ont, submissions) } diff --git a/app/views/ontologies/browser/_ontologies.html.haml b/app/views/ontologies/browser/_ontologies.html.haml index b9361b6c2..88ed7011c 100644 --- a/app/views/ontologies/browser/_ontologies.html.haml +++ b/app/views/ontologies/browser/_ontologies.html.haml @@ -6,7 +6,12 @@ - if @page.page.eql?(1) = content_tag(:p, class: "browse-desc-text", style: "margin-bottom: 12px !important;") do #{t("ontologies.showing_ontologies_size", ontologies_size: @count, analytics_size: @total_ontologies, portals: request_portals_names.join(', ').html_safe).html_safe} (#{sprintf("%.2f", @time)}s) - + - unless @errors.blank? + %div.my-1 + = render Display::AlertComponent.new(type: 'danger') do + - @errors.each do |e| + %div + = e.errors || e - ontologies = c.collection - ontologies.each do |ontology| - config = ontology_portal_config(ontology[:id])&.last || {}