Add per-task terminals over WebSocket with an xterm.js Terminal tab
This commit is contained in:
@@ -28,6 +28,7 @@ type Server struct {
|
||||
agents *agents.Manager
|
||||
notifier *push.Notifier
|
||||
hub *hub
|
||||
terminals *terminals
|
||||
startedAt time.Time
|
||||
spa fs.FS
|
||||
|
||||
@@ -45,6 +46,7 @@ func New(dataDir string, spa fs.FS) (*Server, error) {
|
||||
|
||||
s := &Server{
|
||||
hub: newHub(),
|
||||
terminals: newTerminals(),
|
||||
startedAt: time.Now().UTC(),
|
||||
spa: spa,
|
||||
users: map[string]string{},
|
||||
@@ -79,9 +81,13 @@ func (s *Server) publish(ev api.Event) {
|
||||
s.hub.publish(ev)
|
||||
s.notifier.Observe(ev)
|
||||
s.agents.Observe(ev)
|
||||
if (ev.Kind == "task.merged" || ev.Kind == "task.discarded") && ev.TaskId != nil {
|
||||
s.terminals.close(*ev.TaskId)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) Close() error {
|
||||
s.terminals.closeAll()
|
||||
s.agents.Close()
|
||||
s.notifier.Close()
|
||||
return s.store.Close()
|
||||
|
||||
Reference in New Issue
Block a user