function asProjectTree()

in src/app/teamcity/teamcity-convert.js [67:87]


function asProjectTree(projects, projectMap) {
  // Build a forest of projects
  const roots = [];
  projects.forEach(project => {
    const parent = projectMap[project.parentProjectId];
    if (parent) {
      const children = parent.children || [];
      children.push(project);
      parent.children = children;
      project.parent = parent;
    } else {
      roots.push(project);
    }
  });

  projects.forEach(project => {
    project.path = getPath(project);
  });

  return roots;
}