File tree Expand file tree Collapse file tree 8 files changed +40
-2
lines changed 
views/website/runtime/php Expand file tree Collapse file tree 8 files changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ type IRuntimeService interface {
4040	OperateRuntime (req  request.RuntimeOperate ) error 
4141	GetNodeModules (req  request.NodeModuleReq ) ([]response.NodeModule , error )
4242	OperateNodeModules (req  request.NodeModuleOperateReq ) error 
43+ 	SyncForRestart () error 
4344}
4445
4546func  NewRuntimeService () IRuntimeService  {
@@ -555,3 +556,18 @@ func (r *RuntimeService) OperateNodeModules(req request.NodeModuleOperateReq) er
555556	cmd  +=  " "  +  req .Module 
556557	return  cmd2 .ExecContainerScript (containerName , cmd , 5 * time .Minute )
557558}
559+ 
560+ func  (r  * RuntimeService ) SyncForRestart () error  {
561+ 	runtimes , err  :=  runtimeRepo .List ()
562+ 	if  err  !=  nil  {
563+ 		return  err 
564+ 	}
565+ 	for  _ , runtime  :=  range  runtimes  {
566+ 		if  runtime .Status  ==  constant .RuntimeBuildIng  ||  runtime .Status  ==  constant .RuntimeReCreating  ||  runtime .Status  ==  constant .RuntimeStarting  ||  runtime .Status  ==  constant .RuntimeCreating  {
567+ 			runtime .Status  =  constant .SystemRestart 
568+ 			runtime .Message  =  "System restart causing interrupt" 
569+ 			_  =  runtimeRepo .Save (& runtime )
570+ 		}
571+ 	}
572+ 	return  nil 
573+ }
Original file line number Diff line number Diff line change @@ -4,4 +4,6 @@ type DBContext string
44
55const  (
66	DB  DBContext  =  "db" 
7+ 
8+ 	SystemRestart  =  "systemRestart" 
79)
Original file line number Diff line number Diff line change 88func  Init () {
99	go  syncApp ()
1010	go  syncInstalledApp ()
11+ 	go  syncRuntime ()
1112}
1213
1314func  syncApp () {
@@ -22,3 +23,9 @@ func syncInstalledApp() {
2223		global .LOG .Errorf ("sync instaled app error: %s" , err .Error ())
2324	}
2425}
26+ 
27+ func  syncRuntime () {
28+ 	if  err  :=  service .NewRuntimeService ().SyncForRestart (); err  !=  nil  {
29+ 		global .LOG .Errorf ("sync runtime status error : %s" , err .Error ())
30+ 	}
31+ }
Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ func TestAppToV2(t *testing.T) {
144144			}
145145			_  =  fileOp .DeleteFile (newVersionDir  +  "/config.json" )
146146			oldReadMefile  :=  newVersionDir  +  "/README.md" 
147- 			_  =  fileOp .Cut ([]string {oldReadMefile }, newAppDir )
147+ 			_  =  fileOp .Cut ([]string {oldReadMefile }, newAppDir ,  "" ,  false )
148148			_  =  fileOp .DeleteFile (oldReadMefile )
149149		}
150150	}
Original file line number Diff line number Diff line change @@ -234,6 +234,7 @@ const message = {
234234            starting : 'Starting' , 
235235            recreating : 'Recreating' , 
236236            creating : 'Creating' , 
237+             systemrestart : 'Interrupt' , 
237238        } , 
238239        units : { 
239240            second : 'Second' , 
@@ -1842,6 +1843,7 @@ const message = {
18421843        customScript : 'Custom startup command' , 
18431844        customScriptHelper : 'Please fill in the complete startup command, for example: npm run start' , 
18441845        portError : 'Cannot fill in the same port' , 
1846+         systemRestartHelper : 'Status description: Interruption - status acquisition failed due to system restart' , 
18451847    } , 
18461848    process : { 
18471849        pid : 'Process ID' , 
Original file line number Diff line number Diff line change @@ -233,6 +233,7 @@ const message = {
233233            starting : '啟動中' , 
234234            recreating : '重建中' , 
235235            creating : '創建中' , 
236+             systemrestart : '中斷' , 
236237        } , 
237238        units : { 
238239            second : '秒' , 
@@ -1738,6 +1739,7 @@ const message = {
17381739        customScript : '自訂啟動指令' , 
17391740        customScriptHelper : '請填寫完整的啟動指令,例如:npm run start' , 
17401741        portError : '不能填寫相同連接埠' , 
1742+         systemRestartHelper : '狀態說明:中斷-系統重新啟動導致狀態取得失敗' , 
17411743    } , 
17421744    process : { 
17431745        pid : '進程ID' , 
Original file line number Diff line number Diff line change @@ -233,6 +233,7 @@ const message = {
233233            starting : '启动中' , 
234234            recreating : '重建中' , 
235235            creating : '创建中' , 
236+             systemrestart : '中断' , 
236237        } , 
237238        units : { 
238239            second : '秒' , 
@@ -1738,6 +1739,7 @@ const message = {
17381739        customScript : '自定义启动命令' , 
17391740        customScriptHelper : '请填写完整的启动命令,例如:npm run start' , 
17401741        portError : '不能填写相同端口' , 
1742+         systemRestartHelper : '状态说明:中断-系统重启导致状态获取失败' , 
17411743    } , 
17421744    process : { 
17431745        pid : '进程ID' , 
Original file line number Diff line number Diff line change 22    <div >
33        <RouterMenu  />
44        <LayoutContent  :title =" 'PHP'" v-loading =" loading" 
5+             <template  #prompt >
6+                 <el-alert  type =" info" :closable =" false" 
7+                     <template  #default >
8+                         <span ><span  v-html =" $t('runtime.systemRestartHelper')" span ></span >
9+                     </template >
10+                 </el-alert >
11+             </template >
512            <template  #toolbar >
613                <el-button  type =" primary" @click =" openCreate" 
714                    {{ $t('runtime.create') }}
2431                    <el-table-column  :label =" $t('commons.table.status')" prop =" status" 
2532                        <template  #default =" { row  } " >
2633                            <el-popover 
27-                                 v-if =" row.status === 'error'" 
34+                                 v-if =" row.status === 'error' || row.status === 'systemRestart' " 
2835                                placement =" bottom" 
2936                                :width =" 400" 
3037                                trigger =" hover" 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments