Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions backend/app/service/app_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,14 @@ func upApp(appInstall *model.AppInstall) {
if err != nil {
return err
}
err = composeService.ComposePull()
if err != nil {
appInstall.Status = constant.PullErr
return err
}
err = composeService.ComposeUp()
if err != nil {
appInstall.Status = constant.Error
return err
}
return
Expand All @@ -586,8 +592,14 @@ func upApp(appInstall *model.AppInstall) {
}
}
if err := upProject(appInstall); err != nil {
appInstall.Status = constant.Error
appInstall.Message = err.Error()
otherMsg := ""
if strings.Contains(err.Error(), "no such host") {
otherMsg = i18n.GetMsgByKey("ErrNoSuchHost") + ":"
}
if strings.Contains(err.Error(), "timeout") {
otherMsg = i18n.GetMsgByKey("ErrImagePullTimeOut") + ":"
}
appInstall.Message = otherMsg + err.Error()
} else {
appInstall.Status = constant.Running
}
Expand Down Expand Up @@ -751,7 +763,7 @@ func handleErr(install model.AppInstall, err error, out string) error {
func handleInstalled(appInstallList []model.AppInstall, updated bool) ([]response.AppInstalledDTO, error) {
var res []response.AppInstalledDTO
for _, installed := range appInstallList {
if updated && installed.App.Type == "php" || installed.Status == constant.Installing {
if updated && (installed.App.Type == "php" || installed.Status == constant.Installing) {
continue
}
installDTO := response.AppInstalledDTO{
Expand Down
1 change: 1 addition & 0 deletions backend/constant/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const (
DirNotFound = "DirNotFound"
Upgrading = "Upgrading"
UpgradeErr = "UpgradeErr"
PullErr = "PullErr"

ContainerPrefix = "1Panel-"

Expand Down
1 change: 1 addition & 0 deletions backend/i18n/lang/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ ErrHttpReqTimeOut: "Request timed out {{.err}}"
ErrHttpReqFailed: "Request failed {{.err}}"
ErrHttpReqNotFound: "The file does not exist"
ErrNoSuchHost: "Network connection failed"
ErrImagePullTimeOut: 'Image pull timeout'

#file
ErrFileCanNotRead: "File can not read"
Expand Down
1 change: 1 addition & 0 deletions backend/i18n/lang/zh-Hant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ ErrHttpReqTimeOut: "請求超時 {{.err}}"
ErrHttpReqFailed: "請求失敗 {{.err}}"
ErrHttpReqNotFound: "文件不存在"
ErrNoSuchHost: "網路連接失敗"
ErrImagePullTimeOut: "鏡像拉取超時"

#file
ErrFileCanNotRead: "此文件不支持預覽"
Expand Down
1 change: 1 addition & 0 deletions backend/i18n/lang/zh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ ErrHttpReqTimeOut: "请求超时 {{.err}}"
ErrHttpReqFailed: "请求失败 {{.err}}"
ErrHttpReqNotFound: "文件不存在"
ErrNoSuchHost: "网络连接失败"
ErrImagePullTimeOut: '镜像拉取超时'

#file
ErrFileCanNotRead: "此文件不支持预览"
Expand Down
4 changes: 4 additions & 0 deletions backend/utils/docker/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ func (s *ComposeService) ComposeBuild() error {
return s.Build(context.Background(), s.project, api.BuildOptions{})
}

func (s *ComposeService) ComposePull() error {
return s.Pull(context.Background(), s.project, api.PullOptions{})
}

func GetComposeProject(projectName, workDir string, yml []byte, env []byte, skipNormalization bool) (*types.Project, error) {
var configFiles []types.ConfigFile
configFiles = append(configFiles, types.ConfigFile{
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lang/modules/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ const message = {
downloaderr: 'Download Error',
upgrading: 'Upgrading',
upgradeerr: 'Upgrade Error',
pullerr: 'Pull Image Error',
},
units: {
second: 'Second',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lang/modules/tw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ const message = {
downloaderr: '下載失敗',
upgrading: '升級中',
upgradeerr: '升級失敗',
pullerr: '鏡像拉取失敗',
},
units: {
second: '秒',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lang/modules/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ const message = {
downloaderr: '下载失败',
upgrading: '升级中',
upgradeerr: '升级失败',
pullerr: '镜像拉取失败',
},
units: {
second: '秒',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/app-store/detail/params/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ const handleParams = () => {
if (p.type === 'service' || p.type === 'apps') {
rules[p.envKey] = [Rules.requiredSelect];
if (p.child) {
p.childProp = p.child.envKey;
p.childProp = propStart.value + p.child.envKey;
if (p.child.type === 'service') {
rules[p.child.envKey] = [Rules.requiredSelect];
}
Expand Down