fix: 前端代理默认端口调整&水印开关不生效

This commit is contained in:
meilin.huang
2023-09-27 17:19:58 +08:00
parent 92dff6fdc3
commit fac71a4794
4 changed files with 21 additions and 24 deletions

View File

@@ -405,9 +405,7 @@ const toIndex = async () => {
// 关闭 loading
state.loading.signIn = true;
ElMessage.success(`${currentTimeInfo},欢迎回来!`);
if (await useWartermark()) {
saveUseWatermark(true);
}
saveUseWatermark(await useWartermark());
}, 300);
};

View File

@@ -2,7 +2,12 @@
<div>
<el-row class="mb5">
<el-col :span="4">
<el-button type="primary" icon="plus" @click="addQueryTab({ id: nowDbInst.id, dbs: nowDbInst.databases.split(' ') }, state.db)" size="small"
<el-button
:disabled="!state.db || !nowDbInst.id"
type="primary"
icon="plus"
@click="addQueryTab({ id: nowDbInst.id, dbs: nowDbInst.databases?.split(' ') }, state.db)"
size="small"
>新建查询</el-button
>
</el-col>

View File

@@ -29,7 +29,7 @@ const viteConfig: UserConfig = {
open: VITE_OPEN,
proxy: {
'/api': {
target: 'http://localhost:8888',
target: 'http://localhost:18888',
ws: true,
changeOrigin: true,
},

View File

@@ -76,42 +76,36 @@ func (d *dbAppImpl) GetById(id uint64, cols ...string) *entity.Db {
}
func (d *dbAppImpl) Save(dbEntity *entity.Db) {
// 查找是否存在该库
oldDb := &entity.Db{Name: dbEntity.Name}
// 查找是否存在
oldDb := &entity.Db{Name: dbEntity.Name, InstanceId: dbEntity.InstanceId}
err := d.GetDbBy(oldDb)
if dbEntity.Id == 0 {
biz.IsTrue(err != nil, "该数据库资源已存在")
biz.IsTrue(err != nil, "该实例下数据库已存在")
d.dbRepo.Insert(dbEntity)
return
}
// 如果存在该库,则校验修改的库是否为该库
if err == nil {
biz.IsTrue(oldDb.Id == dbEntity.Id, "该数据库资源已存在")
biz.IsTrue(oldDb.Id == dbEntity.Id, "该实例下数据库已存在")
}
dbId := dbEntity.Id
old := d.GetById(dbId)
var oldDbs []any
for _, v := range strings.Split(old.Database, " ") {
oldDbs := strings.Split(old.Database, " ")
newDbs := strings.Split(dbEntity.Database, " ")
// 比较新旧数据库列表,需要将移除的数据库相关联的信息删除
_, delDb, _ := collx.ArrayCompare(newDbs, oldDbs, func(i1, i2 string) bool {
return i1 == i2
})
for _, v := range delDb {
// 关闭数据库连接
CloseDb(dbEntity.Id, v)
oldDbs = append(oldDbs, v)
}
var newDbs []any
for _, v := range strings.Split(dbEntity.Database, " ") {
newDbs = append(newDbs, v)
}
// 比较新旧数据库列表,需要将移除的数据库相关联的信息删除
_, delDb, _ := collx.ArrayCompare(newDbs, oldDbs, func(i1, i2 any) bool {
return i1.(string) == i2.(string)
})
for _, v := range delDb {
// 删除该库关联的所有sql记录
d.dbSqlRepo.DeleteBy(&entity.DbSql{DbId: dbId, Db: v.(string)})
d.dbSqlRepo.DeleteBy(&entity.DbSql{DbId: dbId, Db: v})
}
d.dbRepo.Update(dbEntity)