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

ExperimentWorkbenchService

parent db84008a
No related branches found
No related tags found
No related merge requests found
let _instance = null;
const SINGLETON_ENFORCER = Symbol();
/**
* Service handling server resources for simulating experiments.
*/
class ExperimentWorkbenchService {
constructor(enforcer) {
if (enforcer !== SINGLETON_ENFORCER) {
throw new Error('Use ' + this.constructor.name + '.instance');
}
}
static get instance() {
if (_instance == null) {
_instance = new ExperimentWorkbenchService(SINGLETON_ENFORCER);
}
return _instance;
}
get experimentInfo() {
return this.expInfo;
}
set experimentInfo(info) {
this.expInfo = info;
console.info(['ExperimentWorkbenchService - experimentInfo', this.expInfo]);
}
}
export default ExperimentWorkbenchService;
......@@ -7,6 +7,7 @@ import { TiMediaRecord } from 'react-icons/ti';
import { VscDebugRestart } from 'react-icons/vsc';
import ExperimentToolsService from './experiment-tools-service';
import ExperimentWorkbenchService from './experiment-workbench-service';
import ServerResourcesService from '../../services/experiments/execution/server-resources-service.js';
import ExperimentStorageService from '../../services/experiments/files/experiment-storage-service';
import RunningSimulationService from '../../services/experiments/execution/running-simulation-service';
......@@ -62,8 +63,7 @@ export default class ExperimentWorkbench extends React.Component {
//await this.updateSimulationInfo();
let experiments = await ExperimentStorageService.instance.getExperiments();
this.experimentInfo = experiments.find(experiment => experiment.id === this.experimentID);
console.info('ExperimentWorkbench - experimentInfo');
console.info(this.experimentInfo);
ExperimentWorkbenchService.instance.experimentInfo = this.experimentInfo;
let experimentName = this.experimentInfo.configuration.name;
this.setState({experimentName: experimentName});
......
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