diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js index c7b302c21f9270e55dc37b6f3a5cdc1511cf1c00..50f7f9461483c8c5459b42e4565e2a57e134c311 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js @@ -598,7 +598,7 @@ function ServerFacade(openbisServer) { }); } - this.searchWithTypeAndLinks = function(sampleType, sampleCode, callbackFunction) + this.searchWithType = function(sampleType, sampleCode, includeAncestorsAndDescendants, callbackFunction) { var matchClauses = [ {"@type":"AttributeMatchClause", fieldType : "ATTRIBUTE", @@ -624,8 +624,14 @@ function ServerFacade(openbisServer) { operator : "MATCH_ALL_CLAUSES" }; + var options = ["PROPERTIES"]; + if(includeAncestorsAndDescendants) { + options.push("ANCESTORS"); + options.push("DESCENDANTS"); + } + var localReference = this; - this.openbisServer.searchForSamplesWithFetchOptions(sampleCriteria, ["PROPERTIES", "ANCESTORS", "DESCENDANTS"], function(data) { + this.openbisServer.searchForSamplesWithFetchOptions(sampleCriteria, options, function(data) { callbackFunction(localReference.getInitializedSamples(data.result)); }); } @@ -634,38 +640,6 @@ function ServerFacade(openbisServer) { this.openbisServer.getDataSetMetaDataWithFetchOptions(dataSetCodes, [ 'SAMPLE' ], callback); } - this.searchWithType = function(sampleType, sampleCode, callbackFunction) - { - var matchClauses = [ {"@type":"AttributeMatchClause", - fieldType : "ATTRIBUTE", - attribute : "TYPE", - desiredValue : sampleType - } - ] - - if(sampleCode){ - matchClauses.push( - { - "@type":"AttributeMatchClause", - fieldType : "ATTRIBUTE", - attribute : "CODE", - desiredValue : sampleCode - } - ); - } - - var sampleCriteria = - { - matchClauses : matchClauses, - operator : "MATCH_ALL_CLAUSES" - }; - - var localReference = this; - this.openbisServer.searchForSamplesWithFetchOptions(sampleCriteria, ["PROPERTIES"], function(data) { - callbackFunction(localReference.getInitializedSamples(data.result)); - }); - } - this.searchWithExperiment = function(experimentIdentifier, callbackFunction) { var matchClauses = [ {"@type":"AttributeMatchClause", diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormController.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormController.js index 459b3a9e98f689691c80e77b0763b97e115864ba..69dfd4982aeafefd0f20526b12d77196b56b635b 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormController.js +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormController.js @@ -64,27 +64,12 @@ function SampleFormController(mainController, mode, sample) { return this._storageControllers[this._storageControllers.length-1]; } -// this.addStorageController = function(storagePropertyGroupName) { -// var storageController = new StorageController({ -// title : null, -// storagePropertyGroupSelector : "off", -// storageSelector : "on", -// userSelector : "off", -// boxSelector: "on", -// boxSizeSelector: "on", -// rackSelector: "on", -// contentsSelector: "off", -// positionSelector: "on" -// }); -// storageController.getModel().storagePropertyGroup = profile.getStoragePropertyGroup(storagePropertyGroupName); -// this._storageControllers.push(storageController); -// } - this.getNextCopyCode = function(callback) { var _this = this; mainController.serverFacade.searchWithType( this._sampleFormModel.sample.sampleTypeCode, this._sampleFormModel.sample.code + "_*", + false, function(results) { callback(_this._sampleFormModel.sample.code + "_" + (results.length + 1)); }); @@ -317,7 +302,7 @@ function SampleFormController(mainController, mode, sample) { var searchUntilFound = null; searchUntilFound = function() { - mainController.serverFacade.searchWithType(_this._sampleFormModel.sample.sampleTypeCode, sampleCodeToOpen, function(data) { + mainController.serverFacade.searchWithType(_this._sampleFormModel.sample.sampleTypeCode, sampleCodeToOpen, false, function(data) { if(data && data.length === 1) { mainController.changeView('showViewSamplePageFromPermId',data[0].permId); } else { //Recursive call diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/DilutionTableView.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/DilutionTableView.js index c895aa3127da50e2a4c935cd78395a2a64642fbb..bb20f1013a2fd46dac016ac6adc0362c60869a56 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/DilutionTableView.js +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/DilutionTableView.js @@ -23,7 +23,7 @@ function DilutionTableView(dilutionTableController, dilutionTableModel) { $container.append("Loading data for Dilution Widget."); var _this = this; //Load all proteins - mainController.serverFacade.searchWithTypeAndLinks("PROTEIN", null, function(data) { + mainController.serverFacade.searchWithType("PROTEIN", null, true, function(data) { _this._dilutionTableModel.allProteins = data; //First repaint after all initializations diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableView.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableView.js index 1865636aa46892fa6060278600c59c715d97a9fd..bcdef2e941dcef2908bd8ef6233f5fea9b3a31a2 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableView.js +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleTable/SampleTableView.js @@ -137,7 +137,7 @@ function SampleTableView(sampleTableController, sampleTableModel) { var $sampleTypesSelector = FormUtil.getSampleTypeDropdown(null, false); $sampleTypesSelector.change(function() { var sampleTypeToShow = $(this).val(); - mainController.serverFacade.searchWithType(sampleTypeToShow, null, function(samples) { + mainController.serverFacade.searchWithType(sampleTypeToShow, null, false, function(samples) { _this._sampleTableModel.allSamples = samples; _this._sampleTableController._reloadTableWithSampleType(sampleTypeToShow); }); diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/legacy/SampleLinksWidget.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/legacy/SampleLinksWidget.js index 4055b322542abe3dc68cbeb32811cfc4785a30d9..4d0ba952a009f54bcd651b0d0bd29841727fb041 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/legacy/SampleLinksWidget.js +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/legacy/SampleLinksWidget.js @@ -227,7 +227,7 @@ function SampleLinksWidget(containerId, profile, serverFacade, title, sampleType if(sampleType !== null) { - mainController.serverFacade.searchWithType(sampleTypeCode, null, function(samples) { + mainController.serverFacade.searchWithType(sampleTypeCode, null, false, function(samples) { //Clear last state if(_this._lastUsedId) { $('#'+_this._lastUsedId + "-table").empty();