mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-02-21 02:33:34 +01:00
finishing up historytype and making remotes update
This commit is contained in:
parent
1a88d564bb
commit
d55bb8812b
@ -158,7 +158,12 @@ func HandleGetRemotes(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Vary", "Origin")
|
||||
w.Header().Set("Cache-Control", "no-cache")
|
||||
remotes := remote.GetAllRemoteRuntimeState()
|
||||
WriteJsonSuccess(w, remotes)
|
||||
ifarr := make([]interface{}, len(remotes))
|
||||
for idx, r := range remotes {
|
||||
ifarr[idx] = r
|
||||
}
|
||||
update := sstore.ModelUpdate{Remotes: ifarr}
|
||||
WriteJsonSuccess(w, update)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,7 @@ func init() {
|
||||
registerCmdAlias("remote", RemoteCommand)
|
||||
registerCmdFn("remote:show", RemoteShowCommand)
|
||||
registerCmdFn("remote:showall", RemoteShowAllCommand)
|
||||
registerCmdFn("remote:new", RemoteNewCommand)
|
||||
|
||||
registerCmdFn("history", HistoryCommand)
|
||||
}
|
||||
@ -360,6 +361,10 @@ func UnSetCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sstore
|
||||
return update, nil
|
||||
}
|
||||
|
||||
func RemoteNewCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sstore.UpdatePacket, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func RemoteShowCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sstore.UpdatePacket, error) {
|
||||
ids, err := resolveUiIds(ctx, pk, R_Session|R_Window|R_Remote)
|
||||
if err != nil {
|
||||
|
@ -273,7 +273,7 @@ func (proc *MShellProc) GetRemoteRuntimeState() RemoteRuntimeState {
|
||||
|
||||
func (msh *MShellProc) NotifyUpdate() {
|
||||
rstate := msh.GetRemoteRuntimeState()
|
||||
update := &sstore.ModelUpdate{Remote: rstate}
|
||||
update := &sstore.ModelUpdate{Remotes: []interface{}{rstate}}
|
||||
sstore.MainBus.SendUpdate("", update)
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ type ModelUpdate struct {
|
||||
Cmd *CmdType `json:"cmd,omitempty"`
|
||||
CmdLine *CmdLineType `json:"cmdline,omitempty"`
|
||||
Info *InfoMsgType `json:"info,omitempty"`
|
||||
Remote interface{} `json:"remote,omitempty"` // *remote.RemoteState
|
||||
Remotes []interface{} `json:"remotes,omitempty"` // []*remote.RemoteState
|
||||
History *HistoryInfoType `json:"history,omitempty"`
|
||||
}
|
||||
|
||||
@ -76,10 +76,11 @@ type InfoMsgType struct {
|
||||
}
|
||||
|
||||
type HistoryInfoType struct {
|
||||
SessionId string `json:"sessionid,omitempty"`
|
||||
WindowId string `json:"windowid,omitempty"`
|
||||
Items []*HistoryItemType `json:"items"`
|
||||
Show bool `json:"show"`
|
||||
HistoryType string `json:"historytype"`
|
||||
SessionId string `json:"sessionid,omitempty"`
|
||||
WindowId string `json:"windowid,omitempty"`
|
||||
Items []*HistoryItemType `json:"items"`
|
||||
Show bool `json:"show"`
|
||||
}
|
||||
|
||||
type CmdLineType struct {
|
||||
|
Loading…
Reference in New Issue
Block a user