Skip to content
Snippets Groups Projects
Commit 9fc12dec authored by juanf's avatar juanf
Browse files

SSDM-1614 : YEASTLAB - ELN UI - Show Names (Fix names on links)

SVN: 33726
parent 791b8698
No related branches found
No related tags found
No related merge requests found
...@@ -542,34 +542,52 @@ function ServerFacade(openbisServer) { ...@@ -542,34 +542,52 @@ function ServerFacade(openbisServer) {
this.searchWithIdentifiers = function(sampleIdentifiers, callbackFunction) this.searchWithIdentifiers = function(sampleIdentifiers, callbackFunction)
{ {
var matchClauses = []; var _this = this;
sampleIdentifiers.forEach(function(sampleIdentifier){ var searchResults = [];
matchClauses.push({ var searchForIdentifiers = jQuery.extend(true, [], sampleIdentifiers);
"@type":"AttributeMatchClause", var searchFunction = null;
fieldType : "ATTRIBUTE",
attribute : "SPACE", var searchNext = function() {
desiredValue : sampleIdentifier.split("/")[1] if(searchForIdentifiers.length === 0) {
}, callbackFunction(searchResults);
{ } else {
"@type":"AttributeMatchClause", var next = searchForIdentifiers.pop();
fieldType : "ATTRIBUTE", searchFunction(next);
attribute : "CODE", }
desiredValue : sampleIdentifier.split("/")[2] }
});
});
var sampleCriteria = var searchFunction = function(sampleIdentifier) {
{ var matchClauses = [{
matchClauses : matchClauses, "@type":"AttributeMatchClause",
operator : "MATCH_ALL_CLAUSES" fieldType : "ATTRIBUTE",
}; attribute : "SPACE",
desiredValue : sampleIdentifier.split("/")[1]
}, {
"@type":"AttributeMatchClause",
fieldType : "ATTRIBUTE",
attribute : "CODE",
desiredValue : sampleIdentifier.split("/")[2]
}];
var sampleCriteria = {
matchClauses : matchClauses,
operator : "MATCH_ALL_CLAUSES"
}
_this.openbisServer.searchForSamplesWithFetchOptions(sampleCriteria, ["PROPERTIES", "ANCESTORS", "DESCENDANTS"], function(data) {
var partialResults = _this.getInitializedSamples(data.result);
partialResults.forEach(function(partialResult) {
searchResults.push(partialResult);
});
searchNext();
});
}
var localReference = this; searchNext();
this.openbisServer.searchForSamplesWithFetchOptions(sampleCriteria, ["PROPERTIES", "ANCESTORS", "DESCENDANTS"], function(data) {
callbackFunction(localReference.getInitializedSamples(data.result));
});
} }
this.searchWithUniqueId = function(samplePermId, callbackFunction) this.searchWithUniqueId = function(samplePermId, callbackFunction)
{ {
var matchClauses = [ var matchClauses = [
......
...@@ -233,23 +233,21 @@ function SampleFormView(sampleFormController, sampleFormModel) { ...@@ -233,23 +233,21 @@ function SampleFormView(sampleFormController, sampleFormModel) {
//Make samples from Orphans left //Make samples from Orphans left
if(annotationsFromSample) { if(annotationsFromSample) {
for(var orphanSamplePermId in annotationsFromSample) { for(var orphanSamplePermId in annotationsFromSample) {
var orphanSample = {}; currentOrphanLinks.push(annotationsFromSample[orphanSamplePermId].identifier);
orphanSample.permId = orphanSamplePermId;
orphanSample.code = annotationsFromSample[orphanSamplePermId].identifier.split('/')[2];
orphanSample.identifier = annotationsFromSample[orphanSamplePermId].identifier;
orphanSample.sampleTypeCode = annotationsFromSample[orphanSamplePermId].sampleType;
orphanSample.properties = { "NAME" : "TO-DO, get names on links"};
currentOrphanLinks.push(orphanSample);
} }
} }
this._sampleFormModel.sampleLinks = new SampleLinksWidget(sampleLinksWidgetId,
profile, var showLinksWidgetAction = function(data) {
mainController.serverFacade, _this._sampleFormModel.sampleLinks = new SampleLinksWidget(sampleLinksWidgetId,
"Links", profile,
requiredLinks, mainController.serverFacade,
isDisabled, "Links",
currentOrphanLinks, requiredLinks,
this._sampleFormModel.mode === FormMode.CREATE); isDisabled,
data,
_this._sampleFormModel.mode === FormMode.CREATE);
_this._sampleFormModel.sampleLinks.repaint();
}
// //
// LINKS TO CHILDREN // LINKS TO CHILDREN
...@@ -447,7 +445,12 @@ function SampleFormView(sampleFormController, sampleFormModel) { ...@@ -447,7 +445,12 @@ function SampleFormView(sampleFormController, sampleFormModel) {
//Repaint parents and children after updating the property state to show the annotations //Repaint parents and children after updating the property state to show the annotations
this._sampleFormModel.sampleLinksParents.repaint(); this._sampleFormModel.sampleLinksParents.repaint();
this._sampleFormModel.sampleLinksChildren.repaint(); this._sampleFormModel.sampleLinksChildren.repaint();
this._sampleFormModel.sampleLinks.repaint();
if(currentOrphanLinks.length !== 0) {
mainController.serverFacade.searchWithIdentifiers(currentOrphanLinks, showLinksWidgetAction);
} else {
showLinksWidgetAction([]);
}
if(this._sampleFormModel.mode !== FormMode.CREATE) { if(this._sampleFormModel.mode !== FormMode.CREATE) {
//Preview image //Preview image
......
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