updating dashboard template. a bit more resiliency for dashboard api
diff --git a/dashboard.js b/dashboard.js
index 0197ba9..83b8d4e 100644
--- a/dashboard.js
+++ b/dashboard.js
@@ -11,22 +11,53 @@
var boot_start = new Date().getTime();
// Different way of doing routes :P
+function not_found(res, msg) {
+ res.writeHead(404, {
+ "Content-Type":"application/json"
+ });
+ var json = {
+ error:true,
+ message:msg
+ };
+ res.write(JSON.stringify(json), 'utf-8');
+ res.end();
+}
function routeApi(resource) {
return function(req, res) {
- console.log('[HTTP] API request for ' + resource + '.');
- var queries = url.parse(req.url, true).query;
- res.writeHead(200, {
- "Content-Type":"application/json"
- });
- var json = api[resource];
- if (queries.platform) {
- json = json[queries.platform];
+ try {
+ console.log('[HTTP] API request for ' + resource + '.');
+ var queries = url.parse(req.url, true).query;
+ var json = api[resource];
+ if (queries.platform) {
+ json = json[queries.platform];
+ if (!json) {
+ not_found(res, 'platform "' + queries.platform + '" not found.');
+ return;
+ }
+ }
+ if (queries.sha) {
+ json = json[queries.sha];
+ if (!json) {
+ not_found(res, 'sha "' + queries.sha + '" on platform "' + queries.platform + '" not found.');
+ return;
+ }
+ }
+ res.writeHead(200, {
+ "Content-Type":"application/json"
+ });
+ res.write(JSON.stringify(json), 'utf-8');
+ res.end();
+ } catch(e) {
+ res.writeHead(500, {
+ "Content-Type":"application/json"
+ });
+ var json = {
+ error:true,
+ message:e.message
+ };
+ res.write(JSON.stringify(json), 'utf-8');
+ res.end();
}
- if (queries.sha) {
- json = json[queries.sha];
- }
- res.write(JSON.stringify(json), 'utf-8');
- res.end();
};
}
diff --git a/package.json b/package.json
index 6ca6ea0..b8b0279 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "medic",
- "version": "0.1.9",
+ "version": "0.1.10",
"description": "continuous integration setup for Apache Cordova",
"author": "Fil Maj <maj.fil@gmail.com> (http://filmaj.ca)",
"main": "dashboard.js",
diff --git a/src/dashboard/templates/css/medic.css b/src/dashboard/templates/css/medic.css
index 321a442..60fa9c0 100644
--- a/src/dashboard/templates/css/medic.css
+++ b/src/dashboard/templates/css/medic.css
@@ -26,8 +26,8 @@
background: url('/img/platforms.svg') 0 0 no-repeat;
}
td.pie_chart {
- height:180px;
- width:320px;
+ height:250px;
+ width:400px;
}
td.percentage img {
margin-top:5px;
diff --git a/src/dashboard/templates/index.html b/src/dashboard/templates/index.html
index bf946a2..642074e 100644
--- a/src/dashboard/templates/index.html
+++ b/src/dashboard/templates/index.html
@@ -14,7 +14,7 @@
<td>Platform</td>
<td>Last Commit</td>
<td>mobile-spec<br/>pass % avg.</td>
- <td>Devices tests run on</td>
+ <td>Device test breakdown (version & model)</td>
</tr>
</thead>
<tbody>
diff --git a/src/dashboard/templates/js/index.js b/src/dashboard/templates/js/index.js
index 89f7388..524552d 100644
--- a/src/dashboard/templates/js/index.js
+++ b/src/dashboard/templates/js/index.js
@@ -141,15 +141,17 @@
(this.point.events && this.point.events.click ? '<br/><i style="font-size:9px;">Hint: click to see failures</i>' : '');
}
},
- plotOptions:{pie:{shadow:false}},
+ plotOptions:{pie:{
+ shadow:false
+ }},
series:[{
name:'Versions',
data:versionData,
size:'60%',
dataLabels:{
- color:'white',
- distance:-30
- }
+ enabled:false
+ },
+ showInLegend:true
},{
name:'Models',
data:modelData,