mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
bug fixes
This commit is contained in:
@@ -534,6 +534,7 @@ func ScreenSetCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (ss
|
|||||||
if focusVal != sstore.ScreenFocusInput && focusVal != sstore.ScreenFocusCmd && focusVal != sstore.ScreenFocusCmdFg {
|
if focusVal != sstore.ScreenFocusInput && focusVal != sstore.ScreenFocusCmd && focusVal != sstore.ScreenFocusCmdFg {
|
||||||
return nil, fmt.Errorf("/screen:set invalid focus argument %q, must be %s", focusVal, formatStrs([]string{sstore.ScreenFocusInput, sstore.ScreenFocusCmd, sstore.ScreenFocusCmdFg}, "or", false))
|
return nil, fmt.Errorf("/screen:set invalid focus argument %q, must be %s", focusVal, formatStrs([]string{sstore.ScreenFocusInput, sstore.ScreenFocusCmd, sstore.ScreenFocusCmdFg}, "or", false))
|
||||||
}
|
}
|
||||||
|
varsUpdated = append(varsUpdated, "focus")
|
||||||
updateMap[sstore.ScreenField_Focus] = focusVal
|
updateMap[sstore.ScreenField_Focus] = focusVal
|
||||||
setNonAnchor = true
|
setNonAnchor = true
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-3
@@ -506,6 +506,7 @@ func InsertCloudSession(ctx context.Context, sessionName string, shareMode strin
|
|||||||
// also creates default window, returns sessionId
|
// also creates default window, returns sessionId
|
||||||
// if sessionName == "", it will be generated
|
// if sessionName == "", it will be generated
|
||||||
func InsertSessionWithName(ctx context.Context, sessionName string, shareMode string, activate bool) (*ModelUpdate, error) {
|
func InsertSessionWithName(ctx context.Context, sessionName string, shareMode string, activate bool) (*ModelUpdate, error) {
|
||||||
|
var newScreen *ScreenType
|
||||||
newSessionId := scbase.GenPromptUUID()
|
newSessionId := scbase.GenPromptUUID()
|
||||||
txErr := WithTx(ctx, func(tx *TxWrap) error {
|
txErr := WithTx(ctx, func(tx *TxWrap) error {
|
||||||
names := tx.SelectStrings(`SELECT name FROM session`)
|
names := tx.SelectStrings(`SELECT name FROM session`)
|
||||||
@@ -514,10 +515,11 @@ func InsertSessionWithName(ctx context.Context, sessionName string, shareMode st
|
|||||||
query := `INSERT INTO session (sessionid, name, activescreenid, sessionidx, notifynum, archived, archivedts, sharemode)
|
query := `INSERT INTO session (sessionid, name, activescreenid, sessionidx, notifynum, archived, archivedts, sharemode)
|
||||||
VALUES (?, ?, '', ?, ?, 0, 0, 'local')`
|
VALUES (?, ?, '', ?, ?, 0, 0, 'local')`
|
||||||
tx.Exec(query, newSessionId, sessionName, maxSessionIdx+1, 0)
|
tx.Exec(query, newSessionId, sessionName, maxSessionIdx+1, 0)
|
||||||
_, err := InsertScreen(tx.Context(), newSessionId, "", true)
|
screenUpdate, err := InsertScreen(tx.Context(), newSessionId, "", true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
newScreen = screenUpdate.Screens[0]
|
||||||
if activate {
|
if activate {
|
||||||
query = `UPDATE client SET activesessionid = ?`
|
query = `UPDATE client SET activesessionid = ?`
|
||||||
tx.Exec(query, newSessionId)
|
tx.Exec(query, newSessionId)
|
||||||
@@ -533,6 +535,7 @@ func InsertSessionWithName(ctx context.Context, sessionName string, shareMode st
|
|||||||
}
|
}
|
||||||
update := ModelUpdate{
|
update := ModelUpdate{
|
||||||
Sessions: []*SessionType{session},
|
Sessions: []*SessionType{session},
|
||||||
|
Screens: []*ScreenType{newScreen},
|
||||||
}
|
}
|
||||||
if activate {
|
if activate {
|
||||||
update.ActiveSessionId = newSessionId
|
update.ActiveSessionId = newSessionId
|
||||||
@@ -614,7 +617,7 @@ func fmtUniqueName(name string, defaultFmtStr string, startIdx int, strs []strin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func InsertScreen(ctx context.Context, sessionId string, origScreenName string, activate bool) (UpdatePacket, error) {
|
func InsertScreen(ctx context.Context, sessionId string, origScreenName string, activate bool) (*ModelUpdate, error) {
|
||||||
var newScreenId string
|
var newScreenId string
|
||||||
txErr := WithTx(ctx, func(tx *TxWrap) error {
|
txErr := WithTx(ctx, func(tx *TxWrap) error {
|
||||||
query := `SELECT sessionid FROM session WHERE sessionid = ? AND NOT archived`
|
query := `SELECT sessionid FROM session WHERE sessionid = ? AND NOT archived`
|
||||||
@@ -667,7 +670,7 @@ func InsertScreen(ctx context.Context, sessionId string, origScreenName string,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
update := ModelUpdate{Screens: []*ScreenType{newScreen}}
|
update := &ModelUpdate{Screens: []*ScreenType{newScreen}}
|
||||||
if activate {
|
if activate {
|
||||||
bareSession, err := GetBareSessionById(ctx, sessionId)
|
bareSession, err := GetBareSessionById(ctx, sessionId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user