Skip to content

Commit

Permalink
Root viewer (#177)
Browse files Browse the repository at this point in the history
* Add preflight check support in datasvc

* Implement iframe service for viewing .root files
  • Loading branch information
Mohitty authored and labkode committed Aug 8, 2019
1 parent a285c4f commit ffea664
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
3 changes: 3 additions & 0 deletions cmd/revad/svcs/httpsvcs/datasvc/datasvc.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ func (s *svc) Handler() http.Handler {
func (s *svc) setHandler() {
s.handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.Method {
case "HEAD":
w.WriteHeader(http.StatusOK)
return
case "GET":
s.doGet(w, r)
return
Expand Down
22 changes: 16 additions & 6 deletions cmd/revad/svcs/httpsvcs/iframeuisvc/iframeuisvc.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,28 @@ func getHandler() http.Handler {
}

func doOpen(w http.ResponseWriter, r *http.Request) {
filename := r.URL.Path
html := `
<!DOCTYPE html>
<html>
<body>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<h1>Markdown Editor</h1>
<h2>TODO</h2>
<script src="https://root.cern/js/latest/scripts/JSRootCore.min.js" type="text/javascript"></script>
<script type="text/javascript">
var filename = "http://localhost:9998/data` + filename + `";
JSROOT.OpenFile(filename, function(file) {
file.ReadObject("c1;1", function(obj) {
JSROOT.draw("drawing", obj, "colz");
});
});
</script>
</head>
<body>
<div id="drawing" style="width:800px; height:600px"></div>
</body>
<script type="text/javascript">
alert("hello!");
</script>
</html>
`
w.Write([]byte(html))
Expand Down

0 comments on commit ffea664

Please sign in to comment.