Merge branch 'gsoc18'
diff --git a/webapps/proteus-new/src/main/webapp/resources/src/components/auditsummarycomp.vue b/webapps/proteus-new/src/main/webapp/resources/src/components/auditsummarycomp.vue
index 4757b32..bee6ae0 100644
--- a/webapps/proteus-new/src/main/webapp/resources/src/components/auditsummarycomp.vue
+++ b/webapps/proteus-new/src/main/webapp/resources/src/components/auditsummarycomp.vue
@@ -53,211 +53,221 @@
var Archives = [];
var Notes = [];
+ var rowCount = 0;
axios.get(this.origin + '/solr/statistics/select?q=type:software&fl=license_*,id&sort=id+asc&wt=json')
- .then(response=>{
+ .then(response2=>{
+ rowCount = response2.data.response.numFound;
+ if(response2.data.response.numFound!=null){
+ axios.get(this.origin + '/solr/statistics/select?q=type:software&rows='+rowCount+'&fl=license_*,id&sort=id+asc&wt=json')
+ .then(response=>{
- var docs = response.data.response.docs;
-
- for(var i = 0; i < docs.length; i++) {
- var doc = docs[i];
- var repo = doc.id.split("/");
- var reponame = repo[repo.length - 1];
- if (reponame.indexOf("part") == 0)
- reponame = repo[repo.length - 2];
+ var docs = response.data.response.docs;
+
+ for(var i = 0; i < docs.length; i++) {
+ var doc = docs[i];
+ var repo = doc.id.split("/");
+ var reponame = repo[repo.length - 1];
+ if (reponame.indexOf("part") == 0)
+ reponame = repo[repo.length - 2];
- if (label_names[label_names.length - 1] == reponame) {
- Standards[Standards.length - 1] += doc["license_Standards"];
- Apache[Apache.length - 1] += doc["license_Apache"];
- Binaries[Binaries.length - 1] += doc["license_Binaries"];
- Generated[Generated.length - 1] += doc["license_Generated"];
- Unknown[Unknown.length - 1] += doc["license_Unknown"];
- Archives[Archives.length - 1] += doc["license_Archives"];
- Notes[Notes.length - 1] += doc["license_Notes"];
- continue;
- }
+ if (label_names[label_names.length - 1] == reponame) {
+ Standards[Standards.length - 1] += doc["license_Standards"];
+ Apache[Apache.length - 1] += doc["license_Apache"];
+ Binaries[Binaries.length - 1] += doc["license_Binaries"];
+ Generated[Generated.length - 1] += doc["license_Generated"];
+ Unknown[Unknown.length - 1] += doc["license_Unknown"];
+ Archives[Archives.length - 1] += doc["license_Archives"];
+ Notes[Notes.length - 1] += doc["license_Notes"];
+ continue;
+ }
- label_names.push(reponame);
- Standards.push(doc["license_Standards"]);
- Apache.push(doc["license_Apache"]);
- Binaries.push(doc["license_Binaries"]);
- Generated.push(doc["license_Generated"]);
- Unknown.push(doc["license_Unknown"]);
- Archives.push(doc["license_Archives"]);
- Notes.push(doc["license_Notes"]);
-
-
- }
-
-
-
- var data = {
- "labels": label_names,
- "series": [
- {
- label: 'Standards',
- values: Standards
- },
- {
- label: 'Apache',
- values: Apache
- },
- {
- label: 'Binaries',
- values: Binaries
- },
- {
- label: 'Generated',
- values: Generated
- },
- {
- label: 'Unknown',
- values: Unknown
- },
- {
- label: 'Archives',
- values: Archives
- },
- {
- label: 'Notes',
- values: Notes
- }]
- };
-
-
- var chartWidth = 600,
- barHeight = 25,
- groupHeight = barHeight * data.series.length,
- gapBetweenGroups = 25,
- spaceForLabels = 150,
- spaceForLegend = 150;
-
- // Zip the series data together (first values, second values, etc.)
- var zippedData = [];
- for (i=0; i<data.labels.length; i++) {
- for (var j=0; j<data.series.length; j++) {
- zippedData.push(data.series[j].values[i]);
+ label_names.push(reponame);
+ Standards.push(doc["license_Standards"]);
+ Apache.push(doc["license_Apache"]);
+ Binaries.push(doc["license_Binaries"]);
+ Generated.push(doc["license_Generated"]);
+ Unknown.push(doc["license_Unknown"]);
+ Archives.push(doc["license_Archives"]);
+ Notes.push(doc["license_Notes"]);
+
+
}
- }
-
- // Color scale
- var color = d3.scaleOrdinal(d3.schemeAccent);
- var mylabels = ["Standards", "Apache", "Binaries", "Generated", "Unknown", "Archives", "Notes"];
- var chartHeight = barHeight * zippedData.length + gapBetweenGroups * data.labels.length;
-
- var x = d3.scaleLinear()
- .domain([0, d3.max(zippedData)])
- .range([0, chartWidth]);
-
- var y = d3.scaleLinear()
- .range([chartHeight + gapBetweenGroups, 0]);
-
- var yAxis = d3.axisLeft(x)
- .tickFormat('')
- .tickSize(0);
-
- // Specify the chart area and dimensions
- var chart = d3.select("#hzBarChart")
- .attr("width", spaceForLabels + chartWidth + spaceForLegend)
- .attr("height", chartHeight);
-
- // Create bars
- var bar = chart.selectAll("g")
- .data(zippedData)
- .enter().append("g")
- .attr("transform", function(d, i) {
- return "translate(" + spaceForLabels + "," + (i * barHeight + gapBetweenGroups * (0.5 + Math.floor(i/data.series.length))) + ")";
- });
-
- // Create rectangles of the correct width
- bar.append("rect")
- .attr("style", function(d,i) { return "fill:"+color(i % data.series.length); })
- .attr("class", "bar")
- .attr("width", function(x){return x>0?x:0})
- .attr("height", barHeight - 1);
-
- bar.append('rect')
- .attr("x", function(d) {
- var xtoreturn = x(d);
- if(x(d) < 10) xtoreturn = x(d) + 10;
- else if(x(d) < 75) xtoreturn = x(d) - 77;
- else xtoreturn = x(d) - 83;
- if(xtoreturn<0) return 0;
- else return xtoreturn;
- })
- .attr("y", 7)
- .attr('width', 80)
- .attr('height', barHeight - 15)
- .attr('fill', 'white')
-
- // Add text label in bar
- bar.append("text")
- .attr("x", function(d) {
- var xtoreturn = x(d)
- if(x(d) < 80) xtoreturn = 5;
- else xtoreturn = x(d) - 63;
- if(xtoreturn<0) return 0;
- else return xtoreturn })
- .attr("y", (barHeight / 2)+1.5)
- .attr("style", function(d,i) { return "fill:"+color(i % data.series.length); })
- .attr("style", "font-size:.55em")
- .text(function(d, i) { return d + " " + mylabels[i % data.series.length]; });
-
-
- // Draw labels
- bar.append("text")
- .attr("class", "label")
- .attr("x", function(d,i) {
- console.log(d);
- var x = -groupHeight/2;
- if (i % data.series.length === 0)
- x-= (data.labels[Math.floor(i/data.series.length)].length)*3;
- return x; })
- .attr("y", -20)
- .attr("dy", ".35em")
- .attr("transform","rotate(-90)")
- .text(function(d,i) {
- if (i % data.series.length === 0)
- return data.labels[Math.floor(i/data.series.length)];
- else
- return ""});
-
- chart.append("g")
- .attr("class", "y axis")
- .attr("transform", "translate(" + spaceForLabels + ", " + -gapBetweenGroups/2 + ")")
- .call(yAxis);
-
- // Draw legend
- var legendRectSize = 18,
- legendSpacing = 4;
-
- var legend = chart.selectAll('.legend')
- .data(data.series)
- .enter()
- .append('g')
- .attr('transform', function (d, i) {
- var height = legendRectSize + legendSpacing;
- var offset = -gapBetweenGroups/2;
- var horz = spaceForLabels + chartWidth + 40 - legendRectSize;
- var vert = i * height - offset;
- return 'translate(' + 0+ ',' + vert + ')';
- });
-
- legend.append('rect')
- .attr('width', legendRectSize)
- .attr('height', legendRectSize)
- .style('fill', function (d, i) { return color(i); })
- .style('stroke', function (d, i) { return color(i); });
-
- legend.append('text')
- .attr('class', 'legend')
- .attr('x', legendRectSize + legendSpacing)
- .attr('y', legendRectSize - legendSpacing)
- .text(function (d) { return d.label; });
- });
+
+ var data = {
+ "labels": label_names,
+ "series": [
+ {
+ label: 'Standards',
+ values: Standards
+ },
+ {
+ label: 'Apache',
+ values: Apache
+ },
+ {
+ label: 'Binaries',
+ values: Binaries
+ },
+ {
+ label: 'Generated',
+ values: Generated
+ },
+ {
+ label: 'Unknown',
+ values: Unknown
+ },
+ {
+ label: 'Archives',
+ values: Archives
+ },
+ {
+ label: 'Notes',
+ values: Notes
+ }]
+ };
+
+
+ var chartWidth = 600,
+ barHeight = 25,
+ groupHeight = barHeight * data.series.length,
+ gapBetweenGroups = 25,
+ spaceForLabels = 150,
+ spaceForLegend = 150;
+
+ // Zip the series data together (first values, second values, etc.)
+ var zippedData = [];
+ for (i=0; i<data.labels.length; i++) {
+ for (var j=0; j<data.series.length; j++) {
+ zippedData.push(data.series[j].values[i]);
+ }
+ }
+
+ // Color scale
+ var color = d3.scaleOrdinal(d3.schemeAccent);
+ var mylabels = ["Standards", "Apache", "Binaries", "Generated", "Unknown", "Archives", "Notes"];
+ var chartHeight = barHeight * zippedData.length + gapBetweenGroups * data.labels.length;
+
+ var x = d3.scaleLinear()
+ .domain([0, d3.max(zippedData)])
+ .range([0, chartWidth]);
+
+ var y = d3.scaleLinear()
+ .range([chartHeight + gapBetweenGroups, 0]);
+
+ var yAxis = d3.axisLeft(x)
+ .tickFormat('')
+ .tickSize(0);
+
+ // Specify the chart area and dimensions
+ var chart = d3.select("#hzBarChart")
+ .attr("width", spaceForLabels + chartWidth + spaceForLegend)
+ .attr("height", chartHeight);
+
+ // Create bars
+ var bar = chart.selectAll("g")
+ .data(zippedData)
+ .enter().append("g")
+ .attr("transform", function(d, i) {
+ return "translate(" + spaceForLabels + "," + (i * barHeight + gapBetweenGroups * (0.5 + Math.floor(i/data.series.length))) + ")";
+ });
+
+ // Create rectangles of the correct width
+ bar.append("rect")
+ .attr("style", function(d,i) { return "fill:"+color(i % data.series.length); })
+ .attr("class", "bar")
+ .attr("width", function(x){return x>0?x:0})
+ .attr("height", barHeight - 1);
+
+ bar.append('rect')
+ .attr("x", function(d) {
+ var xtoreturn = x(d);
+ if(x(d) < 10) xtoreturn = x(d) + 10;
+ else if(x(d) < 75) xtoreturn = x(d) - 77;
+ else xtoreturn = x(d) - 83;
+ if(xtoreturn<0) return 0;
+ else return xtoreturn;
+ })
+ .attr("y", 7)
+ .attr('width', 80)
+ .attr('height', barHeight - 15)
+ .attr('fill', 'white')
+
+ // Add text label in bar
+ bar.append("text")
+ .attr("x", function(d) {
+ var xtoreturn = x(d)
+ if(x(d) < 80) xtoreturn = 5;
+ else xtoreturn = x(d) - 63;
+ if(xtoreturn<0) return 0;
+ else return xtoreturn })
+ .attr("y", (barHeight / 2)+1.5)
+ .attr("style", function(d,i) { return "fill:"+color(i % data.series.length); })
+ .attr("style", "font-size:.55em")
+ .text(function(d, i) { return d + " " + mylabels[i % data.series.length]; });
+
+
+ // Draw labels
+ bar.append("text")
+ .attr("class", "label")
+ .attr("x", function(d,i) {
+ console.log(d);
+ var x = -groupHeight/2;
+ if (i % data.series.length === 0)
+ x-= (data.labels[Math.floor(i/data.series.length)].length)*3;
+ return x; })
+ .attr("y", -20)
+ .attr("dy", ".35em")
+ .attr("transform","rotate(-90)")
+ .text(function(d,i) {
+ if (i % data.series.length === 0)
+ return data.labels[Math.floor(i/data.series.length)];
+ else
+ return ""});
+
+ chart.append("g")
+ .attr("class", "y axis")
+ .attr("transform", "translate(" + spaceForLabels + ", " + -gapBetweenGroups/2 + ")")
+ .call(yAxis);
+
+ // Draw legend
+ var legendRectSize = 18,
+ legendSpacing = 4;
+
+ var legend = chart.selectAll('.legend')
+ .data(data.series)
+ .enter()
+ .append('g')
+ .attr('transform', function (d, i) {
+ var height = legendRectSize + legendSpacing;
+ var offset = -gapBetweenGroups/2;
+ var horz = spaceForLabels + chartWidth + 40 - legendRectSize;
+ var vert = i * height - offset;
+ return 'translate(' + 0+ ',' + vert + ')';
+ });
+
+ legend.append('rect')
+ .attr('width', legendRectSize)
+ .attr('height', legendRectSize)
+ .style('fill', function (d, i) { return color(i); })
+ .style('stroke', function (d, i) { return color(i); });
+
+ legend.append('text')
+ .attr('class', 'legend')
+ .attr('x', legendRectSize + legendSpacing)
+ .attr('y', legendRectSize - legendSpacing)
+ .text(function (d) { return d.label; });
+
+
+ });
+ }
+
+ });
+
+
}
},
diff --git a/webapps/proteus-new/src/main/webapp/resources/src/components/bublechartcomp.vue b/webapps/proteus-new/src/main/webapp/resources/src/components/bublechartcomp.vue
index 7c3527a..95766ab 100644
--- a/webapps/proteus-new/src/main/webapp/resources/src/components/bublechartcomp.vue
+++ b/webapps/proteus-new/src/main/webapp/resources/src/components/bublechartcomp.vue
@@ -69,84 +69,93 @@
.attr("height", diameter)
.attr("class", "bubble");
+
axios.get(this.origin + '/solr/statistics/select?q=type:software&fl=mime_*&wt=json')
- .then(response=>{
-
-
- var docs = response.data.response.docs;
- var resultingData = [];
- var mime = {};
-
- for(var i = 0; i < docs.length; i++) {
- var doc = docs[i];
- for(var x in doc) {
- var key = x.split("mime_")[1];
- var value = doc[x];
- if(typeof mime[key] === 'undefined') {
- mime[key] = value;
- }
- else {
- mime[key] += value;
- }
- }
- }
-
-
- for(x in mime) {
- var obj = {};
- var jsonObject = {};
- var child = [];
- obj["name"] = x;
- jsonObject["name"] = x;
-
- jsonObject["size"] = mime[x];
- child.push(jsonObject);
- obj["children"] = child;
- resultingData.push(obj);
- }
-
-
-
- var test = {}
- test["name"] = "flare"
- test["children"] = resultingData
-
- var range = d3.schemeBrBG[11];
- range = range.concat(d3.schemePRGn[11]);
-
- color = d3.scaleOrdinal(range);
-
- var root = d3.hierarchy(classes(test))
- .sum(function(d){
- return d.value;
- })
+ .then(response2=>{
+ if(response2.data.response.numFound!=null){
+ axios.get(this.origin + '/solr/statistics/select?q=type:software&rows='+response2.data.response.numFound+'&fl=mime_*&wt=json')
+ .then(response=>{
- bubble(root);
+ var docs = response.data.response.docs;
+ var resultingData = [];
+ var mime = {};
- var node = svg.selectAll(".node")
- .data(root.children)
+ for(var i = 0; i < docs.length; i++) {
+ var doc = docs[i];
+ for(var x in doc) {
+ var key = x.split("mime_")[1];
+ var value = doc[x];
+ if(typeof mime[key] === 'undefined') {
+ mime[key] = value;
+ }
+ else {
+ mime[key] += value;
+ }
+ }
+ }
+
- .enter().append("g")
- .attr("class", "node")
- .attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
+ for(x in mime) {
+ var obj = {};
+ var jsonObject = {};
+ var child = [];
+ obj["name"] = x;
+ jsonObject["name"] = x;
+
+ jsonObject["size"] = mime[x];
+ child.push(jsonObject);
+ obj["children"] = child;
+ resultingData.push(obj);
+ }
- node.append("title")
- .text(function(d) {
- return d.data.className + ": " + format(d.value);
- });
+
- node.append("circle")
- .attr("r", function(d) { return d.r; })
- .attr("style",function(d){
+ var test = {}
+ test["name"] = "flare"
+ test["children"] = resultingData
+
+ var range = d3.schemeBrBG[11];
+ range = range.concat(d3.schemePRGn[11]);
+
+ color = d3.scaleOrdinal(range);
+
+ var root = d3.hierarchy(classes(test))
+ .sum(function(d){
+ return d.value;
+ })
+
+
+ bubble(root);
+
+ var node = svg.selectAll(".node")
+ .data(root.children)
- return "fill:"+color(d.data.className);});
+ .enter().append("g")
+ .attr("class", "node")
+ .attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
- node.append("text")
- .attr("dy", ".3em")
- .style("text-anchor", "middle")
- .text(function(d) { return d.data.className.substring(0, d.r / 3); });
- });
+ node.append("title")
+ .text(function(d) {
+ return d.data.className + ": " + format(d.value);
+ });
+
+ node.append("circle")
+ .attr("r", function(d) { return d.r; })
+ .attr("style",function(d){
+
+ return "fill:"+color(d.data.className);});
+
+ node.append("text")
+ .attr("dy", ".3em")
+ .style("text-anchor", "middle")
+ .text(function(d) { return d.data.className.substring(0, d.r / 3); });
+ });
+ }
+
+ });
+
+
// Returns a flattened hierarchy containing all leaf nodes under the root.
function classes(root) {
diff --git a/webapps/proteus-new/src/main/webapp/resources/src/components/licensepiecomp.vue b/webapps/proteus-new/src/main/webapp/resources/src/components/licensepiecomp.vue
index 1b42df5..7b6f078 100644
--- a/webapps/proteus-new/src/main/webapp/resources/src/components/licensepiecomp.vue
+++ b/webapps/proteus-new/src/main/webapp/resources/src/components/licensepiecomp.vue
@@ -45,101 +45,108 @@
},
methods: {
init(){
- axios.get(this.origin + '/solr/statistics/select?q=type:software&fl=license_*&wt=json')
- .then(function(response) {
+ axios.get(this.origin + '/solr/statistics/select?q=type:software&fl=license_*&wt=json')
+ .then(response2=>{
+ if(response2.data.response.numFound!=null){
+ axios.get(this.origin + '/solr/statistics/select?q=type:software&rows='+response2.data.response.numFound+'&fl=license_*&wt=json')
+ .then(function(response) {
- console.log(response.data);
- var docs = response.data.response.docs;
- var resultingData = [];
- var result = [];
- var license = {};
+ console.log(response.data);
+ var docs = response.data.response.docs;
+ var resultingData = [];
+ var result = [];
+ var license = {};
- for(var i = 0; i < docs.length; i++) {
- var doc = docs[i];
- for(var x in doc) {
- var key = x.split("license_")[1];
- var value = doc[x];
- if(typeof license[key] === 'undefined') {
- license[key] = value;
- }
- else {
- license[key] += value;
- }
- }
+ for(var i = 0; i < docs.length; i++) {
+ var doc = docs[i];
+ for(var x in doc) {
+ var key = x.split("license_")[1];
+ var value = doc[x];
+ if(typeof license[key] === 'undefined') {
+ license[key] = value;
+ }
+ else {
+ license[key] += value;
+ }
+ }
+ }
+
+ for(x in license) {
+ var jsonObject = {};
+ jsonObject["key"] = x;
+ jsonObject["y"] = license[x];
+ resultingData.push(jsonObject);
+ }
+
+ resultingData.sort(function(a, b) {
+ return b.y - a.y;
+ });
+
+ for( i = 0; i < resultingData.length; i++) {
+ if(resultingData[i]["y"] == 0)
+ break;
+ result[i] = resultingData[i];
+ }
+
+ var svg = d3.select("#pielicensesvg"),
+ width = +svg.attr("width"),
+ height = +svg.attr("height"),
+ radius = Math.min(width, height) / 2,
+ g = svg.append("g").attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
+
+ var color = d3.scaleOrdinal(d3.schemeSet3);
+
+ var pie = d3.pie()
+ .sort(null)
+ .value(function(d) { return d.y; });
+
+ var path = d3.arc()
+ .outerRadius(radius - 10)
+ .innerRadius(0);
+
+ var label = d3.arc()
+ .outerRadius(radius - 40)
+ .innerRadius(radius - 40);
+ var arc = g.selectAll(".arc")
+ .data(pie(result))
+ .enter().append("g")
+ .attr("class", "arc");
+
+ arc.append("path")
+ .attr("d", path)
+ .attr("style", function(d) { return "fill:"+color(d.data.key) });
+
+ arc.append("text")
+ .attr("transform", function(d) { return "translate(" + label.centroid(d) + ")"; })
+ .attr("dy", "0.35em")
+ .text(function(d) { return d.data.key; });
+
+ var legend = d3.select("#pielicensesvg").append("svg")
+ .attr("class", "legend")
+ .selectAll("g")
+ .data(pie(result))//setting the data as we know there are only two set of data[programmar/tester] as per the nest function you have written
+ .enter().append("g")
+ .attr("transform", function(d, i) { return "translate(0," + ((i + 1)* 20) + ")"; });
+
+ legend.append("rect")
+ .attr("width", 18)
+ .attr("height", 18)
+ .style("fill", function(d, i) {
+ return color(d.data.key);
+ });
+
+ legend.append("text")
+ .attr("x", 24)
+ .attr("y", 9)
+ .attr("dy", ".35em")
+ .text(function(d) { return d.data.key; });
+
+ console.log(result);
+ });
}
-
- for(x in license) {
- var jsonObject = {};
- jsonObject["key"] = x;
- jsonObject["y"] = license[x];
- resultingData.push(jsonObject);
- }
-
- resultingData.sort(function(a, b) {
- return b.y - a.y;
- });
-
- for( i = 0; i < resultingData.length; i++) {
- if(resultingData[i]["y"] == 0)
- break;
- result[i] = resultingData[i];
- }
-
- var svg = d3.select("#pielicensesvg"),
- width = +svg.attr("width"),
- height = +svg.attr("height"),
- radius = Math.min(width, height) / 2,
- g = svg.append("g").attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");
-
- var color = d3.scaleOrdinal(d3.schemeSet3);
-
- var pie = d3.pie()
- .sort(null)
- .value(function(d) { return d.y; });
-
- var path = d3.arc()
- .outerRadius(radius - 10)
- .innerRadius(0);
-
- var label = d3.arc()
- .outerRadius(radius - 40)
- .innerRadius(radius - 40);
- var arc = g.selectAll(".arc")
- .data(pie(result))
- .enter().append("g")
- .attr("class", "arc");
-
- arc.append("path")
- .attr("d", path)
- .attr("style", function(d) { return "fill:"+color(d.data.key) });
-
- arc.append("text")
- .attr("transform", function(d) { return "translate(" + label.centroid(d) + ")"; })
- .attr("dy", "0.35em")
- .text(function(d) { return d.data.key; });
-
- var legend = d3.select("#pielicensesvg").append("svg")
- .attr("class", "legend")
- .selectAll("g")
- .data(pie(result))//setting the data as we know there are only two set of data[programmar/tester] as per the nest function you have written
- .enter().append("g")
- .attr("transform", function(d, i) { return "translate(0," + ((i + 1)* 20) + ")"; });
-
- legend.append("rect")
- .attr("width", 18)
- .attr("height", 18)
- .style("fill", function(d, i) {
- return color(d.data.key);
- });
-
- legend.append("text")
- .attr("x", 24)
- .attr("y", 9)
- .attr("dy", ".35em")
- .text(function(d) { return d.data.key; });
-
- console.log(result);
+
});
+
}
},
computed: {
diff --git a/webapps/proteus-new/src/main/webapp/resources/src/components/projectstable.vue b/webapps/proteus-new/src/main/webapp/resources/src/components/projectstable.vue
index a44316d..98cb216 100644
--- a/webapps/proteus-new/src/main/webapp/resources/src/components/projectstable.vue
+++ b/webapps/proteus-new/src/main/webapp/resources/src/components/projectstable.vue
@@ -287,8 +287,8 @@
this.docs=response.data.response.docs;
this.count.numFound = response.data.response.numFound;
this.count.start = response.data.response.start;
- if(response.data.response.numFound>10){
- axios.get(this.origin+"/solr/statistics/select?q=type:project&&rows="+this.count.numFound+"&wt=json")
+ if(response.data.response.numFound != null && response.data.response.numFound>10){
+ axios.get(this.origin+"/solr/statistics/select?q=type:project&rows="+this.count.numFound+"&wt=json")
.then(response=>{
this.docs=response.data.response.docs;
this.count.numFound = response.data.response.numFound;
@@ -307,16 +307,27 @@
},
loadLicenseData(){
axios.get(this.origin+"/solr/statistics/select?q=id:\""+this.selectedItem.repo+"\"&fl=license_*&wt=json")
- .then(response=>{
- this.$log.info(response.data);
- this.license.docs=response.data.response.docs[0];
+ .then(response2=>{
+ if(response2.response.data.numFound!=null){
+ axios.get(this.origin+"/solr/statistics/select?q=id:\""+this.selectedItem.repo+"\"&fl=license_*&rows="+response2.data.response.numFound+"&wt=json")
+ .then(response=>{
+ this.$log.info(response.data);
+ this.license.docs=response.data.response.docs[0];
+ });
+ }
+
+
})
},
loadFileDetails(){
axios.get(this.origin+"/solr/statistics/select?q=parent:\""+this.selectedItem.repo+"\"&rows=5000&wt=json")
- .then(response=>{
- this.sortedfiles = response.data.response.docs;
- })
+ .then(response2=>{
+ axios.get(this.origin+"/solr/statistics/select?q=parent:\""+this.selectedItem.repo+"\"&rows="+response2.data.response.numFound+"&wt=json")
+ .then(response=>{
+ this.sortedfiles = response.data.response.docs;
+ });
+ });
+
}
},
diff --git a/webapps/proteus-new/src/main/webapp/resources/src/components/topmimepiecomp.vue b/webapps/proteus-new/src/main/webapp/resources/src/components/topmimepiecomp.vue
index 0aed447..ea15f77 100644
--- a/webapps/proteus-new/src/main/webapp/resources/src/components/topmimepiecomp.vue
+++ b/webapps/proteus-new/src/main/webapp/resources/src/components/topmimepiecomp.vue
@@ -64,103 +64,110 @@
methods: {
init(rows){
axios.get(this.origin + '/solr/statistics/select?q=type:software&fl=mime_*&wt=json')
- .then(function(response) {
+ .then(response2=>{
+ if(response2.data.response.numFound!=null){
+ axios.get(this.origin + '/solr/statistics/select?q=type:software&rows='+response2.data.response.numFound+'&fl=mime_*&wt=json')
+ .then(function(response) {
+
+ console.log(response.data);
+ var docs = response.data.response.docs;
+ var resultingData = [];
+ var result = [];
+ var mime = {};
+
+ for(var i = 0; i < docs.length; i++) {
+ var doc = docs[i];
+ for(var x in doc) {
+ var key = x.split("mime_")[1];
+ var value = doc[x];
+ if(typeof mime[key] === 'undefined') {
+ mime[key] = value;
+ }
+ else {
+ mime[key] += value;
+ }
+ }
+ }
+
+ for(x in mime) {
+ var jsonObject = {};
+ jsonObject["key"] = x;
+ jsonObject["y"] = mime[x];
+ resultingData.push(jsonObject);
+ }
+
+ resultingData.sort(function(a, b) {
+ return b.y - a.y;
+ });
+ if(rows > resultingData.length)rows=resultingData.length;
+ for( i = 1; i <= rows; i++) {
+ result[i-1] = resultingData[i-1];
+ }
+
+ console.log(result);
+
+ var svg = d3.select("#pietopmimesvg");
+ svg.selectAll("*").remove();
+ var width = +svg.attr("width"),
+ height = +svg.attr("height"),
+ radius = Math.min(width, height) / 4,
+ pieposx = (width / 2)+90,
+ pieposy = (height / 2)-140,
+ g = svg.append("g").attr("transform", "translate(" +pieposx + "," +pieposy + ")");
+
+ var color = d3.scaleOrdinal(d3.schemePiYG[11]);
+
+ var pie = d3.pie()
+ .sort(null)
+ .value(function(d) { return d.y; });
+
+ var path = d3.arc()
+ .outerRadius(radius - 10)
+ .innerRadius(0);
+
+ var label = d3.arc()
+ .outerRadius(radius - 40)
+ .innerRadius(radius - 40);
+ var arc = g.selectAll(".arc")
+ .data(pie(result))
+ .enter().append("g")
+ .attr("class", "arc");
+
+ arc.append("path")
+ .attr("d", path)
+ .attr("style", function(d) { return "fill:"+color(d.data.key) });
+
+ arc.append("text")
+ .attr("transform", function(d) { return "translate(" + label.centroid(d) + ")"; })
+ .attr("dy", "0.35em")
+ .text(function(d) { return d.data.key; });
+
+ var legend = d3.select("#pietopmimesvg").append("svg")
+ .attr("class", "legend")
+ .selectAll("g")
+ .data(pie(result))//setting the data as we know there are only two set of data[programmar/tester] as per the nest function you have written
+ .enter().append("g")
+ .attr("transform", function(d, i) { return "translate(0," + ((i + 1)* 20) + ")"; });
+
+ legend.append("rect")
+ .attr("width", 18)
+ .attr("height", 18)
+ .style("fill", function(d, i) {
+ return color(d.data.key);
+ });
+
+ legend.append("text")
+ .attr("x", 24)
+ .attr("y", 9)
+ .attr("dy", ".35em")
+ .text(function(d) { return d.data.key; });
+
+ console.log(result);
+ });
+ }
+
+ });
- console.log(response.data);
- var docs = response.data.response.docs;
- var resultingData = [];
- var result = [];
- var mime = {};
-
- for(var i = 0; i < docs.length; i++) {
- var doc = docs[i];
- for(var x in doc) {
- var key = x.split("mime_")[1];
- var value = doc[x];
- if(typeof mime[key] === 'undefined') {
- mime[key] = value;
- }
- else {
- mime[key] += value;
- }
- }
- }
-
- for(x in mime) {
- var jsonObject = {};
- jsonObject["key"] = x;
- jsonObject["y"] = mime[x];
- resultingData.push(jsonObject);
- }
-
- resultingData.sort(function(a, b) {
- return b.y - a.y;
- });
- if(rows > resultingData.length)rows=resultingData.length;
- for( i = 1; i <= rows; i++) {
- result[i-1] = resultingData[i-1];
- }
-
- console.log(result);
-
- var svg = d3.select("#pietopmimesvg");
- svg.selectAll("*").remove();
- var width = +svg.attr("width"),
- height = +svg.attr("height"),
- radius = Math.min(width, height) / 4,
- pieposx = (width / 2)+90,
- pieposy = (height / 2)-140,
- g = svg.append("g").attr("transform", "translate(" +pieposx + "," +pieposy + ")");
-
- var color = d3.scaleOrdinal(d3.schemePiYG[11]);
-
- var pie = d3.pie()
- .sort(null)
- .value(function(d) { return d.y; });
-
- var path = d3.arc()
- .outerRadius(radius - 10)
- .innerRadius(0);
-
- var label = d3.arc()
- .outerRadius(radius - 40)
- .innerRadius(radius - 40);
- var arc = g.selectAll(".arc")
- .data(pie(result))
- .enter().append("g")
- .attr("class", "arc");
-
- arc.append("path")
- .attr("d", path)
- .attr("style", function(d) { return "fill:"+color(d.data.key) });
-
- arc.append("text")
- .attr("transform", function(d) { return "translate(" + label.centroid(d) + ")"; })
- .attr("dy", "0.35em")
- .text(function(d) { return d.data.key; });
-
- var legend = d3.select("#pietopmimesvg").append("svg")
- .attr("class", "legend")
- .selectAll("g")
- .data(pie(result))//setting the data as we know there are only two set of data[programmar/tester] as per the nest function you have written
- .enter().append("g")
- .attr("transform", function(d, i) { return "translate(0," + ((i + 1)* 20) + ")"; });
-
- legend.append("rect")
- .attr("width", 18)
- .attr("height", 18)
- .style("fill", function(d, i) {
- return color(d.data.key);
- });
-
- legend.append("text")
- .attr("x", 24)
- .attr("y", 9)
- .attr("dy", ".35em")
- .text(function(d) { return d.data.key; });
-
- console.log(result);
- });
}
},
computed: {