mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-02 18:39:05 +01:00
hook up close block to backend to remove the running process
This commit is contained in:
parent
91d7392c34
commit
b721f59166
@ -8,6 +8,7 @@ import * as rxjs from "rxjs";
|
|||||||
import type { WailsEvent } from "@wailsio/runtime/types/events";
|
import type { WailsEvent } from "@wailsio/runtime/types/events";
|
||||||
import { Events } from "@wailsio/runtime";
|
import { Events } from "@wailsio/runtime";
|
||||||
import { produce } from "immer";
|
import { produce } from "immer";
|
||||||
|
import * as BlockService from "@/bindings/pkg/service/blockservice/BlockService";
|
||||||
|
|
||||||
const globalStore = jotai.createStore();
|
const globalStore = jotai.createStore();
|
||||||
|
|
||||||
@ -95,6 +96,7 @@ function removeBlockFromTab(tabId: string, blockId: string) {
|
|||||||
});
|
});
|
||||||
globalStore.set(atoms.tabsAtom, newTabArr);
|
globalStore.set(atoms.tabsAtom, newTabArr);
|
||||||
removeBlock(blockId);
|
removeBlock(blockId);
|
||||||
|
BlockService.CloseBlock(blockId);
|
||||||
}
|
}
|
||||||
|
|
||||||
export { globalStore, atoms, getBlockSubject, addBlockIdToTab, blockDataMap, useBlockAtom, removeBlockFromTab };
|
export { globalStore, atoms, getBlockSubject, addBlockIdToTab, blockDataMap, useBlockAtom, removeBlockFromTab };
|
||||||
|
@ -108,6 +108,15 @@ func CreateBlock(bdef *BlockDef, rtOpts *RuntimeOpts) (*BlockData, error) {
|
|||||||
return blockData, nil
|
return blockData, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CloseBlock(blockId string) {
|
||||||
|
bc := GetBlockController(blockId)
|
||||||
|
if bc == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
bc.Close()
|
||||||
|
close(bc.InputCh)
|
||||||
|
}
|
||||||
|
|
||||||
func GetBlockData(blockId string) *BlockData {
|
func GetBlockData(blockId string) *BlockData {
|
||||||
globalLock.Lock()
|
globalLock.Lock()
|
||||||
defer globalLock.Unlock()
|
defer globalLock.Unlock()
|
||||||
@ -140,6 +149,12 @@ type RunShellOpts struct {
|
|||||||
TermSize shellexec.TermSize `json:"termsize,omitempty"`
|
TermSize shellexec.TermSize `json:"termsize,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (bc *BlockController) Close() {
|
||||||
|
if bc.getShellProc() != nil {
|
||||||
|
bc.ShellProc.Close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (bc *BlockController) DoRunShellCommand(rc *RunShellOpts) error {
|
func (bc *BlockController) DoRunShellCommand(rc *RunShellOpts) error {
|
||||||
if bc.getShellProc() != nil {
|
if bc.getShellProc() != nil {
|
||||||
return nil
|
return nil
|
||||||
|
@ -34,6 +34,10 @@ func (bs *BlockService) CreateBlock(bdefMap map[string]any, rtOptsMap map[string
|
|||||||
return rtnMap, nil
|
return rtnMap, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (bs *BlockService) CloseBlock(blockId string) {
|
||||||
|
blockcontroller.CloseBlock(blockId)
|
||||||
|
}
|
||||||
|
|
||||||
func (bs *BlockService) GetBlockData(blockId string) (map[string]any, error) {
|
func (bs *BlockService) GetBlockData(blockId string) (map[string]any, error) {
|
||||||
blockData := blockcontroller.GetBlockData(blockId)
|
blockData := blockcontroller.GetBlockData(blockId)
|
||||||
if blockData == nil {
|
if blockData == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user