fix: Fixed issue with edit runtime failed (#10631)

This commit is contained in:
CityFun 2025-10-14 16:51:38 +08:00 committed by GitHub
parent 5ca02a1dcf
commit 2a97b0a9de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 1 deletions

View file

@ -232,6 +232,14 @@ func (r *RuntimeService) Page(req request.RuntimeSearch) (int64, []response.Runt
if err != nil {
return 0, nil, err
}
detail, _ := appDetailRepo.GetFirst(repo.WithByID(runtime.AppDetailID))
if detail.AppId == 0 {
appID, appDetailID := handleRuntimeDetailID(runtime)
runtimeDTO.AppDetailID = appDetailID
runtimeDTO.AppID = appID
} else {
runtimeDTO.AppID = detail.AppId
}
for k, v := range envs {
runtimeDTO.Params[k] = v
if strings.Contains(k, "CONTAINER_PORT") || strings.Contains(k, "HOST_PORT") {

View file

@ -1059,3 +1059,17 @@ func getOperation(operate, pkgManager string) string {
}
return ops[1]
}
func handleRuntimeDetailID(runtime model.Runtime) (uint, uint) {
app, _ := appRepo.GetFirst(appRepo.WithKey(runtime.Type))
if app.ID == 0 {
return 0, 0
}
appDetail, _ := appDetailRepo.GetFirst(appDetailRepo.WithVersion(runtime.Version), appDetailRepo.WithAppId(app.ID))
if appDetail.ID == 0 {
return 0, 0
}
runtime.AppDetailID = appDetail.ID
_ = runtimeRepo.Save(&runtime)
return app.ID, appDetail.ID
}

View file

@ -478,6 +478,7 @@ const acceptParams = async (props: OperateRrops) => {
searchAppList(null);
}
} else {
console.log(props);
searchAppList(props.appID);
getRuntime(props.id);
}

View file

@ -2,7 +2,7 @@
<el-row :gutter="20" v-loading="loading">
<el-col :xs="24" :sm="18" :md="8" :lg="8" :xl="8">
<el-form ref="websiteForm" label-position="right" label-width="80px" :model="form" :rules="rules">
<el-form-item :label="$t('website.primaryDomain')" prop="primaryDomain">
<el-form-item :label="$t('commons.table.name')" prop="primaryDomain">
<el-input v-model="form.primaryDomain"></el-input>
</el-form-item>
<el-form-item :label="$t('website.alias')" prop="primaryDomain">