Skip to content
Snippets Groups Projects
Commit bd657ee2 authored by juanf's avatar juanf
Browse files

SSDM-504: Adding experiment types.

SVN: 31742
parent a86717a8
No related branches found
No related tags found
No related merge requests found
...@@ -45,6 +45,7 @@ $.extend(DefaultProfile.prototype, { ...@@ -45,6 +45,7 @@ $.extend(DefaultProfile.prototype, {
}; };
this.allSampleTypes = []; this.allSampleTypes = [];
this.allExperimentTypes = [];
this.allVocabularies = []; this.allVocabularies = [];
this.allDataStores = []; this.allDataStores = [];
this.allPropertyTypes = []; this.allPropertyTypes = [];
...@@ -202,6 +203,15 @@ $.extend(DefaultProfile.prototype, { ...@@ -202,6 +203,15 @@ $.extend(DefaultProfile.prototype, {
return null; return null;
} }
this.getExperimentTypeForExperimentTypeCode = function(typeCode) {
for(var i = 0; i < this.allExperimentTypes.length; i++) {
if(this.allExperimentTypes[i].code === typeCode) {
return this.allExperimentTypes[i];
}
}
return null;
}
this.getTypeForTypeCode = function(typeCode) { this.getTypeForTypeCode = function(typeCode) {
for(var i = 0; i < this.allSampleTypes.length; i++) { for(var i = 0; i < this.allSampleTypes.length; i++) {
if(this.allSampleTypes[i].code === typeCode) { if(this.allSampleTypes[i].code === typeCode) {
......
...@@ -94,47 +94,50 @@ function MainController(profile) { ...@@ -94,47 +94,50 @@ function MainController(profile) {
this.serverFacade.listSampleTypes ( this.serverFacade.listSampleTypes (
function(result) { function(result) {
//Load Sample Types //Load Sample Types
localReference.profile.allSampleTypes = result.result; localReference.profile.allSampleTypes = result.result;
//Init profile
localReference.profile.init(function() {
//Start App
localReference.inspector = new Inspector(localReference.serverFacade, "mainContainer", localReference.profile);
localReference.sideMenu = new SideMenuWidget(localReference, "sideMenu", localReference.serverFacade); //Load datastores for automatic DSS configuration, the first one will be used
localReference.sideMenu.init(); localReference.serverFacade.listDataStores(function(dataStores) {
localReference.profile.allDataStores = dataStores.result;
//Page reload using the URL info
var queryString = Util.queryString(); //Load display settings
var viewName = queryString.viewName; localReference.serverFacade.getUserDisplaySettings( function(response) {
var viewData = queryString.viewData; if(response.result) {
var hideMenu = queryString.hideMenu; localReference.profile.displaySettings = response.result;
if(viewName && viewData) { }
localReference.changeView(viewName, viewData);
if(hideMenu === "true") { //Load Experiment Types
localReference.sideMenu.hideSideMenu(); localReference.serverFacade.listExperimentTypes(function(experiments) {
} localReference.profile.allExperimentTypes = experiments.result;
} else {
localReference.changeView("showBlancPage", null);
} //Init profile
Util.unblockUI(); localReference.profile.init(function() {
//Start App
localReference.inspector = new Inspector(localReference.serverFacade, "mainContainer", localReference.profile);
//Get datastores for automatic DSS configuration, the first one will be used
localReference.serverFacade.listDataStores( localReference.sideMenu = new SideMenuWidget(localReference, "sideMenu", localReference.serverFacade);
function(dataStores) { localReference.sideMenu.init();
localReference.profile.allDataStores = dataStores.result;
} //Page reload using the URL info
); var queryString = Util.queryString();
var viewName = queryString.viewName;
//Get display settings var viewData = queryString.viewData;
localReference.serverFacade.getUserDisplaySettings( function(response) { var hideMenu = queryString.hideMenu;
if(response.result) { if(viewName && viewData) {
localReference.profile.displaySettings = response.result; localReference.changeView(viewName, viewData);
} if(hideMenu === "true") {
}); localReference.sideMenu.hideSideMenu();
}
} else {
localReference.changeView("showBlancPage", null);
}
Util.unblockUI();
});
});
});
}); });
} }
); );
......
...@@ -49,6 +49,10 @@ function ServerFacade(openbisServer) { ...@@ -49,6 +49,10 @@ function ServerFacade(openbisServer) {
this.openbisServer.listSampleTypes(callbackFunction); this.openbisServer.listSampleTypes(callbackFunction);
} }
this.listExperimentTypes = function(callbackFunction) {
this.openbisServer.listExperimentTypes(callbackFunction);
}
this.listVocabularies = function(callbackFunction) { this.listVocabularies = function(callbackFunction) {
this.openbisServer.listVocabularies(callbackFunction); this.openbisServer.listVocabularies(callbackFunction);
} }
......
...@@ -42,14 +42,18 @@ function ExperimentForm(containerId, mainController, experiment, mode) { ...@@ -42,14 +42,18 @@ function ExperimentForm(containerId, mainController, experiment, mode) {
// //
// Title // Title
// //
var $formTitle = null;
if(this._mode === ExperimentFormMode.VIEW || this._mode === ExperimentFormMode.EDIT) { if(this._mode === ExperimentFormMode.VIEW || this._mode === ExperimentFormMode.EDIT) {
$formColumn.append($("<h1>").append("Experiment " + this._experiment.identifier)); $formTitle = $("<h1>").append("Experiment " + this._experiment.identifier);
} else {
$formTitle = $("<h1>").append("Create " + this._experiment.experimentTypeCode);
} }
$formColumn.append($formTitle);
// //
// Metadata Fields // Metadata Fields
// //
var experimentType = this._mainController.profile.getExperimentTypeForExperimentTypeCode(this._experiment.experimentTypeCode);
// //
// Create Sub Experiment // Create Sub Experiment
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment