forked from Kitware/CDash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewSubprojectDependenciesGraph.xsl
180 lines (167 loc) · 6.48 KB
/
viewSubprojectDependenciesGraph.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<xsl:include href="header.xsl"/>
<xsl:include href="footer.xsl"/>
<!-- Local includes -->
<xsl:include href="local/footer.xsl"/>
<xsl:include href="local/header.xsl"/>
<xsl:output method="xml" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
<xsl:template match="/">
<html>
<head>
<title><xsl:value-of select="cdash/title"/></title>
<meta name="robots" content="noindex,nofollow" />
<link rel="StyleSheet" type="text/css">
<xsl:attribute name="href"><xsl:value-of select="cdash/cssfile"/></xsl:attribute>
</link>
<link href='//fonts.googleapis.com/css?family=Open+Sans:400,700|Roboto:400,700' rel='stylesheet' type='text/css'/>
<link href='css/d3.dependencyedgebundling.css' rel='stylesheet' type='text/css'/>
<xsl:call-template name="headscripts"/>
<script type="text/javascript" src="javascript/d3.min.js"></script>
<script type="text/javascript" src="javascript/d3.dependencyedgebundling.js"></script>
<script>
var projname = "<xsl:value-of select="cdash/dashboard/projectname"/>";
</script>
<xsl:text disable-output-escaping="yes">
<script>
var chart = d3.chart.dependencyedgebundling();
chart.mouseOvered(mouseOvered).mouseOuted(mouseOuted);
var dataroot;
function sort_by_name (a, b) {
if (a.name < b.name) {
return -1;
}
if (a.name > b.name) {
return 1;
}
return 0;
}
function sort_by_id (a, b) {
if (a.id < b.id) {
return -1;
}
if (a.id > b.id) {
return 1;
}
return 0;
}
function mouseOvered(d) {
var header1Text = "Name: " + d.key + ", Group: " + d.group;
$('#header1').html(header1Text);
if (d.depends) {
var depends = "<p>Depends: ";
depends += d.depends.join(", ") + "</p>";
$('#dependency').html(depends);
}
var dependents = "";
d3.selectAll('.node--source').each(function (p) {
if (p.key) {
dependents += p.key + ", ";
}
});
if (dependents) {
dependents = "Dependents: " + dependents.substring(0,dependents.length-2);
$('#dependents').html(dependents);
}
d3.select("#toolTip").style("left", (d3.event.pageX + 40) + "px")
.style("top", (d3.event.pageY + 5) + "px")
.style("opacity", ".9");
}
function mouseOuted(d) {
$('#header1').text("");
$('#dependents').text("");
$('#dependency').text("");
d3.select("#toolTip").style("opacity", "0");
}
function resetDepView() {
d3.select('#chart_placeholder svg').remove();
d3.select('#chart_placeholder')
.datum(dataroot)
.call(chart);
}
$(function(){
$('#selectedsort').on("change", function(e) {
selected = $(this).val();
if (parseInt(selected) === 1) {
dataroot.sort(sort_by_id);
} else if (parseInt(selected) === 0) {
dataroot.sort(sort_by_name);
}
resetDepView(dataroot);
});
var rooturl = location.host;
var ajaxlink = "ajax/getsubprojectdependencies.php?project=" + projname;
d3.json(ajaxlink, function(error, classes) {
if (error){
errormsg = "json error " + error + " data: " + classes;
console.log(errormsg);
document.write(errormsg);
return;
}
dataroot = classes;
dataroot.sort(sort_by_name);
resetDepView(dataroot);
});
});
</script>
</xsl:text>
</head>
<body bgcolor="#ffffff">
<xsl:choose>
<xsl:when test="/cdash/uselocaldirectory=1">
<xsl:call-template name="header_local"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="header"/>
</xsl:otherwise>
</xsl:choose>
<!-- Main -->
<div style="position:relative; top:10px; left:20px; overflow:hidden;">
<label style="font-size:1.2em;"><b>Subproject Dependencies Graph</b></label>
<label for="selectedsort" style="margin-left:80px; font-size:.95em;">Sorted by:</label>
<select id="selectedsort">
<option value="0" selected="selected">subproject name</option>
<option value="1">subproject id</option>
</select>
<button onclick="download_svg()" style="float:right; width:200px; margin-right:30px">Export as svg file</button>
</div>
<div class='hint' style="position:relative; top:20px; left:20px; font-size:0.9em; width:350px; color:#999;">
This circle plot captures the interrelationships among subgroups. Mouse over any of the subgroup in this graph to see incoming links (dependents) in green and the outgoing links (dependencies) in red.
</div>
<div id="chart_placeholder" style="position:relative; left:150px; top:-60px">
</div>
<!-- Tooltip -->
<div id="toolTip" class="tooltip" style="opacity:0;">
<div id="header1" class="header"></div>
<div id="dependency" style="color:#d62728;"></div>
<div id="dependents" style="color:#2ca02c;"></div>
<div class="tooltipTail"></div>
</div>
<script>
function download_svg() {
var e = document.createElement('script');
if (window.location.protocol === 'https:') {
e.setAttribute('src', 'https://rawgit.com/NYTimes/svg-crowbar/gh-pages/svg-crowbar.js');
}
else {
e.setAttribute('src', 'http://nytimes.github.com/svg-crowbar/svg-crowbar.js');
}
e.setAttribute('class', 'svg-crowbar');
document.body.appendChild(e);
}
</script>
<!-- FOOTER -->
<br/>
<xsl:choose>
<xsl:when test="/cdash/uselocaldirectory=1">
<xsl:call-template name="footer_local"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="footer"/>
</xsl:otherwise>
</xsl:choose>
</body>
</html>
</xsl:template>
</xsl:stylesheet>