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

SSDM-1648 : Better support for openbis imports (Ongoing work).

SVN: 33763
parent a7812315
No related branches found
No related tags found
No related merge requests found
...@@ -135,12 +135,49 @@ function SampleTableController(parentController, title, experimentIdentifier) { ...@@ -135,12 +135,49 @@ function SampleTableController(parentController, title, experimentIdentifier) {
for (var idx = 0; idx < propertyCodes.length; idx++) { for (var idx = 0; idx < propertyCodes.length; idx++) {
columns.push({ var propertyCode = propertyCodes[idx];
label : propertyCodesDisplayNames[idx], var propertyType = profile.getPropertyType(propertyCode);
property : propertyCodes[idx], if(propertyType.dataType === "CONTROLLEDVOCABULARY") {
isExportable: true, var getVocabularyColumn = function(propertyType) {
sortable : true return function() {
}); return {
label : propertyCodesDisplayNames[idx],
property : propertyCodes[idx],
isExportable: true,
sortable : true,
render : function(data) {
return FormUtil.getVocabularyLabelForTermCode(propertyType, data[propertyType.code]);
},
filter : function(data, filter) {
var value = FormUtil.getVocabularyLabelForTermCode(propertyType, data[propertyType.code]);
return value && value.indexOf(filter) !== -1;
},
sort : function(data1, data2, asc) {
var value1 = FormUtil.getVocabularyLabelForTermCode(propertyType, data1[propertyType.code]);
if(!value1) {
value1 = ""
};
var value2 = FormUtil.getVocabularyLabelForTermCode(propertyType, data2[propertyType.code]);
if(!value2) {
value2 = ""
};
var sortDirection = (asc)? 1 : -1;
return sortDirection * naturalSort(value1, value2);
}
};
}
}
var newVocabularyColumnFunc = getVocabularyColumn(propertyType);
columns.push(newVocabularyColumnFunc());
} else {
columns.push({
label : propertyCodesDisplayNames[idx],
property : propertyCodes[idx],
isExportable: true,
sortable : true
});
}
} }
columns.push({ columns.push({
...@@ -205,12 +242,7 @@ function SampleTableController(parentController, title, experimentIdentifier) { ...@@ -205,12 +242,7 @@ function SampleTableController(parentController, title, experimentIdentifier) {
var sampleModel = { 'identifier' : sample.code, 'default_space' : sample.spaceCode, 'permId' : sample.permId, 'experiment' : sample.experimentIdentifierOrNull }; var sampleModel = { 'identifier' : sample.code, 'default_space' : sample.spaceCode, 'permId' : sample.permId, 'experiment' : sample.experimentIdentifierOrNull };
for (var pIdx = 0; pIdx < propertyCodes.length; pIdx++) { for (var pIdx = 0; pIdx < propertyCodes.length; pIdx++) {
var propertyCode = propertyCodes[pIdx]; var propertyCode = propertyCodes[pIdx];
var propertyType = profile.isPropertyPressent(sampleType, propertyCode); sampleModel[propertyCode] = sample.properties[propertyCode];
var value = sample.properties[propertyCode];
if(propertyType.dataType === "CONTROLLEDVOCABULARY") {
value = FormUtil.getVocabularyLabelForTermCode(propertyType, value);
}
sampleModel[propertyCode] = value;
} }
dataList.push(sampleModel); dataList.push(sampleModel);
} }
......
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