fix update config

This commit is contained in:
Rodrigo Quelca
2021-09-24 17:56:33 +00:00
parent d36569bc54
commit e9e1eb9701

View File

@@ -43,7 +43,8 @@ export default {
visited: this.settings && this.settings.visited ? this.settings.visited : [ visited: this.settings && this.settings.visited ? this.settings.visited : [
{ {
level: 0, level: 0,
active: true active: true,
id: _.random(0,100),
} }
] ]
}; };
@@ -60,16 +61,18 @@ export default {
* Change level in drill down * Change level in drill down
*/ */
changeLevel(data) { changeLevel(data) {
let item = _.find(this.visited, {level: data.level }); let item = _.find(this.visited, data);
this.visited.forEach(function (elem) { this.visited.forEach(function (elem) {
elem.active = false; elem.active = false;
}); });
if(!item) { if(!item) {
data.active = true; data.active = true;
this.visited = _.filter(this.visited, function(o) {
return o.level < data.level;
});
this.visited.push(data); this.visited.push(data);
} else { } else {
item.active = true; item.active = true;
} }
this.$emit("updateSettings", { this.$emit("updateSettings", {
data: this.visited, data: this.visited,