diff options
author | Clark Laughlin <clark.laughlin@linaro.org> | 2015-05-15 23:02:59 -0400 |
---|---|---|
committer | Clark Laughlin <clark.laughlin@linaro.org> | 2015-05-15 23:02:59 -0400 |
commit | 34e91bfdf287cffe2034653b606e59da5345a349 (patch) | |
tree | 66a97ced4cd74a87a65ac447fbaee5680a7bad6f /web-app | |
parent | 59aca11e4e75dac1e0edfa95fbb1662146ec0e23 (diff) |
added more query handlers, more work on web ui
Diffstat (limited to 'web-app')
-rw-r--r-- | web-app/server.go | 62 | ||||
-rw-r--r-- | web-app/static/index.html | 176 |
2 files changed, 234 insertions, 4 deletions
diff --git a/web-app/server.go b/web-app/server.go index efbff70..62e1842 100644 --- a/web-app/server.go +++ b/web-app/server.go @@ -260,7 +260,63 @@ func Results_Tempest_AllJobIds(w http.ResponseWriter, r *http.Request) { func Results_Tempest_OS(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, "URL: %s", r.URL.Path) + w.Header().Set("Content-Type", "application/json") + + count_param := mux.Vars(r)["count"] + count, err := strconv.Atoi(count_param) + if err != nil { + log.Println("error converting parameter from string to int: ", err) + } + + if count < 1 { + count = 1 + } + + if count > 60 { + count = 60 + } + + db, err := neoism.Connect(*neo4j_server) + if err != nil { + log.Println("error connecting to database: ", err) + } + + res := [] struct { + LAVA_Job int32 `json:"t.lava_job"` + Date string `json:"t.date"` + SHA1 string `json:"t.sha1"` + All_tests int32 `json:"t.all_tests"` + Passing_tests int32 `json:"t.passing_tests"` + Failing_tests int32 `json:"t.failing_tests"` + Tests_run int32 `json:"t.tests_run"` + Skipped_tests int32 `json:"t.skipped_tests"` + OS_Distro string `json:"o.distro"` + OS_Version string `json:"o.version"` + Devstack_Branch string `json:"d.name"` + Epoch_time int64 `json:"t.epoch_time"` + }{} + + cq := neoism.CypherQuery{ + Statement: `MATCH (d:Devstack)<-[:USING]-(t:TempestRun)-[:ON]->(o:OS) + WHERE o.distro = {osdistro} AND o.version = {osversion} + RETURN t.lava_job, t.date, t.sha1, t.all_tests, + t.passing_tests, t.failing_tests, t.tests_run, t.skipped_tests, + t.epoch_time, o.distro, o.version, d.name + ORDER BY t.epoch_time DESC + LIMIT {count}`, + Parameters: neoism.Props{"count": count, "osdistro": mux.Vars(r)["osdistro"], "osversion": mux.Vars(r)["osversion"]}, + Result: &res, + } + + err = db.Cypher(&cq) + if err != nil { + log.Println("query error: ", err) + } + + log.Printf("%#v", res) + + enc := json.NewEncoder(w) + enc.Encode(res) } @@ -379,8 +435,8 @@ func main() { s.HandleFunc("/tempest", Results_Tempest_LastN).Queries("count", "{count:[0-9]+}") // DONE s.HandleFunc("/tempest", Results_Tempest_Summary) // DONE s.HandleFunc("/tempest/jobs", Results_Tempest_AllJobIds) // DONE - s.HandleFunc("/tempest/operating-system/{os-distro}/{os-version}", Results_Tempest_OS).Queries("count", "{count:[0-9]+}") - s.HandleFunc("/tempest/operating-system/{os-distro}/{os-version}", Results_Tempest_OS_Summary) + s.HandleFunc("/tempest/operating-system/{osdistro}/{osversion}", Results_Tempest_OS).Queries("count", "{count:[0-9]+}") + s.HandleFunc("/tempest/operating-system/{osdistro}/{osversion}", Results_Tempest_OS_Summary) s.HandleFunc("/tempest/devstack-branch/{branch}", Results_Tempest_Branch).Queries("count", "{count:[0-9]+}") s.HandleFunc("/tempest/devstack-branch/{branch}", Results_Tempest_Branch_Summary) s.HandleFunc("/tempest/job/{job:[0-9]+}", Results_Tempest_Job_Summary) // DONE diff --git a/web-app/static/index.html b/web-app/static/index.html index d0a1030..3a88b88 100644 --- a/web-app/static/index.html +++ b/web-app/static/index.html @@ -1,3 +1,177 @@ <html> -<body>Hello, world!</body> +<head> + <link href='http://fonts.googleapis.com/css?family=Merriweather+Sans:400,700' rel='stylesheet' type='text/css'> + <link href='http://code.jquery.com/ui/1.11.4/themes/overcast/jquery-ui.css' rel='stylesheet' type='text/css'> + + <script type='text/javascript' src="http://code.jquery.com/jquery-2.1.4.min.js"></script> + <script type='text/javascript' src="http://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script> + <script type='text/javascript' src="http://canvasjs.com/assets/script/canvasjs.min.js"></script> + + <style> + h1,h2,h3 { font-family: ‘Merriweather Sans’, Arial, serif; font-weight: 700; } + BODY { font-family: ‘Merriweather Sans’, Arial, serif; font-weight: 400; } + </style> + +<script type="text/javascript"> +window.onload = function () { + + // ubuntu/trusty + $.getJSON( "/results/tempest/operating-system/ubuntu/trusty?count=60", function( data ) { + + var failureDataPoints = []; + var skippedDataPoints = []; + var passingDataPoints = []; + + $.each(data, function (index,value) { + if (value['t.all_tests'] > 0) { + failureDataPoints.unshift({label: value['t.lava_job'], y: value['t.failing_tests']}); + skippedDataPoints.unshift({label: value['t.lava_job'], y: value['t.skipped_tests']}); + passingDataPoints.unshift({label: value['t.lava_job'], y: value['t.passing_tests']}); + } + }); + + var chart = new CanvasJS.Chart("chartTrustyOverview", + { + title:{ + text: "Tempest Results For \"ubuntu/trusty\" (most recent 60)" + }, + legend: { + cursor: "pointer", + itemclick: function (e) { + //console.log("legend click: " + e.dataPointIndex); + //console.log(e); + if (typeof (e.dataSeries.visible) === "undefined" || e.dataSeries.visible) { + e.dataSeries.visible = false; + } else { + e.dataSeries.visible = true; + } + + e.chart.render(); + } + }, + axisX:{prefix: "Job " }, + toolTip:{ + content: function(e){ + var content; + content = e.entries[0].dataSeries.name + " <strong>"+e.entries[0].dataPoint.y ; + return content; + } + }, + animationEnabled: true, zoomEnabled: true, + data: [ + { + name: "Skipped Tests", showInLegend: true, + type: "stackedColumn", + color: "rgba(54,158,173,.7)", + dataPoints: skippedDataPoints + }, + { + name: "Failing Tests", showInLegend: true, + type: "stackedColumn", + color: "rgba(194,70,66,.7)", + dataPoints: failureDataPoints + }, + { + name: "Passing Tests", showInLegend: true, + type: "stackedColumn", + color: "rgba(54,200,30,.7)", + dataPoints: passingDataPoints + } + ] + }); + + chart.render(); + }); + + + + // ubuntu/vivid + $.getJSON( "/results/tempest/operating-system/ubuntu/vivid?count=60", function( data ) { + + var failureDataPoints = []; + var skippedDataPoints = []; + var passingDataPoints = []; + + $.each(data, function (index,value) { + if (value['t.all_tests'] > 0) { + failureDataPoints.unshift({label: value['t.lava_job'], y: value['t.failing_tests']}); + skippedDataPoints.unshift({label: value['t.lava_job'], y: value['t.skipped_tests']}); + passingDataPoints.unshift({label: value['t.lava_job'], y: value['t.passing_tests']}); + } + }); + + var chart = new CanvasJS.Chart("chartVividOverview", + { + title:{ + text: "Tempest Results For \"ubuntu/vivid\" (most recent 60)" + }, +legend: { + cursor: "pointer", + itemclick: function (e) { + //console.log("legend click: " + e.dataPointIndex); + //console.log(e); + if (typeof (e.dataSeries.visible) === "undefined" || e.dataSeries.visible) { + e.dataSeries.visible = false; + } else { + e.dataSeries.visible = true; + } + + e.chart.render(); + } + }, + axisX:{prefix: "Job " }, + toolTip:{ + content: function(e){ + var content; + content = e.entries[0].dataSeries.name + " <strong>"+e.entries[0].dataPoint.y ; + return content; + } + }, + animationEnabled: true, zoomEnabled: true, + data: [ + { + + click: function(e){ + alert( "dataSeries Event => Type: "+ e.dataSeries.type+ ", dataPoint { x:" + e.dataPoint.x + ", y: "+ e.dataPoint.y + " }" ); + }, + name: "Skipped Tests", showInLegend: true, + type: "stackedColumn", + color: "rgba(54,158,173,.7)", + dataPoints: skippedDataPoints + }, + { + name: "Failing Tests", showInLegend: true, + type: "stackedColumn", + color: "rgba(194,70,66,.7)", + dataPoints: failureDataPoints + }, + { + name: "Passing Tests", showInLegend: true, + type: "stackedColumn", + color: "rgba(54,200,30,.7)", + dataPoints: passingDataPoints + } + ] + }); + + chart.render(); + }); + + + } + </script> + + +</head> +<body> +<img src="http://www.linaro.org/app/images/linaro-logo-web.png"/> +<h1>Linaro Openstack CI</h1> + +<p> +Linaro runs Openstack Tempest on arm64 on a nighty schedule. For more information on the hardware and test methodology, see <a href="https://wiki.linaro.org/OpenStack/OpenstackTempestCI">https://wiki.linaro.org/OpenStack/OpenstackTempestCI</a>. +</p> +<p>In the charts below, you can click on the data series labels in the chart legends to show/hide the series.</p> +<div id="chartTrustyOverview" style="height: 450px; width: 90%;"></div> +<div id="chartVividOverview" style="height: 450px; width: 90%;"></div> +</body> </html> |