1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 08:19:15 +08:00

feat(appstore): Handle container restarting status for App (#7676)

This commit is contained in:
zhengkunwang 2025-01-09 17:02:22 +08:00 committed by GitHub
parent 022580bbb2
commit 2185c3d2e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 18 additions and 0 deletions

View File

@ -518,6 +518,9 @@ func (a AppService) Install(req request.AppInstallCreate) (appInstall *model.App
if taskErr := installTask.Execute(); taskErr != nil {
appInstall.Status = constant.InstallErr
appInstall.Message = taskErr.Error()
if strings.Contains(taskErr.Error(), "Timeout") && strings.Contains(taskErr.Error(), "Pulling") {
appInstall.Message = buserr.New("PullImageTimeout").Error() + appInstall.Message
}
_ = appInstallRepo.Save(context.Background(), appInstall)
}
}()

View File

@ -1338,6 +1338,7 @@ func synAppInstall(containers map[string]types.Container, appInstall *model.AppI
exitedCount := 0
pausedCount := 0
runningCount := 0
restartingCount := 0
total := len(containerNames)
for _, name := range containerNames {
if con, ok := containers["/"+name]; ok {
@ -1347,6 +1348,8 @@ func synAppInstall(containers map[string]types.Container, appInstall *model.AppI
exitNames = append(exitNames, name)
case "running":
runningCount++
case "restarting":
restartingCount++
case "paused":
pausedCount++
}
@ -1362,6 +1365,8 @@ func synAppInstall(containers map[string]types.Container, appInstall *model.AppI
if oldStatus == constant.Running {
return
}
case restartingCount == total:
appInstall.Status = constant.Restating
case pausedCount == total:
appInstall.Status = constant.Paused
case len(notFoundNames) == total:

View File

@ -16,6 +16,7 @@ const (
UpErr = "UpErr"
InstallErr = "InstallErr"
Uninstalling = "Uninstalling"
Restating = "Restarting"
ContainerPrefix = "1Panel-"

View File

@ -74,6 +74,7 @@ DeleteRuntimePHP: "Delete PHP runtime environment",
CustomAppStoreNotConfig: "Please configure the offline package address in the app store settings",
CustomAppStoreNotFound: "Failed to retrieve app store package, please check if it exists",
CustomAppStoreFileValid: "App store package must be in .tar.gz format"
PullImageTimeout: "Image pull timeout, please check the network and try again"
#file

View File

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

View File

@ -74,6 +74,7 @@ DeleteRuntimePHP: "删除 PHP 运行环境"
CustomAppStoreNotConfig: "请在应用商店设置离线包地址"
CustomAppStoreNotFound: "应用商店包获取失败,请检查是否存在"
CustomAppStoreFileValid: "应用商店包需要 .tar.gz 格式"
PullImageTimeout: "拉取镜像超时,请尝试增加镜像加速或者更换其他镜像加速"
#file
ErrFileCanNotRead: "此文件不支持预览"

View File

@ -35,6 +35,7 @@ import { nextTick, onMounted, onUnmounted, reactive, ref } from 'vue';
import { downloadFile } from '@/utils/util';
import { ReadByLine } from '@/api/modules/files';
import { GlobalStore } from '@/store';
import bus from '@/global/bus';
const globalStore = GlobalStore();
interface LogProps {
@ -272,6 +273,7 @@ const onCloseLog = async () => {
timer = null;
isLoading.value = false;
emit('update:isReading', false);
bus.emit('refreshTask', true);
};
watch(

View File

@ -63,6 +63,7 @@ const openWithResourceID = (taskType: string, taskOperate: string, resourceID: n
const handleClose = () => {
open.value = false;
bus.emit('refreshTask', true);
};
defineExpose({ openWithResourceID, openWithTaskID });

View File

@ -303,6 +303,7 @@ const message = {
healthy: 'Normal',
executing: 'Executing',
installerr: 'Install Error',
restating: 'Restarting',
},
units: {
second: 'Second',

View File

@ -298,6 +298,7 @@ const message = {
healthy: '正常',
executing: '執行中',
installerr: '安裝失敗',
restating: '重啟中',
},
units: {
second: '秒',

View File

@ -298,6 +298,7 @@ const message = {
healthy: '正常',
executing: '执行中',
installerr: '安装失败',
restating: '重启中',
},
units: {
second: '秒',