+ function drawProjectsTree(projects,slices) {
+ var items = [];
+ var items_sl = [];
+ var slices_no_project = [];
+ $.each( projects, function(i, p) {
+ $.each( slices, function(y, s) {
+ if (s.match('^' + escapeRegExp(p))) {
+ slicename = s.replace(p + '.','')
+ items_sl.push( "<li><a href=\"/resources/" + s + "\" title='Add resources to slice "+slicename+"'><img src='/static/img/icon_slices_small.png' style='width: 12px;'> " + slicename + "</a></li>" );
+ }else if(s.split('.').length < 4){
+ slices_no_project.push( "<li><a href=\"/resources/" + s + "\" title='Add resources to slice "+s+"'><img src='/static/img/icon_slices_small.png' style='width: 12px;'> " + s + "</a></li>" );
+ }
+ });
+ el = "<li><a href=\"/portal/project/" + p + "\" title='Manage project "+p+"' >" + p + "</a>";
+ if (items_sl.length > 0) {
+ el += "<ul>" + items_sl.join( "" ) + "</ul>";
+ }
+ el += "</li>";
+ items.push(el);
+ items_sl = [];
+ });
+
+ elm = '<li>other slices <span class="glyphicon glyphicon-info-sign" title="these are <b>legacy slices</b> from now on, slices must be created within a project"> </span>';
+ if (slices_no_project.length > 0) {
+ elm += "<ul>" + slices_no_project.join( "" ) + "</ul>";
+ }
+ elm += "</li>";
+ items.push(elm);
+
+ $("div#home-project-tree").html($( "<ul/>", { html: items.join( "" ) }));
+ if (projects.length > 0) {
+ $('.dashboard-create-slice').show();
+ }
+ }
+
+ window.setTimeout(function() {
+ $('.projects-loading').hide();
+ },20000);