Skip to content

Commit

Permalink
fix key collision between folder and macros
Browse files Browse the repository at this point in the history
  • Loading branch information
etnnth committed Aug 9, 2023
1 parent af820a3 commit 77bed9f
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/app/services/project_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -687,11 +687,7 @@ angular

var dirpath = _.initial(path);

if (node.resource_type == 'macro') {
var fname = node.name;
} else {
var fname = _.last(path);
}
var fname = `${node.resource_type}.${_.last(path)}.${node.name}`;

if (node.resource_type == 'model' && node.version != null) {
var display_name = node.name + "_v" + node.version;
Expand All @@ -701,17 +697,18 @@ angular

var cur_dir = tree;
_.each(dirpath, function(dir) {
if (!cur_dir[dir]) {
cur_dir[dir] = {
var dname = `dir.${dir}`
if (!cur_dir[dname]) {
cur_dir[dname] = {
type: 'folder',
name: dir,
active: is_active,
items: {}
};
} else if (is_active) {
cur_dir[dir].active = true;
cur_dir[dname].active = true;
}
cur_dir = cur_dir[dir].items;
cur_dir = cur_dir[dname].items;
})
cur_dir[fname] = {
type: 'file',
Expand Down

0 comments on commit 77bed9f

Please sign in to comment.