diff --git a/frontend/components/Viewing/Modals/DownloadModal.js b/frontend/components/Viewing/Modals/DownloadModal.js index 0bde2beb..b46db386 100644 --- a/frontend/components/Viewing/Modals/DownloadModal.js +++ b/frontend/components/Viewing/Modals/DownloadModal.js @@ -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;}); diff --git a/frontend/components/Viewing/Plugin.js b/frontend/components/Viewing/Plugin.js index b2a3b68a..91110c6f 100644 --- a/frontend/components/Viewing/Plugin.js +++ b/frontend/components/Viewing/Plugin.js @@ -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('
Loading Data From Plugin...
') evaluatePlugin(properties.plugin, properties.type).then(status => setStatus(status)); + } else if (status) { const downloadContent = async () => { @@ -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`,