import (
"net/http"
- common "gerrit.automotivelinux.org/gerrit/src/xds/xds-common.git/golib"
- "gerrit.automotivelinux.org/gerrit/src/xds/xds-server/lib/xsapiv1"
+ common "gerrit.automotivelinux.org/gerrit/src/xds/xds-common.git"
+ "gerrit.automotivelinux.org/gerrit/src/xds/xds-server.git/lib/xsapiv1"
"github.com/gin-gonic/gin"
)
return
}
+ // Retrieve session info
+ sess := s.sessions.Get(c)
+ if sess == nil {
+ common.APIError(c, "Unknown sessions")
+ return
+ }
+
s.Log.Debugln("Add target config: ", cfgArg)
- newTgt, err := s.targets.Add(cfgArg)
+ newTgt, err := s.targets.Add(cfgArg, sess)
if err != nil {
common.APIError(c, err.Error())
return
return
}
+ // Retrieve session info
+ sess := s.sessions.Get(c)
+ if sess == nil {
+ common.APIError(c, "Unknown sessions")
+ return
+ }
+
s.Log.Debugln("Delete target id ", id)
- delEntry, err := s.targets.Delete(id)
+ delEntry, err := s.targets.Delete(id, sess)
if err != nil {
common.APIError(c, err.Error())
return
common.APIError(c, "Unknown sessions")
return
}
- sock := sess.IOSocket
- if sock == nil {
- common.APIError(c, "Websocket not established")
- return
- }
- term, err := s.targets.OpenTerminal(id, tid, sock, sess.ID)
+ term, err := s.targets.OpenTerminal(id, tid, sess)
if err != nil {
common.APIError(c, err.Error())
return
common.APIError(c, err.Error())
return
}
- term, err := s.targets.CloseTerminal(id, tid)
+
+ // Retrieve session info
+ sess := s.sessions.Get(c)
+ if sess == nil {
+ common.APIError(c, "Unknown sessions")
+ return
+ }
+
+ term, err := s.targets.CloseTerminal(id, tid, sess)
if err != nil {
common.APIError(c, err.Error())
return
return
}
- term, err := s.targets.ResizeTerminal(id, tid, sizeArg.Cols, sizeArg.Rows)
+ // Retrieve session info
+ sess := s.sessions.Get(c)
+ if sess == nil {
+ common.APIError(c, "Unknown sessions")
+ return
+ }
+
+ term, err := s.targets.ResizeTerminal(id, tid, sizeArg.Cols, sizeArg.Rows, sess)
if err != nil {
common.APIError(c, err.Error())
return