File tree Expand file tree Collapse file tree
packages/libro-jupyter/src/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { l10n } from '@difizen/libro-common/l10n' ;
12import type { CellModel } from '@difizen/libro-core' ;
23import type { ServerManager } from '@difizen/libro-kernel' ;
3- import { l10n } from '@difizen/libro-common/l10n' ;
44import { duration } from 'moment' ;
55
66import { LibroJupyterModel } from '../libro-jupyter-model.js' ;
7- import type {
8- ExecutedWithKernelCellModel ,
9- ServerStatus ,
10- } from '../libro-jupyter-protocol.js' ;
7+ import type { ServerStatus } from '../libro-jupyter-protocol.js' ;
118import {
129 jupyterServiceStatus ,
1310 kernelStatus ,
1411 statusToColor ,
12+ ExecutedWithKernelCellModel ,
1513} from '../libro-jupyter-protocol.js' ;
1614
1715export const EXECUTE_INPUT = 'to_execute' ; // 用户点击执行按钮的时间
@@ -100,7 +98,18 @@ export const getServiceStatusInfo = (
10098 } ;
10199 }
102100
103- return kernelStatus [ libroModel . kernelConnection . status ] ;
101+ let status = libroModel . kernelConnection . status ;
102+
103+ if ( status === 'unknown' ) {
104+ const hasRunningCell = libroModel . cells . some ( ( cell ) => {
105+ return ExecutedWithKernelCellModel . is ( cell . model ) && cell . model . kernelExecuting ;
106+ } ) ;
107+ if ( hasRunningCell ) {
108+ status = 'busy' ;
109+ }
110+ }
111+
112+ return kernelStatus [ status ] ;
104113} ;
105114
106115// 判断服务未启动、kernel正在连接 -> return false
You can’t perform that action at this time.
0 commit comments