code: function generateSidebar(statusMap, nextPipelineId, rootElement) {
    var currentElement = null;
  
    if (nextPipelineId) {
      currentElement = $('<li>');
      // Value should match return of getTreePipelineElementId
      currentElement.attr('id', 'item-pipeline-' + nextPipelineId);
    } else {
      currentElement = rootElement;
      nextPipelineId = statusMap.rootPipelineId;
    }
  
    var parentInfoMap = statusMap.pipelines[nextPipelineId];
    currentElement.append(
        constructStageNode(nextPipelineId, parentInfoMap, true));
  
    if (statusMap.pipelines[nextPipelineId]) {
      var children = statusMap.pipelines[nextPipelineId].children;
      if (children.length > 0) {
        var treeElement = null;
        if (rootElement) {
          treeElement =
              $('<ul id="pipeline-tree" class="treeview-black treeview">');
        } else {
          treeElement = $('<ul>');
        }
  
        $.each(children, function(index, childPipelineId) {
          var childElement = generateSidebar(statusMap, childPipelineId);
          treeElement.append(childElement);
        });
        currentElement.append(treeElement);
      }
    }
    return currentElement;
  }
docs: Recursively creates the sidebar. Use null nextPipelineId to create from root.