Skip to content

Commit

Permalink
Added functionality for SBOL name mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
zane-perry committed Oct 10, 2023
1 parent 43324d9 commit 2d71f0e
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 10 deletions.
55 changes: 47 additions & 8 deletions frontend/components/Viewing/Modals/DownloadModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,61 @@ export default function DownloadModal(properties) {
}).then(response => {
const downloadPlugins = response.data.download;

let type;

switch(properties.type) {
case 'Component':
type = 'ComponentInstance'
break
case 'Module':
type = 'ModuleInstance'
break
case 'ComponentDefinition':
type = 'Component'
break
case 'ModuleDefinition':
type = 'Module'
break
default:
type = properties.type
}

for(let plugin of downloadPlugins) {

axios({
method: 'POST',
url: `${publicRuntimeConfig.backend}/call`,
params: {
name: plugin.name,
endpoint: 'evaluate',
category: 'download',
data: {
type: properties.type
}
endpoint: 'status',
category: 'download'
}

}).then(response => {
if (response.status === 200) selectOptions.push({ value: "plugin", label: plugin.name});
}).catch(error => {return;});

if(response.status === 200) {

axios({
method: 'POST',
url: `${publicRuntimeConfig.backend}/call`,
params: {
name: plugin.name,
endpoint: 'evaluate',
category: 'download',
data: {
type: properties.type
}
}

}).then(response => {
if (response.status === 200) selectOptions.push({ value: "plugin", label: plugin.name});
}).catch(error => {return;});

}

return;

}).catch(error => {return;})

}
}).catch(error => {return;});

Expand Down
40 changes: 38 additions & 2 deletions frontend/components/Viewing/Plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,38 @@ export default function Plugin(properties) {
const dispatch = useDispatch();

const uri = properties.uri;


let type;

switch(properties.type) {
case 'Component':
type = 'ComponentInstance'
break
case 'Module':
type = 'ModuleInstance'
break
case 'ComponentDefinition':
type = 'Component'
break
case 'ModuleDefinition':
type = 'Module'
break
default:
type = properties.type
}

const pluginData = {
uri: uri,
instanceUrl: `${publicRuntimeConfig.backend}/`,
size: 1,
type: properties.type
type: type
};

useEffect(() => {
if (status === null) {
setContent('<div>Loading Data From Plugin...</div>')
evaluatePlugin(properties.plugin, properties.type).then(status => setStatus(status));

}
else if (status) {
const downloadContent = async () => {
Expand Down Expand Up @@ -102,6 +123,21 @@ export default function Plugin(properties) {


async function evaluatePlugin(plugin, type) {

switch(type) {
case 'Component':
type = 'ComponentInstance'
break
case 'Module':
type = 'ModuleInstance'
break
case 'ComponentDefinition':
type = 'Component'
break
case 'ModuleDefinition':
type = 'Module'
break
}
return await axios({
method: 'POST',
url: `${publicRuntimeConfig.backend}/call`,
Expand Down

0 comments on commit 2d71f0e

Please sign in to comment.