diff --git a/src/components/experiment-overview/experiment-overview.js b/src/components/experiment-overview/experiment-overview.js index 4ddbc2617c8a85488d43efcb46330eb6223af473..b43fb7a9d504792832640f57a7b35acfa5de78c6 100644 --- a/src/components/experiment-overview/experiment-overview.js +++ b/src/components/experiment-overview/experiment-overview.js @@ -96,8 +96,8 @@ export default class ExperimentOverview extends React.Component { }; onUpdateStorageExperiments(storageExperiments) { - let joinableExperiments = storageExperiments.filter( - experiment => experiment.joinableServers && experiment.joinableServers.length > 0); + let joinableExperiments = storageExperiments/*.filter( + experiment => experiment.joinableServers && experiment.joinableServers.length > 0)*/; this.setState({ storageExperiments: storageExperiments, joinableExperiments: joinableExperiments diff --git a/src/components/nrp-core-dashboard/nrp-core-dashboard.js b/src/components/nrp-core-dashboard/nrp-core-dashboard.js index 0d9a32263d57159c21551dbac63416bf72d90f55..88489d1d385635993ec40d279564071663286227 100644 --- a/src/components/nrp-core-dashboard/nrp-core-dashboard.js +++ b/src/components/nrp-core-dashboard/nrp-core-dashboard.js @@ -1,6 +1,7 @@ import React from 'react'; import MqttClientService from '../../services/mqtt-client-service'; +import ExperimentStorageService from '../../services/experiments/files/experiment-storage-service'; export default class NrpCoreDashboard extends React.Component { constructor(props) { @@ -22,10 +23,18 @@ export default class NrpCoreDashboard extends React.Component { }); } + async triggerProxyScanStorage() { + let result = await ExperimentStorageService.instance.scanStorage(); + console.info('triggerProxyScanStorage:'); + console.info(result); + } + render() { return ( <div> {this.mqttBrokerUrl} + <br /> + <button onClick={this.triggerProxyScanStorage}>Proxy Scan Storage</button> </div> ); } diff --git a/src/services/experiments/files/experiment-storage-service.js b/src/services/experiments/files/experiment-storage-service.js index 561052f63916063c1d1dcbe821dd2d1b2d6165f7..36942d6c996b583b2dbb7d4d59b2cfd4aaea494f 100644 --- a/src/services/experiments/files/experiment-storage-service.js +++ b/src/services/experiments/files/experiment-storage-service.js @@ -5,8 +5,11 @@ import endpoints from '../../proxy/data/endpoints.json'; import config from '../../../config.json'; import DialogService from '../../dialog-service.js'; -const storageURL = `${config.api.proxy.url}${endpoints.proxy.storage.url}`; -const storageExperimentsURL = `${config.api.proxy.url}${endpoints.proxy.storage.experiments.url}`; +const PROXY_URL = config.api.proxy.url; +const SCAN_STORAGE_URL = `${PROXY_URL}${endpoints.proxy.storage.scanStorage.url}`; +const storageURL = `${PROXY_URL}${endpoints.proxy.storage.url}`; +const storageExperimentsURL = `${PROXY_URL}${endpoints.proxy.storage.experiments.url}`; + let _instance = null; const SINGLETON_ENFORCER = Symbol(); @@ -71,8 +74,9 @@ class ExperimentStorageService extends HttpService { if (!this.experiments || forceUpdate) { try { let experimentList = await (await this.httpRequestGET(storageExperimentsURL)).json(); + console.info(['ExperimentStorageService.getExperiments()', experimentList]); // filter out experiments with incomplete configuration (probably storage corruption) - experimentList = experimentList.filter(experiment => experiment.configuration.experimentFile); + experimentList = experimentList.filter(experiment => experiment.configuration); this.sortExperiments(experimentList); await this.fillExperimentDetails(experimentList); this.experiments = experimentList; @@ -128,15 +132,15 @@ class ExperimentStorageService extends HttpService { async fillExperimentDetails(experimentList) { let experimentUpdates = []; experimentList.forEach(experiment => { - if (!experiment.configuration.brainProcesses && experiment.configuration.bibiConfSrc) { + /*if (!experiment.configuration.brainProcesses && experiment.configuration.bibiConfSrc) { experiment.configuration.brainProcesses = 1; - } + }*/ // retrieve the experiment thumbnail - experimentUpdates.push(this.getThumbnail(experiment.name, experiment.configuration.thumbnail) + /*experimentUpdates.push(this.getThumbnail(experiment.name, experiment.configuration.thumbnail) .then(thumbnail => { experiment.thumbnailURL = URL.createObjectURL(thumbnail); - })); + }));*/ experiment.rights = EXPERIMENT_RIGHTS.OWNED; experiment.rights.launch = (experiment.private && experiment.owned) || !experiment.private; @@ -288,6 +292,14 @@ class ExperimentStorageService extends HttpService { 'please make sure that the contentType and the body type match.'); } } + + /** + * Trigger proxy to scan storage. + * @returns {promise} Result + */ + async scanStorage() { + return await (await this.httpRequestPOST(SCAN_STORAGE_URL)).json(); + } } ExperimentStorageService.EVENTS = Object.freeze({