Skip to content

Commit

Permalink
TVB-2757: Remove unused JS functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
VinczeRobert committed Jan 22, 2021
1 parent b2e3ccb commit dd6e5ac
Showing 1 changed file with 1 addition and 67 deletions.
68 changes: 1 addition & 67 deletions framework_tvb/tvb/interfaces/web/static/js/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,70 +255,4 @@ function applyRuntimeFilters(name, selected_value, dynamic_filters){
}
});
}
}


/**
* After the user executes a filter than we have to replace the select with the old option with
* the select which contains only the options that satisfies the filters.
*
* @param parentDiv the parent div in which is located the select
* @param newSelect the html that contains the new select
* @param selectName the name of the old select
*/
function replaceSelect(parentDiv, newSelect, selectName) {
var allChildren = parentDiv.children;
for (var j = 0; j < allChildren.length; j++) {
if (allChildren[j].nodeName == 'SELECT' && allChildren[j].name == selectName) {
$(newSelect).insertAfter($(allChildren[j]));
parentDiv.removeChild(allChildren[j]);
break;
}
}
}

/**
* Filter fields which are linked with current entity.
* @param {list} linkedDataList list of lists.
* @param {string} currentSelectedGID for current input
* @param {string} treeSessionKey Key
*/
function filterLinked(linkedDataList, currentSelectedGID, treeSessionKey) {
if (currentSelectedGID.length < 1) {
return;
}
for (var i = 0; i < linkedDataList.length; i++) {
var linkedData = linkedDataList[i];
var elemName = linkedData.linked_elem_name;

var filterField = linkedData.linked_elem_field;
var filterData = {
'fields': [filterField],
'operations': ["in"],
'values': [currentSelectedGID.split(' ')]
};

if (!linkedData.linked_elem_parent_name && !linkedData.linked_elem_parent_option) {
applyFilters("", elemName + 'data_select', elemName, treeSessionKey, filterData);
}

var linkedInputName = linkedData.linked_elem_parent_name + "_parameters_option_";
var parentDivID = 'data_' + linkedData.linked_elem_parent_name;

if (linkedData.linked_elem_parent_option) {
linkedInputName = linkedInputName + linkedData.linked_elem_parent_option + "_" + elemName;
parentDivID += linkedData.linked_elem_parent_option;
applyFilters(parentDivID, linkedInputName + 'data_select', linkedInputName, treeSessionKey, filterData);
} else {
$("select[id^='" + linkedInputName + "']").each(function () {
if ($(this)[0].id.indexOf("_" + elemName) < 0) {
return;
}
var option_name = $(this)[0].id.replace("_" + elemName, '').replace(linkedInputName, '');
linkedInputName = $(this)[0].id;
parentDivID += option_name; // todo : possible bug. option names will be concatenated many times if this each runs more than once
applyFilters(parentDivID, linkedInputName + 'data_select', linkedInputName, treeSessionKey, filterData);
});
}
}
}
}

0 comments on commit dd6e5ac

Please sign in to comment.