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

SSDM-3888: Advance search supporting selecting sample types

SVN: 36893
parent 1615d54c
No related branches found
No related tags found
No related merge requests found
...@@ -340,7 +340,7 @@ function AdvancedSearchView(advancedSearchController, advancedSearchModel) { ...@@ -340,7 +340,7 @@ function AdvancedSearchView(advancedSearchController, advancedSearchModel) {
model.push({ value : 'EXPERIMENT', label : ELNDictionary.ExperimentELN + "/" + ELNDictionary.ExperimentInventory }); model.push({ value : 'EXPERIMENT', label : ELNDictionary.ExperimentELN + "/" + ELNDictionary.ExperimentInventory });
model.push({ value : 'SAMPLE', label : "" + ELNDictionary.Sample + "" }); model.push({ value : 'SAMPLE', label : "" + ELNDictionary.Sample + "" });
model.push({ value : 'DATASET', label : "Dataset" }); model.push({ value : 'DATASET', label : "Dataset" });
model.push({ value : '', label : "-----------" }); model.push({ value : '', label : "--------------", disabled : true });
var sampleTypes = profile.getAllSampleTypes(); var sampleTypes = profile.getAllSampleTypes();
for(var tIdx = 0; tIdx < sampleTypes.length; tIdx++) { for(var tIdx = 0; tIdx < sampleTypes.length; tIdx++) {
var sampleType = sampleTypes[tIdx]; var sampleType = sampleTypes[tIdx];
...@@ -351,33 +351,31 @@ function AdvancedSearchView(advancedSearchController, advancedSearchModel) { ...@@ -351,33 +351,31 @@ function AdvancedSearchView(advancedSearchController, advancedSearchModel) {
var $dropdown = FormUtil.getDropdown(model, 'Select Entity Type to search for'); var $dropdown = FormUtil.getDropdown(model, 'Select Entity Type to search for');
$dropdown.change(function() { $dropdown.change(function() {
if($(this).val() !== '') { var kindAndType = $(this).val().split("$");
var kindAndType = $(this).val().split("$");
if(_this._advancedSearchModel.isAllRules()) {
if(_this._advancedSearchModel.isAllRules()) { //1. update the entity type only in the model
//1. update the entity type only in the model _this._advancedSearchModel.setEntityKind(kindAndType[0]);
_this._advancedSearchModel.setEntityKind(kindAndType[0]); //2. change the field type dropdowns in the view
//2. change the field type dropdowns in the view var rows = _this._$tbody.children();
var rows = _this._$tbody.children(); for(var rIdx = 0; rIdx < rows.length; rIdx++) {
for(var rIdx = 0; rIdx < rows.length; rIdx++) { var $row = $(rows[rIdx]);
var $row = $(rows[rIdx]); var tds = $row.children();
var tds = $row.children(); var $newFieldTypeComponent = _this._getNewFieldTypeDropdownComponent($(tds[1]), _this._advancedSearchModel.criteria.entityKind, $row.attr("id"));
var $newFieldTypeComponent = _this._getNewFieldTypeDropdownComponent($(tds[1]), _this._advancedSearchModel.criteria.entityKind, $row.attr("id")); $(tds[0]).empty();
$(tds[0]).empty(); $(tds[0]).append($newFieldTypeComponent);
$(tds[0]).append($newFieldTypeComponent); }
} } else {
} else { _this._advancedSearchModel.resetModel(kindAndType[0]); //Restart model
_this._advancedSearchModel.resetModel(kindAndType[0]); //Restart model _this._paintCriteriaPanel(_this._$searchCriteriaPanelContainer); //Restart view
_this._paintCriteriaPanel(_this._$searchCriteriaPanelContainer); //Restart view }
}
if(kindAndType.length === 2) {
if(kindAndType.length === 2) { var uuidValue = Util.guid();
var uuidValue = Util.guid(); _this._advancedSearchModel.criteria.rules[uuidValue] = { };
_this._advancedSearchModel.criteria.rules[uuidValue] = { }; _this._advancedSearchModel.criteria.rules[uuidValue].type = 'Attribute';
_this._advancedSearchModel.criteria.rules[uuidValue].type = 'Attribute'; _this._advancedSearchModel.criteria.rules[uuidValue].name = 'ATTR.SAMPLE_TYPE';
_this._advancedSearchModel.criteria.rules[uuidValue].name = 'ATTR.SAMPLE_TYPE'; _this._advancedSearchModel.criteria.rules[uuidValue].value = kindAndType[1];
_this._advancedSearchModel.criteria.rules[uuidValue].value = kindAndType[1];
}
} }
}); });
......
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