Skip to content

Commit 2185c3d

Browse files
feat(appstore): Handle container restarting status for App (#7676)
1 parent 022580b commit 2185c3d

File tree

11 files changed

+18
-0
lines changed

11 files changed

+18
-0
lines changed

agent/app/service/app.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,9 @@ func (a AppService) Install(req request.AppInstallCreate) (appInstall *model.App
518518
if taskErr := installTask.Execute(); taskErr != nil {
519519
appInstall.Status = constant.InstallErr
520520
appInstall.Message = taskErr.Error()
521+
if strings.Contains(taskErr.Error(), "Timeout") && strings.Contains(taskErr.Error(), "Pulling") {
522+
appInstall.Message = buserr.New("PullImageTimeout").Error() + appInstall.Message
523+
}
521524
_ = appInstallRepo.Save(context.Background(), appInstall)
522525
}
523526
}()

agent/app/service/app_utils.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,7 @@ func synAppInstall(containers map[string]types.Container, appInstall *model.AppI
13381338
exitedCount := 0
13391339
pausedCount := 0
13401340
runningCount := 0
1341+
restartingCount := 0
13411342
total := len(containerNames)
13421343
for _, name := range containerNames {
13431344
if con, ok := containers["/"+name]; ok {
@@ -1347,6 +1348,8 @@ func synAppInstall(containers map[string]types.Container, appInstall *model.AppI
13471348
exitNames = append(exitNames, name)
13481349
case "running":
13491350
runningCount++
1351+
case "restarting":
1352+
restartingCount++
13501353
case "paused":
13511354
pausedCount++
13521355
}
@@ -1362,6 +1365,8 @@ func synAppInstall(containers map[string]types.Container, appInstall *model.AppI
13621365
if oldStatus == constant.Running {
13631366
return
13641367
}
1368+
case restartingCount == total:
1369+
appInstall.Status = constant.Restating
13651370
case pausedCount == total:
13661371
appInstall.Status = constant.Paused
13671372
case len(notFoundNames) == total:

agent/constant/app.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const (
1616
UpErr = "UpErr"
1717
InstallErr = "InstallErr"
1818
Uninstalling = "Uninstalling"
19+
Restating = "Restarting"
1920

2021
ContainerPrefix = "1Panel-"
2122

agent/i18n/lang/en.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ DeleteRuntimePHP: "Delete PHP runtime environment",
7474
CustomAppStoreNotConfig: "Please configure the offline package address in the app store settings",
7575
CustomAppStoreNotFound: "Failed to retrieve app store package, please check if it exists",
7676
CustomAppStoreFileValid: "App store package must be in .tar.gz format"
77+
PullImageTimeout: "Image pull timeout, please check the network and try again"
7778

7879

7980
#file

agent/i18n/lang/zh-Hant.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ DeleteRuntimePHP: "刪除運行環境 PHP 版本",
7575
CustomAppStoreNotConfig: "請在應用商店設置離線包地址",
7676
CustomAppStoreNotFound: "應用商店包獲取失敗,請檢查是否存在",
7777
CustomAppStoreFileValid: "應用商店包需要 .tar.gz 格式"
78+
PullImageTimeout: "拉取鏡像超時,請嘗試增加鏡像加速或更換其他鏡像加速"
7879

7980

8081
#file

agent/i18n/lang/zh.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ DeleteRuntimePHP: "删除 PHP 运行环境"
7474
CustomAppStoreNotConfig: "请在应用商店设置离线包地址"
7575
CustomAppStoreNotFound: "应用商店包获取失败,请检查是否存在"
7676
CustomAppStoreFileValid: "应用商店包需要 .tar.gz 格式"
77+
PullImageTimeout: "拉取镜像超时,请尝试增加镜像加速或者更换其他镜像加速"
7778

7879
#file
7980
ErrFileCanNotRead: "此文件不支持预览"

frontend/src/components/log-file/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import { nextTick, onMounted, onUnmounted, reactive, ref } from 'vue';
3535
import { downloadFile } from '@/utils/util';
3636
import { ReadByLine } from '@/api/modules/files';
3737
import { GlobalStore } from '@/store';
38+
import bus from '@/global/bus';
3839
const globalStore = GlobalStore();
3940
4041
interface LogProps {
@@ -272,6 +273,7 @@ const onCloseLog = async () => {
272273
timer = null;
273274
isLoading.value = false;
274275
emit('update:isReading', false);
276+
bus.emit('refreshTask', true);
275277
};
276278
277279
watch(

frontend/src/components/task-log/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const openWithResourceID = (taskType: string, taskOperate: string, resourceID: n
6363
6464
const handleClose = () => {
6565
open.value = false;
66+
bus.emit('refreshTask', true);
6667
};
6768
6869
defineExpose({ openWithResourceID, openWithTaskID });

frontend/src/lang/modules/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ const message = {
303303
healthy: 'Normal',
304304
executing: 'Executing',
305305
installerr: 'Install Error',
306+
restating: 'Restarting',
306307
},
307308
units: {
308309
second: 'Second',

frontend/src/lang/modules/tw.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ const message = {
298298
healthy: '正常',
299299
executing: '執行中',
300300
installerr: '安裝失敗',
301+
restating: '重啟中',
301302
},
302303
units: {
303304
second: '秒',

0 commit comments

Comments
 (0)