diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/util/FormUtil.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/util/FormUtil.js index 6e09ccbebbe32c1f653e18ef16f1cbabe28d4387..0846dfa2294fa033cc55805501052e4b730d4eab 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/util/FormUtil.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/util/FormUtil.js @@ -17,6 +17,18 @@ var FormUtil = new function() { // // Standard Form Fields // + this.getDefaultStoragesDropDown = function(id, isRequired) { + if(!this.profile.storagesConfiguration["isEnabled"]) { + return null; + } + var storageVocabularyProp = this.profile.getPropertyType(this.profile.storagesConfiguration["STORAGE_PROPERTIES"][0]["NAME_PROPERTY"]); + var $storageDropDown = this.getFieldForPropertyType(storageVocabularyProp); + $storageDropDown.attr('id', id); + if (isRequired) { + $storageDropDown.attr('required', ''); + } + return $storageDropDown; + } this.getSampleTypeDropdown = function(id, isRequired) { var sampleTypes = this.profile.getAllSampleTypes(); diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SampleForm.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SampleForm.js index 51ab3f8ca7b5888286314182237e8e75c71527a2..764a1c4dc08d5f208cbf3001a7095f0b29e485ce 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SampleForm.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SampleForm.js @@ -340,6 +340,14 @@ function SampleForm(serverFacade, inspector, containerId, profile, sampleTypeCod }); } + this.childrenAdded = function() { + var $childrenStorageDropdown = FormUtil.getDefaultStoragesDropDown('childrenStorageSelector', true); + if($childrenStorageDropdown && !$("#childrenStorageSelector").length) { + var $childrenStorageDropdownWithLabel = FormUtil.getFieldForComponentWithLabel($childrenStorageDropdown, 'Storage'); + $("#newChildrenOnBenchDropDown").append($childrenStorageDropdownWithLabel); + } + } + this.repaint = function() { $("#"+this.containerId).empty(); var sampleType = profile.getSampleTypeForSampleTypeCode(this.sampleTypeCode); @@ -481,6 +489,7 @@ function SampleForm(serverFacade, inspector, containerId, profile, sampleTypeCod component += "<a class='btn btn-default' style='margin-left:25px;' id='generate_children'>Generate Children</a>"; component += "</div>"; component += "</div>"; + component += "<div id='newChildrenOnBenchDropDown'></div>"; } @@ -650,6 +659,7 @@ function SampleForm(serverFacade, inspector, containerId, profile, sampleTypeCod this.createSample = function(isCopyWithNewCode) { Util.blockUI(); + var localReference = this; //Other properties var properties = {}; @@ -744,6 +754,14 @@ function SampleForm(serverFacade, inspector, containerId, profile, sampleTypeCod var samplesToCreate = []; this.sampleLinksChildren.getSamples().forEach(function(child) { if(child.newSample) { + if(this.profile.storagesConfiguration["isEnabled"]) { + child.properties = {}; + child.properties[localReference.profile.storagesConfiguration["STORAGE_PROPERTIES"][0]["NAME_PROPERTY"]] = $("#childrenStorageSelector").val(); + child.properties[localReference.profile.storagesConfiguration["STORAGE_PROPERTIES"][0]["ROW_PROPERTY"]] = 1; + child.properties[localReference.profile.storagesConfiguration["STORAGE_PROPERTIES"][0]["COLUMN_PROPERTY"]] = 1; + child.properties[localReference.profile.storagesConfiguration["STORAGE_PROPERTIES"][0]["BOX_PROPERTY"]] = $("#sampleSpaceProject").val().replace(/\//g,'\/') + "_" + $("#sampleCode").val() + "_EXP_RESULTS"; + child.properties[localReference.profile.storagesConfiguration["STORAGE_PROPERTIES"][0]["USER_PROPERTY"]] = localReference.serverFacade.openbisServer.getSession().split("-")[0]; + } samplesToCreate.push(child); } }); @@ -784,8 +802,6 @@ function SampleForm(serverFacade, inspector, containerId, profile, sampleTypeCod parameters["sampleChildrenRemoved"] = []; } - var localReference = this; - if(this.profile.allDataStores.length > 0) { this.serverFacade.createReportFromAggregationService(this.profile.allDataStores[0].code, parameters, function(response) { localReference.createSampleCallback(response, localReference, isCopyWithNewCode); @@ -969,7 +985,8 @@ function SampleForm(serverFacade, inspector, containerId, profile, sampleTypeCod virtualSample.sampleTypeCode = generatedChildrenType; _this.sampleLinksChildren.addSample(virtualSample); } - + + _this.childrenAdded(); Util.unblockUI(); } diff --git a/plasmid/source/core-plugins/newbrowser/1/dss/reporting-plugins/newbrowserapi/script.py b/plasmid/source/core-plugins/newbrowser/1/dss/reporting-plugins/newbrowserapi/script.py index 485c4f107c13aa9697c4cec7b9a38f291c3b3a57..5b49fd381cedec1048536ea80681b480897c9d08 100644 --- a/plasmid/source/core-plugins/newbrowser/1/dss/reporting-plugins/newbrowserapi/script.py +++ b/plasmid/source/core-plugins/newbrowser/1/dss/reporting-plugins/newbrowserapi/script.py @@ -183,6 +183,12 @@ def insertUpdateSample(tr, parameters, tableBuilder): for newSampleChild in sampleChildrenNew: child = tr.createNewSample(newSampleChild["identifier"], newSampleChild["sampleTypeCode"]); #Create Sample given his id child.setParentSampleIdentifiers([sampleIdentifier]); + for key in newSampleChild["properties"].keySet(): + propertyValue = unicode(newSampleChild["properties"][key]); + if propertyValue == "": + propertyValue = None; + + child.setPropertyValue(key,propertyValue); #Add sample children for sampleChildIdentifier in sampleChildren: