http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/blob/ff98fa34/nexus-ingest/dataset-tiler/build/reports/project/dependencies/js/script.js ---------------------------------------------------------------------- diff --git a/nexus-ingest/dataset-tiler/build/reports/project/dependencies/js/script.js b/nexus-ingest/dataset-tiler/build/reports/project/dependencies/js/script.js new file mode 100644 index 0000000..7f4d9a8 --- /dev/null +++ b/nexus-ingest/dataset-tiler/build/reports/project/dependencies/js/script.js @@ -0,0 +1,202 @@ +/* + * Copyright 2013 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function populateFooter(report) { + $("#gradleVersion").text(report.gradleVersion); + $("#generationDate").text(report.generationDate); +} + +function initializeProjectPage(report) { + $(document).ready(function() { + // event handling to close the insight div + $('#insight').on('click', '#dismissInsight', function(event) { + $('#insight').fadeOut(); + event.preventDefault(); + }); + + // creates a node of a dependency tree + function createDependencyNode(dependency) { + var node = { + data : dependency.name, + state : "open", + attr : {'data-module' : dependency.module}, + children : [] + }; + var classes = []; + if (dependency.alreadyRendered) { + classes.push('alreadyRendered'); + } + if (dependency.hasConflict) { + classes.push('hasConflict'); + } + if (!dependency.resolvable) { + classes.push('unresolvable'); + } + if (classes.length > 0) { + node.attr['class'] = classes.join(' '); + } + $.each(dependency.children, function(index, dependency) { + var dependencyNode = createDependencyNode(dependency); + node.children.push(dependencyNode); + }); + return node; + } + + // finds the moduleInsight by module among the given moduleInsights and returns its insight + function findInsight(moduleInsights, module) { + for (var i = 0; i < moduleInsights.length; i++) { + if (moduleInsights[i].module == module) { + return moduleInsights[i].insight; + } + } + return null; + } + + // creates a node of the insight tree + function createInsightNode(dependency) { + var node = { + data : dependency.name + (dependency.description ? ' (' + dependency.description + ')' : ''), + state : "open", + attr : {}, + children : [] + } + var classes = []; + if (dependency.alreadyRendered) { + classes.push('alreadyRendered'); + } + if (!dependency.resolvable) { + classes.push('unresolvable'); + } + if (dependency.hasConflict) { + classes.push('hasConflict'); + } + if (dependency.isLeaf) { + classes.push('leaf'); + } + if (classes.length > 0) { + node.attr['class'] = classes.join(' '); + } + $.each(dependency.children, function(index, dependency) { + var dependencyNode = createInsightNode(dependency); + node.children.push(dependencyNode); + }); + return node; + } + + // generates a tree for the given module by finding the insight among the given moduleInsights, + // and displays the insight div + function showModuleInsight(module, moduleInsights) { + var $insightDiv = $('#insight'); + $insightDiv.html(''); + $insightDiv.append($('<i> </i>').attr('id', 'dismissInsight').attr('title', 'Close')); + $insightDiv.append($('<h3>Insight for module </h3>').append(module)); + var $tree = $('<div>').addClass('insightTree'); + var insight = findInsight(moduleInsights, module); + var nodes = []; + $.each(insight, function(index, dependency) { + var dependencyNode = createInsightNode(dependency); + nodes.push(dependencyNode); + }); + $tree.append($('<img>').attr('src', 'throbber.gif')).append('Loading...'); + $tree.jstree({ + json_data : { + data : nodes + }, + themes : { + url : 'css/tree.css', + icons : false + }, + plugins : ['json_data', 'themes'] + }).bind("loaded.jstree", function (event, data) { + $('li.unresolvable a').attr('title', 'This dependency could not be resolved'); + $('li.alreadyRendered a').attr('title', 'The children of this dependency are not displayed because they have already been displayed before'); + }); + $insightDiv.append($tree); + $tree.on('click', 'a', function(event) { + event.preventDefault(); + }); + $insightDiv.fadeIn(); + } + + // generates the configuration dependeny trees + var $dependencies = $('#dependencies'); + var project = report.project; + + $dependencies.append($('<h2/>').text('Project ' + project.name)); + if (project.description) { + $dependencies.append($('<p>').addClass('projectDescription').text(project.name)); + } + + $.each(project.configurations, function(index, configuration) { + var $configurationDiv = $('<div/>').addClass('configuration'); + var $configurationTitle = $('<h3/>').addClass('closed').append($('<ins/>')).append(configuration.name); + if (configuration.description) { + $configurationTitle.append(' - ').append($('<span/>').addClass('configurationDescription').text(configuration.description)); + } + $configurationDiv.append($configurationTitle); + + var $contentDiv = $('<div/>').addClass('configurationContent').hide(); + var $tree = $('<div>').addClass('dependencyTree'); + $contentDiv.append($tree); + if (configuration.dependencies && configuration.dependencies.length > 0) { + var nodes = []; + $.each(configuration.dependencies, function(index, dependency) { + var dependencyNode = createDependencyNode(dependency); + nodes.push(dependencyNode); + }); + $tree.append($('<img>').attr('src', 'throbber.gif')).append('Loading...'); + $tree.jstree({ + json_data : { + data : nodes + }, + themes : { + url : 'css/tree.css', + icons : false + }, + plugins : ['json_data', 'themes'] + }).bind("loaded.jstree", function (event, data) { + $('li.unresolvable a').attr('title', 'This dependency could not be resolved'); + $('li.alreadyRendered a').attr('title', 'The children of this dependency are not displayed because they have already been displayed before'); + }); + } + else { + $tree.append($('<p/>').text("No dependency")); + } + + $tree.on('click', 'a', function(event) { + event.preventDefault(); + var module = $(this).closest('li').attr('data-module'); + showModuleInsight(module, configuration.moduleInsights); + }); + + $configurationDiv.append($contentDiv); + $dependencies.append($configurationDiv); + }); + + // allows the titles of each dependency tree to toggle the visibility of their tree + $dependencies.on('click', 'h3', function(event) { + $('div.configurationContent', $(this).parent()).slideToggle(); + $(this).toggleClass('closed'); + }); + + $('#projectBreacrumb').text(project.name); + populateFooter(report); + }); +} + +if (window.projectDependencyReport) { + initializeProjectPage(window.projectDependencyReport); +}
http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/blob/ff98fa34/nexus-ingest/dataset-tiler/build/reports/project/dependencies/root.html ---------------------------------------------------------------------- diff --git a/nexus-ingest/dataset-tiler/build/reports/project/dependencies/root.html b/nexus-ingest/dataset-tiler/build/reports/project/dependencies/root.html new file mode 100644 index 0000000..1b37948 --- /dev/null +++ b/nexus-ingest/dataset-tiler/build/reports/project/dependencies/root.html @@ -0,0 +1,40 @@ + +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> + <meta http-equiv="x-ua-compatible" content="IE=edge"/> + <link rel="stylesheet" type="text/css" href="css/base-style.css"/> + <link rel="stylesheet" type="text/css" href="css/style.css"/> + <script src="js/jquery.min-1.11.0.js" charset="utf-8"> + </script> + <script src="js/jquery.jstree.js" charset="utf-8"> + </script> + <script src="root.js" charset="utf-8"> + </script> + <script src="js/script.js" charset="utf-8"> + </script> + <title>Dependency reports + </title> + </head> + <body> + <div id="content"> + <h1>Dependency Report + </h1> + <div class="breadcrumbs"> + <a href="index.html">Projects + </a> > + <span id="projectBreacrumb"/> + </div> + <div id="insight"> + </div> + <div id="dependencies"> + </div> + <div id="footer"> + <p>Generated by + <a href="http://www.gradle.org">Gradle 2.12 + </a> at Sep 11, 2017 11:11:18 AM + </p> + </div> + </div> + </body> +</html> \ No newline at end of file
