mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-25 11:39:16 +08:00
feat: phpmyadmin redis-commander 增加关联关系
This commit is contained in:
parent
5ed3af03da
commit
25149bbede
@ -84,32 +84,34 @@ 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
|
||||||
}
|
}
|
||||||
iMysqlRepo := repo.NewIMysqlRepo()
|
var resourceId uint
|
||||||
oldMysqlDb, _ := iMysqlRepo.Get(commonRepo.WithByName(dbConfig.DbName))
|
if dbConfig.DbName != "" && dbConfig.DbUser != "" && dbConfig.Password != "" {
|
||||||
resourceId := oldMysqlDb.ID
|
iMysqlRepo := repo.NewIMysqlRepo()
|
||||||
if oldMysqlDb.ID > 0 {
|
oldMysqlDb, _ := iMysqlRepo.Get(commonRepo.WithByName(dbConfig.DbName))
|
||||||
if oldMysqlDb.Username != dbConfig.DbUser || oldMysqlDb.Password != dbConfig.Password {
|
resourceId = oldMysqlDb.ID
|
||||||
return buserr.New(constant.ErrDbUserNotValid)
|
if oldMysqlDb.ID > 0 {
|
||||||
|
if oldMysqlDb.Username != dbConfig.DbUser || oldMysqlDb.Password != dbConfig.Password {
|
||||||
|
return buserr.New(constant.ErrDbUserNotValid)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var createMysql dto.MysqlDBCreate
|
||||||
|
createMysql.Name = dbConfig.DbName
|
||||||
|
createMysql.Username = dbConfig.DbUser
|
||||||
|
createMysql.Format = "utf8mb4"
|
||||||
|
createMysql.Permission = "%"
|
||||||
|
createMysql.Password = dbConfig.Password
|
||||||
|
mysqldb, err := NewIMysqlService().Create(ctx, createMysql)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
resourceId = mysqldb.ID
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
var createMysql dto.MysqlDBCreate
|
|
||||||
createMysql.Name = dbConfig.DbName
|
|
||||||
createMysql.Username = dbConfig.DbUser
|
|
||||||
createMysql.Format = "utf8mb4"
|
|
||||||
createMysql.Permission = "%"
|
|
||||||
createMysql.Password = dbConfig.Password
|
|
||||||
mysqldb, err := NewIMysqlService().Create(ctx, createMysql)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
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
|
||||||
|
@ -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"
|
||||||
|
@ -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">
|
||||||
|
Loading…
Reference in New Issue
Block a user