feat: phpmyadmin redis-commander 增加关联关系

This commit is contained in:
zhengkunwang223 2023-03-08 23:36:32 +08:00 committed by zhengkunwang223
parent 5ed3af03da
commit 25149bbede
3 changed files with 24 additions and 21 deletions

View File

@ -84,14 +84,16 @@ func createLink(ctx context.Context, app model.App, appInstall *model.AppInstall
} }
} }
if !reflect.DeepEqual(dbConfig, dto.AppDatabase{}) && dbConfig.DbName != "" && dbConfig.DbUser != "" && dbConfig.Password != "" { if !reflect.DeepEqual(dbConfig, dto.AppDatabase{}) && dbConfig.ServiceName != "" {
dbInstall, err := appInstallRepo.GetFirst(appInstallRepo.WithServiceName(dbConfig.ServiceName)) dbInstall, err := appInstallRepo.GetFirst(appInstallRepo.WithServiceName(dbConfig.ServiceName))
if err != nil { if err != nil {
return err return err
} }
var resourceId uint
if dbConfig.DbName != "" && dbConfig.DbUser != "" && dbConfig.Password != "" {
iMysqlRepo := repo.NewIMysqlRepo() iMysqlRepo := repo.NewIMysqlRepo()
oldMysqlDb, _ := iMysqlRepo.Get(commonRepo.WithByName(dbConfig.DbName)) oldMysqlDb, _ := iMysqlRepo.Get(commonRepo.WithByName(dbConfig.DbName))
resourceId := oldMysqlDb.ID resourceId = oldMysqlDb.ID
if oldMysqlDb.ID > 0 { if oldMysqlDb.ID > 0 {
if oldMysqlDb.Username != dbConfig.DbUser || oldMysqlDb.Password != dbConfig.Password { if oldMysqlDb.Username != dbConfig.DbUser || oldMysqlDb.Password != dbConfig.Password {
return buserr.New(constant.ErrDbUserNotValid) return buserr.New(constant.ErrDbUserNotValid)
@ -109,7 +111,7 @@ func createLink(ctx context.Context, app model.App, appInstall *model.AppInstall
} }
resourceId = mysqldb.ID resourceId = mysqldb.ID
} }
}
var installResource model.AppInstallResource var installResource model.AppInstallResource
installResource.ResourceId = resourceId installResource.ResourceId = resourceId
installResource.AppInstallId = appInstall.ID installResource.AppInstallId = appInstall.ID

View File

@ -10,6 +10,7 @@
></el-input> ></el-input>
<el-input <el-input
v-model="form[p.envKey]" v-model="form[p.envKey]"
@blur="form[p.envKey] = Number(form[p.envKey])"
v-if="p.type == 'number'" v-if="p.type == 'number'"
:type="p.type" :type="p.type"
@change="updateParam" @change="updateParam"

View File

@ -8,7 +8,7 @@
show-icon show-icon
:closable="false" :closable="false"
/> />
<el-col :span="12" :offset="6"> <el-col :span="20" :offset="2">
<br /> <br />
<el-descriptions border :column="1"> <el-descriptions border :column="1">
<el-descriptions-item v-for="(item, key) in map" :key="key"> <el-descriptions-item v-for="(item, key) in map" :key="key">