#12168 filtered only for services

This commit is contained in:
Jorge Rincon 2023-10-20 10:49:08 +02:00
parent 581d78fc33
commit 13ba9aff39

View File

@ -1565,29 +1565,31 @@ var TreeController = {
const father = []; const father = [];
const newTree = []; const newTree = [];
rawTree.map((raw, index) => { rawTree.map((raw, index) => {
if (raw.servicesChildren.length !== 0) { if (raw.type === "services") {
// search at parent level if (raw.servicesChildren.length !== 0) {
let findedPadre = raw.description.indexOf(searched); // search at parent level
if (findedPadre === -1) { let findedPadre = raw.description.indexOf(searched);
// search for children if (findedPadre === -1) {
raw.servicesChildren.map(child => { // search for children
let finded = child.description.indexOf(searched); raw.servicesChildren.map(child => {
if (finded === 0) { let finded = child.description.indexOf(searched);
//we keep the father of the child that contains it if (finded === 0) {
ancestors.push(child.ancestor); //we keep the father of the child that contains it
} else if (findedPadre === -1 && finded === -1) { ancestors.push(child.ancestor);
//we save the father } else if (findedPadre === -1 && finded === -1) {
father.push(raw.id); //we save the father
} father.push(raw.id);
}); }
});
} else {
//we mark the father as found
controller.finded = 1;
}
} else { } else {
//we mark the father as found let finded = raw.description.indexOf(searched);
controller.finded = 1; if (finded === -1) {
} delete rawTree[index];
} else { }
let finded = raw.description.indexOf(searched);
if (finded === -1) {
delete rawTree[index];
} }
} }
}); });