From 34e91bfdf287cffe2034653b606e59da5345a349 Mon Sep 17 00:00:00 2001 From: Clark Laughlin Date: Fri, 15 May 2015 23:02:59 -0400 Subject: added more query handlers, more work on web ui --- web-app/server.go | 62 +++++++++++++++- web-app/static/index.html | 176 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 234 insertions(+), 4 deletions(-) (limited to 'web-app') 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 @@ -Hello, world! + + + + + + + + + + + + + + + + +

Linaro Openstack CI

+ +

+Linaro runs Openstack Tempest on arm64 on a nighty schedule. For more information on the hardware and test methodology, see https://wiki.linaro.org/OpenStack/OpenstackTempestCI. +

+

In the charts below, you can click on the data series labels in the chart legends to show/hide the series.

+
+
+ -- cgit v1.2.3