mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-04 00:10:25 +08:00
refactor: 图标优化等
This commit is contained in:
BIN
mayfly_go_web/src/assets/icon/mongo.png
Normal file
BIN
mayfly_go_web/src/assets/icon/mongo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
mayfly_go_web/src/assets/icon/mysql.png
Normal file
BIN
mayfly_go_web/src/assets/icon/mysql.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
BIN
mayfly_go_web/src/assets/icon/postgres.png
Normal file
BIN
mayfly_go_web/src/assets/icon/postgres.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
BIN
mayfly_go_web/src/assets/icon/redis.png
Normal file
BIN
mayfly_go_web/src/assets/icon/redis.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -342,6 +342,7 @@ body,
|
|||||||
font-size: 12px
|
font-size: 12px
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 图标垂直居中
|
||||||
.icon-middle {
|
.icon-middle {
|
||||||
.el-icon {
|
.el-icon {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
@@ -351,3 +352,12 @@ body,
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.img-icon {
|
||||||
|
display: inline-flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
cursor: pointer;
|
||||||
|
vertical-align: middle;
|
||||||
|
height: 16px;
|
||||||
|
width: 16px;
|
||||||
|
}
|
||||||
@@ -28,7 +28,12 @@
|
|||||||
<span v-if="data.type == NodeType.DbInst">
|
<span v-if="data.type == NodeType.DbInst">
|
||||||
<el-popover placement="right-start" title="数据库实例信息" trigger="hover" :width="210">
|
<el-popover placement="right-start" title="数据库实例信息" trigger="hover" :width="210">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-icon>
|
<img v-if="data.params.type === 'mysql'" src="@/assets/icon/mysql.png"
|
||||||
|
class="img-icon" />
|
||||||
|
<img v-if="data.params.type === 'postgres'" src="@/assets/icon/postgres.png"
|
||||||
|
class="img-icon" />
|
||||||
|
|
||||||
|
<el-icon v-else>
|
||||||
<InfoFilled />
|
<InfoFilled />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</template>
|
</template>
|
||||||
@@ -64,8 +69,6 @@
|
|||||||
<el-icon v-if="data.type == NodeType.SqlMenu || data.type == NodeType.Sql">
|
<el-icon v-if="data.type == NodeType.SqlMenu || data.type == NodeType.Sql">
|
||||||
<Files color="#f56c6c" />
|
<Files color="#f56c6c" />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</tag-tree>
|
</tag-tree>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div :style="{ height: height }" id="xterm" class="xterm" />
|
<div :style="{ height: props.height }" id="xterm" class="xterm" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
@@ -9,40 +9,31 @@ import { FitAddon } from 'xterm-addon-fit';
|
|||||||
import { getSession } from '@/common/utils/storage.ts';
|
import { getSession } from '@/common/utils/storage.ts';
|
||||||
import config from '@/common/config';
|
import config from '@/common/config';
|
||||||
import { useStore } from '@/store/index.ts';
|
import { useStore } from '@/store/index.ts';
|
||||||
import { nextTick, toRefs, watch, computed, reactive, onMounted, onBeforeUnmount } from 'vue';
|
import { nextTick, computed, reactive, onMounted, onBeforeUnmount } from 'vue';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
machineId: { type: Number },
|
machineId: { type: Number },
|
||||||
cmd: { type: String },
|
cmd: { type: String },
|
||||||
height: { type: String },
|
height: { type: [String, Number] },
|
||||||
})
|
})
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
machineId: 0,
|
|
||||||
cmd: '',
|
cmd: '',
|
||||||
height: '',
|
|
||||||
term: null as any,
|
term: null as any,
|
||||||
socket: null as any,
|
socket: null as any,
|
||||||
});
|
});
|
||||||
|
|
||||||
const {
|
|
||||||
height,
|
|
||||||
} = toRefs(state)
|
|
||||||
|
|
||||||
const resize = 1;
|
const resize = 1;
|
||||||
const data = 2;
|
const data = 2;
|
||||||
const ping = 3;
|
const ping = 3;
|
||||||
|
|
||||||
watch(props, (newValue: any) => {
|
|
||||||
state.machineId = newValue.machineId;
|
|
||||||
state.cmd = newValue.cmd;
|
|
||||||
state.height = newValue.height;
|
|
||||||
});
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
state.machineId = props.machineId as any;
|
|
||||||
state.height = props.height as any;
|
|
||||||
state.cmd = props.cmd as any;
|
state.cmd = props.cmd as any;
|
||||||
|
|
||||||
|
nextTick(() => {
|
||||||
|
initXterm();
|
||||||
|
initSocket();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
@@ -56,11 +47,6 @@ const getThemeConfig: any = computed(() => {
|
|||||||
return store.state.themeConfig.themeConfig;
|
return store.state.themeConfig.themeConfig;
|
||||||
});
|
});
|
||||||
|
|
||||||
nextTick(() => {
|
|
||||||
initXterm();
|
|
||||||
initSocket();
|
|
||||||
});
|
|
||||||
|
|
||||||
function initXterm() {
|
function initXterm() {
|
||||||
const term: any = new Terminal({
|
const term: any = new Terminal({
|
||||||
fontSize: getThemeConfig.value.terminalFontSize || 15,
|
fontSize: getThemeConfig.value.terminalFontSize || 15,
|
||||||
@@ -122,7 +108,7 @@ function initXterm() {
|
|||||||
let pingInterval: any;
|
let pingInterval: any;
|
||||||
function initSocket() {
|
function initSocket() {
|
||||||
state.socket = new WebSocket(
|
state.socket = new WebSocket(
|
||||||
`${config.baseWsUrl}/machines/${state.machineId}/terminal?token=${getSession('token')}&cols=${state.term.cols}&rows=${state.term.rows
|
`${config.baseWsUrl}/machines/${props.machineId}/terminal?token=${getSession('token')}&cols=${state.term.cols}&rows=${state.term.rows
|
||||||
}`
|
}`
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -190,3 +176,10 @@ function closeAll() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<style lang="scss">
|
||||||
|
#xterm {
|
||||||
|
.xterm-viewport {
|
||||||
|
overflow-y: hidden
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { useRoute } from 'vue-router';
|
|||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
machineId: 0,
|
machineId: 0,
|
||||||
height: 700,
|
height: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|||||||
@@ -7,9 +7,7 @@
|
|||||||
<span v-if="data.type == NodeType.Mongo">
|
<span v-if="data.type == NodeType.Mongo">
|
||||||
<el-popover placement="right-start" title="mongo实例信息" trigger="hover" :width="210">
|
<el-popover placement="right-start" title="mongo实例信息" trigger="hover" :width="210">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-icon>
|
<img src="@/assets/icon/mongo.png" class="img-icon" />
|
||||||
<InfoFilled />
|
|
||||||
</el-icon>
|
|
||||||
</template>
|
</template>
|
||||||
<template #default>
|
<template #default>
|
||||||
<el-form class="instances-pop-form" label-width="50px" :size="'small'">
|
<el-form class="instances-pop-form" label-width="50px" :size="'small'">
|
||||||
|
|||||||
@@ -9,9 +9,7 @@
|
|||||||
<span v-if="data.type == NodeType.Redis">
|
<span v-if="data.type == NodeType.Redis">
|
||||||
<el-popover placement="right-start" title="redis实例信息" trigger="hover" :width="210">
|
<el-popover placement="right-start" title="redis实例信息" trigger="hover" :width="210">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-icon>
|
<img src="@/assets/icon/redis.png" class="img-icon" />
|
||||||
<InfoFilled />
|
|
||||||
</el-icon>
|
|
||||||
</template>
|
</template>
|
||||||
<template #default>
|
<template #default>
|
||||||
<el-form class="instances-pop-form" label-width="50px" :size="'small'">
|
<el-form class="instances-pop-form" label-width="50px" :size="'small'">
|
||||||
@@ -129,7 +127,7 @@ import TagTree from '../component/TagTree.vue';
|
|||||||
/**
|
/**
|
||||||
* 树节点类型
|
* 树节点类型
|
||||||
*/
|
*/
|
||||||
class NodeType {
|
class NodeType {
|
||||||
static Redis = 1
|
static Redis = 1
|
||||||
static Db = 2
|
static Db = 2
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ func doSelect(selectStmt *sqlparser.Select, execSqlReq *DbSqlExecReq) (*DbSqlExe
|
|||||||
biz.NotNil(limit, "请完善分页信息后执行")
|
biz.NotNil(limit, "请完善分页信息后执行")
|
||||||
count, err := strconv.Atoi(sqlparser.String(limit.Rowcount))
|
count, err := strconv.Atoi(sqlparser.String(limit.Rowcount))
|
||||||
biz.ErrIsNil(err, "分页参数有误")
|
biz.ErrIsNil(err, "分页参数有误")
|
||||||
biz.IsTrue(count <= maxCount, fmt.Sprintf("查询结果集数需小于系统配置的%d条", maxCount))
|
biz.IsTrue(count <= maxCount, "查询结果集数需小于系统配置的%d条", maxCount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,9 +79,7 @@ func (mm *MysqlMetadata) GetColumns(tableNames ...string) []map[string]interface
|
|||||||
// 获取表主键字段名,不存在主键标识则默认第一个字段
|
// 获取表主键字段名,不存在主键标识则默认第一个字段
|
||||||
func (mm *MysqlMetadata) GetPrimaryKey(tablename string) string {
|
func (mm *MysqlMetadata) GetPrimaryKey(tablename string) string {
|
||||||
columns := mm.GetColumns(tablename)
|
columns := mm.GetColumns(tablename)
|
||||||
if len(columns) == 0 {
|
biz.IsTrue(len(columns) > 0, "[%s] 表不存在", tablename)
|
||||||
panic(biz.NewBizErr(fmt.Sprintf("[%s] 表不存在", tablename)))
|
|
||||||
}
|
|
||||||
for _, v := range columns {
|
for _, v := range columns {
|
||||||
if v["columnKey"].(string) == "PRI" {
|
if v["columnKey"].(string) == "PRI" {
|
||||||
return v["columnName"].(string)
|
return v["columnName"].(string)
|
||||||
|
|||||||
@@ -118,9 +118,7 @@ func (pm *PgsqlMetadata) GetColumns(tableNames ...string) []map[string]interface
|
|||||||
|
|
||||||
func (pm *PgsqlMetadata) GetPrimaryKey(tablename string) string {
|
func (pm *PgsqlMetadata) GetPrimaryKey(tablename string) string {
|
||||||
columns := pm.GetColumns(tablename)
|
columns := pm.GetColumns(tablename)
|
||||||
if len(columns) == 0 {
|
biz.IsTrue(len(columns) > 0, "[%s] 表不存在", tablename)
|
||||||
panic(biz.NewBizErr(fmt.Sprintf("[%s] 表不存在", tablename)))
|
|
||||||
}
|
|
||||||
for _, v := range columns {
|
for _, v := range columns {
|
||||||
if v["columnKey"].(string) == "PRI" {
|
if v["columnKey"].(string) == "PRI" {
|
||||||
return v["columnName"].(string)
|
return v["columnName"].(string)
|
||||||
|
|||||||
@@ -70,9 +70,7 @@ func (m *MachineScript) RunMachineScript(rc *req.Ctx) {
|
|||||||
res, err := cli.Run(script)
|
res, err := cli.Run(script)
|
||||||
// 记录请求参数
|
// 记录请求参数
|
||||||
rc.ReqParam = fmt.Sprintf("[machine: %s, scriptId: %d, name: %s]", cli.GetMachine().GetLogDesc(), scriptId, ms.Name)
|
rc.ReqParam = fmt.Sprintf("[machine: %s, scriptId: %d, name: %s]", cli.GetMachine().GetLogDesc(), scriptId, ms.Name)
|
||||||
if err != nil {
|
biz.ErrIsNilAppendErr(err, "执行命令失败:%s")
|
||||||
panic(biz.NewBizErr(fmt.Sprintf("执行命令失败:%s", err.Error())))
|
|
||||||
}
|
|
||||||
rc.ResData = res
|
rc.ResData = res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package application
|
package application
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
dbapp "mayfly-go/internal/db/application"
|
dbapp "mayfly-go/internal/db/application"
|
||||||
dbentity "mayfly-go/internal/db/domain/entity"
|
dbentity "mayfly-go/internal/db/domain/entity"
|
||||||
machineapp "mayfly-go/internal/machine/application"
|
machineapp "mayfly-go/internal/machine/application"
|
||||||
@@ -85,9 +84,7 @@ func (p *tagTreeAppImpl) Save(tag *entity.TagTree) {
|
|||||||
// 校验同级标签,是否有以该code为开头的标识符
|
// 校验同级标签,是否有以该code为开头的标识符
|
||||||
p.tagTreeRepo.SelectByCondition(&entity.TagTreeQuery{Pid: tag.Pid}, &hasLikeTags)
|
p.tagTreeRepo.SelectByCondition(&entity.TagTreeQuery{Pid: tag.Pid}, &hasLikeTags)
|
||||||
for _, v := range hasLikeTags {
|
for _, v := range hasLikeTags {
|
||||||
if strings.HasPrefix(tag.Code, v.Code) {
|
biz.IsTrue(!strings.HasPrefix(tag.Code, v.Code), "同级标签下的[%s]与[%s]存在相似开头字符, 请修改该标识code", v.Code, tag.Code)
|
||||||
panic(biz.NewBizErr(fmt.Sprintf("同级标签下的[%s]与[%s]存在相似开头字符, 请修改该标识code", v.Code, tag.Code)))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
p.tagTreeRepo.Insert(tag)
|
p.tagTreeRepo.Insert(tag)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ CREATE TABLE `t_sys_config` (
|
|||||||
BEGIN;
|
BEGIN;
|
||||||
INSERT INTO `t_sys_config` VALUES (1, '是否启用登录验证码', 'UseLoginCaptcha', NULL, '1', '1: 启用、0: 不启用', '2022-08-25 22:27:17', 1, 'admin', '2022-08-26 10:26:56', 1, 'admin');
|
INSERT INTO `t_sys_config` VALUES (1, '是否启用登录验证码', 'UseLoginCaptcha', NULL, '1', '1: 启用、0: 不启用', '2022-08-25 22:27:17', 1, 'admin', '2022-08-26 10:26:56', 1, 'admin');
|
||||||
INSERT INTO `t_sys_config` VALUES (2, '是否启用水印', 'UseWartermark', NULL, '1', '1: 启用、0: 不启用', '2022-08-25 23:36:35', 1, 'admin', '2022-08-26 10:02:52', 1, 'admin');
|
INSERT INTO `t_sys_config` VALUES (2, '是否启用水印', 'UseWartermark', NULL, '1', '1: 启用、0: 不启用', '2022-08-25 23:36:35', 1, 'admin', '2022-08-26 10:02:52', 1, 'admin');
|
||||||
INSERT INTO `t_sys_config` VALUES (3, '数据库查询最大结果集', 'DbQueryMaxCount', '[]', '200', '允许sql查询的最大结果集数', '2023-02-11 14:29:03', 1, 'admin', '2023-02-11 14:40:56', 1, 'admin');
|
INSERT INTO `t_sys_config` VALUES (3, '数据库查询最大结果集', 'DbQueryMaxCount', '[]', '200', '允许sql查询的最大结果集数。注: 0=不限制', '2023-02-11 14:29:03', 1, 'admin', '2023-02-11 14:40:56', 1, 'admin');
|
||||||
INSERT INTO `t_sys_config` VALUES (4, '数据库是否记录查询SQL', 'DbSaveQuerySQL', '[]', '0', '1: 记录、0:不记录', '2023-02-11 16:07:14', 1, 'admin', '2023-02-11 16:44:17', 1, 'admin');
|
INSERT INTO `t_sys_config` VALUES (4, '数据库是否记录查询SQL', 'DbSaveQuerySQL', '[]', '0', '1: 记录、0:不记录', '2023-02-11 16:07:14', 1, 'admin', '2023-02-11 16:44:17', 1, 'admin');
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ func GetCron() *cron.Cron {
|
|||||||
|
|
||||||
func AddFun(spec string, cmd func()) cron.EntryID {
|
func AddFun(spec string, cmd func()) cron.EntryID {
|
||||||
id, err := cronService.AddFunc(spec, cmd)
|
id, err := cronService.AddFunc(spec, cmd)
|
||||||
if err != nil {
|
biz.ErrIsNilAppendErr(err, "添加任务失败: %s")
|
||||||
panic(biz.NewBizErr("添加任务失败:" + err.Error()))
|
|
||||||
}
|
|
||||||
return id
|
return id
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user