Skip to content

Commit

Permalink
add an error message if one of the external portal is down
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni authored and Bilelkihal committed Aug 23, 2024
1 parent cb26cb2 commit 7879468
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
6 changes: 3 additions & 3 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: 0db56d748a1574450ebeb5f67429cd0b766cf932
revision: 1fcf35adcb8955d6b2d48ed08055d31cb00cd3c2
branch: feature/federate-multiple-apis
specs:
ontologies_api_client (2.2.0)
Expand Down Expand Up @@ -174,7 +174,7 @@ GEM
flamegraph (0.9.5)
globalid (1.2.1)
activesupport (>= 6.1)
graphql (2.3.2)
graphql (2.3.3)
base64
graphql-client (0.22.0)
activesupport (>= 3.0)
Expand Down Expand Up @@ -349,7 +349,7 @@ GEM
omniauth-orcid (2.1.1)
omniauth-oauth2 (~> 1.3)
ruby_dig (~> 0.0.2)
omniauth-rails_csrf_protection (1.0.1)
omniauth-rails_csrf_protection (1.0.2)
actionpack (>= 4.2)
omniauth (~> 2.0)
open_uri_redirections (0.2.1)
Expand Down
4 changes: 3 additions & 1 deletion app/controllers/concerns/submission_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,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
submissions = submissions.reject { |sub| sub.ontology.nil? }.map { |sub| ontology_hash(sub) }
Expand Down Expand Up @@ -67,7 +69,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) }

Expand Down
7 changes: 6 additions & 1 deletion app/views/ontologies/browser/_ontologies.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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 || {}
Expand Down

0 comments on commit 7879468

Please sign in to comment.