Show connected nodes
This commit is contained in:
parent
c3f8bedea1
commit
dff17cad5b
7 changed files with 212 additions and 6 deletions
23
webserver.go
23
webserver.go
|
|
@ -38,6 +38,7 @@ func initWebserver() (err error) {
|
|||
http.HandleFunc("/nodes/update/{nodeID}", actionNodeUpdate)
|
||||
http.HandleFunc("/nodes/rename/{nodeID}", actionNodeRename)
|
||||
http.HandleFunc("/nodes/delete/{nodeID}", actionNodeDelete)
|
||||
http.HandleFunc("/nodes/connections/{nodeID}", actionNodeConnections)
|
||||
http.HandleFunc("/nodes/create", actionNodeCreate)
|
||||
http.HandleFunc("/nodes/move", actionNodeMove)
|
||||
http.HandleFunc("/types/{typeID}", actionType)
|
||||
|
|
@ -235,6 +236,28 @@ func actionNodeDelete(w http.ResponseWriter, r *http.Request) { // {{{
|
|||
j, _ := json.Marshal(out)
|
||||
w.Write(j)
|
||||
} // }}}
|
||||
func actionNodeConnections(w http.ResponseWriter, r *http.Request) { // {{{
|
||||
nodeID := 0
|
||||
nodeIDStr := r.PathValue("nodeID")
|
||||
nodeID, _ = strconv.Atoi(nodeIDStr)
|
||||
|
||||
nodes, err := GetNodeConnections(nodeID)
|
||||
if err != nil {
|
||||
err = werr.Wrap(err)
|
||||
httpError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
out := struct {
|
||||
OK bool
|
||||
Nodes []Node
|
||||
}{
|
||||
true,
|
||||
nodes,
|
||||
}
|
||||
j, _ := json.Marshal(out)
|
||||
w.Write(j)
|
||||
} // }}}
|
||||
func actionNodeMove(w http.ResponseWriter, r *http.Request) { // {{{
|
||||
var req struct {
|
||||
NewParentID int
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue