From 3a252d47c5c57acd63d8bd35b1fe14435dd05bd8 Mon Sep 17 00:00:00 2001 From: fairy Date: Fri, 8 Nov 2024 09:51:45 +0800 Subject: [PATCH] feat: add log store --- web/src/stores/los.ts | 24 ++++++++++++++++++++++++ web/src/stores/topo.ts | 1 - web/src/views/TopoDisplay.vue | 7 +++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 web/src/stores/los.ts diff --git a/web/src/stores/los.ts b/web/src/stores/los.ts new file mode 100644 index 0000000..b18bb92 --- /dev/null +++ b/web/src/stores/los.ts @@ -0,0 +1,24 @@ +import { ref } from 'vue' +import { defineStore } from 'pinia' +interface LogSearchObj { + timeRange:[Date,Date]; + level:string; + service:{label:string,value:string;} +} +interface LogSearchList { + ip:string; + search_obj:LogSearchObj; +} +export const useLogStore = defineStore('log', () => { + const search_list = ref([] as LogSearchList[]); + + const updateLogList = (param:any) => { + let ip_index = search_list.value.findIndex(item => item.ip === param.ip); + ip_index !== -1 ? search_list.value[ip_index] = param : search_list.value.push(param); + } + + const $reset = () => { + search_list.value = []; + } + return {search_list,updateLogList,$reset} +}) \ No newline at end of file diff --git a/web/src/stores/topo.ts b/web/src/stores/topo.ts index 02f00f1..1ad0e9c 100644 --- a/web/src/stores/topo.ts +++ b/web/src/stores/topo.ts @@ -19,7 +19,6 @@ export const useTopoStore = defineStore('topo', () => { node_click_info.value.node_id = ''; node_click_info.value.process_name = ''; node_click_info.value.target_ip = ''; - console.log('置空节点信息',node_click_info.value.target_ip) } return {nodeData, node_log_id,node_click_info,topo_data, edgeData,$reset} }) diff --git a/web/src/views/TopoDisplay.vue b/web/src/views/TopoDisplay.vue index b905e77..b219517 100644 --- a/web/src/views/TopoDisplay.vue +++ b/web/src/views/TopoDisplay.vue @@ -77,6 +77,7 @@ import { useConfigStore } from "@/stores/config"; import router from "@/router"; import socket from "@/utils/socket"; import { formatDate } from "@/utils/dateFormat"; +import { useLogStore } from "@/stores/los"; const graphMode = ref("default"); const timeInterval = ref("关闭"); @@ -101,6 +102,7 @@ onMounted(() => { onBeforeUnmount(() => { // 离开页面,清空点击事件缓存数据 useTopoStore().$reset(); + useLogStore().$reset(); }); // 点击画布关闭日志tab @@ -436,6 +438,11 @@ watch( height: 100%; margin: 0 auto; position: relative; + // 设置文字双击不能选中 + -webkit-user-select: none; /* Safari */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* IE/Edge */ + user-select: none; /* 标准语法 */ @keyframes bounce { 0%, -- Gitee