Add emitters for install started/stopped
This commit is contained in:
parent
f0d6f67c6b
commit
7f9ec4402a
|
@ -43,6 +43,8 @@ func (h *Handler) ListenForServerEvents(ctx context.Context) {
|
||||||
server.StatusEvent,
|
server.StatusEvent,
|
||||||
server.ConsoleOutputEvent,
|
server.ConsoleOutputEvent,
|
||||||
server.InstallOutputEvent,
|
server.InstallOutputEvent,
|
||||||
|
server.InstallStartedEvent,
|
||||||
|
server.InstallCompletedEvent,
|
||||||
server.DaemonMessageEvent,
|
server.DaemonMessageEvent,
|
||||||
server.BackupCompletedEvent,
|
server.BackupCompletedEvent,
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,12 +9,14 @@ import (
|
||||||
// Defines all of the possible output events for a server.
|
// Defines all of the possible output events for a server.
|
||||||
// noinspection GoNameStartsWithPackageName
|
// noinspection GoNameStartsWithPackageName
|
||||||
const (
|
const (
|
||||||
DaemonMessageEvent = "daemon message"
|
DaemonMessageEvent = "daemon message"
|
||||||
InstallOutputEvent = "install output"
|
InstallOutputEvent = "install output"
|
||||||
ConsoleOutputEvent = "console output"
|
InstallStartedEvent = "install started"
|
||||||
StatusEvent = "status"
|
InstallCompletedEvent = "install completed"
|
||||||
StatsEvent = "stats"
|
ConsoleOutputEvent = "console output"
|
||||||
BackupCompletedEvent = "backup completed"
|
StatusEvent = "status"
|
||||||
|
StatsEvent = "stats"
|
||||||
|
BackupCompletedEvent = "backup completed"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Event struct {
|
type Event struct {
|
||||||
|
|
|
@ -36,6 +36,9 @@ func (s *Server) Install(sync bool) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send the start event so the Panel can automatically update.
|
||||||
|
s.Events().Publish(InstallStartedEvent, "")
|
||||||
|
|
||||||
err := s.internalInstall()
|
err := s.internalInstall()
|
||||||
|
|
||||||
s.Log().Debug("notifying panel of server install state")
|
s.Log().Debug("notifying panel of server install state")
|
||||||
|
@ -52,6 +55,10 @@ func (s *Server) Install(sync bool) error {
|
||||||
l.Warn("failed to notify panel of server install state")
|
l.Warn("failed to notify panel of server install state")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Push an event to the websocket so we can auto-refresh the information in the panel once
|
||||||
|
// the install is completed.
|
||||||
|
s.Events().Publish(InstallCompletedEvent, "")
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user