Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added functionality for SBOL name mappings #545

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading