Skip to content

Commit

Permalink
update home endpoint to add portal config information
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Aug 30, 2024
1 parent 16fedb9 commit 92de4ec
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ gem 'ncbo_cron', git: 'https://github.com/ontoportal-lirmm/ncbo_cron.git', branc
gem 'ncbo_ontology_recommender', git: 'https://github.com/ncbo/ncbo_ontology_recommender.git', branch: 'master'
gem 'goo', github: 'ontoportal-lirmm/goo', branch: 'development'
gem 'sparql-client', github: 'ontoportal-lirmm/sparql-client', branch: 'development'
gem 'ontologies_linked_data', git: 'https://github.com/ontoportal-lirmm/ontologies_linked_data.git', branch: 'development'
gem 'ontologies_linked_data', git: 'https://github.com/ontoportal-lirmm/ontologies_linked_data.git', branch: 'feature/add-portal-config-model'

group :development do
# bcrypt_pbkdf and ed35519 is required for capistrano deployments when using ed25519 keys; see https://github.com/miloserdow/capistrano-deploy/issues/42
Expand Down
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ GIT

GIT
remote: https://github.com/ontoportal-lirmm/ontologies_linked_data.git
revision: 9605eb44c4271c60bedda0520e85d8c3fa2513ac
branch: development
revision: d893c08a2c2f11c743fad520873b7f98b0805240
branch: feature/add-portal-config-model
specs:
ontologies_linked_data (0.0.1)
activesupport
Expand Down Expand Up @@ -164,7 +164,7 @@ GEM
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
ffi (1.17.0)
ffi (1.17.0-x86_64-linux-gnu)
gapic-common (0.21.1)
faraday (>= 1.9, < 3.a)
faraday-retry (>= 1.0, < 3.a)
Expand Down Expand Up @@ -258,7 +258,7 @@ GEM
mutex_m (0.2.0)
net-http-persistent (4.0.2)
connection_pool (~> 2.2)
net-imap (0.4.14)
net-imap (0.4.15)
date
net-protocol
net-pop (0.1.2)
Expand Down
31 changes: 31 additions & 0 deletions config/environments/config.rb.sample
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,37 @@ LinkedData.config do |config|
link: 'https://www.googleapis.com/oauth2/v3/userinfo'
}
}
config.ui_name = 'Bioportal'
config.title = 'NCBO BioPortal'
config.description = "The world's most comprehensive repository of biomedical ontologies "
config.color = '#234979'
config.logo = ''
config.fundedBy = [
{
img_src: 'https://identity.stanford.edu/wp-content/uploads/sites/3/2020/07/block-s-right.png',
url: 'https://www.stanford.edu',

},
{
img_src: 'https://ontoportal.org/images/logo.png',
url: 'https://ontoportal.org/',
}
]
config.federated_portals = {
'agroportal' => {
api: 'http://data.agroportal.lirmm.fr',
ui: 'http://agroportal.lirmm.fr',
apikey: '1cfae05f-9e67-486f-820b-b393dec5764b',
color: '#1e2251'
},
'bioportal' => {
api: 'http://data.bioontology.org',
ui: 'http://bioportal.bioontology.org',
apikey: '4a5011ea-75fa-4be6-8e89-f45c8c84844e',
color: '#234979'
},

}
end

Annotator.config do |config|
Expand Down
18 changes: 13 additions & 5 deletions controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class HomeController < ApplicationController

CLASS_MAP = {
Property: "LinkedData::Models::ObjectProperty"
Property: "LinkedData::Models::ObjectProperty"
}

namespace "/" do
Expand All @@ -28,14 +28,22 @@ class HomeController < ApplicationController
next if route.length < 3 || route.split("/").length > 2
route_no_slash = route.gsub("/", "")
context[route_no_slash] = route_to_class_map[route].type_uri.to_s if route_to_class_map[route] && route_to_class_map[route].respond_to?(:type_uri)
routes_hash[route_no_slash] = LinkedData.settings.rest_url_prefix+route_no_slash
routes_hash[route_no_slash] = LinkedData.settings.rest_url_prefix + route_no_slash
end
routes_hash["@context"] = context
reply ({links: routes_hash})

config = LinkedData::Models::PortalConfig.current_portal_config

federated_portals = config.federated_portals
federated_portals. transform_values! { |v| v.delete(:apikey) ; v }
config.init_federated_portals_settings(federated_portals)

config.class.link_to *routes_hash.map { |key, url| LinkedData::Hypermedia::Link.new(key, url, context[key]) }

reply config
end

get "documentation" do
@metadata_all = metadata_all.sort {|a,b| a[0].name <=> b[0].name}
@metadata_all = metadata_all.sort { |a, b| a[0].name <=> b[0].name }
haml "documentation/documentation".to_sym, :layout => "documentation/layout".to_sym
end

Expand Down

0 comments on commit 92de4ec

Please sign in to comment.