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

SSDM-4342 : Show only Experimental Steps on tree side view, safer implementation.

SVN: 37443
parent 1971eaff
No related branches found
No related tags found
No related merge requests found
...@@ -347,20 +347,25 @@ function SideMenuWidgetView(sideMenuWidgetController, sideMenuWidgetModel) { ...@@ -347,20 +347,25 @@ function SideMenuWidgetView(sideMenuWidgetController, sideMenuWidgetModel) {
mainController.serverFacade.searchForSamplesAdvanced({ entityKind : "SAMPLE", logicalOperator : "AND", rules : sampleRules }, null, mainController.serverFacade.searchForSamplesAdvanced({ entityKind : "SAMPLE", logicalOperator : "AND", rules : sampleRules }, null,
function(searchResult) { function(searchResult) {
var samples = searchResult.objects; var samples = searchResult.objects;
var samplesWithoutELNParents = []; var samplesToShow = [];
for(var sIdx = 0; sIdx < samples.length; sIdx++) { for(var sIdx = 0; sIdx < samples.length; sIdx++) {
var sample = samples[sIdx]; var sample = samples[sIdx];
if(sample.parents) { var sampleIsExperiment = sample.type.code.indexOf("EXPERIMENT") > -1;
var parentInELN = false;
for(var pIdx = 0; pIdx < sample.parents.length; pIdx++) { if(sampleIsExperiment) {
var parentIdentifier = sample.parents[pIdx].identifier.identifier; var parentIsExperiment = false;
parentInELN = parentInELN || profile.isELNIdentifier(parentIdentifier); if(sample.parents) {
for(var pIdx = 0; pIdx < sample.parents.length; pIdx++) {
var parentIdentifier = sample.parents[pIdx].identifier.identifier;
var parentInELN = profile.isELNIdentifier(parentIdentifier);
if(parentInELN) {
parentIsExperiment = parentIsExperiment || sample.parents[pIdx].type.code.indexOf("EXPERIMENT") > -1;
}
}
} }
if(!parentInELN) { if(!parentIsExperiment) {
samplesWithoutELNParents.push(sample); samplesToShow.push(sample);
} }
} else {
samplesWithoutELNParents.push(sample);
} }
} }
...@@ -375,10 +380,7 @@ function SideMenuWidgetView(sideMenuWidgetController, sideMenuWidgetModel) { ...@@ -375,10 +380,7 @@ function SideMenuWidgetView(sideMenuWidgetController, sideMenuWidgetModel) {
} }
var sampleLink = _this.getLinkForNode(sampleDisplayName, sample.getPermId().getPermId(), "showViewSamplePageFromPermId", sample.getPermId().getPermId()); var sampleLink = _this.getLinkForNode(sampleDisplayName, sample.getPermId().getPermId(), "showViewSamplePageFromPermId", sample.getPermId().getPermId());
var sampleNode = { title : sampleLink, entityType: "SAMPLE", key : sample.getPermId().getPermId(), folder : true, lazy : true, view : "showViewSamplePageFromPermId", viewData: sample.getPermId().getPermId() }; var sampleNode = { title : sampleLink, entityType: "SAMPLE", key : sample.getPermId().getPermId(), folder : true, lazy : true, view : "showViewSamplePageFromPermId", viewData: sample.getPermId().getPermId(), icon : "fa fa-flask" };
if(sample.getType().getCode() === "EXPERIMENTAL_STEP") {
sampleNode.icon = "fa fa-flask";
}
results.push(sampleNode); results.push(sampleNode);
} }
dfd.resolve(results); dfd.resolve(results);
...@@ -392,16 +394,16 @@ function SideMenuWidgetView(sideMenuWidgetController, sideMenuWidgetModel) { ...@@ -392,16 +394,16 @@ function SideMenuWidgetView(sideMenuWidgetController, sideMenuWidgetModel) {
} }
} }
if(samplesWithoutELNParents.length > 50) { if(samplesToShow.length > 50) {
var toExecute = function() { var toExecute = function() {
Util.blockUIConfirm("Do you want to show " + samplesWithoutELNParents.length + " " + ELNDictionary.Samples + " on the tree?", Util.blockUIConfirm("Do you want to show " + samplesWithoutELNParents.length + " " + ELNDictionary.Samples + " on the tree?",
getOkResultsFunction(dfd, samplesWithoutELNParents), getOkResultsFunction(dfd, samplesToShow),
getCancelResultsFunction(dfd)); getCancelResultsFunction(dfd));
} }
setTimeout(toExecute, 1000); setTimeout(toExecute, 1000);
} else { } else {
getOkResultsFunction(dfd, samplesWithoutELNParents)(); getOkResultsFunction(dfd, samplesToShow)();
} }
}); });
break; break;
...@@ -416,18 +418,16 @@ function SideMenuWidgetView(sideMenuWidgetController, sideMenuWidgetModel) { ...@@ -416,18 +418,16 @@ function SideMenuWidgetView(sideMenuWidgetController, sideMenuWidgetModel) {
} else { } else {
for(var cIdx = 0; cIdx < samples[0].children.length; cIdx++) { for(var cIdx = 0; cIdx < samples[0].children.length; cIdx++) {
var sample = samples[0].children[cIdx]; var sample = samples[0].children[cIdx];
if(sample.type.code.indexOf("EXPERIMENT") > -1) {
var sampleDisplayName = sample.code; var sampleDisplayName = sample.code;
if(sample.properties && sample.properties[profile.propertyReplacingCode]) { if(sample.properties && sample.properties[profile.propertyReplacingCode]) {
sampleDisplayName = sample.properties[profile.propertyReplacingCode]; sampleDisplayName = sample.properties[profile.propertyReplacingCode];
} }
var sampleLink = _this.getLinkForNode(sampleDisplayName, sample.getPermId().getPermId(), "showViewSamplePageFromPermId", sample.getPermId().getPermId()); var sampleLink = _this.getLinkForNode(sampleDisplayName, sample.getPermId().getPermId(), "showViewSamplePageFromPermId", sample.getPermId().getPermId());
var sampleNode = { title : sampleLink, entityType: "SAMPLE", key : sample.getPermId().getPermId(), folder : true, lazy : true, view : "showViewSamplePageFromPermId", viewData: sample.getPermId().getPermId() }; var sampleNode = { title : sampleLink, entityType: "SAMPLE", key : sample.getPermId().getPermId(), folder : true, lazy : true, view : "showViewSamplePageFromPermId", viewData: sample.getPermId().getPermId(), icon : "fa fa-flask" };
if(sample.getType().getCode() === "EXPERIMENTAL_STEP") { results.push(sampleNode);
sampleNode.icon = "fa fa-flask"; }
}
results.push(sampleNode);
} }
} }
} }
......
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