diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js index fdbee589eb10e5d1858a0f861d81de7e84cc6155..ddd12c15c659cda0e3d96b0f8484f8b58404eb08 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/server/ServerFacade.js @@ -2358,6 +2358,38 @@ function ServerFacade(openbisServer) { searchNext(); } + this.searchWithCodes = function(sampleCodes, callbackFunction) + { + var _this = this; + var searchResults = []; + var searchForCodes = jQuery.extend(true, [], sampleCodes); + + var searchNext = function() { + if(searchForCodes.length === 0) { + callbackFunction(searchResults); + } else { + var next = searchForCodes.pop(); + searchFunction(next); + } + } + + var searchFunction = function(sampleCode) { + _this.searchSamples({ + "withProperties" : true, + "withParents" : true, + "withChildren" : true, + "sampleCode" : sampleCode + }, function(samples) { + samples.forEach(function(sample) { + searchResults.push(sample); + }); + searchNext(); + }); + } + + searchNext(); + } + this.searchContained = function(permId, callbackFunction) { this.searchSamples({ "sampleContainerPermId" : permId, diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/AdvancedSearch/AdvancedSearchView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/AdvancedSearch/AdvancedSearchView.js index 767bc4f6ea30bed27456940489be8aee4c0bc215..45120282cd2e3957853cfd1a0551a14588b9f38b 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/AdvancedSearch/AdvancedSearchView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/AdvancedSearch/AdvancedSearchView.js @@ -475,8 +475,12 @@ function AdvancedSearchView(advancedSearchController, advancedSearchModel) { //how to make an on-select event?? this._getNewFieldTypeDropdownComponent = function($newFieldNameContainer, $newFieldOperatorContainer, $newFieldValueContainer, entityKind, uuid) { //Update dropdown component - this._$andOrDropdownComponent.val("AND").trigger('change'); - this._advancedSearchModel.criteria.logicalOperator = "AND"; + var logicalOperator = "AND"; + if (this._advancedSearchModel.criteria && this._advancedSearchModel.criteria.logicalOperator) { + logicalOperator = this._advancedSearchModel.criteria.logicalOperator; + } + this._$andOrDropdownComponent.val(logicalOperator).trigger('change'); + this._advancedSearchModel.criteria.logicalOperator = logicalOperator; this._$andOrDropdownComponent.removeAttr("disabled"); // $newFieldValueContainer.empty(); // $newFieldValueContainer.append(this._createValueField(uuid)); diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksView.js index 1672d38235e2c464eefd9045ad408fffa9b09bcf..9bee8d03044afbd6ff1be7b61245690eb303d90d 100644 --- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksView.js +++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/LinksView.js @@ -510,45 +510,73 @@ function LinksView(linksController, linksModel) { var $pasteContainer = $("<div>"); $gridContainer.append($pasteContainer); - var $textArea = FormUtil._getTextBox(null, "Object Identifiers separated by space or coma", false); + var $textArea = FormUtil._getTextBox(null, "Object Identifiers or codes separated by space or coma", false); $textArea.css( { 'width' : '100%', "height" : "20%", "min-height" : "100px"}); $pasteContainer.append($textArea); var $addObjectsBtn = FormUtil.getButtonWithIcon("glyphicon-plus", function() { - var identifiers = null; + var maybeIdentifiersOrCodes = null; if($textArea.val().indexOf(",") > -1) { - identifiers = $textArea.val().split(","); + maybeIdentifiersOrCodes = $textArea.val().split(","); } else { - identifiers = $textArea.val().split(" "); + maybeIdentifiersOrCodes = $textArea.val().split(" "); } - var validIdentifiers = []; - for(var vIdx = 0; vIdx < identifiers.length; vIdx++) { - if(identifiers[vIdx].indexOf("/") > -1) { - validIdentifiers.push(identifiers[vIdx].trim()); + var maybeIdentifiers = []; + var maybeCodes = []; + for(var vIdx = 0; vIdx < maybeIdentifiersOrCodes.length; vIdx++) { + if(maybeIdentifiersOrCodes[vIdx].indexOf("/") > -1) { + maybeIdentifiers.push(maybeIdentifiersOrCodes[vIdx].trim()); + } else { + maybeCodes.push(maybeIdentifiersOrCodes[vIdx].trim()); } } - if(validIdentifiers.length == 0) { + + var requestedObjects = (maybeIdentifiers.length + maybeCodes.length); + if(requestedObjects == 0) { + Util.showError("Nothing to paste was found."); return; } Util.blockUI(); - mainController.serverFacade.searchWithIdentifiers(validIdentifiers, function(results) { - var added = 0; - var incorrectType = 0; - for(var sIdx = 0; sIdx < results.length; sIdx++) { - if(sampleTypeCode === undefined || (results[sIdx].sampleTypeCode === sampleTypeCode)) { - linksView.updateSample(results[sIdx], true); + var finalResults = []; + var added = 0; + var incorrectType = 0; + + mainController.serverFacade.searchWithIdentifiers(maybeIdentifiers, function(identifierResults) { + for(var sIdx = 0; sIdx < identifierResults.length; sIdx++) { + if(sampleTypeCode === undefined || (identifierResults[sIdx].sampleTypeCode === sampleTypeCode)) { + finalResults.push(identifierResults[sIdx]); added++; } else { incorrectType++; } } - Util.unblockUI(); - var message = "Pasted " + added + " " + ((added === 1)?ELNDictionary.Sample:ELNDictionary.Samples) + "." - Util.showInfo(message); - $container.empty().hide(); + mainController.serverFacade.searchWithCodes(maybeCodes, function(codeResults) { + for(var sIdx = 0; sIdx < codeResults.length; sIdx++) { + if(sampleTypeCode === undefined || (codeResults[sIdx].sampleTypeCode === sampleTypeCode)) { + finalResults.push(codeResults[sIdx]); + added++; + } else { + incorrectType++; + } + } + + if(requestedObjects != finalResults.length) { + Util.unblockUI(); + Util.showError("Requested " + requestedObjects + " but found " + finalResults.length + ", check your ids!"); + } else { + for(var sIdx = 0; sIdx < finalResults.length; sIdx++) { + linksView.updateSample(finalResults[sIdx], true); + } + Util.unblockUI(); + var message = "Pasted " + added + " " + ((added === 1)?ELNDictionary.Sample:ELNDictionary.Samples) + "." + Util.showInfo(message); + $container.empty().hide(); + } + + }); }); }, "Add"); $addObjectsBtn.css({"margin-top" : "5px"}); diff --git a/pybis/src/python/CHANGELOG.md b/pybis/src/python/CHANGELOG.md index 3789af722ed00a35d77b19ad7defa72bf95ac48a..326a31a84b2be7115f763a2d89b237b7acdba5cf 100644 --- a/pybis/src/python/CHANGELOG.md +++ b/pybis/src/python/CHANGELOG.md @@ -1,3 +1,10 @@ +## Changes with pybis-1.20.2 +- fixed omitted function parameter which could cause issues + +## Changes with pybis-1.20.1 +- improved search performance +- introduced lazy loading for Things.df and Things.objects, so all necessary, and potentially costly, computation takes place only when the user requests those properties + ## Changes with pybis-1.20.0 - metadata for property_types can now be changed to: diff --git a/pybis/src/python/pybis/__init__.py b/pybis/src/python/pybis/__init__.py index c3a8db023a271d41d1b209c485556ecf09c49392..459da92f5b8392eb7458d00eed47387085b8dd52 100644 --- a/pybis/src/python/pybis/__init__.py +++ b/pybis/src/python/pybis/__init__.py @@ -1,7 +1,7 @@ name = "pybis" __author__ = "Swen Vermeul" __email__ = "swen@ethz.ch" -__version__ = "1.20.0" +__version__ = "1.20.2" from . import pybis from .pybis import DataSet diff --git a/pybis/src/python/pybis/pybis.py b/pybis/src/python/pybis/pybis.py index ba76ec927d7a1632385911e1501500f962056421..31d5940a5143ad728ee5fc3351bf0ff319eef307 100644 --- a/pybis/src/python/pybis/pybis.py +++ b/pybis/src/python/pybis/pybis.py @@ -4239,6 +4239,7 @@ class Openbis: count=count, totalCount=totalCount, attrs=attrs, + props=props, response=response, df_initializer=create_data_frame, objects_initializer=create_objects diff --git a/pybis/src/python/setup.py b/pybis/src/python/setup.py index 89f04dee206eb9dfe1ff9e19fb42581a868490d4..56225eefe0cfa908835c32e7a43a5633d8b50468 100644 --- a/pybis/src/python/setup.py +++ b/pybis/src/python/setup.py @@ -13,7 +13,7 @@ with open("README.md", "r", encoding="utf-8") as fh: setup( name="PyBIS", - version="1.20.1", + version="1.20.2", author="Swen Vermeul • ID SIS • ETH Zürich", author_email="swen@ethz.ch", description="openBIS connection and interaction, optimized for using with Jupyter",