feat(断路器): 修复日志复制斜杠,添加日志查询、clientId 随机生成的防止冲突,开发环境自动弹出调试功能

This commit is contained in:
fhysy 2024-08-16 15:42:21 +08:00
parent b9f2b30c57
commit 69756af817
6 changed files with 48 additions and 7 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ out
.DS_Store
*.log*
/dist/
/dist.zip

View File

@ -62,6 +62,12 @@ npmRebuild: false
publish:
provider: generic # 更新服务提供者
url: https://example.com/auto-updates # 更新信息的URL
# provider: github # 更新服务提供者
# owner: fanhuayishiy # GitHub用户名
# repo: mygit1 # GitHub仓库名称
# token: ${env:GITHUB_TOKEN}
# releaseType: release
# 配置Electron下载的镜像地址
electronDownload:
mirror: https://npmmirror.com/mirrors/electron/ # Electron下载的镜像地址

View File

@ -1,6 +1,6 @@
{
"name": "gateway-app",
"version": "1.0.0",
"version": "1.0.3",
"description": "An Electron application with Vue",
"main": "./out/main/index.js",
"author": "example.com",

View File

@ -40,8 +40,11 @@ function createWindow() {
devTools: true
}
});
//开启调试
// mainWindow.webContents.openDevTools()
//开发模式 开启调试
if (is.dev) {
mainWindow.webContents.openDevTools();
}
mainWindow.on('ready-to-show', () => {
mainWindow.show();
});

View File

@ -207,7 +207,12 @@
</div>
<div id="log-box" class="log-box" :class="isOpenLog ? 'open-log' : ''">
<div class="log-box-header">
<div class="log-box-title">日志</div>
<div class="log-box-title">
<div>日志</div>
<div class="log-box-search">
<el-input v-model="logSearch" placeholder="请输入搜索日志" clearable />
</div>
</div>
<div class="log-box-operate">
<view class="log-box-operate-item">
<div>mqtt状态</div>
@ -262,7 +267,7 @@
</div>
<div id="log-box-main" class="log-box-main">
<div class="log-list">
<div v-for="(item, index) in logList" :key="index" class="log-item" :style="{ width: logItemWidth }">
<div v-for="(item, index) in searchLogList" :key="index" class="log-item" :style="{ width: logItemWidth }">
<span v-if="item.type == 'subscribe'" class="iconfont icon-icon_shanghang"></span>
<span v-else-if="item.type == 'publish'" class="iconfont icon-icon_xiahang"></span>
<span v-else-if="item.type == 'system'" class="iconfont icon-icon_xitong"></span>
@ -292,6 +297,7 @@ const webSocketStore = logWebSocketStore();
const activeFold = ref(['1', '3', '4', '5']);
const logList = ref([]);
const logSearch = ref('');
const logItemWidth = ref('auto');
//
const connectionState = ref(false);
@ -319,7 +325,7 @@ const mqttFormRef = ref();
// passWord: '',
// })
const mqttForm = reactive({
clientId: 'mqtt_local',
clientId: getGuid(),
host: '123.60.30.87',
port: '8017',
path: '',
@ -643,7 +649,7 @@ const runMqtt = formEl => {
formEl.validate(valid => {
if (valid) {
axios
.get(config.url + '/mqtt/conn', {
.get(config.url + '/mqtt/conn', {
// GET
params: mqttForm
})
@ -1031,6 +1037,18 @@ const switchSocketStatus = computed(() => {
return switchSocket.socket_open;
});
const searchLogList = computed(() => {
if (!logSearch.value) {
return logList.value
}else{
return logList.value.filter(item => {
return JSON.stringify(item.msg).includes(logSearch.value)
})
}
})
//
onMounted(() => {
initSocket();
@ -1093,7 +1111,16 @@ onUnmounted(() => {
background: #e6e6e6;
font-family: Source Han Sans CN;
color: #333333;
.log-box-title{
display: flex;
align-items: center;
.log-box-search{
margin-left: 10px;
display: flex;
align-items: center;
}
}
.log-box-operate {
display: flex;
align-items: center;
@ -1177,6 +1204,10 @@ onUnmounted(() => {
}
}
:deep(.log-box-search .el-input__wrapper) {
background: #fff;
}
.btn-box {
:deep(.el-form-item__content) {
justify-content: end;