diff --git a/src/views/FileBrowserView/PublishFileBrowser.vue b/src/views/FileBrowserView/PublishFileBrowser.vue index 0e866f39..c15f7644 100644 --- a/src/views/FileBrowserView/PublishFileBrowser.vue +++ b/src/views/FileBrowserView/PublishFileBrowser.vue @@ -140,6 +140,51 @@ + + + + + + + EXTERNAL SERVICES + + + EXTERNAL SERVICES: not found + + + + + {{ el.name }} + + + + + + + { return 0; }; +const EXTERNAL_SERVICES = [ + { + name: 'Bioimagesuite/Viewer', + regex: '.nii(.gz)?$', + extensions: [ + '.nii', + '.nii.gz', + ], + maxsize: 4e6, + endpoint: 'https://bioimagesuiteweb.github.io/unstableapp/viewer.html?image=', + }, + + { + name: 'MetaCell/NWBExplorer', + regex: '.nwb$', + extensions: [ + '.nwb', + ], + maxsize: 4e6, + endpoint: 'http://nwbexplorer.opensourcebrain.org/nwbfile=', + }, +]; + export default { name: 'PublishFileBrowser', props: { @@ -227,7 +295,16 @@ export default { (key) => ({ ...data.folders[key], name: `${key}/`, folder: true }), ).sort(sortByName), ...Object.keys(data.files).map( - (key) => ({ ...data.files[key], name: key, folder: false }), + (key) => { + const { id, size } = data.files[key]; + const services = this.getExternalServices(id, key, size); + return { + ...data.files[key], + name: key, + folder: false, + services, + }; + }, ).sort(sortByName), ]; }, @@ -278,6 +355,16 @@ export default { return publishRest.assetDownloadURI(this.identifier, this.version, asset_id); }, + getExternalServices(asset_id, name, size) { + const { identifier, version } = this; + return EXTERNAL_SERVICES + .filter((service) => new RegExp(service.regex).test(name) && size <= service.maxsize) + .map((service) => ({ + name: service.name, + url: `${service.endpoint}${publishRest.assetDownloadURI(identifier, version, asset_id)}`, + })); + }, + assetMetadataURI(asset_id) { return publishRest.assetMetadataURI(this.identifier, this.version, asset_id); },