From cf1f043f13ecebb9a36ca7cff6686052e1fc05cc Mon Sep 17 00:00:00 2001 From: juanf <juanf> Date: Tue, 15 Mar 2016 10:21:19 +0000 Subject: [PATCH] SSDM-3298 : Show global search matched. SVN: 35901 --- .../html/js/controllers/MainController.js | 56 +------------------ .../eln-lims/html/js/server/ServerFacade.js | 1 + 2 files changed, 3 insertions(+), 54 deletions(-) diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js index 437a024d5ea..604588c75e0 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js @@ -667,67 +667,15 @@ function MainController(profile) { var getDataList = function(callback) { var dataList = []; - var words = value.split(" "); - var searchRegexpes = []; - for(var sIdx = 0; sIdx < words.length; sIdx++) { - var word = words[sIdx]; - searchRegexpes[sIdx] = new RegExp(word, "i"); - } - - var addMatchedPairs = function(matchedPairs, fieldName, fieldValue) { - for(var tIdx = 0; tIdx < searchRegexpes.length; tIdx++) { - if(searchRegexpes[tIdx].test(fieldValue)) { - var match = {}; - match.name = fieldName; - match.found = words[tIdx]; - match.value = fieldValue; - matchedPairs.push(match); - } - } - } - for(var i = 0; i < data.length; i++) { - var matchedPairs = []; - var sample = data[i]; - - addMatchedPairs(matchedPairs, "Code", sample.code); //Check Code - addMatchedPairs(matchedPairs, "Sample Type", sample.sampleTypeCode); //Check Type - - //Check Properties - for (propertyName in sample.properties) { - var propertyValue = sample.properties[propertyName]; - addMatchedPairs(matchedPairs, "Property " + propertyName, propertyValue); //Check Properties - } - - //Check date fields - var regEx = /\d{4}-\d{2}-\d{2}/g; - var match = value.match(regEx); - if(match && match.length === 1) { - var registrationDateValue = Util.getFormatedDate(new Date(sample.registrationDetails.registrationDate)); - if(registrationDateValue.indexOf(match[0]) !== -1) { - matchedPairs.push({ name : "Registration Date", value : registrationDateValue, found : match[0]}); - } - var modificationDateValue = Util.getFormatedDate(new Date(sample.registrationDetails.modificationDate)); - if(modificationDateValue.indexOf(match[0]) !== -1) { - matchedPairs.push({ name : "Modification Date", value : modificationDateValue, found : match[0]}); - } - } - - var $container = $("<p>"); - for(var mIdx = 0; mIdx < matchedPairs.length; mIdx++) { - if(mIdx < 0) { - $container.append($("<br>")); - } - $container.append($("<p>").append($("<strong>").append(matchedPairs[mIdx].name + ": ")).append("Found \"" + matchedPairs[mIdx].found + "\" in \"" + matchedPairs[mIdx].value + "\"")); - } - + var sample = data[i]; //properties dataList.push({ score : sample.properties["*SCORE"], permId : sample.permId, code : sample.code, sampleTypeCode : sample.sampleTypeCode, - matched : $container[0].outerHTML + matched : sample.properties["*MATCHED"] }); } 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 6f6a3e14f6f..dcba4bf4ad9 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 @@ -1325,6 +1325,7 @@ function ServerFacade(openbisServer) { if (sample) { var v1Sample = _this.getV3SampleAsV1(sample); v1Sample.properties["*SCORE"] = objects[i].score; + v1Sample.properties["*MATCHED"] = objects[i].match; v1Samples.push(v1Sample); } } -- GitLab