mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
fix block controller status (add version) (#1430)
This commit is contained in:
parent
f858d3ba0f
commit
ac8dc25ead
@ -311,6 +311,11 @@ class TermViewModel implements ViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateShellProcStatus(fullStatus: BlockControllerRuntimeStatus) {
|
updateShellProcStatus(fullStatus: BlockControllerRuntimeStatus) {
|
||||||
|
if (fullStatus == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const curStatus = globalStore.get(this.shellProcFullStatus);
|
||||||
|
if (curStatus == null || curStatus.version < fullStatus.version) {
|
||||||
globalStore.set(this.shellProcFullStatus, fullStatus);
|
globalStore.set(this.shellProcFullStatus, fullStatus);
|
||||||
const status = fullStatus?.shellprocstatus ?? "init";
|
const status = fullStatus?.shellprocstatus ?? "init";
|
||||||
if (status == "running") {
|
if (status == "running") {
|
||||||
@ -319,6 +324,7 @@ class TermViewModel implements ViewModel {
|
|||||||
this.termRef.current?.setIsRunning?.(false);
|
this.termRef.current?.setIsRunning?.(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
getVDomModel(): VDomModel {
|
getVDomModel(): VDomModel {
|
||||||
const vdomBlockId = globalStore.get(this.vdomBlockId);
|
const vdomBlockId = globalStore.get(this.vdomBlockId);
|
||||||
|
1
frontend/types/gotypes.d.ts
vendored
1
frontend/types/gotypes.d.ts
vendored
@ -56,6 +56,7 @@ declare global {
|
|||||||
// blockcontroller.BlockControllerRuntimeStatus
|
// blockcontroller.BlockControllerRuntimeStatus
|
||||||
type BlockControllerRuntimeStatus = {
|
type BlockControllerRuntimeStatus = {
|
||||||
blockid: string;
|
blockid: string;
|
||||||
|
version: number;
|
||||||
shellprocstatus?: string;
|
shellprocstatus?: string;
|
||||||
shellprocconnname?: string;
|
shellprocconnname?: string;
|
||||||
shellprocexitcode: number;
|
shellprocexitcode: number;
|
||||||
|
@ -79,10 +79,12 @@ type BlockController struct {
|
|||||||
ShellProcStatus string
|
ShellProcStatus string
|
||||||
ShellProcExitCode int
|
ShellProcExitCode int
|
||||||
RunLock *atomic.Bool
|
RunLock *atomic.Bool
|
||||||
|
StatusVersion int
|
||||||
}
|
}
|
||||||
|
|
||||||
type BlockControllerRuntimeStatus struct {
|
type BlockControllerRuntimeStatus struct {
|
||||||
BlockId string `json:"blockid"`
|
BlockId string `json:"blockid"`
|
||||||
|
Version int `json:"version"`
|
||||||
ShellProcStatus string `json:"shellprocstatus,omitempty"`
|
ShellProcStatus string `json:"shellprocstatus,omitempty"`
|
||||||
ShellProcConnName string `json:"shellprocconnname,omitempty"`
|
ShellProcConnName string `json:"shellprocconnname,omitempty"`
|
||||||
ShellProcExitCode int `json:"shellprocexitcode"`
|
ShellProcExitCode int `json:"shellprocexitcode"`
|
||||||
@ -97,6 +99,8 @@ func (bc *BlockController) WithLock(f func()) {
|
|||||||
func (bc *BlockController) GetRuntimeStatus() *BlockControllerRuntimeStatus {
|
func (bc *BlockController) GetRuntimeStatus() *BlockControllerRuntimeStatus {
|
||||||
var rtn BlockControllerRuntimeStatus
|
var rtn BlockControllerRuntimeStatus
|
||||||
bc.WithLock(func() {
|
bc.WithLock(func() {
|
||||||
|
bc.StatusVersion++
|
||||||
|
rtn.Version = bc.StatusVersion
|
||||||
rtn.BlockId = bc.BlockId
|
rtn.BlockId = bc.BlockId
|
||||||
rtn.ShellProcStatus = bc.ShellProcStatus
|
rtn.ShellProcStatus = bc.ShellProcStatus
|
||||||
if bc.ShellProc != nil {
|
if bc.ShellProc != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user