mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-03 16:00:25 +08:00
refactor: code review
This commit is contained in:
@@ -25,6 +25,7 @@ const useCustomFetch = createFetch({
|
||||
headers.set('Authorization', token);
|
||||
headers.set('ClientId', getClientId());
|
||||
}
|
||||
headers.set('Content-Type', 'application/json');
|
||||
options.headers = headers;
|
||||
|
||||
return { options };
|
||||
|
||||
@@ -71,7 +71,7 @@ body,
|
||||
|
||||
.layout-main {
|
||||
box-sizing: border-box;
|
||||
padding: 8px 10px;
|
||||
padding: 10px 10px;
|
||||
overflow-x: hidden;
|
||||
width: 100%;
|
||||
background-color: var(--bg-main-color);
|
||||
|
||||
@@ -276,7 +276,7 @@ const onRemoveTab = (targetId: number) => {
|
||||
const resizeTableHeight = (e: any) => {
|
||||
const vh = window.innerHeight;
|
||||
state.editorSize = e[0].size;
|
||||
const plitpaneHeight = vh - 223;
|
||||
const plitpaneHeight = vh - 233;
|
||||
const editorHeight = plitpaneHeight * (state.editorSize / 100);
|
||||
state.tableDataHeight = plitpaneHeight - editorHeight - 40 + 'px';
|
||||
};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-row>
|
||||
<div class="flex-all-center">
|
||||
<Splitpanes class="default-theme">
|
||||
<Pane size="20" max-size="30">
|
||||
<tag-tree :resource-type="TagResourceTypeEnum.Mongo.value" :tag-path-node-type="NodeTypeTagPath">
|
||||
@@ -44,7 +43,7 @@
|
||||
</Pane>
|
||||
|
||||
<Pane>
|
||||
<div class="mongo-data-tab card pd5">
|
||||
<div class="mongo-data-tab card pd5 w100">
|
||||
<el-row v-if="nowColl">
|
||||
<el-descriptions class="w100" :column="10" size="small" border>
|
||||
<!-- <el-descriptions-item label-align="right" label="tag">xxx</el-descriptions-item> -->
|
||||
@@ -81,8 +80,7 @@
|
||||
<div class="mt5">
|
||||
<el-link @click="findCommand(state.activeName)" icon="refresh" :underline="false" class=""> </el-link>
|
||||
<el-divider direction="vertical" border-style="dashed" />
|
||||
<el-link v-auth="perms.saveData" @click="onEditDoc(null)" type="primary" icon="plus" :underline="false">
|
||||
</el-link>
|
||||
<el-link v-auth="perms.saveData" @click="onEditDoc(null)" type="primary" icon="plus" :underline="false"> </el-link>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="22">
|
||||
@@ -125,7 +123,6 @@
|
||||
</div>
|
||||
</Pane>
|
||||
</Splitpanes>
|
||||
</el-row>
|
||||
|
||||
<el-dialog width="600px" title="find参数" v-model="findDialog.visible">
|
||||
<el-form label-width="auto">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="redis-data-op">
|
||||
<div class="redis-data-op flex-all-center">
|
||||
<Splitpanes class="default-theme">
|
||||
<Pane size="20" max-size="30">
|
||||
<tag-tree :resource-type="TagResourceTypeEnum.Redis.value" :tag-path-node-type="NodeTypeTagPath">
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<el-tree
|
||||
ref="resourceTreeRef"
|
||||
class="none-select"
|
||||
:indent="38"
|
||||
:indent="24"
|
||||
node-key="id"
|
||||
:props="props"
|
||||
:data="data"
|
||||
@@ -422,4 +422,3 @@ const info = async (data: any) => {
|
||||
user-select: none;
|
||||
}
|
||||
</style>
|
||||
@/components/contextmenu
|
||||
|
||||
@@ -56,10 +56,7 @@ const props = defineProps({
|
||||
const emit = defineEmits(['update:visible', 'cancel', 'val-change']);
|
||||
|
||||
const perms = {
|
||||
addAccount: 'account:add',
|
||||
delAccount: 'account:del',
|
||||
saveAccountRole: 'account:saveRoles',
|
||||
changeAccountStatus: 'account:changeStatus',
|
||||
};
|
||||
|
||||
const searchItems = [SearchItem.input('name', '姓名'), SearchItem.input('username', '用户名')];
|
||||
@@ -72,7 +69,7 @@ const columns = [
|
||||
];
|
||||
|
||||
// 该用户拥有的的操作列按钮权限
|
||||
const actionBtns = hasPerms([perms.addAccount, perms.saveAccountRole, perms.changeAccountStatus]);
|
||||
const actionBtns = hasPerms([perms.saveAccountRole]);
|
||||
const actionColumn = TableColumn.new('action', '操作').isSlot().fixedRight().setMinWidth(80).noShowOverflowTooltip().alignCenter();
|
||||
|
||||
const pageTableRef: Ref<any> = ref(null);
|
||||
|
||||
@@ -19,7 +19,7 @@ const (
|
||||
func (dbType DbType) MetaDbName() string {
|
||||
switch dbType {
|
||||
case DbTypeMysql:
|
||||
return "information_schema"
|
||||
return "mysql"
|
||||
case DbTypePostgres:
|
||||
return "postgres"
|
||||
case DM:
|
||||
|
||||
@@ -34,6 +34,7 @@ func getMysqlDB(d *DbInfo) (*sql.DB, error) {
|
||||
// ---------------------------------- mysql元数据 -----------------------------------
|
||||
const (
|
||||
MYSQL_META_FILE = "metasql/mysql_meta.sql"
|
||||
MYSQL_DBS = "MYSQL_DBS"
|
||||
MYSQL_TABLE_INFO_KEY = "MYSQL_TABLE_INFO"
|
||||
MYSQL_INDEX_INFO_KEY = "MYSQL_INDEX_INFO"
|
||||
MYSQL_COLUMN_MA_KEY = "MYSQL_COLUMN_MA"
|
||||
@@ -55,7 +56,7 @@ func (md *MysqlDialect) GetDbServer() (*DbServer, error) {
|
||||
}
|
||||
|
||||
func (md *MysqlDialect) GetDbNames() ([]string, error) {
|
||||
_, res, err := md.dc.Query("SELECT SCHEMA_NAME AS dbname FROM SCHEMATA")
|
||||
_, res, err := md.dc.Query(GetLocalSql(MYSQL_META_FILE, MYSQL_DBS))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
--MYSQL_DBS 数据库名信息
|
||||
SELECT
|
||||
SCHEMA_NAME AS dbname
|
||||
FROM
|
||||
information_schema.SCHEMATA
|
||||
WHERE
|
||||
SCHEMA_NAME NOT IN ('mysql', 'information_schema', 'performance_schema')
|
||||
---------------------------------------
|
||||
--MYSQL_TABLE_INFO 表详细信息
|
||||
SELECT
|
||||
table_name tableName,
|
||||
|
||||
@@ -44,10 +44,9 @@ func (a *configAppImpl) GetPageList(condition *entity.Config, pageParam *model.P
|
||||
|
||||
func (a *configAppImpl) Save(ctx context.Context, config *entity.Config) error {
|
||||
if config.Id == 0 {
|
||||
if err := a.Insert(ctx, config); err != nil {
|
||||
return err
|
||||
return a.Insert(ctx, config)
|
||||
}
|
||||
} else {
|
||||
|
||||
oldConfig := a.GetConfig(config.Key)
|
||||
if oldConfig.Permission != "all" && !strings.Contains(oldConfig.Permission, config.Modifier) {
|
||||
return errorx.NewBiz("您无权修改该配置")
|
||||
@@ -56,7 +55,7 @@ func (a *configAppImpl) Save(ctx context.Context, config *entity.Config) error {
|
||||
if err := a.UpdateById(ctx, config); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
cache.Del(SysConfigKeyPrefix + config.Key)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user