Skip to content
Snippets Groups Projects
Commit 6fc1087a authored by Sandro Weber's avatar Sandro Weber
Browse files

Merged in NRRPLT-8620 (pull request #33)

[NRRPLT-8620] trigger proxy storage scan button
parents 18f67af4 cc7afcba
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
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>
);
}
......
......@@ -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({
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment