Skip to content

Commit

Permalink
Implemented the ability to hook up remote registries #5 (proycon/LaMa…
Browse files Browse the repository at this point in the history
  • Loading branch information
proycon committed Feb 5, 2021
1 parent b6085dd commit 3c403bf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/dev.env.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ const prodEnv = require('./prod.env')

module.exports = merge(prodEnv, {
NODE_ENV: '"development"',
REGISTRY_URL: '"http://localhost:8080/metadata.json"'
REGISTRY_URL: '"http://localhost:8080/metadata.json"',
})
3 changes: 3 additions & 0 deletions config/prod.env.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ module.exports = {
TITLE: '"Language Tool Portal"',
DESCRIPTION: '"This portal provides an overview of available Natural Language Processing software, use the filters above to broaden or narrow the selection."',
REGISTRY_URL: '"/metadata.json"',
REMOTE_REGISTRIES: '[]', //remote metadata.json files whose services are to be included
REMOTE_INCLUDE: '[]', //remote tool identifiers to include, leave empty for all
REMOTE_EXCLUDE: '[]', //remote tool identifiers to exclude
BASE: '"/"',
LOGO_RIGHT: 'true',
LOGO_LEFT: 'true',
Expand Down
16 changes: 14 additions & 2 deletions src/components/ServiceIndex.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@ export default {
this.rewritehost(tool);
this.registry[tool.identifier] = tool
});
//load remote registries
this.env.REMOTE_REGISTRIES.forEach(remoteregistry => {
axios.get(remoteregistry, config).then(response => {
response.data['@graph'].forEach(tool => {
this.resolve(tool);
if (!this.env.REGISTRY_EXCLUDE.includes(tool.identifier) && (this.env.REGISTRY_INCLUDE.length == 0 || this.env.REGISTRY_INCLUDE.includes(tool.identifier)) && !(tool.identifier in tool.registry) && (tool.interfaces.includes("WUI") || tool.interfaces.includes("REST")) ) {
console.log("Registered service from remote registry: " + tool.identifier);
this.registry[tool.identifier] = tool;
}
});
}).catch(error => {
console.log("Unable to obtain remote metadata registry from " + remoteregistry + " :" + error);
});
});
this.registry_loaded = true;
this.$forceUpdate();
}).catch(error => {
Expand All @@ -103,8 +117,6 @@ export default {
if (window.innerHeight > 500) {
window.addEventListener('scroll', this.handleScroll);
}
//console.log("My organizations:", this.env.ORGANIZATIONS);
//console.log("My domains:", this.env.DOMAINS);
},
computed: {
tools: function () {
Expand Down

0 comments on commit 3c403bf

Please sign in to comment.